PageSourceSearch

https://bellacarehospice.net/DXR.axd?r=1_10-zrGPs

js bellacarehospice.net collected 2026-10-05 22:04:06 UTC 155,672 bytes, 4,274 lines download raw bytes

1(function module(ASPx, options) {
2ASPx.modules.Classes = module;
3ASPx.classesScriptParsed = false;
4ASPx.documentLoaded = false; 
5ASPx.CallbackType = {
6 Data: "d",
7 Common: "c"
8};
9ASPx.callbackState = {
10 aborted: "aborted",
11 inTurn: "inTurn",
12 sent: "sent"
13};
14var ASPxClientEvent = ASPx.CreateClass(null, {
15 constructor: function() {
16  this.handlerInfoList = [];
17  this.firingIndex = -1;
18 },
19 AddHandler: function(handler, executionContext) {
20  if(typeof(executionContext) == "undefined")
21   executionContext = null;
22  this.RemoveHandler(handler, executionContext);
23  var handlerInfo = ASPxClientEvent.CreateHandlerInfo(handler, executionContext);
24  this.handlerInfoList.push(handlerInfo);
25 },
26 RemoveHandler: function(handler, executionContext) {
27  this.removeHandlerByCondition(function(handlerInfo) {
28   return handlerInfo.handler == handler && 
29    (!executionContext || handlerInfo.executionContext == executionContext);
30  });
31 },
32 removeHandlerByCondition: function(predicate) {
33   for(var i = this.handlerInfoList.length - 1; i >= 0; i--) {
34   var handlerInfo = this.handlerInfoList[i];
35   if(predicate(handlerInfo)) {
36    ASPx.Data.ArrayRemoveAt(this.handlerInfoList, i);
37    if(i <= this.firingIndex)
38     this.firingIndex--;
39   }
40  }
41 },
42 removeHandlerByControlName: function(controlName) {
43  this.removeHandlerByCondition(function(handlerInfo) {
44   return handlerInfo.executionContext &&  
45    handlerInfo.executionContext.name === controlName;
46  });
47 },
48 ClearHandlers: function() {
49  this.handlerInfoList.length = 0;
50 },
51 FireEvent: function(obj, args) {
52  for(this.firingIndex = 0; this.firingIndex < this.handlerInfoList.length; this.firingIndex++) {
53   var handlerInfo = this.handlerInfoList[this.firingIndex];
54   handlerInfo.handler.call(handlerInfo.executionContext, obj, args);
55  }
56 },
57 InsertFirstHandler: function(handler, executionContext){
58  if(typeof(executionContext) == "undefined")
59   executionContext = null;
60  var handlerInfo = ASPxClientEvent.CreateHandlerInfo(handler, executionContext);
61  ASPx.Data.ArrayInsert(this.handlerInfoList, handlerInfo, 0);
62 },
63 IsEmpty: function() {
64  return this.handlerInfoList.length == 0;
65 }
66});
67ASPxClientEvent.CreateHandlerInfo = function(handler, executionContext) {
68 return {
69  handler: handler,
70  executionContext: executionContext
71 };
72};
73var ASPxClientEventArgs = ASPx.CreateClass(null, {
74 constructor: function() {
75 }
76});
77ASPxClientEventArgs.Empty = new ASPxClientEventArgs();
78var ASPxClientCancelEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
79 constructor: function(){
80  this.constructor.prototype.constructor.call(this);
81  this.cancel = false;
82 }
83});
84var ASPxClientProcessingModeEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
85 constructor: function(processOnServer){
86  this.constructor.prototype.constructor.call(this);
87  this.processOnServer = !!processOnServer;
88 }
89});
90var ASPxClientProcessingModeCancelEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
91 constructor: function(processOnServer){
92  this.constructor.prototype.constructor.call(this, processOnServer);
93  this.cancel = false;
94 }
95});
96var OrderedMap = ASPx.CreateClass(null, {
97 constructor: function(){
98  this.entries = {};
99  this.firstEntry = null;
100  this.lastEntry = null;
101 },
102 add: function(key, element) {
103  var entry = this.addEntry(key, element);
104  this.entries[key] = entry;
105 },
106 remove: function(key) {
107  var entry = this.entries[key];
108  if(entry === undefined)
109   return;
110  this.removeEntry(entry);
111  delete this.entries[key];
112 },
113 clear: function() {
114  this.markAllEntriesAsRemoved();
115  this.entries = {};
116  this.firstEntry = null;
117  this.lastEntry = null;
118 },
119 get: function(key) {
120  var entry = this.entries[key];
121  return entry ? entry.value : undefined;
122 },
123 forEachEntry: function(processFunc, context) {
124  context = context || this;
125  for(var entry = this.firstEntry; entry; entry = entry.next) {
126   if(entry.removed)
127    continue;
128   if(processFunc.call(context, entry.key, entry.value))
129    return;
130  }
131 },
132 addEntry: function(key, element) {
133  var entry = { key: key, value: element, next: null, prev: null };
134  if(!this.firstEntry)
135   this.firstEntry = entry;
136  else {
137   entry.prev = this.lastEntry;
138   this.lastEntry.next = entry;
139  }
140  this.lastEntry = entry;
141  return entry;
142 },
143 removeEntry: function(entry) {
144  if(this.firstEntry == entry)
145   this.firstEntry = entry.next;
146  if(this.lastEntry == entry)
147   this.lastEntry = entry.prev;
148  if(entry.prev)
149   entry.prev.next = entry.next;
150  if(entry.next)
151   entry.next.prev = entry.prev;
152  entry.removed = true;
153 },
154 markAllEntriesAsRemoved: function() {
155  for(var entry = this.firstEntry; entry; entry = entry.next)
156   entry.removed = true;
157 }
158});
159var CollectionBase = ASPx.CreateClass(null, {
160 constructor: function(){
161  this.elementsMap = new OrderedMap();
162  this.isASPxClientCollection = true;
163 },
164 Add: function(key, element) {
165  this.elementsMap.add(key, element);
166 },
167 Remove: function(key) {
168  this.elementsMap.remove(key);
169 },
170 Clear: function(){
171  this.elementsMap.clear();
172 },
173 Get: function(key){
174  return this.elementsMap.get(key);
175 }
176});
177(function garbageCollector(ASPx, options) {
178 ASPx.modules.garbageCollector = garbageCollector;
179 var interval = options.GCCheckInterval;
180 window.setInterval(collectObjects, interval);
181 function canCollectObjects() {
182  if (!ASPx.GetControlCollection) return false;
183  var collection = ASPx.GetControlCollection();
184  return collection && !collection.InCallback();
185 }
186 function collectObjects() {
187  if (!canCollectObjects()) return;
188  ASPx.GetControlCollectionCollection().RemoveDisposedControls();
189  if(typeof(ASPx.GetStateController) != "undefined")
190   ASPx.GetStateController().RemoveDisposedItems();
191  if(ASPx.TableScrollHelperCollection)
192   ASPx.TableScrollHelperCollection.RemoveDisposedObjects();
193  if(ASPx.Ident.scripts.ASPxClientRatingControl)
194   ASPxClientRatingControl.RemoveDisposedElementUnderCursor();
195  var postHandler = ASPx.GetPostHandler();
196  if(postHandler)
197   postHandler.RemoveDisposedFormsFromCache();
198 }
199})(ASPx, options);
200var ControlTree = ASPx.CreateClass(null, {
201 constructor: function(controlCollection, container, controlFilter) {
202  this.container = container;
203  this.domMap = { };
204  this.rootNode = this.createNode(null, null);
205  this.createControlTree(controlCollection, container, controlFilter);
206 },
207 createControlTree: function(controlCollection, container, controlFilter) {
208  controlCollection.ProcessControlsInContainer(container, function(control) {
209   control.RegisterInControlTree(this);
210  }.aspxBind(this), controlFilter);
211  var fixedNodes = [];
212  var fixedNodesChildren = [];
213  for(var domElementID in this.domMap) {
214   if(!this.domMap.hasOwnProperty(domElementID)) continue;
215   var node = this.domMap[domElementID];
216   var controlOwner = node.control ? node.control.controlOwner : null;
217   if(controlOwner && this.domMap[controlOwner.name])
218    continue;
219   if(this.isFixedNode(node))
220    fixedNodes.push(node);
221   else {
222    var parentNode = this.findParentNode(domElementID);
223    parentNode = parentNode || this.rootNode;
224    if(this.isFixedNode(parentNode))
225     fixedNodesChildren.push(node);
226    else {
227     var childNode = node.mainNode || node;
228     this.addChildNode(parentNode, childNode);
229    }
230   }
231  }
232  for(var i = fixedNodes.length - 1; i >= 0; i--)
233   this.insertChildNode(this.rootNode, fixedNodes[i], 0);
234  for(var i = fixedNodesChildren.length - 1; i >= 0; i--)
235   this.insertChildNode(this.rootNode, fixedNodesChildren[i], 0);
236 },
237 findParentNode: function(id) {
238  var element = document.getElementById(id).parentNode;
239  while(element && element.tagName !== "BODY") {
240   if(element.id) {
241    var parentNode = this.domMap[element.id];
242    if(parentNode)
243     return parentNode;
244   }
245   element = element.parentNode;
246  }
247  return null;
248 },
249 addChildNode: function(node, childNode) {
250  if(!childNode.parentNode) {
251   node.children.push(childNode);
252   childNode.parentNode = node;
253  }
254 },
255 insertChildNode: function(node, childNode, index) {
256  if(!childNode.parentNode) {
257   ASPx.Data.ArrayInsert(node.children, childNode, index);
258   childNode.parentNode = node;
259  }
260 },
261 addRelatedNode: function(node, relatedNode) {
262  this.addChildNode(node, relatedNode);
263  relatedNode.mainNode = node;
264 },
265 isFixedNode: function(node) {
266  var control = node.mainNode ? node.mainNode.control : node.control;
267  return control && control.HasFixedPosition();
268 },
269 createNode: function(domElementID, control) {
270  var node = {
271   control: control,
272   children: [],
273   parentNode: null,
274   mainNode: null
275  };
276  if(domElementID)
277   this.domMap[domElementID] = node;
278  return node;
279 }
280});
281var ControlAdjuster = ASPx.CreateClass(null, {
282 constructor: function() {
283 },
284 adjustControlsInHierarchy: function(controlCollection, adjustFunc, container, collapseControls, controlFilter) {
285  var controlTree = new ASPx.ControlTree(controlCollection, container, controlFilter);
286  this.adjustControlsInTree(controlTree.rootNode, adjustFunc, container, collapseControls);
287 },
288 adjustControlsInTree: function(treeNode, adjustFunc, container, collapseControls) {
289  var observer = _aspxGetDomObserver();
290  observer.pause(container, true);
291  var documentScrollInfo;
292  if(collapseControls) {
293   documentScrollInfo = ASPx.GetOuterScrollPosition(document.body);
294   this.collapseControls(treeNode);
295  }
296  var adjustNodes = [], 
297   autoHeightNodes = [];
298  var requireReAdjust = this.forEachControlCore(treeNode, collapseControls, adjustFunc, adjustNodes, autoHeightNodes);
299  if(requireReAdjust)
300   this.forEachControlsBackward(adjustNodes, collapseControls, adjustFunc);
301  else {
302   for(var i = 0, node; node = autoHeightNodes[i]; i++)
303    node.control.AdjustAutoHeight();
304  }
305  if(collapseControls)
306   ASPx.RestoreOuterScrollPosition(documentScrollInfo);
307  observer.resume(container, true);
308 },
309 forEachControlCore: function(node, collapseControls, processFunc, adju
309stNodes, autoHeightNodes) {
310  var requireReAdjust = false,
311   size, newSize;
312  if(node.control) {
313   var checkReadjustment = collapseControls && node.control.IsControlCollapsed() && node.control.CanCauseReadjustment();
314   if(checkReadjustment)
315    size = node.control.GetControlPercentMarkerSize(false, true);
316   if(node.control.IsControlCollapsed() && !node.control.IsExpandableByAdjustment())
317    node.control.ExpandControl();
318   node.control.isInsideHierarchyAdjustment = true;
319   processFunc(node.control);
320   node.control.isInsideHierarchyAdjustment = false;
321   if(checkReadjustment) {
322    newSize = node.control.GetControlPercentMarkerSize(false, true);
323    requireReAdjust = size.width !== newSize.width;
324   }
325   if(node.control.sizingConfig.supportAutoHeight)
326    autoHeightNodes.push(node);
327   node.control.ResetControlPercentMarkerSize();
328  }
329  for(var childNode, i = 0; childNode = node.children[i]; i++)
330   requireReAdjust = this.forEachControlCore(childNode, collapseControls, processFunc, adjustNodes, autoHeightNodes) || requireReAdjust;
331  adjustNodes.push(node);
332  return requireReAdjust;
333 },
334 forEachControlsBackward: function(adjustNodes, collapseControls, processFunc) {
335  for(var i = 0, node; node = adjustNodes[i]; i++)
336   this.forEachControlsBackwardCore(node, collapseControls, processFunc);
337 },
338 forEachControlsBackwardCore: function(node, collapseControls, processFunc) {
339  if(node.control)
340   processFunc(node.control);
341  if(node.children.length > 1) {
342   for(var i = 0, childNode; childNode = node.children[i]; i++) {
343    if(childNode.control)
344     processFunc(childNode.control);
345   }
346  }
347 },
348 collapseControls: function(node) {
349  for(var childNode, i = 0; childNode = node.children[i]; i++)
350   this.collapseControls(childNode);
351  if(node.control && node.control.NeedCollapseControl())
352   node.control.CollapseControl();
353 }
354});
355var controlAdjuster = null;
356function GetControlAdjuster() {
357 if(!controlAdjuster)
358  controlAdjuster = new ControlAdjuster();
359 return controlAdjuster;
360}
361function _aspxFunctionIsInCallstack(currentCallee, targetFunction, depthLimit) {
362 var candidate = currentCallee;
363 var depth = 0;
364 while(candidate && depth <= depthLimit) {
365  candidate = candidate.caller;
366  if(candidate == targetFunction)
367   return true;
368  depth++;
369 }
370 return false;
371}
372ASPx.attachToReady(aspxClassesWindowOnLoad);
373function aspxClassesWindowOnLoad(){
374 ASPx.documentLoaded = true;
375 _aspxMoveLinkElements();
376 _aspxSweepDuplicatedLinks();
377 ResourceManager.SynchronizeResources();
378 var externalScriptProcessor = GetExternalScriptProcessor();
379 if(externalScriptProcessor)
380  externalScriptProcessor.ShowErrorMessages();
381 ASPx.AccessibilityUtils.initialize();
382 ASPx.GetControlCollection().Initialize();
383 _aspxInitializeScripts();
384 _aspxInitializeLinks();
385 _aspxInitializeFocus();
386 ASPx.GetControlCollection().FinalizeInitialization();
387}
388Ident = { };
389Ident.IsDate = function(obj) {
390 return obj && (obj.constructor == Date || obj.constructor.name == "Date");
391};
392Ident.IsRegExp = function(obj) {
393 return obj && obj.constructor === RegExp;
394};
395Ident.IsArray = function(obj) {
396 return obj && obj.constructor == Array;
397};
398Ident.IsASPxClientCollection = function(obj) {
399 return obj && obj.isASPxClientCollection;
400};
401Ident.IsASPxClientControl = function(obj) {
402 return obj && obj instanceof ASPxClientControlBase;
403};
404Ident.IsASPxClientEdit = function(obj) {
405 return obj && obj.isASPxClientEdit;
406};
407Ident.IsFocusableElementRegardlessTabIndex = function (element) {
408 var tagName = element.tagName;
409 return tagName == "TEXTAREA" || tagName == "INPUT" || tagName == "A" ||
410  tagName == "SELECT" || tagName == "IFRAME" || tagName == "OBJECT" || tagName == "BUTTON";
411};
412Ident.isDialogInvisibleControl = function(control) {
413 return !!ASPx.Dialog && ASPx.Dialog.isDialogInvisibleControl(control);
414};
415Ident.isBatchEditUnusedEditor = function(control) {
416 return !!ASPx.BatchEditHelper && ASPx.BatchEditHelper.isBatchEditUnusedEditor(control);
417};
418Ident.scripts = {};
419if(ASPx.IsFunction(window.WebForm_InitCallbackAddField)) {
420 (function() {
421  var original = window.WebForm_InitCallbackAddField;
422  window.WebForm_InitCallbackAddField = function(name, value) {
423   if(typeof(name) == "string" && name)
424    original.apply(null, arguments);
425  };
426 })();
427}
428ASPx.FireDefaultButton = function(evt, buttonID) {
429 if(_aspxIsDefaultButtonEvent(evt, buttonID)) {
430  var defaultButton = ASPx.GetElementById(buttonID);
431  if(defaultButton && defaultButton.click) {
432   if(ASPx.IsFocusable(defaultButton))
433    defaultButton.focus();
434   ASPx.Evt.DoElementClick(defaultButton);
435   ASPx.Evt.PreventEventAndBubble(evt);
436   return false;
437  }
438 }
439 return true;
440};
441function _aspxIsDefaultButtonEvent(evt, defaultButtonID) {
442 if(evt.keyCode != ASPx.Key.Enter)
443  return false;
444 var srcElement = ASPx.Evt.GetEventSource(evt);
445 if(!srcElement || srcElement.id === defaultButtonID)
446  return true;
447 var tagName = srcElement.tagName;
448 var type = srcElement.type;
449 return tagName != "TEXTAREA" && tagName != "BUTTON" && tagName != "A" &&
450  (tagName != "INPUT" || type != "checkbox" && type != "radio" && type != "button" && type != "submit" && type != "reset");
451}
452var PostHandler = ASPx.CreateClass(null, {
453 constructor: function() {
454  this.Post = new ASPxClientEvent();
455  this.PostFinalization = new ASPxClientEvent();
456  this.observableForms = [];
457  this.dxCallbackTriggers = {};
458  this.lastSubmitElementName = null;
459  this.beforeOnSubmit = function() { };
460  this.ReplaceGlobalPostFunctions();
461  this.HandleDxCallbackBeginning();
462  this.HandleMSAjaxRequestBeginning();
463 },
464 Update: function() {
465  this.ReplaceFormsSubmit(true);
466 },
467 ProcessPostRequest: function(ownerID, isCallback, isMSAjaxRequest, isDXCallback) {
468  this.cancelPostProcessing = false;
469  this.isMSAjaxRequest = isMSAjaxRequest;
470  if(this.SkipRaiseOnPost(ownerID, isCallback, isDXCallback))
471   return;
472  var args = new PostHandlerOnPostEventArgs(ownerID, isCallback, isMSAjaxRequest, isDXCallback);
473  this.Post.FireEvent(this, args);
474  this.cancelPostProcessing = args.cancel;
475  if(!args.cancel)
476   this.PostFinalization.FireEvent(this, args);
477 },
478 SkipRaiseOnPost: function(ownerID, isCallback, isDXCallback) { 
479  if(!isCallback)
480   return false;
481  var dxOwner = isDXCallback && ASPx.GetControlCollection().GetByName(ownerID);
482  if(dxOwner) {
483   this.dxCallbackTriggers[dxOwner.uniqueID] = true;
484   return false;
485  }
486  if(this.dxCallbackTriggers[ownerID]) {
487   this.dxCallbackTriggers[ownerID] = false;
488   return true;
489  }
490  return false;
491 },
492 ReplaceGlobalPostFunctions: function() {
493  if(ASPx.IsFunction(window.__doPostBack))
494   this.ReplaceDoPostBack();
495  if(ASPx.IsFunction(window.WebForm_DoCallback))
496   this.ReplaceDoCallback();
497  if(ASPx.IsFunction(window.WebForm_ExecuteCallback))
498   this.ReplaceExecuteCallback();
499  this.ReplaceFormsSubmit();
500 },
501 HandleDxCallbackBeginning: function() {
502  ASPx.GetControlCollection().BeforeInitCallback.AddHandler(function(s, e) {
503   aspxRaisePostHandlerOnPost(e.callbackOwnerID, true, false, true); 
504  });
505 },
506 HandleMSAjaxRequestBeginning: function() {
507  var pageRequestManager = ASPx.GetMSAjaxRequestManager();
508  if(pageRequestManager != null && Ident.IsArray(pageRequestManager._onSubmitStatements)) {
509   pageRequestManager._onSubmitStatements.unshift(function() {
510    var postbackSettings = Sys.WebForms.PageRequestManager.getInstance()._postBackSettings;
511    var postHandler = aspxGetPostHandler();
512    aspxRaisePostHandlerOnPost(postbackSettings.asyncTarget, true, true);
513    return !postHandler.cancelPostProcessing;
514   });
515  }
516 },
517 ReplaceDoPostBack: function() {
518  var original = __doPostBack;
519  __doPostBack = function(eventTarget, eventArgument) {
520   var postHandler = aspxGetPostHandler();
521   aspxRaisePostHandlerOnPost(eventTarget);
522   if(postHandler.cancelPostProcessing)
523    return;
524   ASPxClientControl.postHandlingLocked = true;
525   original(eventTarget, eventArgument);
526   delete ASPxClientControl.postHandlingLocked;
527  };
528 },
529 ReplaceDoCallback: function() {
530  var original = WebForm_DoCallback;
531  WebForm_DoCallback = function(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync) {
532   var postHandler = aspxGetPostHandler();
533   aspxRaisePostHandlerOnPost(eventTarget, true);
534   if(postHandler.cancelPostProcessing)
535    return;
536   return original(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync);
537  };
538 },
539 ReplaceExecuteCallback: function() {
540  var original = WebForm_ExecuteCallback;
541  var handler = this;
542  WebForm_ExecuteCallback = function(callbackObject) {
543   var isDxCallback = callbackObject && callbackObject.context && ASPx.GetControlCollection().Get(callbackObject.context) !== null;
544   ASPx.callbackProcessed = false;
545   original(callbackObject);
546   if(ASPx.Browser.Firefox && document.getElementById("__EVENTVALIDATION")) {
547    var viewStateField = document.getElementById("__VIEWSTATE");
548    if(viewStateField) {
549     var response = callbackObject.xmlRequest.responseText;
550     var separatorIndex = response.indexOf("|");
551     var validationFieldLength = separatorIndex > 0 ? response.substring(0, separatorIndex) : null;
552     if(ASPx.IsNumber(validationFieldLength))
553      viewStateField.value = viewStateField.value; 
554    }
555   }
556   if(isDxCallback && !ASPx.callbackProcessed) {
557    var request = callbackObject.xmlRequest;
558    if(ASPxClientUtils.IsExists(callbackObject.eventCallback)) {
559     if (handler.HasAppErrorOnCallback(request))
560      callbackObject.eventCallback(handler.GetServerErrorText(), callbackObject.context);
561     else if (handler.HasNetworkErrorOnCallback(request))
562      callbackObject.eventCallback(handler.GetNetworkError(), callbackObject.context);
563    }
564   }
565  };
566 },
567 HasAppErrorOnCallback: function(request) {
568  if(!request) return false;
569  var isServerError = request.status && request.status == 500;
570  var pattern = /<html[^>]*>([\w|\W]*)<\/html>/im;
571  var text = request.responseText;
572  return isServerError && !!text && pattern.test(text);
573 },
574 GetServerErrorText: function() {
575  return "Internal Server Error";
576 },
577 HasNetworkErrorOnCallback: function(request) {
578  if (!request) return false;
579  return request.readyState == 4 && request.status == 0;
580 },
581 GetNetworkError: function() {
582  return new NetworkError();
583 },
584 ReplaceFormsSubmit: function(checkObservableCollection) {
585  for(var i = 0; i < document.forms.length; i++) { 
586   var form = document.forms[i];
587   if(checkObservableCollection && ASPx.Data.ArrayIndexOf(this.observableForms, form) >= 0)
588    continue;
589   if(form.submit)
590    this.ReplaceFormSubmit(form);
591   this.ReplaceFormOnSumbit(form);
592   this.observableForms.push(form);
593  }
594 },
595 ReplaceFormSubmit: function(form) {
596  var originalSubmit = form.submit;
597  form.submit = function() {
598   var postHandler = aspxGetPostHandler();
599   aspxRaisePostHandlerOnPost();
600   if(postHandler.cancelPostProcessing)
601    return false;
602   var callee = arguments.callee;
603   this.submit = originalSubmit;
604   var submitResult = this.submit();
605   this.submit = callee;
606   return submitResult;
607  };
608  form = null;
609 },
610 ReplaceFormOnSumbit: function(form) {
611  var originalSubmit = form.onsubmit;
612  form.onsubmit = function() {
613   var postHandler = aspxGetPostHandler();
614   postHandler.beforeOnSubmit();
615   if(postHandler.isMSAjaxRequest)
616    postHandler.isMsAjaxRequest = false;
617   else
618    aspxRaisePostHandlerOnPost(postHandler.GetLastSubmitElementName());
619   if(postHandler.cancelPostProcessing)
620    return false;
621   return ASPx.IsFunction(originalSubmit)
622    ? originalSubmit.apply(this, arguments)
623    : true;
624  };
625  form = null;
626 },
627 SetBeforeOnSubmit: function(action) {
628  this.beforeOnSubmit = action;
629 },
630 SetLastSubmitElementName: function(elementName) {
631  this.lastSubmitElementName = elementName;
632 },
633 GetLastSubmitElementName: function() {
634  return this.lastSubmitElementName;
635 },
636 RemoveDisposedFormsFromCache: function(){
637  for(var i = 0; this.observableForms && i < this.observableForms.length; i++){
638   var form = this.observableForms[i];
639   if(!ASPx.IsExistsElement(form)){
640    ASPx.Data.ArrayRemove(this.observableForms, form);
641    i--;
642   }
643  }
644 }
645});
646var NetworkError = ASPx.CreateClass(null, {
647 constructor: function () {
648  this.message = "Network Error";
649 }
650});
651function aspxRaisePostHandlerOnPost(ownerID, isCallback, isMSAjaxRequest, isDXCallback) {
652 if(ASPxClientControl.postHandlingLocked) return;
653 var postHandler = aspxGetPostHandler();
654 if(postHandler)
655  postHandler.ProcessPostRequest(ownerID, isCallback, isMSAjaxRequest, isDXCallback);
656}
657var aspxPostHandler;
658function aspxGetPostHandler() {
659 if(!aspxPostHandler)
660  aspxPostHandler = new PostHandler();
661 return aspxPostHandler;
662}
663var PostHandlerOnPostEventArgs = ASPx.CreateClass(ASPxClientCancelEventArgs, {
664 constructor: function(ownerID, isCallback, isMSAjaxCallback, isDXCallback){
665  this.constructor.prototype.constructor.call(this);
666  this.ownerID = ownerID;
667  this.isCallback = !!isCallback;
668  this.isDXCallback = !!isDXCallback;
669  this.isMSAjaxCallback = !!isMSAjaxCallback;
670 }
671});
672var ResourceManager = {
673 HandlerStr: "DXR.axd?r=",
674 ResourceHashes: {},
675 SynchronizeResources: function(method){
676  if(!method){
677   method = function(name, resource) { 
678    this.UpdateInputElements(name, resource); 
679   }.aspxBind(this);
680  }
681  var resources = this.GetResourcesData();
682  for(var name in resources)
683   if(resources.hasOwnProperty(name))
684    method(name, resources[name]);
685 },
686 GetResourcesData: function(){
687  return {
688   DXScript: this.GetResourcesElementsString(_aspxGetIncludeScripts(), "src", "DXScript"),
689   DXCss: this.GetResourcesElementsString(_aspxGetLinks(), "href", "DXCss")
690  };
691 },
692 ParseBundleSrc: function(elements, urlAttr){
693  var timeStamp = "";
694  var resourceUrlArray = [];
695  for(var i = 0; i < elements.length; i++) {
696   var resourceUrl = ASPx.Attr.GetAttribute(elements[i], urlAttr);
697   if(resourceUrl) {
698    var pos = resourceUrl.indexOf(this.HandlerStr);
699    if(pos > -1){
700     var list = resourceUrl.substr(pos + this.HandlerStr.length);
701     var ampPos = list.lastIndexOf("-");
702     if(ampPos > -1) {
703      timeStamp = list.substr(ampPos);
704      list = list.substr(0, ampPos);
705     }
706     var indexes = list.split(",");
707     for(var j = 0; j < indexes.length; j++) {
708      resourceUrlArray.push(indexes[j]);
709     }
710    }
711    else
712     resourceUrlArray.push(resourceUrl);
713   }
714  }
715  return {
716   'resourceUrlArray': resourceUrlArray,
717   'timeStamp': timeStamp
718  };
719 },
720 GetResourceHashes: function (id) {
721  if (!this.ResourceHashes[id])
722   this.ResourceHashes[id] = {};
723  return this.ResourceHashes[id];
724 },
725 GetResourcesElementsString: function (elements, urlAttr, id) {
726  var hash = this.GetResourceHashes(id);
727  var resourceUrlArray = this.ParseBundleSrc(elements, urlAttr).resourceUrlArray;
728  for(var i = 0; i < resourceUrlArray.length; i++) {
729   hash[resourceUrlArray[i]] = resourceUrlArray[i];
730  }
731  var array = [];
732  for(var key in hash)
733   if(hash.hasOwnProperty(key))
734    array.push(key);
735  return array.join(",");
736 },
737 GetNewResourcesElementString: function (element, urlAttr, id) {
738  var originalUrl = ASPx.Attr.GetAttribute(element, urlAttr);
739  var handlerStrIndex = originalUrl.indexOf(this.HandlerStr);
740  var dxResources = handlerStrIndex > -1;
741  if(!dxResources) return element[urlAttr];
742  var hash = this.GetResourceHashes(id);
743  var srcInfo = this.ParseBundleSrc([element], urlAttr);
744  var resourceUrlArray = srcInfo.resourceUrlArray;
745  var timeStamp = srcInfo.timeStamp;
746  var newResourceArray = [];
747  for(var i = 0; i < resourceUrlArray.length; i++) {
748    if(!hash[resourceUrlArray[i]])
749    newResourceArray.push(resourceUrlArray[i]);
750  }
751  var newResources = "";
752  if(newResourceArray.length > 0) {
753   var baseUrl = originalUrl.substr(0, handlerStrIndex);
754   newResources = baseUrl + this.HandlerStr + newResourceArray.join(",") + timeStamp;
755  }
756  return newResources;
757 },
758 UpdateInputElements: function(typeName, list){
759  for(var i = 0; i < document.forms.length; i++){
760   var inputElement = document.forms[i][typeName];
761   if(!inputElement)
762    inputElement = this.CreateInputElement(document.forms[i], typeName);
763   inputElement.value = list;
764  }
765 },
766 CreateInputElement: function(form, typeName){
767  var inputElement = ASPx.CreateHiddenField(typeName);
768  form.appendChild(inputElement);
769  return inputElement;
770 }
771};
772ASPx.includeScriptPrefix = "dxis_";
773ASPx.startupScriptPrefix = "dxss_";
774var includeScriptsCache = {};
775var createdIncludeScripts = [];
776var appendedScriptsCount = 0;
777var callbackOwnerNames = [];
778var scriptsRestartHandlers = { };
779function _aspxIsKnownIncludeScript(script) {
780 return !!includeScriptsCache[script.src];
781}
782function _aspxCacheIncludeScript(script) {
783 includeScriptsCache[script.src] = 1;
784}
785function _aspxProcessScriptsAndLinks(ownerName, isCallback) {
786 if(!ASPx.documentLoaded) return; 
787 _aspxProcessScripts(ownerName, isCallback);
788 getLinkProcessor().process();
789 ASPx.ClearCachedCssRules();
790}
791function _aspxGetStartupScripts(container) {
792 return _aspxGetScriptsCore(ASPx.startupScriptPrefix, container);
793}
794function _aspxGetIncludeScripts() {
795 return _aspxGetScriptsCore(ASPx.includeScriptPrefix);
796}
797function _aspxGetScriptsCore(prefix, container) {
798 var result = [];
799 var scripts;
800 if(ASPx.IsExists(container))
801  scripts = ASPx.GetNodesByTagName(container, "SCRIPT");
802 else
803  scripts = document.getElementsByTagName("SCRIPT");
804 for(var i = 0; i < scripts.length; i++) {
805  if(scripts[i].id.indexOf(prefix) == 0)
806   result.push(scripts[i]);
807 }
808 return result;
809}
810function _aspxIsResourceLink(link) {
811 if(typeof link !== "string")
812  link = link.href;
813 return link.toLowerCase().indexOf(ResourceManager.HandlerStr.toLowerCase()) >= 0;
814}
815function _aspxGetLinks(allLinks) {
816 var result = [];
817 var links = document.getElementsByTagName("LINK");
818 for(var i = 0; i < links.length; i++) {
819  if(allLinks || _aspxIsResourceLink(links[i]))
820   result.push(links[i]);
821 }
822 return result;
823}
824function _aspxIsLinksLoaded() {
825 var links = _aspxGetLinks(true);
826 for(var i = 0, link; link = links[i]; i++)
827  if(link.readyState && link.readyState.toLowerCase() == "loading")
828    return false;
829 return true;
830}
831function _aspxInitializeLinks() {
832 var links = _aspxGetLinks(true);
833 for(var i = 0; i < links.length; i++)
834  links[i].loaded = true; 
835}
836var scriptExecutedAttrName = "data-executed";
837var scriptDelayedExecutionAttrName = "data-dx-delayedeval";
838ASPx.MarkInnerScriptBlocksAsDelayedExecution = function(scriptsContainer) {
839 var scripts = scriptsContainer.querySelectorAll("script[id^=" + ASPx.startupScriptPrefix + "]");
840 for(var i = 0; i < scripts.length; i++)
841  ASPx.Attr.SetAttribute(scripts[i], scriptDelayedExecutionAttrName, true);
842};
843function isScriptExecuted(script) {
844 return ASPx.Attr.GetAttribute(script, scriptExecutedAttrName);
845}
846function markScriptAsExecuted(script) {
847 if(ASPx.Attr.GetAttribute(script, scriptDelayedExecutionAttrName))
848  ASPx.Attr.RemoveAttribute(script, scriptDelayedExecutionAttrName);
849 else
850  ASPx.Attr.SetAttribute(script, scriptExecutedAttrName, true);
851}
852function _aspxInitializeScripts() {
853 var scripts = _aspxGetIncludeScripts();
854 for(var i = 0; i < scripts.length; i++)
855  _aspxCacheIncludeScript(scripts[i]);   
856 var startupScripts = _aspxGetStartupScripts();
857 for(var i = 0; i < startupScripts.length; i++)
858  markScriptAsExecuted(startupScripts[i]);
859}
860function _aspxSweepDuplicatedLinks() {
861 var hash = { };
862 var links = _aspxGetLinks();
863 for(var i = 0; i < links.length; i++) {
864  var href = links[i].href;
865  if(!href)
866   continue;
867  if(hash[href]){
868   if(!hash[href].loaded && links[i].loaded) {
869    ASPx.RemoveElement(hash[href]);
870    hash[href] = links[i];
871   }
872   else
873    ASPx.RemoveElement(links[i]);
874  }
875  else
876   hash[href] = links[i];
877 }
878}
879function _aspxSweepDuplicatedScripts() {
880 var hash = { };
881 var scripts = _aspxGetIncludeScripts();
882 for(var i = 0; i < scripts.length; i++) {
883  var src = scripts[i].src;
884  if(!src) continue;
885  if(hash[src])
886   ASPx.RemoveElement(scripts[i]);
887  else
888   hash[src] = scripts[i];
889 }
890}
891function _aspxAreScriptsEqual(script1, script2) {
892 return script1.src == script2.src;
893}
894function _aspxProcessScripts(ownerName, isCallback) {
895 var scripts = _aspxGetIncludeScripts();
896 var previousCreatedScript = null;
897 var firstCreatedScript = null;
898 for(var i = 0; i < scripts.length; i++) {
899  var script = scripts[i];
900  if(script.src == "") continue; 
901  if(_aspxIsKnownIncludeScript(script))
902   continue;
903  var getOnlyNewResources = true;
904  var onlyNewScripts = ResourceManager.GetNewResourcesElementString(script, "src", "DXScript", getOnlyNewResources);
905  if (onlyNewScripts == "")
906   continue;
907  var createdScript = document.createElement("script");
908  ASPx.Attr.AppendScriptType(createdScript);
909  createdScript.src = onlyNewScripts;
910  createdScript.id = script.id;
911  if(ASPx.Data.ArrayIndexOf(createdIncludeScripts, createdScript, _aspxAreScriptsEqual) >= 0)
912   continue;
913  createdIncludeScripts.push(createdScript);
914  ASPx.RemoveElement(script);
915  if(ASPx.Browser.Edge || ASPx.Browser.WebKitFamily || (ASPx.Browser.Firefox && ASPx.Browser.Version >= 4) || ASPx.Browser.IE) {
916   createdScript.onload = new Function("ASPx.OnScriptLoadCallback(this, " + isCallback + ");");
917   if(firstCreatedScript == null)
918    firstCreatedScript = createdScript;
919   createdScript.nextCreatedScript = null;
920   if(previousCreatedScript != null)
921    previousCreatedScript.nextCreatedScript = createdScript;
922   previousCreatedScript = createdScript;
923  } else {
924   createdScript.onload = new Function("ASPx.OnScriptLoadCallback(this);");
925   ASPx.AppendScript(createdScript);
926   _aspxCacheIncludeScript(createdScript);
927  }
928 }
929 if(firstCreatedScript != null) {
930  ASPx.AppendScript(firstCreatedScript);
931  _aspxCacheIncludeScript(firstCreatedScript);
932 }
933 if(isCallback)
934  callbackOwnerNames.push(ownerName);
935 if(createdIncludeScripts.length == 0) {
936  var newLinks = ASPx.GetNodesByTagName(document.body, "link");
937  var needProcessLinks = isCallback && newLinks.length > 0;
938  if(needProcessLinks)
939   needProcessLinks = getLinkProcessor().addLinks(newLinks);
940  if(!needProcessLinks)
941   ASPx.FinalizeScriptProcessing(isCallback);
942 }
943}
944ASPx.FinalizeScriptProcessing = function(isCallback) {
945 createdIncludeScripts = [];
946 appendedScriptsCount = 0;
947 var linkProcessor = getLinkProcessor();
948 if(linkProcessor.hasLinks())
949  _aspxSweepDuplicatedLinks();
950 linkProcessor.reset();
951 _aspxSweepDuplicatedScripts();
952 ResourceManager.SynchronizeResources();
953 _aspxRunStartupScripts(isCallback);
954};
955var startupScriptsRunning = false;
956function _aspxRunStartupScripts(isCallback, container) {
957 startupScriptsRunning = true;
958 try {
959  _aspxRunStartupScriptsCore(container);
960 }
961 finally {
962  startupScriptsRunning = false;
963 }
964 if(ASPx.documentLoaded) {
965  ASPx.GetControlCollection().ProcessActionByPredicate(
966   function(collection) { collection.InitializeElements(isCallback); },
967   function(control) { return !ASPx.IsExists(container) || ASPx.GetIsParent(container, control.GetMainElement()); }
968  );
969  for(var key in scriptsRestartHandlers)
970   if(scriptsRestartHandlers.hasOwnProperty(key))
971    scriptsRestartHandlers[key]();
972  if(isCallback)
973   _aspxRunEndCallbackScript();
974 }
975}
976function _aspxIsStartupScriptsRunning(isCallback) {
977 return startupScriptsRunning;
978}
979function _aspxRunStartupScriptsCore(container) {
980 var scripts = _aspxGetStartupScripts(container);
981 var code;
982 for(var i = 0; i < scripts.length; i++){
983  var script = scripts[i];
984  if(!isScriptExecuted(script)) {
985   _aspxEnsureStartupScriptIsUnique(script.id); 
986   code = ASPx.GetScriptCode(script);
987   eval(code);
988   markScriptAsExecuted(script);
989  }
990 }
991}
992function _aspxEnsureStartupScriptIsUnique(scriptId) {
993 if(!scriptId)
994  return;
995 var scriptExecutedSelector = "script[" + scriptExecutedAttrName + "='true']#" + scriptId;
996 ASPx.RemoveElement(document.querySelector(scriptExecutedSelector));
997}
998function _aspxRunEndCallbackScript() {
999 while(callbackOwnerNames.length > 0) {
1000  var callbackOwnerName = callbackOwnerNames.pop();
1001  var callbackOwner = ASPx.GetControlCollection().Get(callbackOwnerName);
1002  if(callbackOwner)
1003   callbackOwner.DoEndCallback();
1004 }
1005}
1006ASPx.RunStartupScriptsCreatedOnClient = function(container) {
1007 _aspxRunStartupScriptsCore(container);
1008};
1009ASPx.OnScriptReadyStateChangedCallback = function(scriptElement, isCallback) {
1010 if(scriptElement.readyState == "loaded") {
1011  _aspxCacheIncludeScript(scriptElement);
1012  for(var i = 0; i < createdIncludeScripts.length; i++) {
1013   var script = createdIncludeScripts[i];
1014   if(_aspxIsKnownIncludeScript(script)) {
1015    if(!isScriptExecuted(script)) {
1016     markScriptAsExecuted(script);
1017     ASPx.AppendScript(script);
1018     appendedScriptsCount++;
1019    }
1020   } else
1021    break;
1022  }
1023  if(createdIncludeScripts.length == appendedScriptsCount)
1024   ASPx.FinalizeScriptProcessing(isCallback);
1025 }
1026};
1027ASPx.OnScriptLoadCallback = function(scriptElement, isCallback) {
1028 appendedScriptsCount++;
1029 if(scriptElement.nextCreatedScript) {
1030  ASPx.AppendScript(scriptElement.nextCreatedScript);
1031  _aspxCacheIncludeScript(scriptElement.nextCreatedScript);
1032 }
1033 if(createdIncludeScripts.length == appendedScriptsCount)
1034  ASPx.FinalizeScriptProcessing(isCallback);
1035};
1036function _aspxAddScriptsRestartHandler(objectName, handler) {
1037 scriptsRestartHandlers[objectName] = handler;
1038}
1039function _aspxMoveLinkElements() {
1040 var head = ASPx.GetNodesByTagName(document, "head")[0];
1041 var bodyLinks = ASPx.GetNodesByTagName(document.body, "link");
1042 if(head && bodyLinks.length > 0){
1043  var headLinks = ASPx.GetNodesByTagName(head, "link");
1044  var dxLinkAnchor = head.firstChild;
1045  for(var i = 0; i < headLinks.length; i++){
1046   if(_aspxIsResourceLink(headLinks[i]))
1047    dxLinkAnchor = headLinks[i].nextSibling;
1048  }
1049  while(bodyLinks.length > 0) 
1050   head.insertBefore(bodyLinks[0], dxLinkAnchor);
1051 }
1052}
1053var LinkProcessor = ASPx.CreateClass(null, {
1054 constructor: function() {
1055  this.linkInfos = [];
1056  this.loadingObservationTimerID = -1;
1057 },
1058 process: function() {
1059  if(this.hasLinks()) {
1060   if(this.isLinkLoadEventSupported())
1061    this.processViaLoadEvent();
1062   else
1063    this.processViaTimer();
1064  }
1065  else
1066   _aspxSweepDuplicatedLinks();
1067  _aspxMoveLinkElements();
1068 },
1069 addLinks: function(links) {
1070  var prevLinkCount = this.linkInfos.length;
1071  for(var i = 0; i < links.length; i++) {
1072   var link = links[i];
1073   if(link.loaded || link.rel != "stylesheet" || !_aspxIsResourceLink(link))
1074    continue;
1075   var linkInfo = {
1076    link: link,
1077    href: link.href
1078   };
1079   this.linkInfos.push(linkInfo);
1080  }
1081  return prevLinkCount != this.linkInfos.length;
1082 },
1083 hasLinks: function() {
1084  return this.linkInfos.length > 0;
1085 },
1086 reset: function() {
1087  this.linkInfos = [];
1088 },
1089 processViaLoadEvent: function() {
1090  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++)
1091   linkInfo.link.onload = this.onLinkLoad.bind(this);
1092 },
1093 isLinkLoadEventSupported: function() {
1094  return !(ASPx.Browser.Chrome && ASPx.Browser.MajorVersion < 19 || ASPx.Browser.Firefox && ASPx.Browser.MajorVersion < 9 ||
1095   ASPx.Browser.Safari && ASPx.Browser.MajorVersion < 6 || ASPx.Browser.AndroidDefaultBrowser && ASPx.Browser.MajorVersion < 4.4);
1096 },
1097 processViaTimer: function() {
1098  if(this.loadingObservationTimerID == -1)
1099   this.onLinksLoadingObserve();
1100 },
1101 onLinksLoadingObserve: function() {
1102  if(this.getIsAllLinksLoaded()) {
1103   this.loadingObservationTimerID = -1;
1104   this.onAllLinksLoad();
1105  }
1106  else
1107   this.loadingObservationTimerID = window.setTimeout(this.onLinksLoadingObserve.aspxBind(this), 100);
1108 },
1109 getIsAllLinksLoaded: function() {
1110  var styleSheets = document.styleSheets;
1111  var loadedLinkHrefs = { };
1112  for(var i = 0; i < styleSheets.length; i++) {
1113   var styleSheet = styleSheets[i];
1114   try {
1115    if(styleSheet.cssRules)
1116     loadedLinkHrefs[styleSheet.href] = 1;
1117   }
1118   catch(ex) { }
1119  }
1120  var loadedLinksCount = 0;
1121  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
1122   if(loadedLinkHrefs[linkInfo.href])
1123    loadedLinksCount++;
1124  }
1125  return loadedLinksCount == this.linkInfos.length;
1126 },
1127 onAllLinksLoad: function() {
1128  this.reset();
1129  _aspxSweepDuplicatedLinks();
1130  if(createdIncludeScripts.length == 0)
1131   ASPx.FinalizeScriptProcessing(true);
1132 },
1133 onLinkReadyStateChanged: function(linkElement) {
1134  if(linkElement.readyState == "complete")
1135   this.onLinkLoadCore(linkElement);
1136 },
1137 onLinkLoad: function(evt) {
1138  var linkElement = ASPx.Evt.GetEventSource(evt);
1139  this.onLinkLoadCore(linkElement);
1140 },
1141 onLinkLoadCore: function(linkElement) {
1142  var linkInfo = this.getLinkInfo(linkElement);
1143  if(!linkInfo) return;
1144  linkInfo.loaded = true;
1145  var notLoadedLinks = this.linkInfos.filter(function(info) { return !info.loaded; });
1146  if(notLoadedLinks.length == 0)
1147   this.onAllLinksLoad();
1148 },
1149 getLinkInfo: function(linkElement) {
1150  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
1151   if(linkInfo.link == linkElement)
1152    return linkInfo;
1153  }
1154 }
1155});
1156var linkProcessor = null;
1157function getLinkProcessor() {
1158 if(linkProcessor == null)
1159  linkProcessor = new LinkProcessor();
1160 return linkProcessor;
1161}
1162ASPx.LinkProcessor = LinkProcessor;
1163var IFrameHelper = ASPx.CreateClass(null, {
1164 constructor: function(params) {
1165  this.params = params || {};
1166  this.params.src = this.params.src || "";
1167  this.CreateElements();
1168 },
1169 CreateElements: function() {
1170  var elements = IFrameHelper.Create(this.params);
1171  this.containerElement = elements.container;
1172  this.iframeElement = elements.iframe;
1173  this.AttachOnLoadHandler(this, this.iframeElement);
1174  this.SetLoading(true);
1175  if(this.params.onCreate)
1176   this.params.onCreate(this.containerElement, this.iframeElement);
1177 },
1178 AttachOnLoadHandler: function(instance, element) {
1179  ASPx.Evt.AttachEventToElement(element, "load", function() {
1180   instance.OnLoad(element);
1181  });
1182 },
1183 OnLoad: function(element) {
1184  this.SetLoading(false, element);
1185  if(!element.preventCustomOnLoad && this.params.onLoad)
1186   this.params.onLoad();
1187 },
1188 IsLoading: function(element) {
1189  element = element || this.iframeElement;
1190  if(element)
1191   return element.loading;
1192  return false;
1193 },
1194 SetLoading: function(value, element) {
1195  element = element || this.iframeElement;
1196  if(element)
1197   element.loading = value;
1198 },
1199 GetContentUrl: function() {
1200  return this.params.src;
1201 },
1202 SetContentUrl: function(url, preventBrowserCaching) {
1203  if(url) {
1204   this.params.src = url;
1205   if(preventBrowserCaching)
1206    url = IFrameHelper.AddRandomParamToUrl(url);
1207   this.SetLoading(true);
1208   this.iframeElement.src = url;
1209  }
1210 },
1211 RefreshContentUrl: function() {
1212  if(this.IsLoading())
1213   return;
1214  this.SetLoading(true);
1215  var oldContainerElement = this.containerElement;
1216  var oldIframeElement = this.iframeElement;
1217  var postfix = "_del" + Math.floor(Math.random()*100000).toString();
1218  if(this.params.id)
1219   oldIframeElement.id = this.params.id + postfix;
1220  if(this.params.name)
1221   oldIframeElement.name = this.params.name + postfix;
1222  ASPx.SetStyles(oldContainerElement, { height: 0 });
1223  this.CreateElements();
1224  oldIframeElement.preventCustomOnLoad = true;
1225  oldIframeElement.src = ASPx.BlankUrl;
1226  window.setTimeout(function() {
1227   oldContainerElement.parentNode.removeChild(oldContainerElement);
1228  }, 10000); 
1229 }
1230});
1231IFrameHelper.Create = function(params) {
1232 var iframeHtmlStringParts = [ "<iframe frameborder='0'" ];
1233 if(params) {
1234  if(params.id)
1235   iframeHtmlStringParts.push(" id='", params.id, "'");
1236  if(params.name)
1237   iframeHtmlStringParts.push(" name='", params.name, "'");
1238  if(params.title)
1239   iframeHtmlStringParts.push(" title='", params.title, "'");
1240  if(params.scrolling)
1241   iframeHtmlStringParts.push(" scrolling='", params.scrolling, "'");
1242  if(params.src)
1243   iframeHtmlStringParts.push(" src='", params.src, "'");
1244 }
1245 iframeHtmlStringParts.push("></iframe>");
1246 var containerElement = ASPx.CreateHtmlElementFromString("<div style='border-width: 0px; padding: 0px; margin: 0px'></div>");
1247 var iframeElement = ASPx.CreateHtmlElementFromString(iframeHtmlStringParts.join(""));
1248 containerElement.appendChild(iframeElement);
1249 return {
1250  container: containerElement,
1251  iframe: iframeElement
1252 };
1253};
1254IFrameHelper.AddRandomParamToUrl = function(url) {
1255 var prefix = url.indexOf("?") > -1
1256  ? "&"
1257  : "?";
1258 var param = prefix + Math.floor(Math.random()*100000).toString();
1259 var anchorIndex = url.indexOf("#");
1260 return anchorIndex == -1
1261  ? url + param
1262  : url.substr(0, anchorIndex) + param + url.substr(anchorIndex);
1263};
1264IFrameHelper.GetWindow = function(name) {
1265 var frameElement = document.getElementById(name);
1266 return (frameElement != null) ? frameElement.contentWindow : null;
1267};
1268IFrameHelper.GetDocument = function(name) {
1269 var frameElement = document.getElementById(name);
1270 return (frameElement != null) ? frameElement.contentDocument : null;
1271};
1272IFrameHelper.GetDocumentBody = function(name) {
1273 var doc = IFrameHelper.GetDocument(name);
1274 return (doc != null) ? doc.body : null;
1275};
1276IFrameHelper.GetDocumentHead = function (name) {
1277 var doc = IFrameHelper.GetDocument(name);
1278 return (doc != null) ? doc.head || doc.getElementsByTagName('head')[0] : null;
1279};
1280IFrameHelper.GetElement = function(name) {
1281 return document.getElementById(name);
1282};
1283var KbdHelper = ASPx.CreateClass(null, {
1284 constructor: function(control) {
1285  this.control = control;
1286  this.ready = false;
1287  this.clickHandler = this.HandleClick.bind(this);
1288  this.focusHandler = this.onElementFocus.bind(this);
1289  this.blurHandler = this.onBlur.bind(this);
1290 },
1291 Init: function() {
1292  if(!this.ready){
1293   KbdHelper.GlobalInit();
1294   var elements = this.getFocusableElements();
1295   for(var i = 0; i < elements.length; i++) {
1296    var element = elements[i];
1297    element.tabIndex = Math.max(element.tabIndex, 0);
1298    ASPx.Evt.AttachEventToElement(element, "click", this.clickHandler);
1299    ASPx.Evt.AttachEventToElement(element, "focus", this.focusHandler);
1300    ASPx.Evt.AttachEventToElement(element, "blur", this.blurHandler);
1301   }
1302   this.ready = true;
1303  }
1304 },
1305 Dispose: function() {
1306  if(this.ready) {
1307   var elements = this.getFocusableElements();
1308   for(var i = 0; i < elements.length; i++) {
1309    var element = elements[i];
1310    element.tabIndex = -1;
1311    ASPx.Evt.DetachEventFromElement(element, "click", this.clickHandler);
1312    ASPx.Evt.DetachEventFromElement(element, "focus", this.focusHandler);
1313    ASPx.Evt.DetachEventFromElement(element, "blur", this.blurHandler);
1314   }
1315   this.ready = false;
1316  }
1317 },
1318 onElementFocus: function(e) {
1319  if(!this.CanFocus(e))
1320   return true;
1321  KbdHelper.active = this;
1322 },
1323 getFocusableElements: function() {
1324  return [this.GetFocusableElement()]; 
1325 },
1326 GetFocusableElement: function() { return this.control.GetMainElement(); },
1327 canHandleNoFocusAction: function() { 
1328  var focusableElements = this.getFocusableElements();
1329  for(var i = 0; i < focusableElements.length; i++) {
1330   if(focusableElements[i] === _aspxGetFocusedElement())
1331    return false;
1332  }
1333  return true;
1334 },
1335 RequirePreventScrollOnFocus: function() { return false; },
1336 CanFocus: function(e) {
1337  var tag = ASPx.Evt.GetEventSource(e).tagName;
1338  return !(tag === "A" || tag === "TEXTAREA" || tag === "INPUT" || tag === "SELECT" || tag === "IFRAME" || tag === "OBJECT");
1339 },
1340 HandleClick: function(e) {
1341  if(!this.CanFocus(e))
1342   return;
1343  this.Focus();
1344 },
1345 Focus: function() {
1346  var preventScroll = this.RequirePreventScrollOnFocus();
1347  var savedDocumentScrollTop = preventScroll ? ASPx.GetDocumentScrollTop() : -1;
1348  try {
1349   this.GetFocusableElement().focus({ preventScroll: preventScroll });
1350  } catch(e) { }
1351  if(preventScroll && !this.IsNativePreventScrollOnFocusSupported() && savedDocumentScrollTop !== ASPx.GetDocumentScrollTop())
1352   ASPx.SetDocumentScrollTop(savedDocumentScrollTop);
1353 },
1354 IsNativePreventScrollOnFocusSupported: function() {
1355  if(this.isNativePreventScrollOnFocusSupported === undefined)
1356   this.isNativePreventScrollOnFocusSupported = this.CalcIsNativePreventScrollOnFocusSupported();
1357  return this.isNativePreventScrollOnFocusSupported;
1358 },
1359 CalcIsNativePreventScrollOnFocusSupported: function() {
1360  var result = false;
1361  try {
1362   ASPx.GetActiveElement().focus(Object.defineProperty({}, "preventScroll", { get: function() { result = true; } }));
1363  } catch(e) { result = false; }
1364  return result;
1365 },
1366 onBlur: function(){
1367  delete KbdHelper.active;
1368 },
1369 HandleKeyDown: function(e) { }, 
1370 HandleKeyPress: function(e) { }, 
1371 HandleKeyUp: function (e) { },
1372 HandleNoFocusAction: function(e) { },
1373 FocusByAccessKey: function () { }
1374});
1375KbdHelper.GlobalInit = function() {
1376 if(KbdHelper.ready)
1377  return;
1378 ASPx.Evt.AttachEventToDocument("keydown", KbdHelper.OnKeyDown);
1379 ASPx.Evt.AttachEventToDocument("keypress", KbdHelper.OnKeyPress);
1380 ASPx.Evt.AttachEventToDocument("keyup", KbdHelper.OnKeyUp);
1381 KbdHelper.ready = true; 
1382};
1383KbdHelper.swallowKey = false;
1384KbdHelper.accessKeys = { };
1385KbdHelper.ProcessKey = function(e, actionName) {
1386 if(!KbdHelper.active) 
1387  return;
1388 if (KbdHelper.active.canHandleNoFocusAction()) {
1389  KbdHelper.active["HandleNoFocusAction"](e, actionName);
1390  return;
1391 }
1392 var ctl = KbdHelper.active.control;
1393 if(ctl !== ASPx.GetControlCollection().Get(ctl.name)) {
1394  delete KbdHelper.active;
1395  return;
1396 }
1397 if(!KbdHelper.swallowKey) 
1398  KbdHelper.swallowKey = KbdHelper.active[actionName](e);
1399 if(KbdHelper.swallowKey)
1400  ASPx.Evt.PreventEvent(e);
1401};
1402KbdHelper.OnKeyDown = function(e) {
1403 KbdHelper.swallowKey = false;
1404 if(KbdHelper.TryAccessKey(KbdHelper.getKeyName(e)))
1405  ASPx.Evt.PreventEvent(e);
1406 else 
1407  KbdHelper.ProcessKey(e, "HandleKeyDown"); 
1408};
1409KbdHelper.OnKeyPress = function(e) { KbdHelper.ProcessKey(e, "HandleKeyPress"); };
1410KbdHelper.OnKeyUp = function(e) { KbdHelper.ProcessKey(e, "HandleKeyUp"); };
1411KbdHelper.RegisterAccessKey = function(obj) {
1412 var key;
1413 if(obj.accessKey)
1414  key = "CtrlShift" + obj.accessKey;
1415 else if(obj.keyTipModeShortcut)
1416  key = obj.keyTipModeShortcut;
1417 if(!key) return;
1418 KbdHelper.accessKeys[key.toLowerCase()] = obj.name;
1419};
1420KbdHelper.TryAccessKey = function(code) {
1421 var key = code.toLowerCase ? code.toLowerCase() : String.fromCharCode(code).toLowerCase();
1422 var name = KbdHelper.accessKeys[key];
1423 if(!name) return false;
1424 var obj = ASPx.GetControlCollection().Get(name);
1425 return KbdHelper.ClickAccessKey(obj);
1426};
1427KbdHelper.ClickAccessKey = function (control) {
1428 if (!control) return false;
1429 var el = control.GetMainElement();
1430 if (!el) return false;
1431 el.focus();
1432 setTimeout(function () {
1433  if (KbdHelper.active && KbdHelper.active.FocusByAccessKey)
1434   KbdHelper.active.FocusByAccessKey();
1435 }.aspxBind(this), ASPx.FOCUS_TIMEOUT);
1436 return true;
1437};
1438KbdHelper.getKeyName = function(e) {
1439 var name = "";
1440 if(e.altKey)
1441  name += "Alt";
1442 if(e.ctrlKey)
1443  name += "Ctrl";
1444 if(e.shiftKey)
1445  name += "Shift";
1446 var keyCode = e.key || e.code || String.fromCharCode(ASPx.Evt.GetKeyCode(e));
1447 if(keyCode.match(/key/i))
1448  name += keyCode.replace(/key/i, "");
1449 else if(keyCode.match(/digit/i))
1450  name += keyCode.replace(/digit/i, "");
1451 else if(keyCode.match(/arrow/i))
1452  name += keyCode.replace(/arrow/i, "");
1453 else if(keyCode.match(/ins/i))
1454  name += "Ins";
1455 else if(keyCode.match(/del/i))
1456  name += "Del";
1457 else if(keyCode.match(/back/i))
1458  name += "Back";
1459 else if(!keyCode.match(/alt/i) && !keyCode.match(/control/i) && !keyCode.match(/shift/i))
1460  name += keyCode;
1461 return name.replace(/^a-zA-Z0-9/, "");
1462};
1463AccessKeysHelper = ASPx.CreateClass(KbdHelper, {
1464 constructor: function (control) {
1465  this.constructor.prototype.constructor.call(this, control);
1466  this.accessKeysVisible = false;
1467  this.activeKey = null;
1468  this.accessKey = control.createAccessKey ? control.createAccessKey(control.accessKey) : new AccessKey(control.accessKey);
1469  this.accessKeys = this.accessKey.accessKeys;
1470  this.charIndex = 0;
1471  this.onFocusByAccessKey = null;
1472  this.onClose = null;
1473  this.manualStopProcessing = false;
1474  this.isActive = false;
1475  this.areAccessKeysShown = false;
1476 },
1477 Init: function (control) {
1478  KbdHelper.prototype.Init.call(this);
1479  KbdHelper.RegisterAccessKey(control);   
1480 },
1481 Add: function (accessKey) {
1482  this.accessKey.Add(accessKey);
1483 },
1484 HandleKeyDown: function (e) {
1485  var keyCode = ASPx.Evt.GetKeyCode(e);
1486  var stopProcessing = this.processKeyDown(keyCode);
1487  if (stopProcessing.value) {
1488   this.stopProcessing();
1489   if(this.onClosedOnEscape && (keyCode == ASPx.Key.Esc || stopProcessing.fireEvent))
1490    this.onClosedOnEscape();
1491  }
1492  return stopProcessing;
1493 },
1494 HandleNoFocusAction: function (e, actionName) {
1495  var keyCode = ASPx.Evt.GetKeyCode(e);
1496  if (this.onClosedOnEscape && keyCode == ASPx.Key.Esc && actionName == "HandleKeyDown")
1497   this.onClosedOnEscape();
1498 },
1499 Activate: function () {
1500  KbdHelper.ClickAccessKey(this.control);
1501  this.areAccessKeysShown = true;
1502 },
1503 Stop: function() {
1504  this.stopProcessing();
1505 },
1506 stopProcessing: function () {
1507  this.HideAccessKeys();
1508  if (KbdHelper.active && this.isActive) {
1509   this.isActive = false;
1510   KbdHelper.active.control.GetMainElement().blur();
1511   delete KbdHelper.active;
1512  }
1513 },
1514 onBlur: function() {
1515  if (this.manualStopProcessing) {
1516   this.manualStopProcessing = false;
1517   return;
1518  }
1519  this.HideAccessKeys();
1520  KbdHelper.prototype.onBlur.call(this);
1521 },
1522 processKeyDown: function (keyCode) {
1523  switch (keyCode) {
1524   case ASPx.Key.Left:
1525    this.TryMoveFocusLeft();
1526    return { value: false };
1527   case ASPx.Key.Right:
1528    this.TryMoveFocusRight();
1529    return { value: false };
1530   case ASPx.Key.Esc:
1531    if(this.control.hideAllPopups)
1532     this.control.hideAllPopups(true, true);
1533    if(this.activeKey)
1534     this.activeKey = this.activeKey.Return();
1535    this.charIndex = 0;
1536    if (!this.activeKey)
1537     return { value: true };
1538    break;
1539   case ASPx.Key.Enter:
1540    return { value: true };
1541   default:
1542    if (!ASPx.IsPrintableKey(keyCode))
1543     return { value: false };
1544    var char = String.fromCharCode(keyCode).toUpperCase();
1545    var needToContinue = { value: false };
1546    var keyResult;
1547    if(this.activeKey)
1548     keyResult = this.activeKey.TryAccessKey(char, this.charIndex, needToContinue);
1549    if (needToContinue.value) {
1550     this.charIndex++;
1551     return { value: false };
1552    }
1553    this.charIndex = 0;
1554    if(keyResult !== undefined)
1555     this.activeKey = keyResult;
1556    else
1557     return { value: true, fireEvent: true };
1558    if (!this.activeKey || !this.activeKey.accessKeys || this.activeKey.accessKeys.length == 0) {
1559     if (this.activeKey && this.activeKey.manualStopProcessing) {
1560      this.manualStopProcessing = true;
1561      break;
1562     }
1563     return { value: true, fireEvent: true };
1564    }
1565  }
1566  return { value: false };
1567 },
1568 TryMoveFocusLeft: function (modifier) {},
1569 TryMoveFocusRight: function (modifier) {},
1570 TryMoveFocusUp: function (modifier) {},
1571 TryMoveFocusDown: function (modifier) {},
1572 FocusByAccessKey: function() {
1573  if (this.onFocusByAccessKey)
1574   this.onFocusByAccessKey();
1575  this.HideAccessKeys();
1576  KbdHelper.prototype.FocusByAccessKey.call(this);
1577  this.activeKey = this.accessKey;
1578  this.activeKey.execute();
1579  this.isActive = true;
1580  this.areAccessKeysShown = true;
1581 },
1582 HideAccessKeys: function() {
1583  this.areAccessKeysShown = false;
1584  this.hideAccessKeys(this.accessKey);
1585 },
1586 Update: function() {
1587  this.throttleMethod(this.refresh, 100);
1588 },
1589 refresh: function() {
1590  if(this.activeKey && this.areAccessKeysShown) {
1591   this.activeKey.execute();
1592  }
1593 },
1594 throttleMethod: function(method, delay) {
1595  clearTimeout(method.timerId);
1596  method.timerId = setTimeout(function() {
1597   method.call(this);
1598  }.aspxBind(this), delay);
1599 },
1600 AreAccessKeysShown: function() {
1601  return this.areAccessKeysShown;
1602 },
1603 hideAccessKeys: function (accessKey) {
1604  for (var i = 0, ak; ak = accessKey.accessKeys[i]; i++) {
1605   this.hideAccessKeys(ak);
1606  }
1607  if (accessKey)
1608   accessKey.hide();
1609 },
1610 HandleClick: function(e) {
1611  KbdHelper.prototype.HandleClick.call(this, e);
1612  this.stopProcessing();
1613 }
1614});
1615AccessKey = ASPx.CreateClass(null, {
1616 constructor: function (popupItem, getPopupElement, keyTipElement, key, onlyClick, manualStopProcessing) {
1617  this.key = key ? key : keyTipElement ? ASPxClientUtils.Trim(ASPx.GetInnerText(keyTipElement)) : null;
1618  this.popupItem = popupItem;
1619  this.getPopupElement = getPopupElement;
1620  this.keyTipElement = keyTipElement;
1621  this.accessKeys = [];
1622  this.needShowChilds = true;
1623  this.parent = null;
1624  this.onlyClick = onlyClick;
1625  this.manualStopProcessing = manualStopProcessing;
1626 },
1627 Add: function (accessKey) {
1628  this.accessKeys.push(accessKey);
1629  accessKey.parent = this;
1630 },
1631 TryAccessKey: function (char, index, needToContinue) {
1632  if (!this.accessKeys || this.accessKeys.length == 0)
1633   return;
1634  for (var i = 0, accessKey; accessKey = this.accessKeys[i]; i++) {
1635   if (accessKey.key[index] == char && accessKey.isVisible()) {
1636    if (accessKey.key[index + 1]) {
1637     needToContinue.value = true;
1638    }
1639    else {
1640     accessKey.execute();
1641     return accessKey;
1642    }
1643   } else {
1644    accessKey.hide();
1645   }
1646  }
1647  for (var i = 0, accessKey; accessKey = this.accessKeys[i]; i++) {
1648   var key = accessKey.TryAccessKey(char, index, needToContinue);
1649   if (key)
1650    return key;
1651  }
1652  return;
1653 },
1654 isVisible: function(){
1655  return ASPx.GetElementVisibility(this.keyTipElement);
1656 },
1657 Return: function () {
1658  this.hideChildAccessKeys();
1659  if (this.parent) {
1660   this.parent.showAccessKeys(true);
1661  }  
1662  return this.parent;
1663 },
1664 execute: function () {
1665  this.hideAll();
1666  if (this.popupItem && this.popupItem.accessKeyClick && !this.onlyClick)
1667   this.popupItem.accessKeyClick();
1668  if (this.getPopupElement && this.onlyClick)
1669   ASPx.Evt.EmulateMouseClick(this.getPopupElement(this.popupItem));
1670  if (this.accessKeys)
1671   setTimeout(function () {
1672    this.showAccessKeys(true);
1673   }.aspxBind(this), 100);
1674 },
1675 showAccessKeys: function(directShow) {
1676  if (!directShow && !this.needShowChilds)
1677   return;
1678  for (var i = 0; i < this.accessKeys.length; i++) {
1679   var accessKey = this.accessKeys[i];
1680   if (accessKey) {
1681    var popupElement = accessKey.getPopupElement ? accessKey.getPopupElement(accessKey.popupItem) : null;
1682    if (popupElement && this.isElementVisible(popupElement)) {
1683     this.show(accessKey);
1684    }
1685    accessKey.showAccessKeys();
1686   }
1687  }
1688 },
1689 isElementVisible: function (el) { return ASPx.IsElementVisible(el, true); },
1690 show: function(accessKey) {
1691  var keyTipElement = accessKey.keyTipElement;
1692  var popupElement = accessKey.getPopupElement(accessKey.popupItem);
1693  this.showKeyTipElement(keyTipElement, this.calculateCoordinates(accessKey, keyTipElement, popupElement));
1694 },
1695 showKeyTipElement: function (keyTipElement, coordinates) {
1696  ASPx.SetAbsoluteY(keyTipElement, coordinates.top);
1697  ASPx.SetAbsoluteX(keyTipElement, coordinates.left);
1698  ASPx.SetElementVisibility(keyTipElement, true); 
1699 },
1700 calculateCoordinates: function (accessKey, keyTipElement, popupElement) {
1701  var top = ASPx.GetAbsolutePositionY(popupElement);
1702  var left = ASPx.GetAbsolutePositionX(popupElement);
1703  if (accessKey.popupItem.getAccessKeyPosition)
1704   switch (accessKey.popupItem.getAccessKeyPosition()) {
1705    case "AboveRight":
1706     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
1707     top = top - keyTipElement.offsetHeight / 2;
1708     break;
1709    case "Right":
1710     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
1711     top = top + popupElement.offsetHeight / 2 - keyTipElement.offsetHeight / 2;
1712     break;
1713    case "BelowRight":
1714     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
1715     top = top + keyTipElement.offsetHeight / 2;
1716     break;
1717    default:
1718     top = top + popupElement.offsetHeight;
1719     left = left + popupElement.offsetWidth / 2 - keyTipElement.offsetWidth / 2;
1720     break;
1721   }
1722  else {
1723   top = top + popupElement.offsetHeight;
1724   left = left + popupElement.offsetWidth / 2 - keyTipElement.offsetWidth / 2;
1725  }
1726  return { top: top, left: left };
1727 },
1728 hide: function() {
1729  if (this.keyTipElement)
1730   ASPx.SetElementVisibility(this.keyTipElement, false);
1731 },
1732 hideChildAccessKeys: function () {
1733  this.hideAccessKeys(this.accessKeys);
1734 },
1735 hideAccessKeys: function (accessKeys) {
1736  if (accessKeys) {
1737   for (var i = 0, accessKey; accessKey = accessKeys[i]; i++) {
1738    if (accessKey.keyTipElement)
1739     accessKey.hide();
1740    accessKey.hideChildAccessKeys();
1741   }
1742  }
1743 },
1744 hideAll: function () {
1745  this.getRoot(this).hideChildAccessKeys();
1746 },
1747 getRoot: function (accessKey) {
1748  if (!accessKey.parent)
1749   return accessKey;
1750  return this.getRoot(accessKey.parent);
1751 }
1752});
1753var focusedElement = null;
1754function aspxOnElementFocused(evt) {
1755 evt = ASPx.Evt.GetEvent(evt);
1756 if(evt && evt.target)
1757  focusedElement = evt.target;
1758}
1759function _aspxInitializeFocus() {
1760 if(!ASPx.GetActiveElement())
1761  ASPx.Evt.AttachEventToDocument("focus", aspxOnElementFocused);
1762}
1763function _aspxGetFocusedElement() {
1764 var activeElement = ASPx.GetActiveElement();
1765 return activeElement ? activeElement : focusedElement;
1766}
1767CheckBoxCheckState = {
1768 Checked : "Checked",
1769 Unchecked : "Unchecked",
1770 Indeterminate : "Indeterminate"
1771};
1772CheckBoxInputKey = { 
1773 Checked : "C",
1774 Unchecked : "U",
1775 Indeterminate : "I"
1776};
1777var CheckableElementStateController = ASPx.CreateClass(null, {
1778 constructor: function(imageProperties) {
1779  this.checkBoxStates = [];
1780  this.imageProperties = imageProperties;
1781  this.customImageMarkerClassName = "dxcbCI";
1782 },
1783 GetValueByInputKey: function(inputKey) {
1784  return this.GetFirstValueBySecondValue("Value", "StateInputKey", inputKey);
1785 },
1786 GetInputKeyByValue: function(value) {
1787  return this.GetFirstValueBySecondValue("StateInputKey", "Value", value);
1788 },
1789 GetImagePropertiesNumByInputKey: function(value) {
1790  return this.GetFirstValueBySecondValue("ImagePropertiesNumber", "StateInputKey", value);
1791 },
1792 GetNextCheckBoxValue: function(currentValue, allowGrayed) {
1793  var currentInputKey = this.GetInputKeyByValue(currentValue);
1794  var nextInputKey = '';
1795  switch(currentInputKey) {
1796   case CheckBoxInputKey.Checked:
1797    nextInputKey = CheckBoxInputKey.Unchecked; break;
1798   case CheckBoxInputKey.Unchecked:
1799    nextInputKey = allowGrayed ? CheckBoxInputKey.Indeterminate : CheckBoxInputKey.Checked; break;
1800   case CheckBoxInputKey.Indeterminate:
1801    nextInputKey = CheckBoxInputKey.Checked; break;
1802  }
1803  return this.GetValueByInputKey(nextInputKey);
1804 },
1805 GetCheckStateByInputKey: function(inputKey) {
1806  switch(inputKey) {
1807   case CheckBoxInputKey.Checked: 
1808    return CheckBoxCheckState.Checked;
1809   case CheckBoxInputKey.Unchecked: 
1810    return CheckBoxCheckState.Unchecked;
1811   case CheckBoxInputKey.Indeterminate: 
1812    return CheckBoxCheckState.Indeterminate;
1813  }
1814 },
1815 GetValueByCheckState: function(checkState) {
1816  switch(checkState) {
1817   case CheckBoxCheckState.Checked: 
1818    return this.GetValueByInputKey(CheckBoxInputKey.Checked);
1819   case CheckBoxCheckState.Unchecked: 
1820    return this.GetValueByInputKey(CheckBoxInputKey.Unchecked);
1821   case CheckBoxCheckState.Indeterminate: 
1822    return this.GetValueByInputKey(CheckBoxInputKey.Indeterminate);
1823  }
1824 },
1825 GetFirstValueBySecondValue: function(firstValueName, secondValueName, secondValue) {
1826  return this.GetValueByFunc(firstValueName, 
1827   function(checkBoxState) { return checkBoxState[secondValueName] === secondValue; });
1828 },
1829 GetValueByFunc: function(valueName, func) {
1830  for(var i = 0; i < this.checkBoxStates.length; i++) {
1831   if(func(this.checkBoxStates[i]))
1832    return this.checkBoxStates[i][valueName];
1833  }  
1834 },
1835 AssignElementClassName: function(element, cssClassPropertyKey, disabledCssClassPropertyKey, assignedClassName) {
1836  var classNames = [ ];
1837  for(var i = 0; i < this.imageProperties[cssClassPropertyKey].length; i++) {
1838   classNames.push(this.imageProperties[disabledCssClassPropertyKey][i]);
1839   classNames.push(this.imageProperties[cssClassPropertyKey][i]);
1840  }
1841  var elementClassName = element.className;
1842  for(var i = 0; i < classNames.length; i++) {
1843   var className = classNames[i];
1844   var index = elementClassName.indexOf(className);
1845   if(index > -1)
1846    elementClassName = elementClassName.replace((index == 0 ? '' : ' ') + className, "");
1847  }
1848  elementClassName += " " + assignedClassName;
1849  element.className = elementClassName;
1850 },
1851 UpdateInternalCheckBoxDecoration: function(mainElement, inputKey, enabled) {
1852  var imagePropertiesNumber = this.GetImagePropertiesNumByInputKey(inputKey);
1853  for(var imagePropertyKey in this.imageProperties) {
1854   if(this.imageProperties.hasOwnProperty(imagePropertyKey)) {
1855    var propertyValue = this.imageProperties[imagePropertyKey][imagePropertiesNumber];
1856    propertyValue = propertyValue || !isNaN(propertyValue) ? propertyValue : "";
1857    switch(imagePropertyKey) {
1858     case "0" : mainElement.title = propertyValue; break;
1859     case "1" : mainElement.style.width = propertyValue + (propertyValue != "" ? "px" : ""); break;
1860     case "2" : mainElement.style.height = propertyValue + (propertyValue != "" ? "px" : ""); break;
1861    }
1862    if(enabled) {
1863     switch(imagePropertyKey) {
1864      case "3" : this.SetImageSrc(mainElement, propertyValue); break;
1865      case "4" : 
1866       this.AssignElementClassName(mainElement, "4", "8", propertyValue);
1867       break;
1868      case "5" : this.SetBackgroundPosition(mainElement, propertyValue, true); break;
1869      case "6" : this.SetBackgroundPosition(mainElement, propertyValue, false); break;
1870     }
1871    } else {
1872     switch(imagePropertyKey) {
1873      case "7" : this.SetImageSrc(mainElement, propertyValue); break;
1874      case "8" : 
1875       this.AssignElementClassName(mainElement, "4", "8", propertyValue);
1876       break;
1877      case "9" : this.SetBackgroundPosition(mainElement, propertyValue, true); break;
1878      case "10" : this.SetBackgroundPosition(mainElement, propertyValue, false); break;
1879     }
1880    }
1881   }
1882  }
1883 },
1884 SetImageSrc: function(mainElement, src) {
1885  if(src === ""){
1886   mainElement.style.backgroundImage = "";
1887   mainElement.style.backgroundPosition = "";
1888   ASPx.RemoveClassNameFromElement(mainElement, this.customImageMarkerClassName);
1889  }
1890  else{
1891   mainElement.style.backgroundImage = "url('" + src + "')";
1892   this.SetBackgroundPosition(mainElement, 0, true);
1893   this.SetBackgroundPosition(mainElement, 0, false);
1894   ASPx.AddClassNameToElement(mainElement, this.customImageMarkerClassName);
1895  }
1896 },
1897 SetBackgroundPosition: function(element, value, isX) {
1898  if(value === "") {
1899   element.style.backgroundPosition = value;
1900   return;
1901  }
1902  if(element.style.backgroundPosition === "")
1903   element.style.backgroundPosition = isX ? "-" + value.toString() + "px 0px" : "0px -" + value.toString() + "px";
1904  else {
1905   var position = element.style.backgroundPosition.split(' ');
1906   element.style.backgroundPosition = isX ? '-' + value.toString() + "px " + position[1] :  position[0] + " -" + value.toString() + "px";
1907  }
1908 },
1909 AddState: function(value, stateInputKey, imagePropertiesNumber) {
1910  this.checkBoxStates.push({
1911   "Value" : value, 
1912   "StateInputKey" : stateInputKey, 
1913   "ImagePropertiesNumber" : imagePropertiesNumber
1914  });
1915 },
1916 GetAriaCheckedValue: function(state) {
1917  switch(state) {
1918   case ASPx.CheckBoxCheckState.Checked: return "true";
1919   case ASPx.CheckBoxCheckState.Unchecked: return "false";
1920   case ASPx.CheckBoxCheckState.Indeterminate: return "mixed";
1921   default: return "";
1922  }
1923 },
1924 GetAriaSelectedValue: function(state) {
1925  switch(state) {
1926   case ASPx.CheckBoxCheckState.Checked: return "true";
1927   case ASPx.CheckBoxCheckState.Unchecked: return "false";
1928   case ASPx.CheckBoxCheckState.Indeterminate: return "undefined";
1929   default: return "";
1930  }
1931 },
1932 SetAriaCheckedSelectedAttributes: function(mainElement, state) {
1933  if(mainElement.attributes["aria-checked"] !== undefined) {
1934   var ariaCheckedValue = this.GetAriaCheckedValue(state);
1935   mainElement.setAttribute("aria-checked", ariaCheckedValue);
1936  }
1937  if(mainElement.attributes["aria-selected"] !== undefined) {
1938   var ariaSelectedValue = this.GetAriaSelectedValue(state);
1939   mainElement.setAttribute("aria-selected", ariaSelectedValue);
1940  }
1941 }
1942});
1943CheckableElementStateController.Create = function(imageProperties, valueChecked, valueUnchecked, valueGrayed, allowGrayed) {
1944 var stateController = new CheckableElementStateController(imageProperties);
1945 stateController.AddState(valueChecked, CheckBoxInputKey.Checked, 0);
1946 stateController.AddState(valueUnchecked, CheckBoxInputKey.Unchecked, 1);
1947 if(typeof(valueGrayed) != "undefined")
1948  stateController.AddState(valueGrayed, CheckBoxInputKey.Indeterminate, allowGrayed ? 2 : 1);
1949 stateController.allowGrayed = allowGrayed;
1950 return stateController;
1951};
1952var CheckableElementHelper = ASPx.CreateClass(null, {
1953 InternalCheckBoxInitialize: function(internalCheckBox) {
1954  this.AttachToMainElement(internalCheckBox);
1955  this.AttachToInputElement(internalCheckBox);
1956 },
1957 AttachToMainElement: function(internalCheckBox) {
1958  var instance = this;
1959  if(internalCheckBox.mainElement) {
1960    var toggleEvent = internalCheckBox.displaySwitch ? ASPx.TouchUIHelper.touchMouseDownEventName : "click";
1961    ASPx.Evt.AttachEventToElement(internalCheckBox.mainElement, toggleEvent,
1962    function (evt) {
1963     if(ASPx.Evt.IsRightButtonPressed(evt))
1964      return;
1965     instance.InvokeClick(internalCheckBox, evt);
1966     if(!internalCheckBox.disableCancelBubble)
1967      return ASPx.Evt.PreventEventAndBubble(evt);
1968    }
1969   );
1970   ASPx.Evt.AttachEventToElement(internalCheckBox.mainElement, "mousedown",
1971    function (evt) {
1972     internalCheckBox.Refocus();
1973    }
1974   );
1975   ASPx.Evt.PreventElementDragAndSelect(internalCheckBox.mainElement, true);
1976  }
1977 },
1978 AttachToInputElement: function(internalCheckBox) {
1979  var instance = this;
1980  if(internalCheckBox.inputElement && internalCheckBox.mainElement) {
1981   var checkableElement = internalCheckBox.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement;
1982   ASPx.Evt.AttachEventToElement(checkableElement, "focus",
1983    function (evt) { 
1984     if(!internalCheckBox.enabled)
1985      checkableElement.blur();
1986     else
1987      internalCheckBox.OnFocus();
1988    }
1989   );
1990   ASPx.Evt.AttachEventToElement(checkableElement, "blur", 
1991    function (evt) { 
1992     internalCheckBox.OnLostFocus();
1993    }
1994   );
1995   ASPx.Evt.AttachEventToElement(checkableElement, "keyup",
1996    function (evt) { 
1997     if(ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Space)
1998      instance.InvokeClick(internalCheckBox, evt);
1999    }
2000   );
2001   ASPx.Evt.AttachEventToElement(checkableElement, "keydown",
2002    function (evt) { 
2003     if(ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Space)
2004      return ASPx.Evt.PreventEvent(evt);
2005    }
2006   );
2007  }
2008 },
2009 IsKBSInputWrapperExist: function() {
2010  return ASPx.Browser.Opera || ASPx.Browser.WebKitFamily;
2011 },
2012 GetICBMainElementByInput: function(icbInputElement) {
2013  return this.IsKBSInputWrapperExist() ? icbInputElement.parentNode.parentNode : icbInputElement.parentNode;
2014 },
2015 RequirePreventFocus: function() { return false; },
2016 InvokeClick: function(internalCheckBox, evt) {
2017  if(internalCheckBox.enabled && !internalCheckBox.GetReadOnly()) {
2018   var inputElementValue = internalCheckBox.inputElement.value;
2019   var focusableElement = internalCheckBox.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement; 
2020   if(!this.RequirePreventFocus())
2021    focusableElement.focus();
2022   internalCheckBox.inputElement.value = inputElementValue; 
2023   this.InvokeClickCore(internalCheckBox, evt);
2024   }
2025 },
2026 InvokeClickCore: function(internalCheckBox, evt) {
2027  internalCheckBox.OnClick(evt);
2028 }
2029});
2030CheckableElementHelper.Instance = new CheckableElementHelper();
2031var CheckBoxInternal = ASPx.CreateClass(null, {
2032 constructor: function(inputElement, stateController, allowGrayed, allowGrayedByClick, helper, container, storeValueInInput, key, disableCancelBubble,
2033  accessibilityCompliant, displaySwitch) {
2034  this.inputElement = inputElement;
2035  this.mainElement = helper.GetICBMainElementByInput(this.inputElement);
2036  this.name = (key ? key : this.inputElement.id) + CheckBoxInternal.GetICBMainElementPostfix();
2037  this.mainElement.id = this.name;
2038  this.stateController = stateController;
2039  this.container = container;
2040  this.allowGrayed = allowGrayed;
2041  this.allowGrayedByClick = allowGrayedByClick;
2042  this.autoSwitchEnabled = true;
2043  this.displaySwitch = displaySwitch;
2044  this.storeValueInInput = !!storeValueInInput;
2045  this.storedInputKey = !this.storeValueInInput ? this.inputElement.value : null;
2046  this.disableCancelBubble = !!disableCancelBubble;
2047  this.accessibilityCompliant = accessibilityCompliant;
2048  this.focusDecoration = null;
2049  this.focused = false;
2050  this.focusLocked = false;
2051  this.enabled = !this.mainElement.className.match(/dxWeb_\w+Disabled(\b|_)/);
2052  this.readOnly = false;
2053  this.preventFocus = helper.RequirePreventFocus();
2054  this.CheckedChanged = new ASPxClientEvent();
2055  this.Focus = new ASPxClientEvent();
2056  this.LostFocus = new ASPxClientEvent();
2057  helper.InternalCheckBoxInitialize(this);
2058 },
2059 GetReadOnly: function() {
2060  return this.readOnly;
2061 },
2062 ChangeInputElementTabIndex: function() {  
2063  var changeMethod = this.enabled ? ASPx.Attr.RestoreTabIndexAttribute : ASPx.Attr.SaveTabIndexAttributeAndReset;
2064  changeMethod(this.inputElement);
2065 },
2066 CreateFocusDecoration: function(focusedStyle) {
2067   this.focusDecoration = new FocusedStyleDecoration(this);
2068   this.focusDecoration.AddStyle('F', focusedStyle[0], focusedStyle[1]);
2069   this.focusDecoration.AddPostfix("");
2070 },
2071 UpdateFocusDecoration: function() {
2072  this.focusDecoration.Update();
2073 },  
2074 StoreInputKey: function(inputKey) {
2075  if(this.storeValueInInput)
2076   this.inputElement.value = inputKey;
2077  else
2078   this.storedInputKey = inputKey;
2079 },
2080 GetStoredInputKey: function() {
2081  if(this.storeValueInInput)
2082   return this.inputElement.value;
2083  else
2084   return this.storedInputKey;
2085 },
2086 OnClick: function(e) {
2087  if(this.autoSwitchEnabled) {
2088   var currentValue = this.GetValue();
2089   var value = this.stateController.GetNextCheckBoxValue(currentValue, this.allowGrayedByClick && this.allowGrayed);
2090   this.SetValue(value);
2091  }
2092  this.CheckedChanged.FireEvent(this, e);
2093 },
2094 OnFocus: function() {
2095  if(!this.IsFocusLocked()) {
2096   this.focused = true;
2097   this.UpdateFocusDecoration();
2098   this.Focus.FireEvent(this, null);
2099  } else
2100   this.UnlockFocus();
2101 },
2102 OnLostFocus: function() {
2103  if(!this.IsFocusLocked()) {
2104   this.focused = false;
2105   this.UpdateFocusDecoration();
2106   this.LostFocus.FireEvent(this, null);
2107  }
2108 },
2109 Refocus: function() {
2110  if(this.preventFocus) return;
2111  if(this.focused) {
2112   this.LockFocus();
2113   this.inputElement.blur();
2114   if(ASPx.Browser.MacOSMobilePlatform) {
2115    window.setTimeout(function() {
2116     ASPx.SetFocus(this.inputElement);
2117    }, ASPx.FOCUS_TIMEOUT);
2118   } else {
2119    ASPx.SetFocus(this.inputElement);
2120   }
2121  }
2122 },
2123 LockFocus: function() {
2124  this.focusLocked = true;
2125 },
2126 UnlockFocus: function() {
2127  this.focusLocked = false;
2128 },
2129 IsFocusLocked: function() {
2130  if(!!ASPx.Attr.GetAttribute(this.mainElement, ASPx.Attr.GetTabIndexAttributeName()))
2131   return false;
2132  return this.focusLocked;
2133 },
2134 SetValue: function(value, force) {
2135  var currentValue = this.GetValue();
2136  if(currentValue !== value || force) {
2137   var newInputKey = this.stateController.GetInputKeyByValue(value);
2138   if(newInputKey) {
2139    this.StoreInputKey(newInputKey);   
2140    this.stateController.UpdateInternalCheckBoxDecoration(this.mainElement, newInputKey, this.enabled);
2141   }
2142  }
2143  if(this.accessibilityCompliant) {
2144   var state = this.GetCurrentCheckState();
2145   this.stateController.SetAriaCheckedSelectedAttributes(this.mainElement, state);
2146  }
2147 },
2148 GetValue: function() {
2149  return this.stateController.GetValueByInputKey(this.GetCurrentInputKey());
2150 },
2151 GetCurrentCheckState: function() {
2152  return this.stateController.GetCheckStateByInputKey(this.GetCurrentInputKey());
2153 },
2154 GetCurrentInputKey: function() {
2155  return this.GetStoredInputKey();
2156 },
2157 GetChecked: function() {
2158  return this.GetCurrentInputKey() === CheckBoxInputKey.Checked;
2159 },
2160 SetChecked: function(checked) {
2161  var newValue = this.stateController.GetValueByCheckState(checked ? CheckBoxCheckState.Checked : CheckBoxCheckState.Unchecked);
2162  this.SetValue(newValue);
2163 },
2164 SetEnabled: function(enabled) {
2165  if(this.enabled != enabled) {
2166   this.enabled = enabled;
2167   this.stateController.UpdateInternalCheckBoxDecoration(this.mainElement, this.GetCurrentInputKey(), this.enabled);
2168   this.ChangeInputElementTabIndex();
2169  }
2170 },
2171 GetEnabled: function() {
2172  return this.enabled;
2173 }
2174});
2175CheckBoxInternal.GetICBMainElementPostfix = function() {
2176 return "_D";
2177};
2178var CheckBoxInternalCollection = ASPx.CreateClass(CollectionBase, {
2179 constructor: function(imageProperties, allowGrayed, storeValueInInput, helper, disableCancelBubble, accessibilityCompliant) {
2180  this.constructor.prototype.constructor.call(this);
2181  this.stateController = allowGrayed 
2182   ? CheckableElementStateController.Create(imageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked, CheckBoxInputKey.Indeterminate, true)
2183   : CheckableElementStateController.Create(imageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked);
2184  this.helper = helper || CheckableElementHelper.Instance;
2185  this.storeValueInInput = !!storeValueInInput;
2186  this.disableCancelBubble = !!disableCancelBubble;
2187  this.accessibilityCompliant = accessibilityCompliant;
2188 },
2189 Add: function(key, inputElement, container) {
2190  this.Remove(key);
2191  var checkBox = this.CreateInternalCheckBox(key, inputElement, container);
2192  CollectionBase.prototype.Add.call(this, key, checkBox);
2193  return checkBox;
2194 },
2195 SetImageProperties: function(imageProperties) {
2196  this.stateController.imageProperties = imageProperties;
2197 },
2198 CreateInternalCheckBox: function(key, inputElement, container) {
2199  return new CheckBoxInternal(inputElement, this.stateController, this.stateController.allowGrayed, false, this.helper, container, 
2200   this.storeValueInInput, key, this.disableCancelBubble, this.accessibilityCompliant);
2201 }
2202});
2203var FocusedStyleDecoration = ASPx.CreateClass(null, {
2204 constructor: function(editor) {
2205  this.editor = editor;
2206  this.postfixList = [];
2207  this.styles = {};
2208  this.innerStyles = {};
2209 },
2210 AddPostfix: function(value) {
2211  this.postfixList.push(value);
2212 },
2213 AddStyle: function(key, className, cssText) {
2214  this.styles[key] = this.CreateRule(className, cssText);
2215  this.innerStyles[key] = this.CreateRule("", this.FilterInnerCss(cssText));
2216 },
2217 CreateRule: function(className, cssText) {
2218  return ASPx.Str.Trim(className + " " + ASPx.CreateImportantStyleRule(this.GetStyleSheet(), cssText));
2219 },
2220 GetStyleSheet: function() {
2221  return ASPx.GetCurrentStyleSheet();
2222 },
2223 FilterInnerCss: function(css) {
2224  return css.replace(/(border|background-image)[^:]*:[^;]+/gi, "");
2225 },
2226 Update: function() {
2227  for(var i = 0; i < this.postfixList.length; i++) {
2228   var postfix = this.postfixList[i];
2229   var inner = postfix.length > 0;
2230   var element = this.GetElementByPostfix(postfix);
2231   if(element)
2232    this.ApplyStyles(element, inner);
2233  }
2234 },
2235 GetElementByPostfix: function(postfix) {
2236  return ASPx.GetElementById(this.editor.name + postfix);
2237 },
2238 ApplyStyles: function(element, inner) {
2239  this.ApplyFocusedStyle(element, inner);
2240 },
2241 ApplyFocusedStyle: function(element, inner) {
2242  if(this.HasDecoration("F"))
2243   this.ApplyDecoration("F", element, inner, this.editor.focused);
2244 },
2245 HasDecoration: function(key) {
2246  return !!this.styles[key];
2247 },
2248 ApplyDecoration: function(key, element, inner, active) {
2249  var value = inner ? this.innerStyles[key] : this.styles[key];
2250  this.RemoveDecoration(element, value);
2251  if(active)
2252   ASPx.AddClassNameToElement(element, value);
2253 },
2254 RemoveDecoration: function(element, value) {
2255  ASPx.RemoveClassNameFromElement(element, value);
2256 },
2257 ApplyDecorationCore: function() {
2258 },
2259 EnsureElementBorder: function(element) {
2260  var border = parseInt(element.border) || 0;
2261  element.border = 1;
2262  element.border = border;
2263 }
2264});
2265var EditorStyleDecoration = ASPx.CreateClass(FocusedStyleDecoration, {
2266 constructor: function(editor) {
2267  this.constructor.prototype.constructor.call(this, editor);
2268  this.lockUpdate = false;
2269 },
2270 LockUpdate: function() {
2271  this.lockUpdate = true;
2272 },
2273 UnlockUpdate: function() {
2274  this.lockUpdate = false;
2275 },
2276 IsUpdateLocked: function() {
2277  return this.lockUpdate;
2278 },
2279 Update: function () {
2280  if(this.IsUpdateLocked())
2281   return;
2282  ASPx.FocusedStyleDecoration.prototype.Update.call(this);
2283 },
2284 ApplyStyles: function (element, inner) {
2285  this.ApplyInvalidStyle(element, inner);
2286  ASPx.FocusedStyleDecoration.prototype.ApplyStyles.call(this, element, inner);
2287 },
2288 ApplyInvalidStyle: function (element, inner) {
2289  if(this.HasDecoration("I")) {
2290   var isValid = this.editor.GetIsValid();
2291   this.ApplyDecoration("I", element, inner, !isValid);
2292  }
2293 }
2294});
2295var TextEditorStyleDecoration = ASPx.CreateClass(EditorStyleDecoration, {
2296 constructor: function(editor) {
2297  this.constructor.prototype.constructor.call(this, editor);
2298  this.nullTextClassName = "";
2299 },
2300 ApplyStyles: function(element, inner) {
2301  ASPx.EditorStyleDecoration.prototype.ApplyStyles.call(this, element, inner);
2302  this.ApplyNullTextStyle(element, inner);
2303 },
2304 ApplyNullTextStyle: function(element, inner) {
2305  if(!this.HasDecoration("N"))
2306   return;
2307  var apply = !this.editor.focused && this.editor.CanApplyNullTextDecoration();
2308  this.EnsureSpellcheckAttribute(element, apply);
2309  this.ApplyDecoration("N", element, inner, apply);
2310 },
2311 EnsureSpellcheckAttribute: function(element, apply) {
2312  if(apply)
2313   ASPx.Attr.ChangeAttribute(element, "spellcheck", "false");
2314  else
2315   ASPx.Attr.RestoreAttribute(element, "spellcheck");
2316 },
2317 ApplyNullTextClassName: function(active) {
2318  var nullTextClassName = this.GetNullTextClassName();
2319  var editorMainElement = this.editor.GetMainElement();
2320  if(active)
2321   ASPx.AddClassNameToElement(editorMainElement, nullTextClassName);
2322  else
2323   ASPx.RemoveClassNameFromElement(editorMainElement, nullTextClassName);
2324 },
2325 GetNullTextClassName: function() {
2326  if (!this.nullTextClassName)
2327   this.InitializeNullTextClassName();
2328  return this.nullTextClassName;
2329 },
2330 InitializeNullTextClassName: function() {
2331  var nullTextStyle = this.styles["N"];
2332  if (nullTextStyle) {
2333   var nullTextStyleClassNames = nullTextStyle.split(" ");
2334   for (var i = 0; i < nullTextStyleClassNames.length; i++)
2335    if (nullTextStyleClassNames[i].match("dxeNullText"))
2336     this.nullTextClassName = nullTextStyleClassNames[i];
2337  }
2338 }
2339});
2340var touchUIHelperUsePointerEvents = (ASPx.Browser.Edge || ASPx.Browser.EdgeWebKit) && ASPx.Browser.MSTouchUI && !!window.PointerEvent;
2341var TouchUIHelper = {
2342 isGesture: false,
2343 isMouseEventFromScrolling: false,
2344 isNativeScrollingAllowed: true,
2345 clickSensetivity: 10,
2346 documentTouchHandlers: {},
2347 documentEventAttachingAllowed: true,
2348 msTouchDraggableClassName: "dxMSTouchDraggable",
2349 touchMouseDownEventName: ASPx.Browser.WebKitTouchUI ? "touchstart" : (touchUIHelperUsePointerEvents ? "pointerdown" : "mousedown"),
2350 touchMouseUpEventName: ASPx.Browser.WebKitTouchUI ? "touchend" : (touchUIHelperUsePointerEvents ? "pointerup" : "mouseup"),
2351 touchMouseMoveEventName: ASPx.Browser.WebKitTouchUI ? "touchmove" : (touchUIHelperUsePointerEvents ? "pointermove" : "mousemove"),
2352 startPreventingTouchMove: function() {
2353  if(touchUIHelperUsePointerEvents)
2354   ASPx.Evt.AttachEventToDocument("touchmove", ASPx.Evt.PreventEvent);
2355 },
2356 stopPreventingTouchMove: function() {
2357  if(touchUIHelperUsePointerEvents)
2358   ASPx.Evt.DetachEventFromDocument("touchmove", ASPx.Evt.PreventEvent);
2359 },
2360 isTouchEvent: function(evt) {
2361  if(!evt) return false;
2362  return ASPx.Browser.WebKitTouchUI && ASPx.IsExists(evt.changedTouches); 
2363 },
2364 isTouchEventName: function(eventName) {
2365  return ASPx.Browser.WebKitTouchUI && (eventName.indexOf("touch") > -1 || eventName.indexOf("gesture") > -1);
2366 },
2367 getEventX: function(evt) {
2368  var touchPoint = null;
2369  if(evt.changedTouches.length > 0)
2370   touchPoint = evt.changedTouches;
2371  else if(evt.targetTouches.length > 0)
2372   touchPoint = evt.targetTouches;
2373  return touchPoint ? touchPoint[0].pageX : 0;
2374 },
2375 getEventY: function(evt) { 
2376  var touchPoint = null;
2377  if(evt.changedTouches.length > 0)
2378   touchPoint = evt.changedTouches;
2379  else if(evt.targetTouches.length > 0)
2380   touchPoint = evt.targetTouches;
2381  return touchPoint ? touchPoint[0].pageY : 0;
2382 },
2383 getWebkitMajorVersion: function(){
2384  if(!this.webkitMajorVersion){
2385   var regExp = new RegExp("applewebkit/(\\d+)", "i");
2386   var matches = regExp.exec(ASPx.Browser.UserAgent);
2387   if(matches && matches.index >= 1)
2388    this.webkitMajorVersion = matches[1];
2389  }
2390  return this.webkitMajorVersion;
2391 },
2392 getIsLandscapeOrientation: function(){
2393  if(ASPx.Browser.MacOSMobilePlatform || ASPx.Browser.AndroidMobilePlatform)
2394   return Math.abs(window.orientation) == 90;
2395  return ASPx.GetDocumentClientWidth() > ASPx.GetDocumentClientHeight();
2396 },
2397 nativeScrollingSupported: function() {
2398  var allowedSafariVersion = ASPx.Browser.Version >= 5.1 && ASPx.Browser.Version < 8; 
2399  var webkitMajorVersion = this.getWebkitMajorVersion();
2400  var allowedWebKitVersion = webkitMajorVersion > 533 && webkitMajorVersion < 600;
2401  return (ASPx.Browser.MacOSMobilePlatform && (allowedSafariVersion || allowedWebKitVersion))
2402   || (ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.PlaformMajorVersion >= 3) || (ASPx.Browser.MSTouchUI);
2403 },
2404 makeScrollableIfRequired: function(element, options) {
2405  if(ASPx.Browser.WebKitTouchUI && element) {
2406   var overflow = ASPx.GetCurrentStyle(element).overflow;
2407   if(element.tagName == "DIV" &&  overflow != "hidden" && overflow != "visible" ){
2408    return this.MakeScrollable(element);
2409   }
2410  }
2411 },
2412 preventScrollOnEvent: function(evt){
2413 },
2414 handleFastTapIfRequired: function(evt, action, preventCommonClickEvents) {
2415  if(ASPx.Browser.WebKitTouchUI && evt.type == 'touchstart' && action) {
2416   this.FastTapHelper.HandleFastTap(evt, action, preventCommonClickEvents);
2417   return true;
2418  }
2419  return false;
2420 },
2421 ensureDocumentSizesCorrect: function (){
2422  return (document.documentElement.clientWidth - document.documentElement.clientHeight) / (screen.width - screen.height) > 0;
2423 },
2424 ensureOrientationChanged: function(onOrientationChangedFunction){
2425  if(ASPxClientUtils.iOSPlatform || this.ensureDocumentSizesCorrect())
2426   onOrientationChangedFunction();
2427  else {
2428   window.setTimeout(function(){
2429    this.ensureOrientationChanged(onOrientationChangedFunction);
2430   }.aspxBind(this), 100);
2431  }
2432 },
2433 onEventAttachingToDocument: function(eventName, func){
2434  if(ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
2435   if(!this.documentTouchHandlers[eventName])
2436    this.documentTouchHandlers[eventName] = [];
2437   this.documentTouchHandlers[eventName].push(func);
2438   return this.documentEventAttachingAllowed;
2439  }
2440  return true;
2441 },
2442 onEventDettachedFromDocument: function(eventName, func){
2443  if(ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
2444   var handlers = this.documentTouchHandlers[eventName];
2445   if(handlers)
2446    ASPx.Data.ArrayRemove(handlers, func);
2447  }
2448 },
2449 processDocumentTouchEventHandlers: function(proc) {
2450  var touchEventNames = ["touchstart", "touchend", "touchmove", "gesturestart", "gestureend"];
2451  for(var i = 0; i < touchEventNames.length; i++) {
2452   var eventName = touchEventNames[i];
2453   var handlers = this.documentTouchHandlers[eventName];
2454   if(handlers) {
2455    for(var j = 0; j < handlers.length; j++) {
2456     proc(eventName,handlers[j]);
2457    }
2458   }
2459  }
2460 },
2461 removeDocumentTouchEventHandlers: function() {
2462  if(ASPx.Browser.MacOSMobilePlatform) {
2463   this.documentEventAttachingAllowed = false;
2464   this.processDocumentTouchEventHandlers(ASPx.Evt.DetachEventFromDocumentCore);
2465  }
2466 },
2467 restoreDocumentTouchEventHandlers: function () {
2468  if(ASPx.Browser.MacOSMobilePlatform) {
2469   this.documentEventAttachingAllowed = true;
2470   this.processDocumentTouchEventHandlers(ASPx.Evt.AttachEventToDocumentCore);
2471  }
2472 },
2473 IsNativeScrolling: function() {
2474  return TouchUIHelper.nativeScrollingSupported() && TouchUIHelper.isNativeScrollingAllowed;
2475 },
2476 pointerEnabled: !!(window.PointerEvent || window.MSPointerEvent),
2477 pointerDownEventName: window.PointerEvent ? "pointerdown" : "MSPointerDown",
2478 pointerUpEventName: window.PointerEvent ? "pointerup" : "MSPointerUp",
2479 pointerCancelEventName: window.PointerEvent ? "pointercancel" : "MSPointerCancel",
2480 pointerMoveEventName: window.PointerEvent ? "pointermove" : "MSPointerMove",
2481 pointerOverEventName: window.PointerEvent ? "pointerover" : "MSPointerOver",
2482 pointerOutEventName: window.PointerEvent ? "pointerout" : "MSPointerOut",
2483 pointerType: {
2484  Touch: "touch",
2485  Pen: "pen",
2486  Mouse: "mouse"
2487 },
2488 msGestureEnabled: !!(window.PointerEvent || window.MSPointerEvent) && typeof(MSGesture) != "undefined",
2489 msTouchCreateGesturesWrapper: function(element, onTap){
2490  if(!TouchUIHelper.msGestureEnabled) 
2491   return;
2492  var gesture = new MSGesture();
2493  gesture.target = element;
2494  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerDownEventName, function(evt){
2495   gesture.addPointer(evt.pointerId);
2496  });
2497  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerUpEventName, function(evt){
2498   gesture.stop();
2499  });
2500  if(onTap)
2501   ASPx.Evt.AttachEventToElement(element, "MSGestureTap", onTap);
2502  return gesture;
2503 },
2504 useLongTapHelper: function () {
2505  return ASPx.Browser.Safari && ASPx.Browser.TouchUI;
2506 },
2507 attachLongTapHandler: function(element, handler, onlyBubbling) {
2508  var timerID = -1;
2509  var timeout = 1000;
2510  var event = null;
2511  var preventClickEvent = false;
2512  var startX = -1;
2513  var startY = -1;
2514  var pixelLimit = 5;
2515  function onTouchMouseDown(evt) {
2516   abortWating();
2517   event = evt;
2518   startX = evt.pageX;
2519   startY = evt.pageY;
2520   preventClickEvent = false;
2521   timerID = window.setTimeout(onTimeout, timeout);
2522  }
2523  function onTouchMouseMove(evt) {
2524   if (!isUnderTouch())
2525    return;
2526   var shiftX = Math.abs(startX - evt.pageX),
2527    shiftY = Math.abs(startY - evt.pageY),
2528    maxShift = Math.max(shiftX, shiftY);
2529   if (maxShift > pixelLimit)
2530    abortWating();
2531  }
2532  function onTouchMouseUp(evt) {
2533   abortWating();
2534   if (preventClickEvent) {
2535    ASPx.Evt.PreventEventAndBubble(evt);
2536    preventClickEvent = false;
2537   }
2538  }
2539  function onTimeout() {
2540   handler(event);
2541   preventClickEvent = true;
2542   abortWatingInternal();
2543  }
2544  function isUnderTouch() {
2545   return timerID !== -1;
2546  }
2547  function abortWating() {
2548   if (isUnderTouch()) {
2549    window.clearTimeout(timerID);
2550    abortWatingInternal();
2551   }
2552  }
2553  function abortWatingInternal() {
2554   timerID = -1;
2555   event = null;
2556  }
2557  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.touchMouseDownEventName, onTouchMouseDown, onlyBubbling);
2558  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.touchMouseMoveEventName, onTouchMouseMove, onlyBubbling);
2559  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.touchMouseUpEventName, onTouchMouseUp, onlyBubbling);
2560  element.style["-webkit-user-select"] = "none";
2561  return function () {
2562   ASPx.Evt.DetachEventFromElement(element, TouchUIHelper.touchMouseDownEventName, onTouchMouseDown);
2563   ASPx.Evt.DetachEventFromElement(element, TouchUIHelper.touchMouseMoveEventName, onTouchMouseMove);
2564   ASPx.Evt.DetachEventFromElement(element, TouchUIHelper.touchMouseUpEventName, onTouchMouseUp);
2565   element.style["-webkit-user-select"] = "";
2566  };
2567 }
2568};
2569var CacheHelper = {};
2570CacheHelper.GetCachedValueCore = function(obj, key, func, cacheObj, fillValueMethod) {
2571 if(!cacheObj)
2572  cacheObj = obj;
2573 if(!cacheObj.cache)
2574  cacheObj.cache = {};
2575 if(!key) 
2576  key = "default";
2577 fillValueMethod(obj, key, func, cacheObj);
2578 return cacheObj.cache[key];
2579};
2580CacheHelper.GetCachedValue = function(obj, key, func, cacheObj) {
2581 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
2582  function(obj, key, func, cacheObj) {
2583   if(!ASPx.IsExists(cacheObj.cache[key]))
2584    cacheObj.cache[key] = func.apply(obj, []);
2585  });
2586};
2587CacheHelper.GetCachedElement = function(obj, key, func, cacheObj) {
2588 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
2589  function(obj, key, func, cacheObj) {
2590   if(!ASPx.IsValidElement(cacheObj.cache[key]))
2591    cacheObj.cache[key] = func.apply(obj, []);
2592  });
2593};
2594CacheHelper.GetCachedElements = function(obj, key, func, cacheObj) {
2595 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
2596  function(obj, key, func, cacheObj) {
2597   if(!ASPx.IsValidElements(cacheObj.cache[key])){
2598    var elements = func.apply(obj, []);
2599    if(!Ident.IsArray(elements))
2600     elements = [elements];
2601    cacheObj.cache[key] = elements;
2602   }
2603  });
2604};
2605CacheHelper.GetCachedElementById = function(obj, id, cacheObj) {
2606 return CacheHelper.GetCachedElement(obj, id, function() { return ASPx.GetElementById(id); }, cacheObj);
2607};
2608CacheHelper.GetCachedChildById = function(obj, parent, id, cacheObj) {
2609 return CacheHelper.GetCachedElement(obj, id, function() { return ASPx.GetChildById(parent, id); }, cacheObj);
2610};
2611CacheHelper.DropCachedValue = function(cacheObj, key) {
2612 cacheObj.cache[key] = null;
2613};  
2614CacheHelper.DropCache = function(cacheObj) {
2615 cacheObj.cache = null;
2616};  
2617var DomObserver = ASPx.CreateClass(null, {
2618 constructor: function() {
2619  this.items = { };
2620 },
2621 subscribe: function(elementID, callbackFunc) {
2622  var item = this.items[elementID];
2623  if(item)
2624   this.unsubscribe(elementID);
2625  item = {
2626   elementID: elementID,
2627   callbackFunc: callbackFunc,
2628   pauseCount: 0
2629  };
2630  this.prepareItem(item);
2631  this.items[elementID] = item;
2632 },
2633 prepareItem: function(item) {
2634 },
2635 unsubscribe: function(elementID) {
2636  this.items[elementID] = null;
2637 },
2638 getItemElement: function(item) {
2639  var element = this.getElementById(item.elementID);
2640  if(element)
2641   return element;
2642  this.unsubscribe(item.elementID);
2643  return null;
2644 },
2645 getElementById: function(elementID) {
2646  var element = document.getElementById(elementID);
2647  return element && ASPx.IsValidElement(element) ? element : null;
2648 },
2649 pause: function(element, includeSubtree) {
2650  this.changeItemsState(element, includeSubtree, true);
2651 },
2652 resume: function(element, includeSubtree) {
2653  this.changeItemsState(element, includeSubtree, false);
2654 },
2655 forEachItem: function(processFunc, context) {
2656  context = context || this;
2657  for(var itemName in this.items) {
2658   if(!this.items.hasOwnProperty(itemName))
2659    continue;
2660   var item = this.items[itemName];
2661   if(item) {
2662    var needBreak = processFunc.call(context, item);
2663    if(needBreak)
2664     return;
2665   }
2666  }
2667 },
2668 changeItemsState: function(element, includeSubtree, pause) {
2669  this.forEachItem(function(item) {
2670   if(!element)
2671    this.changeItemState(item, pause);
2672   else {
2673    var itemElement = this.getItemElement(item);
2674    if(itemElement && (element == itemElement || (includeSubtree && ASPx.GetIsParent(element, itemElement)))) {
2675     this.changeItemState(item, pause);
2676     if(!includeSubtree)
2677      return true;
2678    }
2679   }
2680  }.aspxBind(this));
2681 },
2682 changeItemState: function(item, pause) {
2683  if(pause)
2684   this.pauseItem(item);
2685  else
2686   this.resumeItem(item);
2687 },
2688 pauseItem: function(item) {
2689  item.paused = true;
2690  item.pauseCount++;
2691 },
2692 resumeItem: function(item) {
2693  if(item.pauseCount > 0) {
2694   if(item.pauseCount == 1)
2695    item.paused = false;
2696   item.pauseCount--;
2697  }
2698 }
2699});
2700DomObserver.IsMutationObserverAvailable = function() {
2701 return !!window.MutationObserver;
2702};
2703var TimerObserver = ASPx.CreateClass(DomObserver, {
2704 constructor: function() {
2705  this.constructor.prototype.constructor.call(this);
2706  this.timerID = -1;
2707  this.observationTimeout = 300;
2708 },
2709 subscribe: function(elementID, callbackFunc) {
2710  DomObserver.prototype.subscribe.call(this, elementID, callbackFunc);
2711  if(!this.isActivated())
2712   this.startObserving();
2713 },
2714 isActivated: function() {
2715  return this.timerID !== -1;
2716 },
2717 startObserving: function() {
2718  if(this.isActivated())
2719   window.clearTimeout(this.timerID);
2720  this.timerID = window.setTimeout(this.onTimeout, this.observationTimeout);
2721 },
2722 onTimeout: function() {
2723  var observer = _aspxGetDomObserver();
2724  observer.doObserve();
2725  observer.startObserving();
2726 },
2727 doObserve: function() {
2728  if(!ASPx.documentLoaded) return;
2729  this.forEachItem(function(item) {
2730   if(!item.paused)
2731    this.doObserveForItem(item);
2732  }.aspxBind(this));
2733 },
2734 doObserveForItem: function(item) {
2735  var element = this.getItemElement(item);
2736  if(element)
2737   item.callbackFunc.call(this, element);
2738 }
2739});
2740var MutationObserver = ASPx.CreateClass(DomObserver, {
2741 constructor: function() {
2742  this.constructor.prototype.constructor.call(this);
2743  this.callbackTimeout = 10;
2744 },
2745 prepareItem: function(item) {
2746  item.callbackTimerID = -1;
2747  var target = this.getElementById(item.elementID);
2748  if(!target)
2749   return;
2750  var observerCallbackFunc = function() {
2751   if(item.callbackTimerID === -1) {
2752    var timeoutHander = function() {
2753     item.callbackTimerID = -1;
2754     item.callbackFunc.call(this, target);
2755    }.aspxBind(this);
2756    item.callbackTimerID = window.setTimeout(timeoutHander, this.callbackTimeout);
2757   }
2758  }.aspxBind(this);
2759  var observer = new window.MutationObserver(observerCallbackFunc);
2760  var config = { attributes: true, childList: true, characterData: true, subtree: true };
2761  observer.observe(target, config);
2762  item.observer = observer;
2763  item.config = config;
2764 },
2765 unsubscribe: function(elementID) {
2766  var item = this.items[elementID];
2767  if(item) {
2768   item.observer.disconnect();
2769   item.observer = null;
2770  }
2771  DomObserver.prototype.unsubscribe.call(this, elementID);
2772 },
2773 pauseItem: function(item) {
2774  DomObserver.prototype.pauseItem.call(this, item);
2775  item.observer.disconnect();
2776 },
2777 resumeItem: function(item) {
2778  DomObserver.prototype.resumeItem.call(this, item);
2779  if(!item.paused) {
2780   var target = this.getItemElement(item);
2781   if(target)
2782    item.observer.observe(target, item.config);
2783  }
2784 }
2785});
2786var domObserver = null;
2787function _aspxGetDomObserver() {
2788 if(domObserver == null)
2789  domObserver = DomObserver.IsMutationObserverAvailable() ? new MutationObserver() : new TimerObserver();
2790 return domObserver;
2791}
2792var ControlUpdateWatcher = ASPx.CreateClass(null, {
2793 constructor: function() {
2794  this.helpers = { };
2795  this.clearLockerTimerID = -1;
2796  this.clearLockerTimerDelay = 15;
2797  this.postProcessing = false;
2798  this.init();
2799 },
2800 init: function() {
2801  var postHandler = aspxGetPostHandler();
2802  postHandler.Post.AddHandler(this.OnPost, this);
2803 },
2804 Add: function(helper) {
2805  this.helpers[helper.GetName()] = helper;
2806 },
2807 CanSendCallback: function(dxCallbackOwner, arg) {
2808  this.LockConfirmOnBeforeWindowUnload();
2809  var modifiedHelpers = this.FilterModifiedHelpersByDXCallbackOwner(this.GetModifiedHelpers(), dxCallbackOwner, arg);
2810  if(modifiedHelpers.length === 0) return true;
2811  var modifiedHelpersInfo = this.GetToConfirmAndToResetLists(modifiedHelpers, dxCallbackOwner.name);
2812  if(!modifiedHelpersInfo) return true;
2813  if(modifiedHelpersInfo.toConfirm.length === 0) {
2814   this.ResetClientChanges(modifiedHelpersInfo.toReset);
2815   return true;
2816  }
2817  var helper = modifiedHelpersInfo.toConfirm[0];
2818  if(!confirm(helper.GetConfirmUpdateText()))
2819   return false;
2820  this.ResetClientChanges(modifiedHelpersInfo.toReset);
2821  return true;
2822 },
2823 OnPost: function(s, e) {
2824  if(this.isDxCallback(e))
2825   return;
2826  this.postProcessing = true;
2827  this.LockConfirmOnBeforeWindowUnload();
2828  var modifiedHelpersInfo = this.GetModifedHelpersInfo(e);
2829  if(!modifiedHelpersInfo)
2830   return;
2831  if(modifiedHelpersInfo.toConfirm.length === 0) {
2832   this.ResetClientChanges(modifiedHelpersInfo.toReset);
2833   return;
2834  }
2835  var helper = modifiedHelpersInfo.toConfirm[0];
2836  if(!confirm(helper.GetConfirmUpdateText())) {
2837   e.cancel = true;
2838   this.finishPostProcessing();
2839  }
2840  if(!e.cancel)
2841   this.ResetClientChanges(modifiedHelpersInfo.toReset);
2842 },
2843 isDxCallback: function(e) {
2844  return e.isDXCallback || this.isInternalUploadControlCallback();
2845 },
2846 isInternalUploadControlCallback: function() {
2847  var isInCallback = false;
2848  for(var key in this.helpers) {
2849   if(this.helpers.hasOwnProperty(key)) {
2850    var helper = this.helpers[key];
2851    isInCallback = isInCallback || helper.isInUploadCallback();
2852   }
2853  }
2854  return isInCallback;
2855 },
2856 finishPostProcessing: function() {
2857  this.postProcessing = false;
2858 },
2859 GetModifedHelpersInfo: function(e) {
2860  var modifiedHelpers = this.FilterModifiedHelpers(this.GetModifiedHelpers(), e);
2861  if(modifiedHelpers.length === 0) return;
2862  return this.GetToConfirmAndToResetLists(modifiedHelpers, e && e.ownerID);
2863 },
2864 GetToConfirmAndToResetLists: function(modifiedHelpers, ownerID) {
2865  var resetList = [ ];
2866  var confirmList = [ ];
2867  for(var i = 0; i < modifiedHelpers.length; i++) {
2868   var helper = modifiedHelpers[i];
2869   if(!helper.GetConfirmUpdateText()) { 
2870    resetList.push(helper);
2871    continue;
2872   }
2873   if(helper.CanShowConfirm(ownerID)) { 
2874    resetList.push(helper);
2875    confirmList.push(helper);
2876   }
2877  }
2878  return { toConfirm: confirmList, toReset: resetList };
2879 },
2880 FilterModifiedHelpers: function(modifiedHelpers, e) {
2881  if(modifiedHelpers.length === 0)
2882   return [ ];
2883  if(this.RequireProcessUpdatePanelCallback(e))
2884   return this.FilterModifiedHelpersByUpdatePanels(modifiedHelpers);
2885  if(this.postProcessing)
2886   return this.FilterModifiedHelpersByPostback(modifiedHelpers);
2887  return modifiedHelpers;
2888 },
2889 FilterModifiedHelpersByDXCallbackOwner: function(modifiedHelpers, dxCallbackOwner, arg) {
2890  var result = [ ];
2891  for(var i = 0; i < modifiedHelpers.length; i++) {
2892   var helper = modifiedHelpers[i];
2893   if(helper.NeedConfirmOnCallback(dxCallbackOwner, arg))
2894    result.push(helper);
2895  }
2896  return result;
2897 },
2898 FilterModifiedHelpersByUpdatePanels: function(modifiedHelpers) {
2899  var result = [ ];
2900  var updatePanels = this.GetUpdatePanelsWaitedForUpdate();
2901  for(var i = 0; i < updatePanels.length; i++) {
2902   var panelID = updatePanels[i].replace(/\$/g, "_");
2903   var panel = ASPx.GetElementById(panelID);
2904   if(!panel) continue;
2905   for(var j = 0; j < modifiedHelpers.length; j++) {
2906    var helper = modifiedHelpers[j];
2907    if(ASPx.GetIsParent(panel, helper.GetControlMainElement()))
2908     result.push(helper);
2909   }
2910  }
2911  return result;
2912 },
2913 FilterModifiedHelpersByPostback: function(modifiedHelpers) {
2914  var result = [ ];
2915  for(var i = 0; i < modifiedHelpers.length; i++) {
2916   var helper = modifiedHelpers[i];
2917   if(helper.NeedConfirmOnPostback())
2918    result.push(helper);
2919  }
2920  return result;
2921 },
2922 RequireProcessUpdatePanelCallback: function(e) {
2923  var rManager = this.GetMSRequestManager();
2924  if(rManager && e && e.isMSAjaxCallback)
2925   return rManager._postBackSettings.async;
2926  return false;
2927 },
2928 GetUpdatePanelsWaitedForUpdate: function() {
2929  var rManager = this.GetMSRequestManager();
2930  if(!rManager) return [ ];
2931  var panelUniqueIDs = rManager._postBackSettings.panelsToUpdate || [ ];
2932  var panelClientIDs = [ ];
2933  for(var i = 0; i < panelUniqueIDs.length; i++) {
2934   var index = ASPx.Data.ArrayIndexOf(rManager._updatePanelIDs, panelUniqueIDs[i]);
2935   if(index >= 0)
2936    panelClientIDs.push(rManager._updatePanelClientIDs[index]);
2937  }
2938  return panelClientIDs;
2939 },
2940 GetMSRequestManager: function() {
2941  return ASPx.GetMSAjaxRequestManager();
2942 },
2943 GetModifiedHelpers: function() {
2944  var result = [ ];
2945  for(var key in this.helpers) { 
2946   if(this.helpers.hasOwnProperty(key)) {
2947    var helper = this.helpers[key];
2948    if(helper.HasChanges())
2949     result.push(helper);
2950   }
2951  }
2952  return result;
2953 },
2954 ResetClientChanges: function(modifiedHelpers) {
2955  for(var i = 0; i < modifiedHelpers.length; i++)
2956   modifiedHelpers[i].ResetClientChanges();
2957 },
2958 GetConfirmUpdateMessage: function() {
2959  if(this.confirmOnWindowUnloadLocked) return;
2960  var modifiedHelpersInfo = this.GetModifedHelpersInfo();
2961  if(!modifiedHelpersInfo || modifiedHelpersInfo.toConfirm.length === 0) 
2962   return;
2963  var helper = modifiedHelpersInfo.toConfirm[0];
2964  return helper.GetConfirmUpdateText();
2965 },
2966 LockConfirmOnBeforeWindowUnload: function() {
2967  this.confirmOnWindowUnloadLocked = true;
2968  this.clearLockerTimerID = ASPx.Timer.ClearTimer(this.clearLockerTimerID);
2969  this.clearLockerTimerID = window.setTimeout(function() {
2970   this.confirmOnWindowUnloadLocked = false;
2971  }.aspxBind(this), this.clearLockerTimerDelay);
2972 },
2973 OnWindowBeforeUnload: function(e) {
2974  var confirmMessage = this.GetConfirmUpdateMessage();
2975  if(confirmMessage)
2976   e.returnValue = confirmMessage;
2977  this.finishPostProcessing();
2978  return confirmMessage;
2979 },
2980 OnWindowUnload: function(e) {
2981  if(this.confirmOnWindowUnloadLocked) return;
2982  var modifiedHelpersInfo = this.GetModifedHelpersInfo();
2983  if(!modifiedHelpersInfo) return;
2984  this.ResetClientChanges(modifiedHelpersInfo.toReset);
2985 },
2986 OnMouseDown: function(e) {
2987 },
2988 OnFocusIn: function(e) {
2989 },
2990 PreventBeforeUnloadOnLinkClick: function(e) {
2991  if(ASPx.GetObjectKeys(this.helpers).length == 0)
2992   return;
2993  var link = ASPx.GetParentByTagName(ASPx.Evt.GetEventSource(e), "A");
2994  if(!link || link.dxgvLinkClickHanlderAssigned)
2995   return;
2996  var url = ASPx.Attr.GetAttribute(link, "href");
2997  if(!url || url.indexOf("javascript:") < 0)
2998   return;
2999  ASPx.Evt.AttachEventToElement(link, "click", function(ev) { return ASPx.Evt.PreventEvent(ev); });
3000  link.dxgvLinkClickHanlderAssigned = true;
3001 }
3002});
3003ControlUpdateWatcher.Instance = null;
3004ControlUpdateWatcher.getInstance = function () {
3005 if (!ControlUpdateWatcher.Instance) {
3006  ControlUpdateWatcher.Instance = new ControlUpdateWatcher();
3007  ASPx.Evt.AttachEventToElement(window, "beforeunload", function(e) {
3008   return ControlUpdateWatcher.Instance.OnWindowBeforeUnload(e);
3009  });
3010  ASPx.Evt.AttachEventToElement(window, "unload", function(e) {
3011   ControlUpdateWatcher.Instance.OnWindowUnload(e);
3012  });
3013  ASPx.Evt.AttachEventToDocument("mousedown", function(e) {
3014   ControlUpdateWatcher.Instance.OnMouseDown(e);
3015  });
3016  ASPx.Evt.AttachEventToDocument("focusin", function(e) {
3017   ControlUpdateWatcher.Instance.OnFocusIn(e);
3018  });
3019 }
3020 return ControlUpdateWatcher.Instance;
3021};
3022var UpdateWatcherHelper = ASPx.CreateClass(null, {
3023 constructor: function(owner) {
3024  this.owner = owner;
3025  this.ownerWatcher = ControlUpdateWatcher.getInstance();
3026  this.ownerWatcher.Add(this);
3027 },
3028 GetName: function() {
3029  return this.owner.name;
3030 },
3031 GetControlMainElement: function() {
3032  return this.owner.GetMainElement();
3033 },
3034 GetControlParentForm: function(){
3035  return ASPx.GetParentByTagName(this.GetControlMainElement(), "FORM");
3036 },
3037 CanShowConfirm: function(requestOwnerID) {
3038  return true;
3039 },
3040 HasChanges: function() {
3041  return false;
3042 },
3043 GetConfirmUpdateText: function() {
3044  return "";
3045 },
3046 NeedConfirmOnCallback: function(dxCallbackOwner) {
3047  return true;
3048 },
3049 NeedConfirmOnPostback: function() {
3050  if(ASPx.IsUploadSubmitRequest)
3051   return !ASPx.IsUploadSubmitRequest(this.GetControlParentForm(
3051));
3052  return true;
3053 },
3054 ResetClientChanges: function() {
3055 },
3056 ConfirmOnCustomControlEvent: function() {
3057  var confirmMessage = this.GetConfirmUpdateText();
3058  if(confirmMessage)
3059   return confirm(confirmMessage);
3060  return false;
3061 },
3062 isInUploadCallback: function() {
3063  return false;
3064 }
3065});
3066var ControlTabIndexManager = ASPx.CreateClass(null, {
3067 constructor: function() {
3068  this.elementsWithChangedTabIndex = {};
3069 },
3070 getChangedElementsForControlId: function(id) {
3071  if(!this.elementsWithChangedTabIndex[id])
3072   this.elementsWithChangedTabIndex[id] = [];
3073  return this.elementsWithChangedTabIndex[id];
3074 },
3075 isElementWithChangedIndex: function(element) {
3076  for(var key in this.elementsWithChangedTabIndex)
3077   if(this.elementsWithChangedTabIndex.hasOwnProperty(key))
3078    if(this.elementsWithChangedTabIndex[key].indexOf(element) !== -1)
3079     return true;
3080  return false;
3081 },
3082 changeTabIndexAttribute: function(element, id) {
3083  var elements = this.getChangedElementsForControlId(id);
3084  ASPx.Attr.ChangeTabIndexAttribute(element);
3085  if(elements.indexOf(element) === -1)
3086   elements.push(element);
3087 },
3088 restoreTabIndexAttribute: function(element, id) {
3089  var elements = this.getChangedElementsForControlId(id),
3090   index = elements.indexOf(element);
3091  if(index !== -1) {
3092   elements.splice(index, 1);
3093   if(!this.isElementWithChangedIndex(element))
3094    ASPx.Attr.RestoreTabIndexAttribute(element);
3095  }
3096 }
3097});
3098ControlTabIndexManager.Instance = null;
3099ControlTabIndexManager.getInstance = function() {
3100 if(!ControlTabIndexManager.Instance)
3101  ControlTabIndexManager.Instance = new ControlTabIndexManager();
3102 return ControlTabIndexManager.Instance;
3103};
3104var ControlCallbackHandlersQueue = ASPx.CreateClass(null, {
3105 constructor: function (owner) {
3106  this.owner = owner;
3107  this.handlerInfos = [];
3108 },
3109 addCallbackHandler: function(handlerInfo) {
3110  this.handlerInfos.push(handlerInfo);
3111 },
3112 executeCallbacksHandlers: function() {
3113  for(var i = 0, handlerInfo; handlerInfo = this.handlerInfos[i]; i++)
3114   handlerInfo.handler.call(this.owner, handlerInfo.result);
3115  this.handlerInfos = [];
3116 }
3117});
3118var ControlCallbackQueueHelper = ASPx.CreateClass(null, {
3119 constructor: function (owner) {
3120  this.owner = owner;
3121  this.pendingCallbacks = [];
3122  this.receivedCallbacks = [];
3123  this.attachEvents();
3124 },
3125 showLoadingElements: function () {
3126  this.owner.ShowLoadingDiv();
3127  if (this.owner.IsCallbackAnimationEnabled())
3128   this.owner.StartBeginCallbackAnimation();
3129  else
3130   this.owner.ShowLoadingElementsInternal();
3131 },
3132 attachEvents: function () {
3133  this.owner.EndCallback.AddHandler(this.onEndCallback.aspxBind(this));
3134  this.owner.CallbackError.AddHandler(this.onCallbackError.aspxBind(this));
3135 },
3136 detachEvents: function () {
3137  this.owner.EndCallback.RemoveHandler(this.onEndCallback);
3138  this.owner.CallbackError.RemoveHandler(this.onCallbackError);
3139 },
3140 onCallbackError: function (owner, result) {
3141  this.sendErrorToChildControl(result);
3142 },
3143 ignoreDuplicates: function () {
3144  return true;
3145 },
3146 hasDuplicate: function (arg) {
3147  for (var i in this.pendingCallbacks) {
3148   if (this.pendingCallbacks[i].arg == arg && this.pendingCallbacks[i].state != ASPx.callbackState.aborted)
3149    return true;
3150  }
3151  return false;
3152 },
3153 getToken: function (halperContext, callbackInfo) {
3154  return {
3155   cancel: function () {
3156    if (callbackInfo.state == ASPx.callbackState.sent) {
3157     callbackInfo.state = ASPx.callbackState.aborted;
3158     halperContext.sendNext();
3159    }
3160    if (callbackInfo.state == ASPx.callbackState.inTurn)
3161     ASPx.Data.ArrayRemove(halperContext.pendingCallbacks, callbackInfo);
3162   },
3163   callbackId: -1
3164  };
3165 },
3166 sendCallback: function (arg, handlerContext, handler, commandName, onBeforeSend) {
3167  if (this.ignoreDuplicates() && this.hasDuplicate(arg))
3168   return false;
3169  var handlerContext = handlerContext || this.owner;
3170  var callbackInfo = {
3171   arg: arg,
3172   handlerContext: handlerContext,
3173   handler: handler || handlerContext.OnCallback,
3174   state: ASPx.callbackState.inTurn,
3175   callbackId: -1,
3176   onBeforeSend: onBeforeSend
3177  };
3178  this.pendingCallbacks.push(callbackInfo);
3179  if (!this.hasActiveCallback()) {
3180   this.createCallbackByCallbackInfo(callbackInfo, commandName);
3181  }
3182  return this.getToken(this, callbackInfo);
3183 },
3184 hasActiveCallback: function () {
3185  return this.getCallbacksInfoByState(ASPx.callbackState.sent).length > 0;
3186 },
3187 sendNext: function () {
3188  var nextCallbackInfo = this.getCallbacksInfoByState(ASPx.callbackState.inTurn)[0];
3189  if (nextCallbackInfo) {
3190   this.createCallbackByCallbackInfo(nextCallbackInfo);
3191   return nextCallbackInfo.callbackId;
3192  }
3193 },
3194 createCallbackByCallbackInfo: function(callbackInfo, commandName) {
3195  if(callbackInfo.onBeforeSend)
3196   callbackInfo.onBeforeSend();
3197  callbackInfo.callbackId = this.owner.CreateCallback(callbackInfo.arg, commandName);
3198  callbackInfo.state = ASPx.callbackState.sent;
3199 },
3200 onEndCallback: function () {
3201  if (!this.owner.isErrorOnCallback && this.hasPendingCallbacks()) {
3202   var curCallbackId;
3203   var curCallbackInfo;
3204   var handlerContext;
3205   for (var i in this.receivedCallbacks) {
3206    if(this.receivedCallbacks.hasOwnProperty(i)) {
3207     curCallbackId = this.receivedCallbacks[i];
3208     curCallbackInfo = this.getCallbackInfoById(curCallbackId);
3209     if (curCallbackInfo.state != ASPx.callbackState.aborted) {
3210      handlerContext = curCallbackInfo.handlerContext;
3211      if (handlerContext.OnEndCallback)
3212       handlerContext.OnEndCallback();
3213      this.sendNext();
3214     }
3215     ASPx.Data.ArrayRemove(this.pendingCallbacks, curCallbackInfo);
3216    }
3217   }
3218   ASPx.Data.ArrayClear(this.receivedCallbacks);
3219  }
3220 },
3221 hasPendingCallbacks: function () {
3222  return this.pendingCallbacks && this.pendingCallbacks.length && this.pendingCallbacks.length > 0;
3223 },
3224 processCallback: function (result, callbackId) {
3225  this.receivedCallbacks.push(callbackId);
3226  if (this.hasPendingCallbacks()) {
3227   var callbackInfo = this.getCallbackInfoById(callbackId);
3228   if (callbackInfo.state != ASPx.callbackState.aborted)
3229    callbackInfo.handler.call(callbackInfo.handlerContext, result);
3230  }
3231 },
3232 getCallbackInfoById: function (id) {
3233  for (var i in this.pendingCallbacks) {
3234   if (this.pendingCallbacks[i].callbackId == id)
3235    return this.pendingCallbacks[i];
3236  }
3237 },
3238 getCallbacksInfoByState: function (state) {
3239  var result = [];
3240  for (var i in this.pendingCallbacks) {
3241   if (this.pendingCallbacks[i].state == state)
3242    result.push(this.pendingCallbacks[i]);
3243  }
3244  return result;
3245 },
3246 sendErrorToChildControl: function (callbackObj) {
3247  if (!this.hasPendingCallbacks())
3248   return;
3249  var callbackInfo = this.getCallbackInfoById(callbackObj.callbackId || 0);
3250  if (!callbackInfo)
3251   return;
3252  var hasChildControlHandler = (callbackInfo.handlerContext != this.owner) && callbackInfo.handlerContext.OnCallbackError;
3253  if (hasChildControlHandler)
3254   callbackInfo.handlerContext.OnCallbackError.call(callbackInfo.handlerContext, callbackObj.message, callbackObj.data);
3255 }
3256});
3257var AccessibilityHelperBase = ASPx.CreateClass(null, {
3258 constructor: function(control) {
3259  this.control = control;
3260  this.pronounceMessageTimeout = 500;
3261  this.pronounceIsStarted = false;
3262  this.timerID = -1;
3263 },
3264 PronounceMessage: function(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement) {
3265  this.timerID = ASPx.Timer.ClearTimer(this.timerID);
3266  this.pronounceIsStarted = true;
3267  this.timerID = window.setTimeout(function() {
3268   this.PronounceMessageCore(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement);
3269  }.aspxBind(this), this.getPronounceTimeout());
3270 },
3271 PronounceMessageCore: function(text) {
3272  this.processValidationState();
3273  if(this.control.IsFocused())
3274   this.control.SendMessageToAssistiveTechnology(text);
3275 },
3276 GetActiveElement: function(inputIsMainElement) {
3277  if(this.pronounceIsStarted) return null;
3278  var mainElement = inputIsMainElement ? this.control.GetInputElement() : this.getMainElement();
3279  var activeElementId = ASPx.Attr.GetAttribute(mainElement, 'aria-activedescendant');
3280  return activeElementId ? ASPx.GetElementById(activeElementId) : mainElement;
3281 },
3282 GetPronounceElement: function() { return null; },
3283 processValidationState: function() {
3284  var errorTextElement = null;
3285  if(this.control.GetErrorCell())
3286   errorTextElement = this.getAriaExplanatoryTextManager().GetErrorTextElement();
3287  var input = this.getInputElement();
3288  var invalidArg =  { "aria-invalid": !this.control.isValid ? "true" : "" };
3289  this.changeActivityAttributes(input, invalidArg);
3290  if(errorTextElement)
3291   this.getAriaExplanatoryTextManager().SetOrRemoveText([input], errorTextElement, !this.control.isValid, false, true);
3292 },
3293 getMainElement: function() {
3294  if(!ASPx.IsExistsElement(this.mainElement))
3295   this.mainElement = this.control.GetAccessibilityAssistantElement();
3296  return this.mainElement;
3297 },
3298 changeActivityAttributes: function(element, args) {
3299  if(!element)
3300   return;
3301  for(var key in args) {
3302   if(args.hasOwnProperty(key)) {
3303    var value = args[key];
3304    if(key == "innerHtml")
3305     ASPx.SetInnerHtml(element, value);
3306    else {
3307     var action = value !== "" ? ASPx.Attr.SetAttribute : ASPx.Attr.RemoveAttribute;
3308     action(element, key, value);
3309    }
3310   }
3311  }
3312 },
3313 getPronounceTimeout: function() { return this.pronounceMessageTimeout; },
3314 getInputElement: function() { return this.control.GetInputElement(); },
3315 getAriaExplanatoryTextManager: function() { return this.control.ariaExplanatoryTextManager; }
3316});
3317var AccessibilityHelper = ASPx.CreateClass(AccessibilityHelperBase, {
3318 constructor: function(control) {
3319  this.constructor.prototype.constructor.call(this, control);
3320  this.activeItem = this.getItems()[0];
3321 },
3322 PronounceMessageCore: function(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement) {
3323  if(!this.getItems())
3324   return;
3325  this.toogleItem();
3326  var mainElement = this.getMainElement();
3327  var activeItem = this.getItem(true);
3328  var inactiveItem = this.getItem();
3329  if(ASPx.Attr.GetAttribute(mainElement, "role") != "application")
3330   mainElementArgs = this.addArguments(mainElementArgs, { "aria-activedescendant" : activeItem.id });
3331  var messageAttrObj = {};
3332  var activeItemRole = ASPx.Attr.GetAttribute(activeItem, "role");
3333  var attrName = activeItemRole == "combobox" ? "aria-label" : "innerHtml";
3334  messageAttrObj[attrName] = ASPx.Str.EncodeHtml(text);
3335  activeItemArgs = this.addArguments(activeItemArgs, messageAttrObj);
3336  messageAttrObj[attrName] = "";
3337  inactiveItemArgs = this.addArguments(inactiveItemArgs, messageAttrObj);
3338  var errorTextElement = null;
3339  if(this.control.GetErrorCell()) {
3340   errorTextElement = this.getAriaExplanatoryTextManager().GetErrorTextElement();
3341   activeItemArgs = this.addArguments(activeItemArgs,   {"aria-invalid"  : !this.control.isValid ? "true" : "" });
3342   mainElementArgs = this.addArguments(mainElementArgs, { "aria-invalid" : "" });
3343   inactiveItemArgs = this.addArguments(inactiveItemArgs,  { "aria-invalid" : "" });
3344  }
3345  this.changeActivityAttributes(activeItem, activeItemArgs);
3346  if(errorTextElement) {
3347   this.getAriaExplanatoryTextManager().SetOrRemoveText([activeItem], errorTextElement, !this.control.isValid, false, true);
3348   this.getAriaExplanatoryTextManager().SetOrRemoveText([mainElement, inactiveItem], errorTextElement, false, false, false);
3349  }
3350  this.changeActivityAttributes(mainElement, mainElementArgs);
3351  if(!!ownerMainElement && ASPx.Attr.GetAttribute(ownerMainElement, "role") != "application")
3352   this.changeActivityAttributes(ownerMainElement, { "aria-activedescendant": activeItem.id });
3353  this.changeActivityAttributes(inactiveItem, inactiveItemArgs);
3354  this.pronounceIsStarted = false;
3355 },
3356 GetPronounceElement: function() {
3357  return this.getItem(true);
3358 },
3359 getItems: function() {
3360  if(!ASPx.IsExistsElement(this.items))
3361   this.items = ASPx.GetChildElementNodes(this.getMainElement());
3362  return this.items;
3363 },
3364 getItem: function(isActive) {
3365  if(isActive)
3366   return this.activeItem;
3367  var items = this.getItems();
3368  return items[0] === this.activeItem ? items[1] : items[0];
3369 },
3370 toogleItem: function() {
3371  this.activeItem = this.getItem();
3372 },
3373 addArguments: function(targetArgs, newArgs) {
3374  if(!targetArgs) targetArgs = { };
3375  for(var key in newArgs) {
3376   if(newArgs.hasOwnProperty(key) && !targetArgs.hasOwnProperty(key))
3377    targetArgs[key] = newArgs[key];
3378  }
3379  return targetArgs;
3380 }
3381});
3382var AccessibilityPronouncer = ASPx.CreateClass(null, {
3383 constructor: function() {
3384  this.pronouncerId = "dxPronouncer";
3385  this.initialized = false;
3386  this.focusableMessageElement = null;
3387  this.messageElement = null;
3388  this.pronouncers = {
3389   live: new AccessibilityLivePronouncer(this),
3390   descendant: new AccessibilityDescendantPronouncer(this)
3391  };
3392 },
3393 Pronounce: function(args, type) {
3394  this.pronouncers[type].Pronounce(args);
3395 },
3396 EnsureInitialize: function() {
3397  if(!this.initialized)
3398   this.initialize();
3399 },
3400 RemoveState: function() {
3401  for(var pronouncer in this.pronouncers)
3402   if(this.pronouncers.hasOwnProperty(pronouncer))
3403    pronouncer.RemoveState();
3404 },
3405 RestoreControlState: function(type, mainElement) {
3406  this.pronouncers[type].RestoreControlState(mainElement);
3407 },
3408 RestoreElementsState: function(type, elements) {
3409  this.pronouncers[type].RestoreElementsState(elements);
3410 },
3411 RestoreElementState: function(type, element) {
3412  this.pronouncers[type].RestoreElementState(element);
3413 },
3414 initialize: function() {
3415  this.createFocusableMessageElement();
3416  this.createMessageElement();
3417  this.prepareFocusableMessageElement();
3418  this.setAttributesForKeyboardNavigation();
3419  this.initialized = true;
3420 },
3421 createFocusableMessageElement: function() {
3422  var focusableMessageElement = document.createElement("DIV");
3423  document.body.appendChild(focusableMessageElement);
3424  this.focusableMessageElement = focusableMessageElement;   
3425 },
3426 prepareFocusableMessageElement: function() {
3427  this.focusableMessageElement.className = "dxAIFME";
3428 },
3429 setAttributesForKeyboardNavigation: function() {
3430  ASPx.Attr.Aria.SetApplicationRole(this.focusableMessageElement);
3431  ASPx.Attr.Aria.SetSilence(this.focusableMessageElement);
3432 },
3433 createMessageElement: function() {
3434  var messageElement = document.createElement("DIV");
3435  messageElement.id = this.pronouncerId;
3436  ASPx.Attr.SetAttribute(messageElement, "role", "note");
3437  this.focusableMessageElement.appendChild(messageElement);
3438  this.messageElement = messageElement;
3439 },
3440 getMessage: function(messagePartsArg) {
3441  var messageParts = messagePartsArg.filter(function(x) { return ASPx.IsExists(x); });
3442  return messageParts.join(", ");
3443 }
3444});
3445var AccessibilityPronouncerBase = ASPx.CreateClass(null, {
3446 constructor: function() {
3447  this.state = { };
3448 },
3449 Pronounce: function(args) {
3450  var messageElement = this.getMessageElement();
3451  ASPx.Attr.Aria.SetOrRemoveLabel(messageElement);
3452  ASPx.SetInnerHtml(messageElement, "");
3453  this.PronounceCore(args);
3454 },
3455 PronounceCore: function(args) { },
3456 SaveElementState: function(element) { 
3457  if(this.state[element.id])
3458   return;
3459  this.state[element.id] = {
3460   element: element,
3461   descendant: ASPx.Attr.GetAttribute(element, ASPx.Attr.Aria.descendant)
3462  };
3463 },
3464 RemoveState: function() {
3465  this.state = { };
3466 },
3467 RestoreControlState: function(mainElement) { 
3468  for(var elementInfo in this.state) {
3469   if(this.state.hasOwnProperty(elementInfo)) {
3470    var element = this.state[elementInfo].element;
3471    if(!mainElement || ASPx.GetIsParent(mainElement, element))
3472     this.RestoreElementState(element);
3473   }
3474  }
3475 },
3476 RestoreElementsState: function(elements) { 
3477  for(var i = 0; i < elements.length; i++)
3478   this.RestoreElementState(elements[i]);
3479 },
3480 RestoreElementState: function(element) {
3481  var elementState = this.state[element.id];
3482  if(!elementState)
3483   return;
3484  ASPx.Attr.Aria.SetOrRemoveDescendant(element, elementState.descendant);
3485  delete this.state[element.id];
3486 },
3487 getMessage: function(args) {
3488  return ASPx.AccessibilityPronouncer.getMessage(args.messageParts);
3489 },
3490 getMessageElement: function() {
3491  return ASPx.AccessibilityPronouncer.messageElement;
3492 },
3493 getFocusableMessageElement: function() {
3494   return ASPx.AccessibilityPronouncer.focusableMessageElement;
3495 }
3496});
3497var AccessibilityLivePronouncer = ASPx.CreateClass(AccessibilityPronouncerBase, {
3498 constructor: function() {
3499  this.constructor.prototype.constructor.call(this);
3500 },
3501 PronounceCore: function(args) {
3502  var message = this.getMessage(args);
3503  var messageElement = this.getMessageElement();
3504  ASPx.Attr.SetAttribute(this.getFocusableMessageElement(), "aria-live", "assertive");
3505  ASPx.Attr.Aria.SetAtomic(this.getFocusableMessageElement(), "true");
3506  ASPx.SetInnerHtml(messageElement, ASPx.Str.EncodeHtml(message));
3507 }
3508});
3509var AccessibilityDescendantPronouncer = ASPx.CreateClass(AccessibilityPronouncerBase, {
3510 constructor: function() {
3511  this.constructor.prototype.constructor.call(this);
3512 },
3513 PronounceCore: function(args) {
3514  var message = this.getMessage(args);
3515  var activeElement = ASPx.GetActiveElement();
3516  var messageElement = this.getMessageElement();
3517  this.SaveElementState(activeElement);
3518  ASPx.Attr.RemoveAttribute(this.getFocusableMessageElement(), "aria-live");
3519  ASPx.Attr.RemoveAttribute(this.getFocusableMessageElement(), "aria-atomic");
3520  ASPx.Attr.Aria.SetOrRemoveLabel(messageElement, message);
3521  ASPx.Attr.Aria.SetOrRemoveDescendant(activeElement, messageElement.id);
3522 }
3523});
3524ASPx.AccessibilityPronouncerType = {
3525 live: "live",
3526 descendant: "descendant"
3527};
3528ASPx.AccessibilityPronouncer = new AccessibilityPronouncer();
3529var RestoreFocusHelper = ASPx.CreateClass(null, {
3530 constructor: function() {
3531  this.excludedIDs = [ "DXCBtn" ]; 
3532  this.pronouncerType = ASPx.AccessibilityPronouncerType.live;
3533  this.callbackQueue = [];
3534  this.Initialize();
3535 },
3536 Initialize: function() {
3537  var that = this;
3538  ASPx.attachToLoad(function() {
3539   ASPxClientControl.GetControlCollection().BeginCallback.AddHandler(that.OnBeginCallback, that);
3540   ASPxClientControl.GetControlCollection().EndCallback.AddHandler(that.OnEndCallback, that);
3541  });
3542 },
3543 OnBeginCallback: function(s, e) {
3544  var control = e.control;
3545  if(!control.allowRestoreFocusOnCallbacks())
3546   return;
3547  control.accessibilityFocusTreeLine = this.getFocusTreeLine(control);
3548  var controlHasCallbackTreeLine = this.callbackQueueContainsTreeLine(control);
3549  this.pushTreeLineInfoIntoCallbackQueue(control);
3550  if(control.accessibilityFocusTreeLine && !controlHasCallbackTreeLine)
3551   control.SendMessageToAssistiveTechnology(this.getDefaultCallbackMessage());
3552 },
3553 OnEndCallback: function(s, e) {
3554  var control = e.control;
3555  if(!control.allowRestoreFocusOnCallbacks())
3556   return;
3557  var treeLineInfo = this.shiftTreeLineInfoFromCallbackQueue(control);
3558  if(treeLineInfo.queueLength == 0) {
3559   if(!control.accessibilityFocusTreeLine && treeLineInfo.treeLine)
3560    control.accessibilityFocusTreeLine = treeLineInfo.treeLine;
3561   var focusElement = this.findFocusElement(control);
3562   var focusIsManagerByPopupwindow = this.isFocusManagedByActivePopupWindow(focusElement);
3563   var focusIsManagedByControl = control.shouldPreventFocusRestoringOnCallback && control.shouldPreventFocusRestoringOnCallback();
3564   if(!focusIsManagerByPopupwindow && !focusIsManagedByControl)
3565    ASPx.AccessibilityUtils.SetFocusAccessible(focusElement);
3566   delete control.accessibilityFocusTreeLine;
3567  }
3568 },
3569 pushTreeLineInfoIntoCallbackQueue: function(control) {
3570  var controlTreeLine = control.accessibilityFocusTreeLine ? control.accessibilityFocusTreeLine.slice(0) : null;
3571  if(!this.callbackQueue[control.name])
3572   this.callbackQueue[control.name] = [];
3573  this.callbackQueue[control.name].push(controlTreeLine);
3574 },
3575 shiftTreeLineInfoFromCallbackQueue: function(control) {
3576  var treeLineInfo = { queueLength: 0, treeLine: null };
3577  var treeLines = this.callbackQueue[control.name];
3578  if(treeLines && treeLines.length > 0) {
3579   treeLineInfo.treeLine = treeLines.shift();
3580   var linesCount = treeLines.length;
3581   treeLineInfo.queueLength = linesCount;
3582   if(linesCount > 0 && !treeLines[0] && treeLineInfo.treeLine)
3583    treeLines[0] = treeLineInfo.treeLine.slice(0);
3584  }
3585  return treeLineInfo;
3586 },
3587 callbackQueueContainsTreeLine: function(control) {
3588  var treeLines = this.callbackQueue[control.name];
3589  if(!treeLines || treeLines.length == 0) 
3590   return false;
3591  if(treeLines[treeLines.length - 1])
3592   return true;
3593  return false;
3594 },
3595 getDefaultCallbackMessage: function() {
3596  return ASPx.AccessibilitySR.DefaultCallbackMessage;
3597 },
3598 isFocusManagedByActivePopupWindow: function(focusElement) {
3599  var popupControl = this.getActivePopupControl();
3600  if(!popupControl || popupControl.accessibleFocusElement)
3601   return false;
3602  this.initializePopupAccessibleFocusElement(popupControl, focusElement);
3603  return popupControl.setFocusOnCallback;
3604 },
3605 getActivePopupControl: function() {
3606  var activePopupWindow = ASPx.GetPopupControlCollection && ASPx.GetPopupControlCollection().GetCurrentActiveWindowElement();
3607  if(!activePopupWindow)
3608   return null;
3609  var popupInfo = ASPx.GetPopupControlCollection().GetPopupWindowFromID(activePopupWindow.id);
3610  return popupInfo.popupControl;
3611 },
3612 initializePopupAccessibleFocusElement: function(popupControl, focusElement) {
3613  if(popupControl.setFocusOnCallback)
3614   popupControl.accessibleFocusElement = focusElement;
3615  else {
3616   var parentControl = popupControl.GetParentControl();
3617   if(parentControl && parentControl.GetMainElement())
3618    popupControl.accessibleFocusElement = ASPx.FindFirstChildActionElement(parentControl.GetMainElement());
3619  }
3620 },
3621 getFocusTreeLine: function(control) {
3622  var element = ASPx.GetActiveElement();
3623  if(!ASPx.IsExistsElement(element))
3624   return null;
3625  var mainElement = control.GetMainElement();
3626  if(!ASPx.GetIsParent(mainElement, element)) {
3627   var treeInfo = this.findFocusedControlElement(mainElement, element);
3628   element = treeInfo.focusElement;
3629   mainElement = treeInfo.rootElement;
3630  }
3631  return this.getTreeLineCore(mainElement, element);
3632 },
3633 getTreeLineCore: function(mainElement, element) {
3634  if(!element) return null;
3635  treeLine = [ ];
3636  while(element) {
3637   treeLine.push({ 
3638    id: element.id,
3639    tagName: element.tagName,
3640    index: ASPx.Data.ArrayIndexOf(element.parentNode.childNodes, element)
3641   });
3642   if(element === mainElement || element === document.body)
3643    break;
3644   element = element.parentNode;
3645  }
3646  return treeLine;
3647 },
3648 findFocusedControlElement: function(mainElement, activeElement) {
3649  var element = null;
3650  var parentElement = mainElement;
3651  var focusedEditor = ASPx.IsExists(ASPx.GetFocusedEditor) ? ASPx.GetFocusedEditor() : null;
3652  if(focusedEditor && ASPx.GetIsParent(mainElement, focusedEditor.GetMainElement()))
3653   element = focusedEditor.GetFocusableInputElement();
3654  else {
3655   if(mainElement && activeElement) {
3656    var mainControl = ASPx.GetClientControlByElementID(mainElement.id);
3657    var parentControls = ASPx.GetParentClientControls(activeElement.id);
3658    for(var i = parentControls.length - 1; i > -1; i--) {   
3659     if(mainControl.name == parentControls[i].name) {
3660      element = activeElement;
3661      var rootIndex = i > 0 ? i - 1 : i;
3662      parentElement = parentControls[rootIndex].GetMainElement();
3663      if(!parentElement && parentControls[rootIndex].GetCurrentWindowElement)
3664       parentElement = parentControls[rootIndex].GetCurrentWindowElement();
3665      break;
3666     }
3667    }
3668   }
3669  }
3670  return { focusElement: element, rootElement: parentElement }; 
3671 },
3672 findFocusElement: function(control) {
3673  if(!control.accessibilityFocusTreeLine)
3674   return;
3675  var treeLine = control.accessibilityFocusTreeLine.slice(0);
3676  var focusElementParent = this.findFocusElementParentById(treeLine);
3677  if(!focusElementParent) 
3678   return;
3679  return this.findFocusElementFromDOMTree(treeLine, focusElementParent);
3680 },
3681 findFocusElementParentById: function(treeLine) {
3682  for(var i = 0; i < treeLine.length; i++) {
3683   var id = treeLine[i].id;
3684   if(!this.isValidId(id))
3685    continue;
3686   var element = document.getElementById(id);
3687   if(element) {
3688    treeLine.splice(i, treeLine.length - i);
3689    treeLine.reverse();
3690    return element;
3691   }
3692  }
3693  return null;
3694 },
3695 findFocusElementFromDOMTree: function(treeLine, focusElementParent) {
3696  var element = focusElementParent;
3697  for(var i = 0; i < treeLine.length; i++) {
3698   var info = treeLine[i];
3699   if(info.index >= element.childNodes.length) {
3700    element = element.childNodes.length > 0 ? element.childNodes[element.childNodes.length - 1] : null;
3701    return this.findNeighbourFocusElement(element, focusElementParent);
3702   }
3703   var child = element.childNodes[info.index];
3704   if(child.tagName !== info.tagName)
3705    return this.findNeighbourFocusElement(child, focusElementParent);
3706   element = child;
3707  }
3708  return element;
3709 },
3710 findNeighbourFocusElement: function(element, focusElementParent) {
3711  ASPx.ActionElementsCache.BeginUsage();
3712  var result = this.findNeighbourFocusElementCore(element, focusElementParent);
3713  ASPx.ActionElementsCache.EndUsage();
3714  return result;
3715 },
3716 findNeighbourFocusElementCore: function(element, focusElementParent) {
3717  if(!element || !element.parentNode) return null;
3718  var neighbours = element.parentNode.childNodes;
3719  var indices = this.calcLeftRightIndices(ASPx.Data.ArrayIndexOf(neighbours, element), neighbours.length);
3720  for(var i = 0; i < indices.length; i++) {
3721   var index = indices[i];
3722   var actionElement = ASPx.FindFirstChildActionElement(neighbours[index]);
3723   if(actionElement)
3724    return actionElement;
3725  }
3726  if(element === focusElementParent)
3727   return null;
3728  return this.findNeighbourFocusElement(element.parentNode, focusElementParent);
3729 },
3730 calcLeftRightIndices: function(startIndex, count) {
3731  var indices = [ ];
3732  var incSides = [ 0, 0 ];
3733  var index = startIndex;
3734  for(var i = 0; i < count; i++) {
3735   indices.push(index);
3736   var even = i % 2 === 0;
3737   var nextIndex = this.calcNextIndex(startIndex, count, incSides, even);
3738   if(nextIndex < 0)
3739    nextIndex = this.calcNextIndex(startIndex, count, incSides, !even);
3740   index = nextIndex;
3741  }
3742  return indices;
3743 },
3744 calcNextIndex: function(startIndex, count, incSides, even) {
3745  var sideIndex = even ? 0 : 1;
3746  var inc = incSides[sideIndex];
3747  inc += even ? -1 : 1;
3748  var nextIndex = startIndex + inc;
3749  if(nextIndex >= 0 && nextIndex < count) {
3750   incSides[sideIndex] = inc;
3751   return nextIndex;
3752  }
3753  return -1;
3754 },
3755 isValidId: function(id) {
3756  return id && !this.isExcludedId(id);
3757 },
3758 isExcludedId: function(id) {
3759  var result = false;
3760  for(var i = 0; i < this.excludedIDs.length; i++) {
3761   if(id.indexOf(this.excludedIDs[i]) > -1) {
3762    result = true;
3763    break;
3764   }
3765  }
3766  return result;
3767 }
3768});
3769var EventStorage = ASPx.CreateClass(null, {
3770 constructor: function() {
3771  this.bag = { };
3772 },
3773 Save: function(e, data, overwrite) {
3774  var key = this.getEventKey(e);
3775  if(this.bag.hasOwnProperty(key) && !overwrite)
3776   return;
3777  this.bag[key] = data;
3778  window.setTimeout(function() { delete this.bag[key]; }.aspxBind(this), 100);
3779 },
3780 Load: function(e) {
3781  var key = this.getEventKey(e);
3782  return this.bag[key];
3783 },
3784 getEventKey: function(e) {
3785  if(ASPx.IsExists(e.timeStamp))
3786   return e.timeStamp.toString();
3787  var eventSource = ASPx.Evt.GetEventSource(e);
3788  var type = e.type.toString();
3789  return eventSource ? type + "_" + eventSource.uniqueID.toString() : type;
3790 }
3791});
3792ASPx.RestoreFocusHelper = new RestoreFocusHelper();
3793EventStorage.Instance = null;
3794EventStorage.getInstance = function() {
3795 if(!EventStorage.Instance)
3796  EventStorage.Instance = new EventStorage();
3797 return EventStorage.Instance;
3798};
3799var GetGlobalObject = function(objectName) {
3800 var fields = objectName.split('.');
3801 var obj = window[fields[0]];
3802 for(var i = 1;
3802 obj && i < fields.length; i++) {
3803  obj = obj[fields[i]];
3804 }
3805 return obj;
3806};
3807var GetExternalScriptProcessor = function() {
3808 return ASPx.ExternalScriptProcessor ? ASPx.ExternalScriptProcessor.getInstance() : null;
3809};
3810var SAVED_WIDTH_ATTR = "data-dx-ripple-saved-width";
3811var RIPPLE_FIXED_ROW_ATTR = "data-dx-ripple-locked";
3812var READ_ONLY_COMBOBOX_MARKER_CSS_CLASS = "dxICBReadonlyMarker";
3813var ThemesWithRipple = ['Material'];
3814var RippleHelper = {
3815 rippleTargetClassName: "dxRippleTarget",
3816 rippleTargetExternalClassName: "dxRippleTargetExternal",
3817 rippleContainerClassName: "dxRippleContainer",
3818 rippleClassName: "dxRipple",
3819 touchRadius: -1,
3820 isMobileExternalRipple: null,
3821 zoom: 1,
3822 Init: function() {
3823  if(this.getIsRippleFunctionalityEnabled()) {
3824   setTimeout(function() {
3825    this.calcTouchRadius();
3826   }.aspxBind(this), 0);
3827  }
3828 },
3829 calcTouchRadius: function() {
3830  var testBlock = document.createElement("DIV");
3831  ASPx.SetStyles(testBlock, {
3832   height: "1in",
3833   width: "1in",
3834   left: "-100%",
3835   top: "-100%",
3836   position: "absolute"
3837  });
3838  document.body.appendChild(testBlock);
3839  this.touchRadius = (1.8 / 2.54) * Math.max(testBlock.offsetWidth, testBlock.offsetHeight);
3840  document.body.removeChild(testBlock);
3841 },
3842 isRippleFunctionalityEnabled: null,
3843 checkRippleFunctionality: function() {
3844  if(ASPx.Browser.Safari && ASPx.Browser.Version <= 5.1)
3845   return false;
3846  for(var i = 0; i < ThemesWithRipple.length; i++) {
3847   var firstRippleThemeElement = document.querySelector("[class*='_" + ThemesWithRipple[i] + "']");
3848   if(firstRippleThemeElement)
3849    return true;
3850  }  
3851  return false;
3852 },
3853 ReInit: function() {
3854  this.isRippleFunctionalityEnabled = null;
3855  this.Init();
3856 },
3857 onDocumentMouseDown: function(evt) {
3858  if(RippleHelper.getIsRippleFunctionalityEnabled())
3859   RippleHelper.processMouseDown(evt);
3860 },
3861 getIsRippleFunctionalityEnabled: function() {
3862  if(!ASPx.IsExists(this.isRippleFunctionalityEnabled))
3863   this.isRippleFunctionalityEnabled = this.checkRippleFunctionality();
3864  return this.isRippleFunctionalityEnabled;
3865 },
3866   createTargetInfo: function(target) {
3867  return { 
3868   x: ASPx.GetAbsoluteX(target),
3869   y: ASPx.GetAbsoluteY(target),
3870   width: target.offsetWidth,
3871   height: target.offsetHeight,
3872   classNames: ASPx.GetClassNameList(target),
3873   getTarget: function() { return target; },
3874   getRect: function() { return {x: this.x, y: this.y, width: this.width, height: this.height }; }
3875  };
3876 },
3877 createEventInfo: function(evt) {
3878  return { x: this.getEventX(evt), y: this.getEventY(evt) };
3879 },
3880 processMouseDown: function(evt) {
3881  var evtSource = ASPx.Evt.GetEventSource(evt);
3882  var rippleTarget = this.getRippleTargetElement(evtSource);
3883  if(this.needToProcessRipple(rippleTarget, evtSource))
3884   this.processRipple(this.createTargetInfo(rippleTarget), this.createEventInfo(evt));
3885 },
3886 getRippleTargetElement: function(evtSource) {
3887  if(this.hasRippleMarker(evtSource))
3888   return evtSource;
3889  if(evtSource.tagName && evtSource.tagName.toLowerCase() == "input" && ASPx.ElementContainsCssClass(evtSource, "dxTI")) {
3890   var elements = ASPx.GetChildElementNodesByPredicate(evtSource.parentNode.parentNode, function(element) {
3891    return this.hasRippleMarker(element);
3892   }.aspxBind(this));
3893   return elements && elements[0];
3894  }
3895  return ASPx.GetParent(evtSource, function(element) {
3896   return this.hasRippleMarker(element);
3897  }.aspxBind(this));
3898 },
3899 hasRippleMarker: function(element) {
3900  if(!ASPx.IsExistsElement(element))
3901   return false;
3902  var computedStyles = window.getComputedStyle(element, ":before");
3903  if(ASPx.IsExists(computedStyles)) {
3904   var content = computedStyles.getPropertyValue("content");
3905   if(content.indexOf(this.rippleTargetExternalClassName) > -1) {
3906    ASPx.AddClassNameToElement(element, this.rippleTargetExternalClassName);
3907    return true;
3908   }
3909   return content.indexOf(this.rippleTargetClassName) > -1;
3910  }
3911  return false;
3912 },
3913 needToProcessRipple: function(rippleTarget, evtSource) {
3914  if(!rippleTarget || !ASPx.AnimationUtils)
3915   return false;
3916  var isClearButton = ASPx.ElementContainsCssClass(rippleTarget, "dxeButton") && rippleTarget.id && rippleTarget.id.indexOf("B-100") !== -1;
3917  var isEmptyCalendarDay = ASPx.ElementContainsCssClass(rippleTarget, "dxeCalendarDay") && ASPx.Str.Trim(rippleTarget.textContent) == "";
3918  var isReadonly = ASPx.ElementContainsCssClass(rippleTarget, READ_ONLY_COMBOBOX_MARKER_CSS_CLASS);
3919  var tempFixDisable = ASPx.ElementContainsCssClass(rippleTarget, "dxSwitcher") && ASPx.Browser.MacOSMobilePlatform;
3920  var rippleIsForbidden = isReadonly || isClearButton || isEmptyCalendarDay || ASPx.GetParentByPartialClassName(rippleTarget, "Disabled") ||
3921   ASPx.ElementContainsCssClass(rippleTarget, "dxgvBatchEditCell") || ASPx.ElementContainsCssClass(rippleTarget, "dxcvEditForm") ||
3922   ASPx.GetParentByPartialClassName(evtSource, "dxcvFocusedCell") || tempFixDisable;
3923  return !rippleIsForbidden;
3924 },
3925 hasBothOverflow: function(style) {
3926  return style.overflow == "scroll" || style.overflow == "auto" || style.overflow == "hidden";
3927 },
3928 hasOverflowX: function(style) {
3929  return style.overflowX == "scroll" || style.overflowX == "auto" || style.overflowX == "hidden";
3930 },
3931 hasOverflowY: function(style) {
3932  return style.overflowY == "scroll" || style.overflowY == "auto" || style.overflowY == "hidden";
3933 },
3934 getExternalRippleContainerSize: function(targetRect) {
3935  if(ASPx.Browser.MobileUI) {
3936   var origTouchRadius = this.getOriginTouchRadius();
3937   if(origTouchRadius < targetRect.width || origTouchRadius < targetRect.height)
3938    origTouchRadius = Math.max(targetRect.width, targetRect.height);
3939   return {x: targetRect.x + (targetRect.width - origTouchRadius) / 2, y: targetRect.y + (targetRect.height - origTouchRadius) / 2, width: origTouchRadius, height: origTouchRadius };
3940  }
3941  var result = { x: 0, y: 0, width: 0, height: 0 };
3942  var diff = targetRect.width - targetRect.height;
3943  if(diff > 0) {
3944   result.x = targetRect.x;
3945   result.y = targetRect.y - diff / 2;
3946   result.width = targetRect.width;
3947   result.height = targetRect.width;
3948  } else {
3949   result.x = targetRect.x + diff / 2;
3950   result.y = targetRect.y;
3951   result.width = targetRect.height;
3952   result.height = targetRect.height;
3953  }
3954  return result;
3955 },
3956 getInternalContainerSize: function(targetInfo) {
3957  var parentWithOverflow = RippleHelper.getParentWithOverflow(targetInfo.getTarget());
3958  if(!ASPx.IsExists(parentWithOverflow))
3959   return targetInfo;
3960  var parentWithOverflowStyle = ASPx.GetCurrentStyle(parentWithOverflow);
3961  var bothOverflow = this.hasBothOverflow(parentWithOverflowStyle);
3962  var overflowX = this.hasOverflowX(parentWithOverflowStyle);
3963  var overflowY = this.hasOverflowY(parentWithOverflowStyle);
3964  var parentRect = {
3965   x: ASPx.GetAbsoluteX(parentWithOverflow),
3966   y: ASPx.GetAbsoluteY(parentWithOverflow),
3967   width: parentWithOverflow.offsetWidth,
3968   height: parentWithOverflow.offsetHeight
3969  };
3970  return this.getInternalContainerSizeCore(targetInfo, parentRect, bothOverflow, overflowX, overflowY);
3971 },
3972 getInternalContainerSizeCore: function(targetRect, parentRect, bothOverflow, overflowX, overflowY) {
3973  var result = {};
3974  ASPx.Data.MergeHashTables(result, targetRect);
3975  if(bothOverflow || overflowX) {
3976   result.x = targetRect.x < parentRect.x ? parentRect.x : targetRect.x;
3977   if(targetRect.x + targetRect.width > parentRect.x + parentRect.width)
3978    result.width = parentRect.x + parentRect.width - targetRect.x;
3979   if(parentRect.x > targetRect.x)
3980    result.width -= (parentRect.x - targetRect.x);
3981  }
3982  if(bothOverflow || overflowY) {
3983   result.y = targetRect.y < parentRect.y ? parentRect.y : targetRect.y;
3984   if(targetRect.y + targetRect.height > parentRect.y + parentRect.height)
3985    result.height = parentRect.y + parentRect.height - targetRect.y;
3986   if(parentRect.y > targetRect.y)
3987    result.height -= (parentRect.y - targetRect.y);
3988  }
3989  return result;
3990 },
3991 calculateRippleContainerSize: function(targetInfo, isExternalRipple) {
3992  return isExternalRipple ? this.getExternalRippleContainerSize(targetInfo) : this.getInternalContainerSize(targetInfo);
3993 },
3994 getParentWithOverflow: function(rippleTarget) {
3995  var result = ASPx.GetParent(rippleTarget, function(element) {
3996   var elementStyle = ASPx.GetCurrentStyle(element);
3997   return this.hasBothOverflow(elementStyle) || this.hasOverflowX(elementStyle) || this.hasOverflowY(elementStyle);
3998  }.aspxBind(this));
3999  return result;
4000 },
4001 getDuration: function(targetInfo) {
4002  return this.IsExternalRipple(targetInfo) || ASPx.Browser.MobileUI ? 650 : 450;
4003 },
4004 createRippleTransition: function(container, rippleElement, radius, targetInfo) {
4005  var rippleSize = 2 * radius;
4006  var transitionProperties = {
4007   width: { from: 0, to: rippleSize, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "width", unit: "px" },
4008   height: { from: 0, to: rippleSize, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "height", unit: "px" },
4009   marginLeft: { from: 0, to: -rippleSize / 2, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "marginLeft", unit: "px" },
4010   marginTop: { from: 0, to: -rippleSize / 2, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "marginTop", unit: "px" },
4011   opacity: { from: 1, to: 0.05, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "o
4011pacity", unit: "%" }
4012  };
4013  var rippleTransition = ASPx.AnimationUtils.createMultipleAnimationTransition(rippleElement, {
4014   transition: ASPx.AnimationConstants.Transitions.RIPPLE,
4015   duration: this.getDuration(targetInfo),
4016   needForceTransitionEndByTimerFlag: true, 
4017   onComplete: function() {
4018    this.RemoveRippleContainer(container.parentElement);
4019   }.bind(this)
4020  });
4021  rippleTransition.Start(transitionProperties);
4022 },
4023 needForceTransitionEndByTimer: function() { return true; }, 
4024 calculateRadius: function(isExternalRipple, posX, posY, containerRect) {
4025  var radius = -1;
4026  if(isExternalRipple) {
4027   if(ASPx.Browser.MobileUI)
4028    radius = this.getOriginTouchRadius() / 2;
4029   else
4030    radius = Math.max(containerRect.height, containerRect.width);
4031  } else {
4032   var width1 = posX - containerRect.x;
4033   var width2 = containerRect.width - width1;
4034   var height1 = posY - containerRect.y;
4035   var height2 = containerRect.height - height1;
4036   var rippleWidth = Math.max(width1, width2);
4037   var rippleHeight = Math.max(height1, height2);
4038   radius = Math.sqrt(Math.pow(rippleHeight, 2) + Math.pow(rippleWidth, 2));
4039  }
4040  return radius;
4041 },
4042 createRippleElement: function(container, rippleCenter) {
4043  var rippleElement = document.createElement("DIV");
4044  rippleElement.className = this.rippleClassName;
4045  container.appendChild(rippleElement);
4046  ASPxClientUtils.SetAbsoluteX(rippleElement, rippleCenter.x);
4047  ASPxClientUtils.SetAbsoluteY(rippleElement, rippleCenter.y);
4048  return rippleElement;
4049 },
4050 processRipple: function(targetInfo, eventInfo) {
4051  this.initRippleProcess();
4052  var isExternalRipple = this.IsExternalRipple(targetInfo);
4053  var rippleCenter = this.getRippleCenter(targetInfo.getRect(), eventInfo, isExternalRipple);
4054  var container = this.createRippleContainer(targetInfo, isExternalRipple);
4055  var rippleElement = this.createRippleElement(container, rippleCenter);
4056  var radius = this.calculateRadius(isExternalRipple, rippleCenter.x, rippleCenter.y, this.getElementRect(container));
4057  this.createRippleTransition(container, rippleElement, radius, targetInfo);
4058 },
4059 initRippleProcess: function() {
4060  this.isMobileExternalRipple = null;
4061  this.zoom = screen.width / window.innerWidth;
4062 },
4063 getRippleCenter: function(targetInfo, eventInfo, isExternalRipple) {
4064  var posX = 0;
4065  var posY = 0;
4066  if(isExternalRipple) {
4067   posX = targetInfo.x + targetInfo.width / 2;
4068   posY = targetInfo.y + targetInfo.height / 2;
4069  } else {
4070   posX = eventInfo.x;
4071   posY = eventInfo.y;
4072  }
4073  return {x: posX, y: posY};
4074 },
4075 createRippleContainer: function(targetInfo, isExternalRipple) {
4076  var containerParent = targetInfo.getTarget();
4077  if(!containerParent)
4078   return;
4079  var containerTagName = containerParent.tagName == "TR" ? "TD" : "DIV";
4080  var container = document.createElement(containerTagName);
4081  container.className = this.rippleContainerClassName;
4082  if(containerParent.parentNode && containerParent.tagName == "IMG")
4083   containerParent = containerParent.parentNode;
4084  if(this.isARowInFixedLayoutTable(containerParent))
4085   this.lockFixedLayoutTableSizes(containerParent);
4086  containerParent.appendChild(container);
4087  if(isExternalRipple)
4088   container.style.borderRadius = "50%";
4089  var containerRect = this.calculateRippleContainerSize(targetInfo, isExternalRipple);
4090  this.assignContainerSettings(container, containerRect);
4091  return container;
4092 },
4093 isARowInFixedLayoutTable: function(containerParent) {
4094  if(containerParent.tagName !== "TR")
4095   return false;
4096  var parentTable = this.getParentTable(containerParent);
4097  return parentTable && ASPx.GetCurrentStyle(parentTable)["table-layout"] === "fixed";
4098 },
4099 processFirstRowOfFixedTable: function(containerRow, rowAction, cellAction) {
4100  var firstRow = this.getFirstRow(containerRow);
4101  rowAction(firstRow);
4102  var cells = ASPx.Data.CollectionToArray(firstRow.cells);
4103  cells.forEach(cellAction);
4104 },
4105 getParentTable: function(element) {
4106  var parentTable = element;
4107  while(parentTable && parentTable.tagName !== "TABLE")
4108   parentTable = parentTable.parentElement;
4109  return parentTable;
4110 },
4111 lockFixedLayoutTableSizes: function(containerRow) {
4112  var firstRow = this.getFirstRow(containerRow);
4113  if(this.incLockCount(firstRow) === 1) {
4114   var cells = ASPx.Data.CollectionToArray(firstRow.cells);
4115   var widths = cells.map(function(cell) { return cell.style.width; });
4116   var computedWidths = cells.map(function(cell) {
4117    return window.getComputedStyle(cell).width;
4118   });
4119   var fixWidth = function(cell, i) {
4120    if(ASPx.Attr.IsExistsAttribute(cell, SAVED_WIDTH_ATTR))
4121     return;
4122    if(widths[i])
4123     ASPx.Attr.SetAttribute(cell, SAVED_WIDTH_ATTR, widths[i]);
4124    cell.style.width = computedWidths[i];
4125   };
4126   cells.forEach(fixWidth);
4127  }
4128 }, 
4129 unlockFixedLayoutTableSizes: function(containerRow) {
4130  var firstRow = this.getFirstRow(containerRow);   
4131  if(this.decLockCount(firstRow) === 0) {
4132   var cells = ASPx.Data.CollectionToArray(firstRow.cells);
4133   var restoreState = function(cell) {
4134    if(ASPx.Attr.IsExistsAttribute(cell, SAVED_WIDTH_ATTR)) {
4135     cell.style.width = ASPx.Attr.GetAttribute(cell, SAVED_WIDTH_ATTR);
4136     ASPx.Attr.RemoveAttribute(cell, SAVED_WIDTH_ATTR);
4137    } else {
4138     cell.style.width = null;
4139    }
4140   };
4141   cells.forEach(restoreState);
4142  }
4143 },
4144 getFirstRow: function(containerRow) { return ASPx.GetChildByTagName(containerRow.parentElement, "TR", 0); },
4145 incLockCount: function(elem) { return this.changeLockCount(elem, 1); },
4146 decLockCount: function(elem) { return this.changeLockCount(elem, -1); },
4147 changeLockCount: function(elem, diff) {
4148  var lockCounter = this.getLockCount(elem);
4149  lockCounter += diff;
4150  lockCounter = Math.max(0, lockCounter);
4151  if(lockCounter === 0)
4152   ASPx.Attr.RemoveAttribute(elem, RIPPLE_FIXED_ROW_ATTR);
4153  else
4154   ASPx.Attr.SetAttribute(elem, RIPPLE_FIXED_ROW_ATTR, lockCounter);
4155  return lockCounter;
4156 },
4157 getLockCount: function(lockElement) {
4158  var attrValue = ASPx.Attr.GetAttribute(lockElement, RIPPLE_FIXED_ROW_ATTR);
4159  return parseInt(attrValue) || 0;
4160 },
4161 assignContainerSettings: function(container, containerRect) {
4162  var properties = {
4163   height: containerRect.height,
4164   width: containerRect.width,
4165   left: ASPx.PrepareClientPosForElement(containerRect.x, container, true),
4166   top: ASPx.PrepareClientPosForElement(containerRect.y, container, false)
4167  };
4168  if(ASPx.Browser.MobileUI)
4169   ASPx.Data.MergeHashTables(properties, {marginTop: 0, marginLeft: 0 });
4170  ASPx.SetStyles(container, properties, ASPx.Browser.MobileUI);
4171 },
4172 IsExternalRipple: function(targetInfo) {
4173  var hasExternalRippleClassName = ASPx.ElementContainsCssClass(targetInfo.getTarget(), this.rippleTargetExternalClassName);
4174  if(!ASPx.Browser.MobileUI)
4175   return hasExternalRippleClassName;
4176  return hasExternalRippleClassName || this.IsMobileExternalRipple(targetInfo);
4177 },
4178 IsMobileExternalRipple: function(targetInfo) {
4179  if(this.isMobileExternalRipple == null) {
4180   var originTouchRadius = this.getOriginTouchRadius();
4181   this.isMobileExternalRipple = ASPx.Browser.MobileUI && targetInfo.width < originTouchRadius && targetInfo.height < originTouchRadius;
4182  }
4183  return this.isMobileExternalRipple;
4184 },
4185 RemoveRippleContainer: function(element) {
4186  if(!element)
4187   return;
4188  var childs = ASPx.GetChildNodesByClassName(element, this.rippleContainerClassName);
4189  var rippleContainer = childs.length > 0 ? childs[0] : null;
4190  if(rippleContainer != null) {
4191   var containerParent = rippleContainer.parentNode;
4192   containerParent.removeChild(rippleContainer);
4193   if(this.isARowInFixedLayoutTable(containerParent))
4194    this.unlockFixedLayoutTableSizes(containerParent);
4195  }
4196 },
4197 getEventX: function(evt) {
4198  return ASPxClientUtils.GetEventX(evt);
4199 },
4200 getEventY: function(evt) {
4201  return ASPxClientUtils.GetEventY(evt);
4202 },
4203 getOriginTouchRadius: function() {
4204  return this.touchRadius / this.zoom;
4205 },
4206 getElementRect: function(element) {
4207  return { x: ASPx.GetAbsoluteX(element), y: ASPx.GetAbsoluteY(element), width: element.offsetWidth, height: element.offsetHeight };
4208 }
4209};
4210var AccessibilitySR = {
4211 AddStringResources: function(stringResourcesObj) {
4212  if(stringResourcesObj) {
4213   for(var key in stringResourcesObj)
4214    if(stringResourcesObj.hasOwnProperty(key))
4215     this[key] = stringResourcesObj[key];
4216  }
4217 }
4218};
4219ASPx.OrderedMap = OrderedMap;
4220ASPx.CollectionBase = CollectionBase;
4221ASPx.FunctionIsInCallstack = _aspxFunctionIsInCallstack;
4222ASPx.RaisePostHandlerOnPost = aspxRaisePostHandlerOnPost;
4223ASPx.GetPostHandler = aspxGetPostHandler;
4224ASPx.ProcessScriptsAndLinks = _aspxProcessScriptsAndLinks;
4225ASPx.InitializeLinks = _aspxInitializeLinks;
4226ASPx.InitializeScripts = _aspxInitializeScripts;
4227ASPx.RunStartupScripts = _aspxRunStartupScripts;
4228ASPx.IsStartupScriptsRunning = _aspxIsStartupScriptsRunning;
4229ASPx.AddScriptsRestartHandler = _aspxAddScriptsRestartHandler;
4230ASPx.GetFocusedElement = _aspxGetFocusedElement;
4231ASPx.GetDomObserver = _aspxGetDomObserver;
4232ASPx.CacheHelper = CacheHelper;
4233ASPx.ControlTree = ControlTree;
4234ASPx.ControlAdjuster = ControlAdjuster;
4235ASPx.GetControlAdjuster = GetControlAdjuster;
4236ASPx.ControlCallbackHandlersQueue = ControlCallbackHandlersQueue;
4237ASPx.ResourceManager = ResourceManager;
4238ASPx.UpdateWatcherHelper = UpdateWatcherHelper;
4239ASPx.EventStorage = EventStorage;
4240ASPx.GetGlobalObject = GetGlobalObject;
4241ASPx.GetExternalScriptProcessor = GetExternalScriptProcessor;
4242ASPx.CheckBoxCheckState = CheckBoxCheckState;
4243ASPx.CheckBoxInputKey = CheckBoxInputKey;
4244ASPx.CheckableElementStateController = CheckableElementStateController;
4245ASPx.CheckableElementHelper = CheckableElementHelper;
4246ASPx.CheckBoxInternal = CheckBoxInternal;
4247ASPx.CheckBoxInternalCollection = CheckBoxInternalCollection;
4248ASPx.ControlCallbackQueueHelper = ControlCallbackQueueHelper;
4249ASPx.FocusedStyleDecoration = FocusedStyleDecoration;
4250ASPx.EditorStyleDecoration = EditorStyleDecoration;
4251ASPx.TextEditorStyleDecoration = TextEditorStyleDecoration;
4252ASPx.AccessibilitySR = AccessibilitySR;
4253ASPx.KbdHelper = KbdHelper;
4254ASPx.AccessKeysHelper = AccessKeysHelper;
4255ASPx.AccessKey = AccessKey;
4256ASPx.IFrameHelper = IFrameHelper;
4257ASPx.Ident = Ident;
4258ASPx.TouchUIHelper = TouchUIHelper;
4259ASPx.ControlUpdateWatcher = ControlUpdateWatcher;
4260ASPx.ControlTabIndexManager = ControlTabIndexManager;
4261ASPx.AccessibilityHelperBase = AccessibilityHelperBase;
4262ASPx.AccessibilityHelper = AccessibilityHelper;
4263ASPx.RippleHelper = RippleHelper;
4264ASPx.ThemesWithRipple = ThemesWithRipple;
4265ASPx.NetworkError = NetworkError;
4266window.ASPxClientEvent = ASPxClientEvent;
4267window.ASPxClientEventArgs = ASPxClientEventArgs;
4268window.ASPxClientCancelEventArgs = ASPxClientCancelEventArgs;
4269window.ASPxClientProcessingModeEventArgs = ASPxClientProcessingModeEventArgs;
4270window.ASPxClientProcessingModeCancelEventArgs = ASPxClientProcessingModeCancelEventArgs;
4271ASPx.Evt.AttachEventToDocument(TouchUIHelper.touchMouseDownEventName, RippleHelper.onDocumentMouseDown);
4272ASPx.classesScriptParsed = true;
4273})(ASPx, { GCCheckInterval: 5000 });
4274

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.