ASPxSplitterHelper = _aspxCreateClass(null, {
 constructor: function(splitter) {
  this.splitter = splitter;
  this.cache = {};
  this.clientStateElementId = this.splitter.name + "_CS";
 },
 GetClientStateElement: function() {
  return ASPxSplitterHelper.GetCachedValue(this, this.clientStateElementId, this, function(){
   return _aspxGetElementById(this.clientStateElementId);
  });
 },
 GetMoveMaxDeltaSize: function(deltaSize) {
  if(deltaSize == 0)
   return 0;
  if(this.isHeavyUpdate) {
   var parent = this.splitter.moveLeftPane.parent;
   var totalSize = 0, minSize = 0;
   for(var i = 0; i < parent.panes.length; i++) {
    var pane = parent.panes[i];
    if(pane.isSizePx)
     continue;
    if(pane.collapsed) {
     totalSize += pane.GetSizeDiff(pane.isVertical);
     minSize += pane.GetSizeDiff(pane.isVertical);
    }
    else {
     totalSize += pane.GetOffsetSize();
     minSize += pane.GetMinSize();
    }
   }
   if(this.moveRightPane.isSizePx) {
    deltaSize = this.GetPaneMaxDeltaSize(this.splitter.moveRightPane, -deltaSize);
    deltaSize = this.GetMaxDeltaSize(totalSize, minSize, Number.MAX_VALUE, -deltaSize);
   }
   else {
    deltaSize = this.GetMaxDeltaSize(totalSize, minSize, Number.MAX_VALUE, -deltaSize);
    deltaSize = this.GetPaneMaxDeltaSize(this.splitter.moveLeftPane, -deltaSize);
   }
  }
  else {
   deltaSize = this.GetPaneMaxDeltaSize(this.splitter.moveRightPane, -deltaSize);
   deltaSize = this.GetPaneMaxDeltaSize(this.splitter.moveLeftPane, -deltaSize);
  }
  return deltaSize;
 },
 GetPaneMaxDeltaSize: function(pane, deltaSize) {
  return this.GetMaxDeltaSize(pane.GetOffsetSize(), pane.GetMinSize(), pane.maxSize, deltaSize);
 },
 GetMaxDeltaSize: function(size, min, max, deltaSize) {
  var minDeltaSize = Math.floor(min - size);
  var maxDeltaSize = Math.floor(max - size);
  if(deltaSize < minDeltaSize)
   return (size < min) ? 0 : minDeltaSize;
  else if(deltaSize > maxDeltaSize)
   return (size > max) ? 0 : maxDeltaSize;
  return deltaSize;
 },
 GetCurrentPos: function() {
  return this.splitter.moveIsVertical ? ASPxClientSplitter.CurrentYPos : ASPxClientSplitter.CurrentXPos;
 },
 SetResizingPanelVisibility: function(visible) {
  var resizingPanel = ASPxSplitterHelper.GetCachedValue(this, "resizingPanel", this, function(){
   var resizingPanel = document.createElement("DIV");
   resizingPanel.style.overflow = "hidden";
   resizingPanel.style.position = "absolute";
   if(__aspxIE) {
    resizingPanel.style.backgroundColor = "White";
    resizingPanel.style.filter = "alpha(opacity=1)";
   }
   resizingPanel.isVisible = false;
   return resizingPanel;
  });
  if(resizingPanel.isVisible != visible) {
   if(visible) {
    var mainElement = this.splitter.GetMainElement();
    _aspxSetStylePosition(resizingPanel, _aspxGetAbsoluteX(mainElement), _aspxGetAbsoluteY(mainElement));
    _aspxSetStyleSize(resizingPanel, mainElement.offsetWidth, mainElement.offsetHeight);
    mainElement.parentNode.appendChild(resizingPanel);
   }
   else
    resizingPanel.parentNode.removeChild(resizingPanel);
   resizingPanel.isVisible = visible;
  }
 }
});
ASPxSplitterHelper.GetCachedValue = function(cacheObj, cacheName, obj, func) {
 if(!_aspxIsExists(cacheObj.cache[cacheName]))
  cacheObj.cache[cacheName] = func.apply(obj, []);
 return cacheObj.cache[cacheName];
};
ASPxSplitterHelper.DropCachedValue = function(cacheObj, cacheName) {
 cacheObj.cache[cacheName] = null;
};  
ASPxSplitterHelper.Resize = function(pane1, pane2, deltaSize) {
 if(pane1.isSizePx || pane2.isSizePx) {
  if(pane1.isSizePx)
   pane1.size += deltaSize;
  if(pane2.isSizePx)
   pane2.size -= deltaSize;
 }
 else {
  var c = (pane1.size + pane2.size) / (pane1.GetOffsetSize() + pane2.GetOffsetSize());
  pane1.size = c * (pane1.GetOffsetSize() + deltaSize);
  pane2.size = c * (pane2.GetOffsetSize() - deltaSize);
 }
};
ASPxSplitterPaneHelper = _aspxCreateClass(null, {
 constructor: function(pane) {
  this.pane = pane;
  this.cache = {};
  this.indexPath = this.GetIndexPath();
  var paneIdPostfix = this.pane.isRootPane ? "" : "_" + this.indexPath;
  var separatorIdPostfix = paneIdPostfix + "_S";
  this.postfixes = {
   pane: paneIdPostfix,
   separator: separatorIdPostfix,
   table: paneIdPostfix + "_T",
   contentContainer: paneIdPostfix + "_CC",
   collapseForwardButton: separatorIdPostfix + "_CF",
   collapseBackwardButton: separatorIdPostfix + "_CB",
   collapseButtonsSeparator: separatorIdPostfix + "_CS"
  };
  this.buttonsTableExists = _aspxIsExists(this.GetCollapseBackwardButton());
  this.separatorImageExists = _aspxIsExists(this.GetCollapseButtonsSeparatorImage());
  this.buttonsExists = this.buttonsTableExists || this.separatorImageExists;
 },
 GetCachedValue: function(name, func) {
  return ASPxSplitterHelper.GetCachedValue(this, name, this, func);
 },
 DropCachedValue: function(name) {
  ASPxSplitterHelper.DropCachedValue(this, name);
 },
 GetIndexPath: function() {
  if(this.pane.isRootPane)
   return "";
  var parentPane = this.pane.parent;
  if(parentPane.isRootPane)
   return "" + this.pane.index;
  return parentPane.helper.indexPath + __aspxItemIndexSeparator + this.pane.index;
 },
 GetCachedElement: function(idPostfix) {
  return this.GetCachedValue(idPostfix, function(){
   return this.pane.splitter.GetChild(idPostfix);
  });
 },
 DropCachedElement: function(idPostfix) {
  this.DropCachedValue(idPostfix);
 },
 GetPaneElement: function() {
  return this.GetCachedElement(this.postfixes.pane);
 },
 GetTableElement: function() {
  return this.GetCachedElement(this.postfixes.table);
 },
 GetContentContainerElement: function() {
  return this.GetCachedElement(this.postfixes.contentContainer);
 },
 DropContentContainerElementFromCache: function() {
  this.DropCachedElement(this.postfixes.contentContainer);
 },
 GetSeparatorElementId: function() {
  return this.pane.splitter.name + this.postfixes.separator;
 },
 GetSeparatorElement: function() {
  return this.GetCachedElement(this.postfixes.separator);
 },
 GetSeparatorDivElement: function() {
  return this.GetCachedValue("separatorDivElement", function(){
   var separatorElement = this.GetSeparatorElement();
   return _aspxIsExists(separatorElement) ? separatorElement.childNodes[0] : null;
  });
 },
 GetCollapseBackwardButton: function() {
  return this.GetCachedElement(this.postfixes.collapseBackwardButton);
 },
 GetCollapseForwardButton: function() {
  return this.GetCachedElement(this.postfixes.collapseForwardButton);
 },
 GetCollapseButtonsSeparator: function() {
  return this.GetCachedElement(this.postfixes.collapseButtonsSeparator);
 },
 GetCollapseButtonsTable: function() {
  return this.GetCachedValue("collapseButtonsTable", function(){
   return this.buttonsTableExists ? _aspxGetParentByTagName(this.GetCollapseForwardButton(), "TABLE") : null;
  });
 },
 GetCollapseButtonsSeparatorImage: function() {
  return this.GetCachedValue("collapseButtonsSeparatorImage", function(){
   var separator = this.GetCollapseButtonsSeparator();
   if(!_aspxIsExists(separator)) {
    if(!this.buttonsTableExists)
     separator = this.GetSeparatorElement();
    else
     return null;
   }
   return _aspxGetChildByTagName(separator, "IMG", 0);
  });
 },
 GetButtonUpdateElement: function(buttonElement) {
  return !this.pane.isVertical ? buttonElement.parentNode : buttonElement;
 },
 GetClientStateObject: function() {
  var result = {};
  if(!this.pane.isRootPane) {
   result.s = Math.round(this.pane.size * 1000) / 1000;
   result.st = this.pane.sizeType;
   result.c = this.pane.collapsed;
  }
  if(this.pane.panes.length > 0) {
   result.i = [];
   for(var i = 0; i < this.pane.panes.length; i++)
    result.i[i] = this.pane.panes[i].helper.GetClientStateObject();
  }
  return result;
 },
 SetEmptyDivVisible: function(visible) {
  var emptyDiv = this.GetCachedValue("emptyDiv", function(){
   var emptyDiv = document.createElement("DIV");
   emptyDiv.style.cssText = "overflow: hidden; width: 0px; height: 0px";
   emptyDiv.isVisible = false;
   return emptyDiv;
  });
  if(visible != emptyDiv.isVisible) {
   if(visible)
    this.GetPaneElement().appendChild(emptyDiv);
   else 
    this.GetPaneElement().removeChild(emptyDiv);
   emptyDiv.isVisible = visible;
  }
 }
});
ASPxSplitterResizingPointer = _aspxCreateClass(null, {
 constructor: function(elementId) {
  this.elementId = elementId;
  this.element = _aspxGetElementById(this.elementId);
  this.x = 0;
  this.y = 0;
 },
 SetCursor: function(cursor) {
  this.element.style.cursor = cursor;
 },
 SetPosition: function(x, y) {
  this.x = x;
  this.y = y;
  _aspxSetAbsoluteY(this.element, this.y);
  _aspxSetAbsoluteX(this.element, this.x);
 },
 SetVisibility: function(isVisible) {
  _aspxSetElementDisplay(this.element, isVisible);
 },
 Move: function(delta, isX) {
  if(isX)
   this.x += delta;
  else
   this.y += delta;
  this.SetPosition(this.x, this.y);
 },
 AttachToElement: function(element, isShow) {
  _aspxSetStyleSize(this.element, element.offsetWidth, element.offsetHeight);
  this.SetVisibility(true);
  this.SetPosition(_aspxGetAbsoluteX(element), _aspxGetAbsoluteY(element));
 }
});
ASPxClientSplitter = _aspxCreateClass(ASPxClientControl, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.emptyUrls = [
   "javascript:false",
   "about:blank",
   "#"
  ];
  this.width = "100%";
  this.height = "200px";
  this.helper = new ASPxSplitterHelper(this);
  this.resizingPointer = new ASPxSplitterResizingPointer(this.name + "_RP");
  this.rootPane = new ASPxClientSplitterPane(this, null, 0, {});
  this.liveResizing = false;
  this.allowResize = true;
  this.defaultMinSize = 5;
  this.showSeparatorImage = true;
  this.showCollapseBackwardButton = false;  
  this.showCollapseForwardButton = false;
  this.prepared = false;
  this.PaneResizing = new ASPxClientEvent();
  this.PaneResized = new ASPxClientEvent();
  this.PaneCollapsing = new ASPxClientEvent();
  this.PaneCollapsed = new ASPxClientEvent();
  this.PaneExpanding = new ASPxClientEvent();
  this.PaneExpanded = new ASPxClientEvent();
  this.PaneResizeCompleted = new ASPxClientEvent();
  this.isASPxClientSplitter = true;
 },
 Initialize: function() {
  this.constructor.prototype.Initialize.call(this);
  this.rootPane.ForEach("Initialize");
  this.rootPane.ForEach("ChangeEmptySizes");
  this.rootPane.ForEach("RefreshContentUrl", true);
  this.Prepare();
 },
 Prepare: function() {
  if(this.prepared || !this.IsDisplayed())
   return;
  this.rootPane.ForEach("Prepare", true);
  ASPxClientSplitter.instances[this.name] = this;
  this.prepared = true;
 },
 AdjustControlCore: function() {
  this.Prepare();
  this.UpdateControlSizes();
  this.rootPane.ForEach("AdjustControls", true);
  this.SynchronizeProperties();
 },
 UpdateControlSizes: function() {
  var element = this.GetMainElement();
  element.style.width = this.width;
  element.style.height = this.height;
  var focusedElement = _aspxGetFocusedElement(); 
  this.UpdatePanesVisible(_aspxChangeStyleAttribute);
  if(__aspxWebKitFamily) {
   var webkitSpecialElement = document.createElement("DIV");
   element.parentNode.appendChild(webkitSpecialElement);
   var offsetHeight = element.offsetHeight;
   element.parentNode.removeChild(webkitSpecialElement);
  }
  var newWidth = _aspxGetClearClientWidth(element);
  var newHeight = _aspxGetClearClientHeight(element);
  this.UpdatePanesVisible(_aspxRestoreStyleAttribute);
  if((this.rootPane.offsetWidth != newWidth) || (this.rootPane.offsetHeight != newHeight)) {
   this.rootPane.offsetWidth = newWidth;
   this.rootPane.offsetHeight = newHeight;
   this.rootPane.UpdatePanes();
  }
  if(focusedElement) { 
   focusedElement.blur();
   if(__aspxIE && __aspxBrowserVersion < 8 && focusedElement.tagName == "TD") {
    var childInput = _aspxGetChildByTagName(focusedElement, "INPUT", 0);
    if(childInput && _aspxElementIsVisible(childInput))
     focusedElement = childInput;
   }
   try { 
    focusedElement.focus();
   }
   catch(e) { }
  }
 },
 UpdatePanesVisible: function(func) {
  var firstTD = this.rootPane.panes[0].helper.GetPaneElement();
  func(firstTD, "width", "1px");
  func(firstTD, "height", "1px");
  func(this.rootPane.panes[0].helper.GetContentContainerElement(), "display", "none");
  for(var i = 1; i < this.rootPane.panes.length; i++) {
   var pane = this.rootPane.panes[i];
   func(pane.helper.GetPaneElement(), "display", "none");
   func(pane.helper.GetSeparatorElement(), "display", "none");
  }
 },
 SynchronizeProperties: function() {
  var clientStateElement = this.helper.GetClientStateElement();
  if(_aspxIsExists(clientStateElement)) {
   var stateString = _aspxToJson(this.rootPane.helper.GetClientStateObject());
   this.helper.GetClientStateElement().value = stateString;
   if(this.cookieName != "") {
    _aspxDelCookie(this.cookieName);
    _aspxSetCookie(this.cookieName, stateString);
   }
  }
 },
 GetPaneByPath: function(panePath, parentPane) {
  var pane = _aspxIsExists(parentPane) ? parentPane : this.rootPane;
  for(var i = 0; i < panePath.length; i++)
   pane = pane.panes[panePath[i]];
  return pane;
 },
 GetPaneByStringPath: function(paneStringPath, paneIndexSeparator) {
  if(!_aspxIsExists(paneIndexSeparator))
   paneIndexSeparator = __aspxItemIndexSeparator;
  return this.GetPaneByPath(paneStringPath.split(paneIndexSeparator));
 },
 OnWindowResize: function() {
  if(!this.IsDisplayed())
   return;
  this.UpdateControlSizes();
 },
 OnSeparatorMouseDown: function(moveRightPanePath) {
  var pane = this.GetPaneByStringPath(moveRightPanePath);
  this.moveRightPane = pane;
  this.moveLeftPane = pane.prevPane;
  this.moveIsVertical = this.moveRightPane.isVertical;
  this.moveStartPos = this.helper.GetCurrentPos();
  this.moveLastPos = this.moveStartPos;
  this.isHeavyUpdate = (this.moveLeftPane.isSizePx && !this.moveRightPane.isSizePx) ||
   (!this.moveLeftPane.isSizePx && this.moveRightPane.isSizePx);
  if(!this.moveLeftPane.IsAllowResize() || !this.moveRightPane.IsAllowResize())
   return false;
  if(this.moveLeftPane.collapsed || this.moveRightPane.collapsed)
   return false;
  if(this.RaiseCancelEvent("PaneResizing", this.moveRightPane) || this.RaiseCancelEvent("PaneResizing", this.moveLeftPane))
   return false;
  var cursor = this.moveIsVertical ? "n-resize" : "w-resize";
  if(!this.liveResizing) {
   this.resizingPointer.SetCursor(cursor);
   this.resizingPointer.AttachToElement(this.moveRightPane.helper.GetSeparatorElement(), true);
  }
  this.helper.SetResizingPanelVisibility(true);
  _aspxChangeStyleAttribute(document.body, "cursor", cursor);
  return true;
 },
 OnSeparatorMouseUp: function() {
  this.helper.SetResizingPanelVisibility(false);
  _aspxRestoreStyleAttribute(document.body, "cursor");
  if(!this.liveResizing || !this.isHeavyUpdate) {
   var deltaSize = this.moveLastPos - this.moveStartPos;
   this.moveLeftPane.SetOffsetSize(this.moveLeftPane.GetOffsetSize() - deltaSize);
   this.moveRightPane.SetOffsetSize(this.moveRightPane.GetOffsetSize() + deltaSize);
   ASPxSplitterHelper.Resize(this.moveLeftPane, this.moveRightPane, deltaSize);
   this.moveLeftPane.parent.ForEach("UpdateChildrenSize");
  }
  if(!this.liveResizing)
   this.resizingPointer.SetVisibility(false);
  this.moveLeftPane.parent.ForEach("AdjustControls");
  this.SynchronizeProperties();
  this.RaiseEvent("PaneResizeCompleted", this.moveLeftPane);
  this.RaiseEvent("PaneResizeCompleted", this.moveRightPane);
 },
 OnMouseMove: function() {
  var deltaSize = this.helper.GetMoveMaxDeltaSize(this.helper.GetCurrentPos() - this.moveLastPos);
  if(deltaSize == 0) return;
  this.moveLeftPane.SetOffsetSize(this.moveLeftPane.GetOffsetSize() + deltaSize);
  this.moveRightPane.SetOffsetSize(this.moveRightPane.GetOffsetSize() - deltaSize);
  if(this.liveResizing){
   var changePaneSize = function(pane, deltaSize) {
    pane.SetContentVisible(false);
    if(pane.ApplyElementSize()) {
    pane.ForEach("UpdateChildrenSize");
    pane.SetContentVisible(true);
     pane.RaiseResizedEvent();
    }
   };
   if(this.isHeavyUpdate) {
    ASPxSplitterHelper.Resize(this.moveLeftPane, this.moveRightPane, deltaSize);
    this.moveLeftPane.parent.ForEach("UpdateChildrenSize");
   }
   else {
    changePaneSize(this.moveLeftPane, deltaSize, this.helper);
    changePaneSize(this.moveRightPane, -deltaSize, this.helper);
   }
  }
  else
   this.resizingPointer.Move(deltaSize, !this.moveIsVertical);
  this.moveLastPos += deltaSize;
 },
 OnCollapseButtonClick: function(panePath, forwardDirection) {
  var rightPane = this.GetPaneByStringPath(panePath);
  var pane1 = forwardDirection ? rightPane.prevPane : rightPane;
  var pane2 = forwardDirection ? rightPane : rightPane.prevPane;
  if(pane1.collapsed && pane1.maximizedPane == pane2) {
   if(!this.RaiseCancelEvent("PaneExpanding", pane1))
    pane1.Expand();
  }
  else {
   if(!this.RaiseCancelEvent("PaneCollapsing", pane2))
    pane2.Collapse(pane1);
  }
  this.SynchronizeProperties();
 },
 IsEmptyUrl: function(url) {
  for(var i = 0; i < this.emptyUrls.length; i++)
   if(url == this.emptyUrls[i])
    return true;
  return false;
 },
 RaiseEvent: function(eventName, pane) {
  this[eventName].FireEvent(this, new ASPxClientSplitterPaneEventArgs(pane));
 },
 RaiseCancelEvent: function(eventName, pane) {
  var args = new ASPxClientSplitterPaneCancelEventArgs(pane);
  this[eventName].FireEvent(this, args);
  return args.cancel;
 },
 GetPaneCount: function() {
  return this.rootPane.GetPaneCount();
 },
 GetPane: function(index) {
  return this.rootPane.GetPane(index);
 },
 GetPaneByName: function(name) {
  return this.rootPane.GetPaneByName(name);
 },
 SetAllowResize: function(allowResize) {
  if(this.allowResize == allowResize)
   return;
  this.allowResize = allowResize;
  this.rootPane.ForEach("UpdateSeparatorStyle", true);
 },
 SetWidth: function(width) {
  this.width = width + "px";
  this.UpdateControlSizes();
 },
 SetHeight: function(height) {
  this.height = height + "px";
  this.UpdateControlSizes();
 }
});
ASPxClientSplitter.Cast = ASPxClientControl.Cast;
ASPxClientSplitterPane = _aspxCreateClass(null, {
 constructor: function(splitter, parent, index, paneProperties) {
  this.splitter = splitter;
  this.parent = parent;
  this.index = index;
  this.name = _aspxIsExists(paneProperties.name) ? paneProperties.name : "";
  this.isRootPane = (this.parent == null);
  this.helper = new ASPxSplitterPaneHelper(this);
  this.prevPane = null;
  this.nextPane = null;
  this.panes = [];
  this.isVertical = this.isRootPane ? false : !parent.isVertical;
  this.hasSeparator = (this.index > 0);
  this.collapsed = _aspxIsExists(paneProperties.collapsed) ? paneProperties.collapsed : false;
  this.size = _aspxIsExists(paneProperties.size) ? paneProperties.size : 0;
  this.sizeType = _aspxIsExists(paneProperties.sizeType) ? paneProperties.sizeType : null;
  this.maxSize = _aspxIsExists(paneProperties.maxSize) ? paneProperties.maxSize : Number.MAX_VALUE;
  this.minSize = _aspxIsExists(paneProperties.minSize) ? paneProperties.minSize : this.splitter.defaultMinSize;
  this.allowResize = _aspxIsExists(paneProperties.allowResize) ? paneProperties.allowResize : true;
  this.showCollapseForwardButton = _aspxIsExists(paneProperties.showCollapseForwardButton) ? paneProperties.showCollapseForwardButton : false;
  this.showCollapseBackwardButton = _aspxIsExists(paneProperties.showCollapseBackwardButton) ? paneProperties.showCollapseBackwardButton : false;
  this.iframe = {};
  if(_aspxIsExists(paneProperties.iframe)) {
   this.iframe = {
    src: paneProperties.iframe[0],
    scrolling: paneProperties.iframe[1]
   };
   if(paneProperties.iframe.length > 2)
    this.iframe.name = paneProperties.iframe[2];
   this.isContentUrl = true;
  }
  this.isSizePx = (this.sizeType == "px");
  this.maximizedPane = null;
  this.dragPrevented = false;
  this.offsetWidth = 0;
  this.offsetHeight = 0;
  this.widthDiff = 0;
  this.heightDiff = 0;
  this.minimizedWidthDiff = 0;
  this.minimizedHeightDiff = 0;
  this.contentContainerWidthDiff = 0;
  this.contentContainerHeightDiff = 0;
  this.isASPxClientSplitterPane = true;
 },
 CreatePanes: function(panesProperties) {
  var prevPane = null;
  var pane = null;
  for(var i = 0; i < panesProperties.length; i ++) {
   this.panes.push(pane = new ASPxClientSplitterPane(this.splitter, this, i, panesProperties[i]));
   pane.prevPane = prevPane;
   if(prevPane != null)
    prevPane.nextPane = pane;
   prevPane = pane;
   if(_aspxIsExists(panesProperties[i].panes))
    pane.CreatePanes(panesProperties[i].panes);
  }
 },
 Initialize: function() {
  this.InitializePreventDragging();
  if(this.isRootPane)
   return;
  if(this.collapsed) {
   if(this.IsFirstPane())
    this.maximizedPane = this.parent.panes[1];
   else if (this.prevPane.maximizedPane != this)
    this.maximizedPane = this.prevPane;
   else
    this.maximizedPane = this.nextPane;
   if (this.maximizedPane == null)
    this.collapsed = false;
  }
 },
 Prepare: function() {
  var EvaluateWidthDiff = function(element) {
   return element.offsetWidth - element.clientWidth;
  };
  var EvaluateHeightDiff = function(element) {
   var elementClientHeight = ((__aspxSafari && (__aspxBrowserVersion < 4)) || (__aspxChrome && (__aspxBrowserVersion < 2))) ? (element.offsetHeight - element.clientTop * 2) : element.clientHeight;
   return element.offsetHeight - elementClientHeight;
  };
  this.GetSeparatorSize();
  var element = this.helper.GetPaneElement();
  this.widthDiff = EvaluateWidthDiff(element);
  this.heightDiff = EvaluateHeightDiff(element);
  if(this.panes.length == 0) {
    var contentContainerElement = this.helper.GetContentContainerElement();
   _aspxSetScrollBarVisibility(contentContainerElement, false);
   _aspxSetStyleSize(contentContainerElement, 1, 1);
   this.contentContainerWidthDiff = contentContainerElement.offsetWidth - 1;
   this.contentContainerHeightDiff = contentContainerElement.offsetHeight - 1;
   _aspxSetScrollBarVisibility(contentContainerElement, true);
  }
  this.UpdateStyle(element, true);
  this.collapsedWidthDiff = EvaluateWidthDiff(element);
  this.collapsedHeightDiff = EvaluateHeightDiff(element);
  this.UpdateStyle(element, false);
  var separator = this.helper.GetSeparatorElement();
  if(_aspxIsExists(separator)) {
   _aspxSetElementDisplay(this.helper.GetSeparatorDivElement(), false);
   if(!this.isVertical)
    this.separatorSizeDiff = separator.offsetWidth - separator.clientWidth;
   else
    this.separatorSizeDiff = separator.offsetHeight - separator.clientHeight;
   _aspxSetElementDisplay(this.helper.GetSeparatorDivElement(), true);
  }
  else
   this.separatorSizeDiff = 0;
  this.PrepareSeparatorButtons();
 },
 PrepareSeparatorButtons: function() {
  if(!(this.hasSeparator && this.helper.buttonsExists))
   return;
  var sizeProperty = this.isVertical ? "offsetWidth" : "offsetHeight";
  if(this.helper.buttonsTableExists) {
   this.collapseBackwardButtonSize = this.helper.GetButtonUpdateElement(this.helper.GetCollapseBackwardButton())[sizeProperty];
   this.collapseForwardButtonSize = this.helper.GetButtonUpdateElement(this.helper.GetCollapseForwardButton())[sizeProperty];
   this.buttonsTableDiffSize = this.helper.GetCollapseButtonsTable()[sizeProperty] - this.collapseBackwardButtonSize - this.collapseForwardButtonSize;
   if(this.helper.separatorImageExists) {
    this.collapseButtonsSeparatorSize = this.helper.GetButtonUpdateElement(this.helper.GetCollapseButtonsSeparator())[sizeProperty];
    this.buttonsTableDiffSize -= this.collapseButtonsSeparatorSize;
   }
  }
  else
   this.collapseButtonsSeparatorSize = this.helper.GetCollapseButtonsSeparatorImage()[sizeProperty];
 },
 InitializePreventDragging: function() {
  if(!this.dragPrevented && this.helper.separatorImageExists) {
   _aspxPreventElementDrag(this.helper.GetCollapseButtonsSeparatorImage());
   this.dragPrevented = true;
  }
 },
 ForEach: function(funcName, skippSelf) {
  if(!_aspxIsExists(skippSelf) || !skippSelf)
   this[funcName]();
  for(var i = 0; i < this.panes.length; i++)
   this.panes[i].ForEach(funcName);
 },
 SetContentVisible: function(visible) {
  _aspxSetElementDisplay(this.helper.GetContentContainerElement(), visible);
  if(__aspxIE)
   this.helper.SetEmptyDivVisible(!visible);
 },
 AdjustControls: function() {
  if(this.panes.length == 0 && !this.collapsed && !this.isContentUrl)
   aspxGetControlCollection().AdjustControls(this.helper.GetContentContainerElement(), false);
 },
 UpdatePanes: function() {
  this.ForEach("UpdateChildrenSize");
  this.ForEach("UpdateVisualElements", true);
 },
 UpdateVisualElements: function() {
  this.UpdateButtonsVisibility();
  this.UpdateSeparatorStyle();
  this.UpdatePaneStyle();
 },
 IsBackwardButtonVisible: function() {
  return ASPxSplitterHelper.GetCachedValue(this.helper, "isBackwardButtonVisible", this, function() {
   if(!this.helper.buttonsTableExists)
    return false;
   if(this.collapsed && (this.maximizedPane == this.prevPane))
    return true;
   if(this.prevPane.collapsed)
    return false;
   return this.showCollapseBackwardButton;
  });
 },
 IsForwardButtonVisible: function() {
  return ASPxSplitterHelper.GetCachedValue(this.helper, "isForwardButtonVisible", this, function(){
   if(!this.helper.buttonsTableExists)
    return false;
   if(this.prevPane.collapsed && (this.prevPane.maximizedPane == this))
    return true;
   if(this.collapsed)
    return false;
   return this.showCollapseForwardButton;
  });
 },
 DropCachedButtonsVisible: function() {
  ASPxSplitterHelper.DropCachedValue(this.helper, "isBackwardButtonVisible");
  ASPxSplitterHelper.DropCachedValue(this.helper, "isForwardButtonVisible");
 },
 IsAllowResize: function() {
  return this.allowResize && this.splitter.allowResize;
 },
 UpdateSeparatorStyle: function() {
  if(!this.hasSeparator)
   return;
  var prevPaneCollapsed = this.prevPane != null && this.prevPane.collapsed;
  var prevPaneAllowResize = this.prevPane != null && this.prevPane.IsAllowResize();
  var isCollapsed = this.collapsed || prevPaneCollapsed;
  var resizingEnabled = this.IsAllowResize() && prevPaneAllowResize;
  aspxGetStateController().SetMouseStateItemsEnabled(this.helper.GetSeparatorElementId(), null, !isCollapsed && resizingEnabled);
  this.UpdateStyle(this.helper.GetSeparatorElement(), isCollapsed);
 },
 UpdatePaneStyle: function() {
  this.UpdateStyle(this.helper.GetPaneElement(), this.collapsed);
 },
 UpdateStyle: function(element, isSelect) {
  if(isSelect)
   aspxGetStateController().SelectElementBySrcElement(element);
  else
   aspxGetStateController().DeselectElementBySrcElement(element);
 },
 UpdateButtonsVisibility: function() {
  if(!(this.hasSeparator && this.helper.buttonsExists))
   return;
  var separatorSize = this.GetOffsetSize(!this.isVertical) - this.separatorSizeDiff;
  if(this.helper.buttonsTableExists) {
   var buttonsSize = this.buttonsTableDiffSize;
   if(this.IsBackwardButtonVisible())
    buttonsSize += this.collapseBackwardButtonSize;
   if(this.IsForwardButtonVisible())
    buttonsSize += this.collapseForwardButtonSize;
   var buttonsVisible = (buttonsSize <= separatorSize);
   var backwardButtonVisible = buttonsVisible && this.IsBackwardButtonVisible();
   var forwardButtonVisible = buttonsVisible && this.IsForwardButtonVisible();
   _aspxSetElementDisplay(this.helper.GetButtonUpdateElement(this.helper.GetCollapseBackwardButton()), backwardButtonVisible);
   _aspxSetElementDisplay(this.helper.GetButtonUpdateElement(this.helper.GetCollapseForwardButton()), forwardButtonVisible);
   if(this.helper.separatorImageExists) {
    if(!buttonsVisible)
     buttonsSize = this.buttonsTableDiffSize;
    buttonsSize += this.collapseButtonsSeparatorSize;
    var separatorImageVisible = this.splitter.showSeparatorImage && (backwardButtonVisible === forwardButtonVisible) && (buttonsSize <= separatorSize);
    _aspxSetElementDisplay(this.helper.GetButtonUpdateElement(this.helper.GetCollapseButtonsSeparator()), separatorImageVisible);
   }
  }
  else {
   var separatorImageVisible = this.splitter.showSeparatorImage && (this.collapseButtonsSeparatorSize <= separatorSize);
   _aspxSetElementDisplay(this.helper.GetCollapseButtonsSeparatorImage(), separatorImageVisible);
  }
 },
 GetSeparatorSize: function() {
  return ASPxSplitterHelper.GetCachedValue(this.helper, "separatorSize", this, function() {
   var separator = this.helper.GetSeparatorElement();
   return _aspxIsExists(separator) ? (this.isVertical ? separator.offsetHeight : separator.offsetWidth) : 0;
  });
 },
 GetTotalSeparatorsSize: function(isVertical) {
  if(!_aspxIsExists(isVertical) || (isVertical == this.isVertical))
   return 0;
  var cacheKey = (isVertical ? "v" : "h") + "TotalSeparatorsSize"; 
  return ASPxSplitterHelper.GetCachedValue(this.helper, cacheKey, this, function() {
   var result = 0;
   for(var i = 0; i < this.panes.length; i++)
    result += this.panes[i].GetSeparatorSize();
   return result;
  });
 },
 GetMinSize: function(isVertical) {
  if(!_aspxIsExists(isVertical))
   isVertical = this.isVertical;
  var cacheKey = (isVertical ? "v" : "h") + "ItemMinSize";
  return ASPxSplitterHelper.GetCachedValue(this.helper, cacheKey, this, function() {
   var result = 0;
   for(var i = 0; i < this.panes.length; i++)
    if(isVertical != this.isVertical)
     result += this.panes[i].GetMinSize(isVertical);
    else
     result = Math.max(result, this.panes[i].GetMinSize(isVertical));
   result += this.GetTotalSeparatorsSize(isVertical);
   var minSize = (isVertical == this.isVertical) ? this.minSize : this.splitter.defaultMinSize;
   result = Math.max(result, Math.max(minSize, this.GetSizeDiff(isVertical)));
   return result;
  });
 },
 GetMaxSize: function() {
  return Math.max(this.maxSize, this.GetSizeDiff(this.isVertical));
 },
 ChangeEmptySizes: function() {
  var prcSum = 0;
  var emptyPanesCount = 0;
  for(var i = 0; i < this.panes.length; i++) {
   var pane = this.panes[i];
   if(pane.sizeType == "%")
    prcSum += pane.size;
   else if(pane.sizeType == null)
    emptyPanesCount++;
  }
  var freePrcSize = 100 - prcSum;
  if((emptyPanesCount > 0) && (freePrcSize > 0)) {
   for(var i = 0; i < this.panes.length; i++) {
    var pane = this.panes[i];
    if(pane.sizeType == null) {
     pane.sizeType = "%";
     pane.size = freePrcSize / emptyPanesCount;
    }
   }
  }
 },
 PrepareUpdateInfo: function() {
  var updateInfo = {};
  var prepareUpdateInfoPart = function() {
   return {
    panes: [],
    sum: 0,
    sumMin: 0,
    sumMax: 0,
    addPane: function() {
     this.panes.push(pane);
     if(pane.collapsed) {
      var sizeDiff = pane.GetSizeDiff(pane.isVertical);
      this.sum += sizeDiff;
      this.sumMin += sizeDiff;
     }
     else {
      this.sum += pane.size;
      this.sumMin += pane.GetMinSize();
     }
     this.sumMax += pane.GetMaxSize();
    },
    IsIgnoreMaxSize: function() {
     return this.sumMax < this.sum;
    }
   };
  };
  updateInfo.px = prepareUpdateInfoPart();
  updateInfo.prc = prepareUpdateInfoPart();
  updateInfo.collapsed = prepareUpdateInfoPart();
  updateInfo.onlyPxPanes = true; 
  updateInfo.hasPxPanesShown = false;
  updateInfo.hasPrcPanesShown = false;
  for(var i = 0; i < this.panes.length; i++) {
   var pane = this.panes[i];
   if(pane.collapsed)
    updateInfo.collapsed.addPane(pane);
   else if(pane.isSizePx) {
    updateInfo.px.addPane(pane);
    updateInfo.hasPxPanesShown = true;
   }
   else {
    updateInfo.prc.addPane(pane);
    updateInfo.hasPrcPanesShown = true;
   }
   if(!pane.isSizePx)
    updateInfo.onlyPxPanes = false;
  }
  updateInfo.px.isIgnoreMaxSize = (!updateInfo.hasPrcPanesShown && (updateInfo.px.sumMax < updateInfo.px.sum));
  updateInfo.prc.isIgnoreMaxSize = (updateInfo.prc.sumMax < updateInfo.prc.sum);
  return updateInfo;
 },
 SetChildrenSecondSize: function() {
  var orientation = this.isVertical;
  var size = this.GetClientSize(orientation);
  for(var i = 0; i < this.panes.length; i++)
   this.panes[i].SetOffsetSize(size, orientation);
 },
 GetChildrenTotalSize: function() {
  return this.GetClientSize(!this.isVertical) - this.GetTotalSeparatorsSize(!this.isVertical);
 },
 UpdateChildrenSize: function() {
  if(this.collapsed || (this.panes.length == 0))
   return;
  var updateInfo = this.PrepareUpdateInfo();
  var childrenTotalSize = this.GetChildrenTotalSize();
  var pxMaxSize = childrenTotalSize - (updateInfo.prc.sumMin + updateInfo.collapsed.sumMin);
  var pxTotalSize = 0;
  if((pxMaxSize > 0) && updateInfo.hasPxPanesShown) {
   var c = !updateInfo.hasPrcPanesShown ? (pxMaxSize / updateInfo.px.sum) : 1;
   for(var i = 0; i < updateInfo.px.panes.length; i++) {
    var pane = updateInfo.px.panes[i];
    var newSize = Math.max(Math.round(pane.size * c), pane.GetMinSize());
    if(!updateInfo.px.isIgnoreMaxSize)
     newSize = Math.min(newSize, pane.GetMaxSize());
    pane.SetOffsetSize(newSize);
    pxTotalSize += newSize;
   }
   if(!updateInfo.hasPrcPanesShown || (pxTotalSize > pxMaxSize))
    pxTotalSize = this.NormalizePanesSizes(updateInfo.px.panes, pxTotalSize, pxMaxSize);
   if (updateInfo.onlyPxPanes) {
    for(var i = 0; i < updateInfo.px.panes.length; i++) {
     var pane = updateInfo.px.panes[i];
     pane.size = pane.GetOffsetSize();
    }
   }
  }
  var prcMaxSize = pxMaxSize - pxTotalSize + updateInfo.prc.sumMin;
  var prcTotalSize = 0;
  if((prcMaxSize > 0) && updateInfo.hasPrcPanesShown) {
   var c = 1 / updateInfo.prc.sum;
   for(var i = 0; i < updateInfo.prc.panes.length; i++) {
    var pane = updateInfo.prc.panes[i];
    var newSize = Math.max(Math.round(pane.size * c * (childrenTotalSize - pxTotalSize)), pane.GetMinSize());
    if(!updateInfo.prc.isIgnoreMaxSize)
     newSize = Math.min(newSize, pane.GetMaxSize());
    pane.SetOffsetSize(newSize);
    prcTotalSize += newSize;
   }
   if(prcTotalSize != prcMaxSize)
    prcTotalSize = this.NormalizePanesSizes(updateInfo.prc.panes, prcTotalSize, prcMaxSize);
  }
  for(var i = 0; i < updateInfo.collapsed.panes.length; i++) {
   var pane = updateInfo.collapsed.panes[i];
   pane.SetOffsetSize(pane.GetSizeDiff(pane.isVertical));
  }
  this.SetChildrenSecondSize();
  for(var i = 0; i < this.panes.length; i++) {
   var pane = this.panes[i];
   if(pane.collapsed)
    pane.SetContentVisible(false);
   else
    pane.SetContentVisible(true);
   if(pane.ApplyElementSize())
    pane.RaiseResizedEvent();
  }
  this.ForEach("UpdateButtonsVisibility", true);
 },
 GetPossibleUp: function() {
  return this.GetMaxSize() - this.GetOffsetSize();
 },
 GetPossibleDown: function() {
  return this.GetOffsetSize() - this.GetMinSize();
 },
 NormalizePanesSizes: function(panes, size, maxSize) {
  var insufficientSize = maxSize - size;
  var changeStep = (insufficientSize > 0) ? 1 : -1;
  var possibleChangeFunction = (insufficientSize > 0) ? "GetPossibleUp" : "GetPossibleDown";
  var changed = true;
  while((insufficientSize != 0) && changed) {
   changed = false;
  for(var i = 0; i < panes.length; i++) {
   var pane = panes[i];
    if(pane[possibleChangeFunction]() > 0) {
     pane.SetOffsetSize(pane.GetOffsetSize() + changeStep);
     insufficientSize -= changeStep;
     changed = true;
     if(insufficientSize == 0)
      break;
  }
   }
  }
  return maxSize - insufficientSize;
 },
 GetOffsetSize: function(isVertical) {
  if(!_aspxIsExists(isVertical))
   isVertical = this.isVertical;
  return isVertical ? this.offsetHeight : this.offsetWidth;
 },
 GetClientSize: function(isVertical) {
  return isVertical ? this.GetClientHeightInternal(true) : this.GetClientWidthInternal(true);
 },
 SetOffsetSize: function(value, isVertical) {
  if(!_aspxIsExists(isVertical))
   isVertical = this.isVertical;
  if(isVertical)
   this.offsetHeight = value;
  else
   this.offsetWidth = value;
 },
 GetSizeDiff: function(isVertical) {
  return isVertical ? this.GetHeightDiff(true) : this.GetWidthDiff(true);
 },
 GetWidthDiff: function(isContainer) {
  if(this.collapsed)
   return this.collapsedWidthDiff;
  return this.widthDiff + (isContainer ? this.contentContainerWidthDiff : 0);
 },
 GetHeightDiff: function(isContainer) {
  if(this.collapsed)
   return this.collapsedHeightDiff;
  return this.heightDiff + (isContainer ? this.contentContainerHeightDiff : 0);
 },
 GetClientWidthInternal: function(isContainer) {
  return this.offsetWidth - this.GetWidthDiff(isContainer);
 },
 GetClientHeightInternal: function(isContainer) {
  return this.offsetHeight - this.GetHeightDiff(isContainer);
 },
 ApplyElementSize: function() {
  if(this.IsSizeChanged()) {
   var paneWidth = this.GetClientWidthInternal(false);
   var paneHeight = this.GetClientHeightInternal(false);
   var contentContainerWidth = this.GetClientWidthInternal(true);
   var contentContainerHeight = this.GetClientHeightInternal(true);
   if(contentContainerWidth < 0) {
    paneWidth -= contentContainerWidth;
    contentContainerWidth = 0;
   }
   if(contentContainerHeight < 0) {
    paneHeight -= contentContainerHeight;
    contentContainerHeight = 0;
   }
   _aspxSetStyleSize(this.helper.GetPaneElement(), paneWidth, paneHeight);
   var contentContainerElement = this.helper.GetContentContainerElement();
   _aspxSetStyleSize(contentContainerElement, contentContainerWidth, contentContainerHeight);
   if(__aspxChrome && __aspxBrowserMajorVersion >= 3
     || __aspxSafari && __aspxBrowserMajorVersion >= 5) {
    var marginRight = _aspxPxToInt(contentContainerElement.style.marginRight);
    marginRight -= _aspxPxToInt(_aspxGetCurrentStyle(contentContainerElement).marginRight);
    contentContainerElement.style.marginRight = marginRight + "px";
   }
   if(__aspxWebKitFamily) {
    var updated = _aspxSetScrollBarVisibilityCore(contentContainerElement, "overflowY", this.GetClientWidthInternal(true) > _aspxGetVerticalScrollBarWidth());
    if(updated && this.isContentUrl)
     this.RefreshContentUrl();
   }
   return true;
  }
  return false;
 },
 IsSizeChanged: function() {
  if(!_aspxIsExists(this.lastWidth) || !_aspxIsExists(this.lastHeight) ||
   (this.offsetWidth != this.lastWidth) || (this.offsetHeight != this.lastHeight)) {
   this.lastWidth = this.offsetWidth;
   this.lastHeight = this.offsetHeight;
   return true;
  }
  return false;
 },
 GetSplitter: function() {
  return this.splitter;
 },
 GetParentPane: function() {
  return this.parent;
 },
 GetPrevPane: function() {
  return this.prevPane;
 },
 GetNextPane: function() {
  return this.nextPane;
 },
 IsFirstPane: function() {
  return (this.prevPane == null);
 },
 IsLastPane: function() {
  return (this.nextPane == null);
 },
 IsVertical: function() {
  return this.isVertical;
 },
 GetPaneCount: function() {
  return this.panes.length;
 },
 GetPane: function(index) {
  return (0 <= index && index < this.panes.length) ? this.panes[index] : null;
 },
 GetPaneByName: function(name) {
  for(var i = 0; i < this.panes.length; i++)
   if(this.panes[i].name == name) return this.panes[i];
  for(var i = 0; i < this.panes.length; i++) {
   var pane = this.panes[i].GetPaneByName(name);
   if(pane != null) return pane;
  }
  return null;
 },
 GetClientWidth: function() {
  var clientWidth = this.GetClientWidthInternal(true);
  if(!this.IsContentUrlPane()){
   var contentContainer = this.helper.GetContentContainerElement();
   if((contentContainer.style.overflow == "auto" && contentContainer.scrollHeight > contentContainer.clientHeight) 
     || contentContainer.style.overflow == "scroll"
     || contentContainer.style.overflowY == "scroll"){
    clientWidth = clientWidth - _aspxGetVerticalScrollBarWidth();
   }
  }
  return clientWidth;
 },
 GetClientHeight: function() {
  return this.GetClientHeightInternal(true);
 },
 Collapse: function(maximizedPane) {
  if(!this.splitter.prepared)
   return false;
  if(this.collapsed)
   return false;
  if(!_aspxIsExists(maximizedPane) || !maximizedPane.isASPxClientSplitterPane)
   return false;
  return this.CollapseExpandCore(true, maximizedPane, "PaneCollapsed");
 },
 Expand: function() {
  if(!this.splitter.prepared)
   return false;
  if(!this.collapsed)
   return false;
  return this.CollapseExpandCore(false, null, "PaneExpanded");
 },
 CollapseExpandCore: function(collapsed, maximizedPane, eventName) {
  this.collapsed = collapsed;
  this.maximizedPane = maximizedPane;
  this.DropCachedButtonsVisible();
  if(this.nextPane != null)
   this.nextPane.DropCachedButtonsVisible();
  this.GetParentPane().UpdatePanes();
  this.GetParentPane().ForEach("AdjustControls");
  this.splitter.RaiseEvent(eventName, this);
  return true;
 },
 IsCollapsed: function() {
  return this.collapsed;
 },
 IsContentUrlPane: function() {
  return this.isContentUrl;
 },
 GetContentUrl: function() {
  return this.iframe.src;
 },
 SetContentUrl: function(url) {
  if(!this.isContentUrl)
   return;
  if(_aspxIsExists(url) && this.iframe.src != url) {
   this.iframe.src = url;
   this.RefreshContentUrl();
  }
 },
 RefreshContentUrl: function() {
  if(!this.isContentUrl)
   return;
  this.GetCreateContentUrlIFrame().src = this.GetContentUrl();
 },
 GetCreateContentUrlIFrame: function() {
  var contentContainer = this.helper.GetContentContainerElement();
  if(contentContainer.tagName == "DIV") {
   contentContainer.parentNode.removeChild(contentContainer);
   var iframe = _aspxCreateIFrame({
    id: contentContainer.id,
    name: this.iframe.name,
    scrolling: this.iframe.scrolling,
    src: this.iframe.src
   });
   iframe.style.width = contentContainer.style.width;
   iframe.style.height = contentContainer.style.height;
   this.helper.GetPaneElement().appendChild(iframe);
   this.helper.DropContentContainerElementFromCache();
   return iframe;
  }
  else
   return contentContainer;
 },
 SetAllowResize: function(allowResize) {
  this.allowResize = allowResize;
  this.UpdateSeparatorStyle();
  if(!this.IsLastPane())
   this.nextPane.UpdateSeparatorStyle();
 },
 RaiseResizedEvent: function() {
  this.splitter.RaiseEvent("PaneResized", this);
 },
 GetElement: function() {
  return this.helper.GetPaneElement();
 },
 SetSize: function(size) {
  if(!this.splitter.prepared)
   return;
  if(this.SetSizeCore(size)) {
   this.parent.ForEach("UpdateChildrenSize");
   this.parent.ForEach("AdjustControls");
   this.splitter.SynchronizeProperties();
  }
 },
 GetSize: function() {
  return this.size + this.sizeType;
 },
 SetSizeCore: function(size) {
  if(!_aspxIsExists(size))
   return false;
  if(typeof(size) == "string") {
   var parsedSize = parseInt(size);
   if(isNaN(parsedSize))
    return false;
   this.size = parsedSize;
   this.sizeType = (size.indexOf("%") > -1) ? "%" : "px";
  }
  else if(typeof(size) == "number") {
   this.size = size;
   this.sizeType = "px";
  }
  else
   return false;
  this.isSizePx = this.sizeType == "px";
  return true;
 }
});
ASPxClientSplitter.instances = {};
ASPxClientSplitter.GetInstance = function(name) {
 var instance = ASPxClientSplitter.instances[name];
 if(_aspxIsExists(instance)) {
  if(_aspxIsExists(instance.GetMainElement()))
   return instance;
  delete ASPxClientSplitter.instances[name]; 
 }
 return null;
};
ASPxClientSplitter.timerInterval = 0;
ASPxClientSplitter.GetRegEx = function(idPostfix) {
 if(!_aspxIsExists(this.regExs))
  this.regExs = {};
 if(!_aspxIsExists(this.regExs[idPostfix]))
  this.regExs[idPostfix] = "_\\d+(" + __aspxItemIndexSeparator + "\\d+)*_" + idPostfix + "$";
 return this.regExs[idPostfix];
};
ASPxClientSplitter.IsActualWindowResize = function() {
 var width = _aspxGetDocumentClientWidth();
 var height = _aspxGetDocumentClientHeight();
 if(width != ASPxClientSplitter.lastWindowResizeWidth || height != ASPxClientSplitter.lastWindowResizeHeight) {
  ASPxClientSplitter.lastWindowResizeWidth = width;
  ASPxClientSplitter.lastWindowResizeHeight = height;
  return true;
 }
 return false;
};
ASPxClientSplitter.SuspendedWindowResizeCore = function() {
 for(var name in ASPxClientSplitter.instances) {
  var instance = ASPxClientSplitter.GetInstance(name);
  if(_aspxIsExists(instance))
   instance.OnWindowResize();
 }
};
ASPxClientSplitter.mainWindowResizeTimeout = -1;
ASPxClientSplitter.additionalWindowResizeTimeout = -1;
ASPxClientSplitter.MainSuspendedWindowResize = function() {
 ASPxClientSplitter.SuspendedWindowResizeCore();
 ASPxClientSplitter.mainWindowResizeTimeout = _aspxClearTimer(ASPxClientSplitter.mainWindowResizeTimeout);
};
ASPxClientSplitter.AdditionalSuspendedWindowResize = function() {
 ASPxClientSplitter.SuspendedWindowResizeCore();
 ASPxClientSplitter.additionalWindowResizeTimeout = _aspxClearTimer(ASPxClientSplitter.additionalWindowResizeTimeout);
};
ASPxClientSplitter.OnWindowResize = function() {
 if(!ASPxClientSplitter.IsActualWindowResize())
  return;
 if(ASPxClientSplitter.additionalWindowResizeTimeout != -1)
  ASPxClientSplitter.additionalWindowResizeTimeout = _aspxClearTimer(ASPxClientSplitter.additionalWindowResizeTimeout);
 if(ASPxClientSplitter.mainWindowResizeTimeout == -1)
  ASPxClientSplitter.mainWindowResizeTimeout = _aspxSetTimeout(ASPxClientSplitter.MainSuspendedWindowResize, ASPxClientSplitter.timerInterval);
 else
  ASPxClientSplitter.additionalWindowResizeTimeout = _aspxSetTimeout(ASPxClientSplitter.AdditionalSuspendedWindowResize, 100);
};
ASPxClientSplitter.SaveCurrentPos = function(evt) {
 evt = _aspxGetEvent(evt);
 ASPxClientSplitter.CurrentXPos = _aspxGetEventX(evt);
 ASPxClientSplitter.CurrentYPos = _aspxGetEventY(evt);
};
ASPxClientSplitter.FindParentCell = function(element) {
 if(element.tagName != "TD") 
  element = _aspxGetParentByTagName(element, "TD");
 return element;
};
ASPxClientSplitter.FindSplitterInfo = function(evt, regex, suffixLength) {
 var element = ASPxClientSplitter.FindParentCell(_aspxGetEventSource(evt));
 if(_aspxIsExists(element)) {
  var matchResult = element.id.match(regex);
  if(_aspxIsExists(matchResult)) {
   var name = element.id.substring(0, matchResult.index);
   var splitter = ASPxClientSplitter.GetInstance(name);
   if(splitter != null) {
    var panePath = element.id.substring(matchResult.index + 1, element.id.length - suffixLength);
    return { "splitter" : splitter, "panePath" : panePath };
   }
  }  
 }
 return null;
};
ASPxClientSplitter.OnMouseClick = function(evt) {
 var info = ASPxClientSplitter.FindSplitterInfo(evt, ASPxClientSplitter.GetRegEx("S_CF"), 5);
 if(_aspxIsExists(info))
  info.splitter.OnCollapseButtonClick(info.panePath, true);
 else {
  info = ASPxClientSplitter.FindSplitterInfo(evt, ASPxClientSplitter.GetRegEx("S_CB"), 5);
  if(_aspxIsExists(info))
   info.splitter.OnCollapseButtonClick(info.panePath, false);
 } 
};
ASPxClientSplitter.OnMouseDown = function(evt) {
 var info = ASPxClientSplitter.FindSplitterInfo(evt, ASPxClientSplitter.GetRegEx("S"), 2);
 if(!_aspxIsExists(info)) 
  info = ASPxClientSplitter.FindSplitterInfo(evt, ASPxClientSplitter.GetRegEx("S_CS"), 5);
 if(_aspxIsExists(info) && _aspxIsExists(info.splitter)) {
  _aspxSetElementSelectionEnabled(document.body, false);
  ASPxClientSplitter.current = info.splitter;
  ASPxClientSplitter.SaveCurrentPos(evt);
  ASPxClientSplitter.isInMove = info.splitter.OnSeparatorMouseDown(info.panePath);
 }
};
ASPxClientSplitter.OnMouseUp = function() {
 if(ASPxClientSplitter.isInMove) {
  ASPxClientSplitter.isInMove = false;
  _aspxSetElementSelectionEnabled(document.body, true);
  ASPxClientSplitter.current.OnSeparatorMouseUp();
 }
};
ASPxClientSplitter.mouseMoveTimeoutId = -1;
ASPxClientSplitter.SuspendedMouseMove = function() {
 if(ASPxClientSplitter.isInMove)
  ASPxClientSplitter.current.OnMouseMove();
 ASPxClientSplitter.mouseMoveTimeoutId = _aspxClearTimer(ASPxClientSplitter.mouseMoveTimeoutId);
};
ASPxClientSplitter.OnMouseMove = function(evt) {
 if(!ASPxClientSplitter.isInMove)
  return;
 if(__aspxIE && !_aspxGetIsLeftButtonPressed(evt)) {
  ASPxClientSplitter.OnMouseUp(evt);
  return;
 }
 ASPxClientSplitter.SaveCurrentPos(evt);
 if(ASPxClientSplitter.mouseMoveTimeoutId == -1)
  ASPxClientSplitter.mouseMoveTimeoutId = _aspxSetTimeout(ASPxClientSplitter.SuspendedMouseMove, ASPxClientSplitter.timerInterval);
};
_aspxAttachEventToElement(window, "resize", ASPxClientSplitter.OnWindowResize);
_aspxAttachEventToDocument("click", ASPxClientSplitter.OnMouseClick);
_aspxAttachEventToDocument("mousedown", ASPxClientSplitter.OnMouseDown);
_aspxAttachEventToDocument("mouseup", ASPxClientSplitter.OnMouseUp);
_aspxAttachEventToDocument("mousemove", ASPxClientSplitter.OnMouseMove);
ASPxClientSplitterPaneEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(pane) {
  this.constructor.prototype.constructor.call(this, pane);
  this.pane = pane;
 }
});
ASPxClientSplitterPaneCancelEventArgs = _aspxCreateClass(ASPxClientSplitterPaneEventArgs, {
 constructor: function(pane) {
  this.constructor.prototype.constructor.call(this, pane);
  this.cancel = false;
 }
});
ASPxClientRatingControl = _aspxCreateClass(ASPxClientControl, {
 __isASPxRatingControl: true,
 INDEX_DEFAULT: 0,
 INDEX_USER: 1,
 INDEX_CHECKED: 2,
 INDEX_HOVER: 3,
 FILLPRECISION_EXACT: 0,
 FILLPRECISION_HALF: 1,   
 FILLPRECISION_FULL: 2, 
 constructor: function(name){
  this.constructor.prototype.constructor.call(this, name);
  this.itemCount = 0;
  this.itemWidth = 0;
  this.itemHeight = 0;
  this.mainDiv = null;
  this.checkedDiv = null;
  this.hoverDiv = null;
  this.titles = [ ];
  this.fillPrecision = 0;
  this.ItemClick = new ASPxClientEvent();  
 },
 SetDimensions: function(itemCount, itemWidth, itemHeight) {
  this.itemCount = itemCount;
  this.itemWidth = itemWidth;
  this.itemHeight = itemHeight;
 },
 Initialize: function() {
  this.constructor.prototype.Initialize.call(this);
  this.AddAnchors();
  if(__aspxIE && __aspxBrowserVersion < 7) { 
   this.GetMainDiv().style.fontSize = "0";
   this.GetCheckedDiv().style.fontSize = "0";
   this.GetHoverDiv().style.fontSize = "0";
  }
 },
 AddAnchors: function() {
  var div = this.GetMainDiv();  
  if(div.lastChild.nodeName == "A")
   return;
  for(var i = 0; i < this.itemCount; i++) 
   div.appendChild(this.CreateAnchor(i))
 },
 CreateAnchor: function(index) {
  var anchor = document.createElement("a");  
  anchor.style.width = this.itemWidth + "px";
  anchor.style.height = this.itemHeight + "px";
  anchor.style.marginLeft = index * this.itemWidth + "px";
  anchor.style.marginTop = -this.itemHeight + "px";
  anchor.style.display = "block";
  _aspxSetAttribute(anchor, "DXIndex", index); 
  if(_aspxIsExists(this.titles) && _aspxIsExists(this.titles[index])) {
   _aspxSetAttribute(anchor, "title", this.titles[index]);
  } else if(_aspxIsExists(this.toolTip)) {
     _aspxSetAttribute(anchor, "title", this.toolTip);
  }
  if(!this.GetReadOnly())  
   _aspxSetAttribute(anchor, "href", "javascript:aspxRatingControlVote('" + this.name + "'," + index + ")");
  return anchor;
 },
 GetChildDiv: function(parent){
  for(var i = 0; i < parent.childNodes.length; i++) {
   var child = parent.childNodes[i];
   if(child.tagName == "DIV")
    return child;
  }
 },
 GetMainDiv: function() {
  if(this.mainDiv == null)
   this.mainDiv = this.GetMainElement();
  return this.mainDiv;
 },
 GetCheckedDiv: function() {
  if(this.checkedDiv == null)
   this.checkedDiv = this.GetChildDiv(this.GetMainDiv());
  return this.checkedDiv;
 },
 GetHoverDiv: function() {
  if(this.hoverDiv == null)
   this.hoverDiv = this.GetChildDiv(this.GetCheckedDiv());
  return this.hoverDiv;
 },
 GetHiddenField: function() {
    return _aspxGetElementById(this.name + "S");
 }, 
 GetCurrentState: function() {
  var state = this.GetHiddenField().value.split(";");    
  return [state[0] == "T", Number(state[1])];
 },
 UpdateStateInput: function(readOnly, value) {
  this.GetHiddenField().value = (readOnly ? "T" : "F") + ";" + value;
 }, 
 GetReadOnly: function() {    
  return this.GetCurrentState()[0];
 },
 SetReadOnly: function(readOnly) {
  if(readOnly)
   this.DisabledAnchors();
  else 
   this.EnabledAnchors();
  this.UpdateStateInput(readOnly, this.GetValue());
 },
 DisabledAnchors: function() {
  var collection = this.GetMainDiv().childNodes;
  for(var i = 0; i < collection.length; i++) {
   if(collection[i].nodeName == "A") {       
    _aspxRemoveAttribute(collection[i], "href");
   }
  }
 },
 EnabledAnchors: function() {
  var collection = this.GetMainDiv().childNodes;
  for(var i = 0; i < collection.length; i++) {
   if(collection[i].nodeName == "A") {       
    _aspxSetAttribute(collection[i], "href", "javascript:aspxRatingControlVote('" + 
     this.name + "'," + collection[i].attributes.getNamedItem("DXIndex").value + ")");
   }
  }
 },
 GetValue: function() {
  return this.GetCurrentState()[1];
 },
 SetValue: function(value, isUi){
  if(value > this.itemCount)
   value = this.itemCount;
  this.UpdateStateInput(this.GetReadOnly(), value);
  this.UpdateCheckDiv(value, isUi);
  this.UpdateHoverDiv(-1);
 },
 UpdateCheckDiv: function(value, isUi){
  var div = this.GetCheckedDiv();
  var index = isUi ? this.INDEX_USER : this.INDEX_CHECKED;
  div.style.backgroundPosition = "0 " + (-this.itemHeight * index) + "px";
  if(!isUi)
   value = this.QuantizeValue(value);
  div.style.width = this.itemWidth * value + "px";
 },
 QuantizeValue: function(input) {
  switch(this.fillPrecision) {
   case this.FILLPRECISION_EXACT:
    return input;
   case this.FILLPRECISION_FULL:
    return Math.round(input);
   case this.FILLPRECISION_HALF:
    return Math.round(input * 2) / 2;
  }
 },
 HandleVote: function(index) {
  if(this.GetReadOnly())
   return;
  this.SetValue(index + 1, true);
  var processOnServer = this.RaiseItemClick(index);
  if(processOnServer)
   this.SendPostBack(index);
 },
 HandleMouseMove: function(htmlEvent) {
  var index = this.GetItemIndexAtCursor(htmlEvent);
  if(index != -1)
   this.UpdateHoverDiv(index);  
 },
 HandleMouseOut: function() {
  this.UpdateHoverDiv(-1);
 },
 GetItemIndexAtCursor: function(htmlEvent) {
  if(_aspxGetEventSource(htmlEvent).nodeName == "A")
   return parseInt(_aspxGetEventSource(htmlEvent).attributes.getNamedItem("DXIndex").value);
  return -1;
 },
 UpdateHoverDiv: function(itemIndex) {
  this.GetHoverDiv().style.width = (itemIndex + 1) * this.itemWidth + "px";
 },
 RaiseItemClick: function(index){
  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("ItemClick");
  if(!this.ItemClick.IsEmpty()){
   var args = new ASPxClientRatingControlItemClickEventArgs(processOnServer, index);
   this.ItemClick.FireEvent(this, args);
   processOnServer = args.processOnServer;
  }
  return processOnServer;
 }
});
ASPxClientRatingControl.Cast = ASPxClientControl.Cast;
ASPxClientRatingControl.elementUnderCursor = null;
ASPxClientRatingControl.active = null;
ASPxClientRatingControl.DocMouseMoveHandler = function(htmlEvent) {
 var element = _aspxGetEventSource(htmlEvent);
 if(element == ASPxClientRatingControl.elementUnderCursor)
  return;
 ASPxClientRatingControl.elementUnderCursor = element;
 for(var i = 0; i < 3 && element != null; i++) {
  if(element.id) {
   var obj = aspxGetControlCollection().Get(element.id);
   if(obj != null && obj.__isASPxRatingControl) {
    if(ASPxClientRatingControl.active != null)
     ASPxClientRatingControl.active.HandleMouseOut();   
    ASPxClientRatingControl.active = obj;
    if(!obj.GetReadOnly())
     obj.HandleMouseMove(htmlEvent);
    return;
   }   
  }
  element = element.parentNode;
 }
 if(ASPxClientRatingControl.active != null) {
  ASPxClientRatingControl.active.HandleMouseOut();
  ASPxClientRatingControl.active = null;
 }
};
function aspxRatingControlVote(name, index) {
 var control = aspxGetControlCollection().Get(name);
 if(control)
  control.HandleVote(index);
}
ASPxClientRatingControlItemClickEventArgs = _aspxCreateClass(ASPxClientProcessingModeEventArgs, {
 constructor: function(processOnServer, index){
  this.constructor.prototype.constructor.call(this, processOnServer);
  this.index = index;
 }
});
ASPxClientRatingControl.handlerAssigned = false;
if(!ASPxClientRatingControl.handlerAssigned) {
 _aspxAttachEventToDocument("mousemove", ASPxClientRatingControl.DocMouseMoveHandler);
 ASPxClientRatingControl.handlerAssigned = true;
}

ASPxClientNewsControl = _aspxCreateClass(ASPxClientDataView, {
 constructor: function(name){
  this.constructor.prototype.constructor.call(this, name);
  this.sizingConfig.allowSetHeight = false;
  this.TailClick = new ASPxClientEvent();  
 },
 DoTailClick: function(itemName, evt){
  var clickedElement = _aspxGetEventSource(evt);
  this.OnTailClick(clickedElement, itemName, evt);
 }, 
 OnTailClick: function(clickedElement, itemName, htmlEvent) {
  var itemElement = clickedElement;  
  if(_aspxIsExists(itemElement)) {
   var processOnServer = this.RaiseTailClick(itemElement, itemName, htmlEvent);  
   var hasItemLink = this.GetLinkElement(itemElement) != null;
   if(processOnServer && !hasItemLink) {      
    this.SendPostBack("CLICK:" + itemName);
   }
  }
 },
 RaiseTailClick: function(tailElement, itemName, htmlEvent){
  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("TailClick");
  if(!this.TailClick.IsEmpty()){
   var args = new ASPxClientNewsControlItemEventArgs(processOnServer, itemName, tailElement, htmlEvent);
   this.TailClick.FireEvent(this, args);
   processOnServer = args.processOnServer;
  }
  return processOnServer;
 }
});
ASPxClientNewsControl.Cast = ASPxClientControl.Cast;
ASPxClientNewsControlItemEventArgs = _aspxCreateClass(ASPxClientProcessingModeEventArgs, {
 constructor: function(processOnServer, name, htmlElement, htmlEvent){
  this.constructor.prototype.constructor.call(this, processOnServer);
  this.name = name;
  this.htmlElement = htmlElement;
  this.htmlEvent = htmlEvent;
 }
});
function aspxHLTClick(evt, name, itemName) {
 var control = aspxGetControlCollection().Get(name);
 if(control != null) control.DoTailClick(itemName, evt);
}
