var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } { let window = _____WB$wombat$assign$function_____("window"); let self = _____WB$wombat$assign$function_____("self"); let document = _____WB$wombat$assign$function_____("document"); let location = _____WB$wombat$assign$function_____("location"); let top = _____WB$wombat$assign$function_____("top"); let parent = _____WB$wombat$assign$function_____("parent"); let frames = _____WB$wombat$assign$function_____("frames"); let opener = _____WB$wombat$assign$function_____("opener"); ASPxClientTabControlBase = _aspxCreateClass(ASPxClientControl, { ActiveRowItemCssClass: "dxtc-activeRowItem", constructor: function(name) { this.constructor.prototype.constructor.call(this, name); this.activeTabIndex = 0; this.callbackCount = 0; this.cookieName = ""; this.emptyHeight = false; this.emptyWidth = false; this.tabsHeight = null; this.tabAlign = "Left"; this.tabPosition = "Top"; this.tabCount = 0; this.tabs = []; this.tabsContentRequest = []; this.enableScrolling = !!this.GetScrollVisibleArea(); this.firstShownTabIndex = 0; this.scrollManager = null; this.scrollingFillerElementWidth = 5000; this.handleClickOnWholeTab = true; this.sizingConfig.correction = true; this.sizingConfig.adjustControl = true; this.liteRender = false; this.TabClick = new ASPxClientEvent(); this.ActiveTabChanged = new ASPxClientEvent(); this.ActiveTabChanging = new ASPxClientEvent(); this.InitializeOnResize(); }, Initialize: function() { this.constructor.prototype.Initialize.call(this); if(!this.liteRender) this.CorrrectCellsBounds(true); if(!this.ShouldInitializeControlInline()) this.InitializeTabControl(); if(this.liteRender) this.AdjustPageContentsSizeLite(); }, InlineInitialize: function() { if(this.liteRender) { this.PrepareControlElementsLite(); var tabsCell = this.GetTabsCell(); if(tabsCell) aspxAssignAccessabilityEventsToChildrenLinks(tabsCell); } if(this.enableScrolling) { this.InitializeScrolling(); this.GetScrollableArea().style.position = "relative"; var sva = this.GetScrollVisibleArea(); sva.style.overflow = "hidden"; sva.style.position = "relative"; if(this.liteRender) _aspxSetElementFloat(sva, this.rtl ? "right" : "left"); } this.InitializeEnabledAndVisible(); if(!this.liteRender) this.CorrrectCellsBounds(true); if(this.ShouldInitializeControlInline()) this.InitializeTabControl(); }, OnBrowserWindowResizeInternal: function(evt) { if(_aspxIsExistsElement(this.GetMainElement()) && this.AdjustOnWindowResize()) this.AdjustControl(); }, AdjustOnWindowResize: function() { return (this.enableScrolling || this.liteRender) && (this.IsPercentageSize(this.GetMainElement(), "width")); }, InitializeEnabledAndVisible: function() { for(var i = 0; i < this.tabs.length; i++) { this.SetTabVisible(i, this.tabs[i].clientVisible, true); this.SetTabEnabled(i, this.tabs[i].clientEnabled, true); } }, InitializeCallBackData: function() { var element = this.GetContentElement(this.activeTabIndex); if(element != null) element.loaded = true; }, InitializeOnResize: function() { var element = this.GetMainElement(); if(element && !this.liteRender) element.onresize = new Function("aspxTCResize(\"" + this.name + "\");"); }, ShouldInitializeControlInline: function() { return this.liteRender ? !(__aspxIE && __aspxBrowserVersion < 8) : !this.IsPercentageSize(this.GetMainElement(), "width"); }, InitializeTabControl: function() { if(this.liteRender) { var mainElem = this.GetMainElement(); if(this.IsPercentageSize(this.GetMainElement(), "width")) mainElem.style.overflow = "visible"; if(this.enableScrolling) { this.RecalculateTabStripWidthLite(); this.AdjustTabScrolling(true, false); } else { this.StoreInitialIndentsSize(); this.AdjustTabControlSizeLite(); } } else { if(this.enableScrolling) this.AdjustTabScrolling(true, false); } if(this.IsMultiRow()) this.PlaceActiveTabRowToBottom(this.activeTabIndex); }, StoreInitialIndentsSize: function() { var leftIndent = this.GetLeftIndentLite(); var rightIndent = this.GetRightIndentLite(); var dimension = this.IsTopBottomTabPosition() ? "width" : "height"; this.minLeftIndentSizeLite = leftIndent ? _aspxPxToInt(_aspxGetCurrentStyle(leftIndent)[dimension]) : 0; this.minRightIndentSizeLite = rightIndent ? _aspxPxToInt(_aspxGetCurrentStyle(rightIndent)[dimension]) : 0; }, InitializeScrolling: function() { this.scrollManager = new ASPxScrollingManager(this, this.GetScrollableArea(), [1, 0], this.OnBeforeScrolling, this.OnAfterScrolling, true); this.scrollManager.scrollSessionInterval = 5; this.scrollManager.animationAcceleration = 0.5; this.InitializeScrollButton(this.GetScrollLeftButtonElement()); this.InitializeScrollButton(this.GetScrollRightButtonElement()); }, InitializeScrollButton: function(button) { if(!button || !button.id) return; var img = _aspxGetChildByTagName(button, "IMG", 0); _aspxPreventElementDrag(img); _aspxSetElementSelectionEnabled(img, false); _aspxSetElementSelectionEnabled(button, false); var manager = this.scrollManager; var dir = button.id.charAt(button.id.length - 1) == "R" ? 1 : -1; if(this.enabled) { _aspxAttachEventToElement(button, "mousedown", function(e) { manager.StartScrolling(dir, 5, 5); }); _aspxAttachEventToElement(button, "mouseup", function(e) { manager.StopScrolling(); }); if(__aspxIE) { _aspxAttachEventToElement(button, "dblclick", function(e) { manager.StartScrolling(dir, 5, 5); manager.StopScrolling(); }); } } }, ScrollToShowTab: function(tabIndex, doAnimation) { if(!this.GetVisibleTabElement(tabIndex)) return; var getWidtn = function(tc, index) { var res = 0; var tab = tc.GetVisibleTabElement(index); var separator = tc.GetSeparatorElement(index); if(tab && tab.style.display !== 'none') res += tab.offsetWidth; if(separator && separator.style.display !== 'none') res += separator.offsetWidth; return res; }; var startIndex = this.firstShownTabIndex; var endIndex = tabIndex; var scrollToRight = !this.rtl; if(tabIndex < this.firstShownTabIndex) { startIndex = tabIndex; endIndex = this.firstShownTabIndex - 1; scrollToRight = !scrollToRight; } var width = 0; var shift = 0; var tabCount = 0; var scrollVisibleAreaWidth = this.GetScrollVisibleArea().offsetWidth; for(var i = startIndex; i <= endIndex; i++) width += getWidtn(this, i); for(var i = startIndex; i <= endIndex; i++) { var diff = width - shift; if(__aspxIE && __aspxBrowserVersion > 8) diff -= 1; if(diff > scrollVisibleAreaWidth || !(scrollToRight ^ this.rtl)) { shift += getWidtn(this, i); tabCount++; } } if(this.GetVisibleTabElement(tabIndex).offsetWidth >= scrollVisibleAreaWidth && scrollToRight ^ this.rtl) { tabCount--; shift -= getWidtn(this, tabIndex); } if(shift <= 0) return; this.firstShownTabIndex += tabCount * (scrollToRight ^ this.rtl ? 1 : -1); if(doAnimation) { this.scrollManager.animationOffset = this.GetScrollAnimationOffset(this.firstShownTabIndex); this.scrollManager.PrepareForScrollAnimation(); this.scrollManager.DoScrollSessionAnimation(scrollToRight ? -1 : 1); } else { this.scrollManager.SetScrolledAreaPosition(this.scrollManager.GetScrolledAreaPosition() + this.GetScrollAnimationOffset(this.firstShownTabIndex) * (scrollToRight ? -1 : 1)); } }, OnBeforeScrolling: function(manager, direction) { var tc = manager.owner; if(tc.IsFullyScrolledToLeft() && direction < 0 || tc.IsFullyScrolledToRight() && direction > 0) { manager.StopScrolling(); return; } var prevFirstShownTabIndex = tc.firstShownTabIndex; var diff = (direction > 0 ^ tc.rtl) ? 1 : -1; do { if(tc.firstShownTabIndex <= 0 && diff < 0 || tc.firstShownTabIndex >= tc.tabs.length - 1 && diff > 0) break; tc.firstShownTabIndex += diff; } while(!tc.IsTabVisible(tc.firstShownTabIndex)); manager.animationOffset = tc.GetScrollAnimationOffset(tc.firstShownTabIndex); }, OnAfterScrolling: function(manager, direction) { manager.owner.UpdateScrollButtonsEnabled(); }, AdjustTabScrolling: function(scrollToActiveTab, doAnimation) { if(!this.GetMainElement()) return; this.UpdateScrollButtonsVisible(); if(scrollToActiveTab) this.ScrollToShowTab(this.activeTabIndex, doAnimation); if(this.enabled) this.UpdateScrollButtonsEnabled(); if(this.liteRender) this.AdjustPageContentsSizeLite(); }, GetScrollAnimationOffset: function(newFirstShownTabIndex) { var newPos = 0; var i = this.GetNextVisibleTabIndex(-1); while(i < newFirstShownTabIndex) { newPos += this.GetVisibleTabElement(i).offsetWidth; var separator = this.GetSeparatorElement(i); newPos += separator && separator.offsetWidth; i = this.GetNextVisibleTabIndex(i); } if(this.rtl) newPos = -newPos; return Math.abs(this.scrollManager.GetScrolledAreaPosition() + newPos); }, AdjustScrollVisibleAreaWidth: function() { var sva = this.GetScrollVisibleArea(); var mainElement = this.GetMainElement(); if(mainElement.style.width == "" || mainElement.style.width == "0px") { _aspxSetOffsetWidth(sva, this.GetScrollableAreaWidth()); return; } _aspxSetOffsetWidth(sva, 1); if(this.liteRender) { var scrollWrapper = _aspxGetChildNodesByClassName(mainElement, "dxtc-wrapper")[0]; var c = _aspxGetElementNodes(scrollWrapper); var restWidth = 0; for(var i = 0; i < c.length; i++) restWidth += c[i].offsetWidth; restWidth = restWidth - sva.offsetWidth - this.GetStripContainerBordersAndPaddingsSummaryValueLite(); var svaWidth = this.GetControlInnerSizeLite() - restWidth; _aspxSetOffsetWidth(sva, svaWidth); var scrollWrapperWidth = restWidth + svaWidth; if(__aspxIE && __aspxBrowserVersion < 7) scrollWrapperWidth += 3; _aspxSetOffsetWidth(scrollWrapper, scrollWrapperWidth); } else { var activeTabContentElement = this.GetContentElement(this.activeTabIndex); if(activeTabContentElement) _aspxSetElementDisplay(activeTabContentElement, false); sva.style.width = sva.parentNode.offsetWidth + "px"; if(activeTabContentElement) _aspxSetElementDisplay(activeTabContentElement, true); } if(this.liteRender) this.RecalculateTabStripWidthLite(); }, UpdateScrollButtonsEnabled: function() { if(!this.IsStateControllerEnabled()) return; aspxGetStateController().SetElementEnabled(this.GetScrollLeftButtonElement(), !this.IsFullyScrolledToLeft()); aspxGetStateController().SetElementEnabled(this.GetScrollRightButtonElement(), !this.IsFullyScrolledToRight()); }, UpdateScrollButtonsVisible: function() { this.AdjustScrollVisibleAreaWidth(); var scrollButtonsVisible = this.GetScrollVisibleArea().offsetWidth < this.GetScrollableAreaWidth(); _aspxSetElementDisplay(this.GetScrollLeftButtonContainer(), scrollButtonsVisible); _aspxSetElementDisplay(this.GetScrollRightButtonContainer(), scrollButtonsVisible); if(!scrollButtonsVisible) this.ScrollToShowTab(0, true); this.AdjustScrollVisibleAreaWidth(); }, GetScrollableAreaWidth: function() { return this.GetScrollableArea().offsetWidth - this.scrollingFillerElementWidth; }, IsFullyScrolledToLeft: function() { if(!this.rtl) return _aspxPxToInt(this.GetScrollableArea().style.left) >= 0 || this.GetPrevVisibleTabIndex(this.firstShownTabIndex) < 0; var visibleWidth = this.GetScrollableAreaWidth() - _aspxPxToInt(this.GetScrollableArea().style.left); return visibleWidth <= this.GetScrollVisibleArea().offsetWidth || this.GetNextVisibleTabIndex(this.firstShownTabIndex) < 0; }, IsFullyScrolledToRight: function() { if(this.rtl) return _aspxPxToInt(this.GetScrollableArea().style.left) <= 0 || this.GetPrevVisibleTabIndex(this.firstShownTabIndex) < 0; var visibleWidth = this.GetScrollableAreaWidth() + _aspxPxToInt(this.GetScrollableArea().style.left); return visibleWidth <= this.GetScrollVisibleArea().offsetWidth || this.GetNextVisibleTabIndex(this.firstShownTabIndex) < 0; }, PrepareControlElementsLite: function() { this.PrepareTabStripLite(); this.PrepareContentElementsLite(); }, PrepareTabStripLite: function() { var mainElem = this.GetMainElement(); var idPrefix = mainElem.id; var c = _aspxGetDescendantNodesByClassName(mainElem, "dxtc-strip"); if(c.length > 0) { var tabStrip = c[0]; tabStrip.id = idPrefix + this.GetTabsCellID(); } }, PrepareContentElementsLite: function() { var mainElem = this.GetMainElement(); var contentContainer = this.GetContentContainerElementLite(); if(!contentContainer) return; contentContainer.id = mainElem.id + this.GetContentsCellID(); if(!this.GetTabsCell() && contentContainer.style.cssText) contentContainer.style.cssText = _aspxCreateImportantCssText(contentContainer.style.cssText); }, AdjustPageContentsSizeLite: function() { var mainElem = this.GetMainElement(); var contentContainer = this.GetContentsCell(); if(!contentContainer) return; var c = _aspxGetChildNodes(mainElem, function(e) { return e.className && !_aspxElementHasCssClass(e, "dxtc-content"); }); var restSize = 0; this.SetElementSizeLite(contentContainer, this.GetControlInnerSizeLite()); if(this.IsTopBottomTabPosition()) { if(mainElem.style.height != "") { contentContainer.style.height = ""; for(var i = 0; i < c.length; i++) restSize += this.GetElementOffsetSizeLite(c[i], "height"); _aspxSetOffsetHeight(contentContainer, mainElem.offsetHeight - restSize); } } else { if(mainElem.style.width != "") { contentContainer.style.width = ""; for(var i = 0; i < c.length; i++) restSize += this.GetElementOffsetSizeLite(c[i], "width"); _aspxSetOffsetWidth(contentContainer, mainElem.offsetWidth - restSize); } } }, GetContentContainerElementLite: function() { var c = _aspxGetChildNodesByClassName(this.GetMainElement(), "dxtc-content"); return c.length > 0 ? c[0] : null; }, GetControlInnerSizeLite: function() { if(this.IsTopBottomTabPosition()) return this.GetControlInnerSizeCoreLite("width"); return this.GetControlInnerSizeCoreLite("height"); }, SetInnerElementsVisibility: function(parent, visible) { var elements = _aspxGetElementNodes(parent); for(var i = 0; i < elements.length; i++) _aspxSetElementDisplay(elements[i], visible); }, RequireContentMeasurement: function(mainElement, dimension) { return this.IsPercentageSize(mainElement, dimension) || !mainElement.style[dimension]; }, GetControlInnerSizeCoreLite: function(dimension) { var mainElement = this.GetMainElement(); var res = 0; if(dimension == "width" && !mainElement.style.height) { _aspxSetOffsetHeight(mainElement, this.GetHeight()); var heightLocked = true; } if(this.RequireContentMeasurement(mainElement, dimension)) { this.SetInnerElementsVisibility(mainElement, false); res = this.GetElementOffsetSizeLite(mainElement, dimension); this.SetInnerElementsVisibility(mainElement, true); } else { res = this.GetElementOffsetSizeLite(mainElement, dimension); } if(heightLocked) mainElement.style.height = null; res = Math.max(res, this.GetContentSize(dimension)); if(!this.enableScrolling) res = Math.max(res, this.GetStripSizeLite() + this.minLeftIndentSizeLite + this.minRightIndentSizeLite); return res - this.GetElementBordersAndPaddingsLite(mainElement, dimension); }, GetContentSize: function(dimension) { var contentContainer = this.GetContentContainerElementLite(); if(!contentContainer) return 0; contentContainer.style[dimension] = ""; var result = this.GetElementBordersAndPaddingsLite(contentContainer, dimension); var contentElement = this.GetContentElement(this.activeTabIndex); if(contentElement) result += this.GetElementOffsetSizeLite(contentElement, dimension); return result; }, GetElementOffsetSizeLite: function(element, demension) { if(__aspxIE && __aspxBrowserVersion > 8 || __aspxFirefox && __aspxBrowserVersion > 12) { var computedStyle = window.getComputedStyle(element, null); var result; if(demension == "width") result = _aspxPxToFloat(computedStyle.width); else result = _aspxPxToFloat(computedStyle.height); return result + this.GetElementBordersAndPaddingsLite(element, demension); } if(demension == "width") return element.offsetWidth; return element.offsetHeight; }, GetElementBordersAndPaddingsLite: function(element, demension) { if(demension == "width") return _aspxGetLeftRightBordersAndPaddingsSummaryValue(element); return _aspxGetTopBottomBordersAndPaddingsSummaryValue(element); }, IsPercentageSize: function(element, dimension) { return element.style[dimension].indexOf("%") > -1; }, AdjustTabControlSizeLite: function() { if(!this.GetTabsCell()) { this.AdjustPageContentsSizeLite(); return; } this.PrepareStripsForIE("none", "both"); this.CorrectTabsWidthLite(); var controlSize = this.GetControlInnerSizeLite(); var tabsSize = this.GetStripSizeLite(); var indentsSize = controlSize - tabsSize - this.GetStripContainerBordersAndPaddingsSummaryValueLite(); switch(this.tabAlign) { case "Left": indentsSize = indentsSize - this.GetElementSizeLite(this.GetLeftIndentLite()); this.SetElementSizeLite(this.GetRightIndentLite(), Math.max(indentsSize, this.minLeftIndentSizeLite)); break; case "Right": indentsSize = indentsSize - this.GetElementSizeLite(this.GetRightIndentLite()); this.SetElementSizeLite(this.GetLeftIndentLite(), Math.max(indentsSize, this.minRightIndentSizeLite)); break; case "Center": indentsSize = Math.floor(indentsSize / 2); this.SetElementSizeLite(this.GetLeftIndentLite(), Math.max(indentsSize, this.minLeftIndentSizeLite)); indentsSize = controlSize - (tabsSize + indentsSize) - this.GetStripContainerBordersAndPaddingsSummaryValueLite() this.SetElementSizeLite(this.GetRightIndentLite(), Math.max(indentsSize, this.minRightIndentSizeLite)); break; default: indentsSize = this.GetElementSizeLite(this.GetLeftIndentLite()) + this.GetElementSizeLite(this.GetRightIndentLite()); tabsSize = controlSize - indentsSize; } if(this.IsMultiRow() || this.tabAlign == "Justify") { this.SetStripMarginsLite(0, false); this.SetStripSizeLite(tabsSize - this.GetStripContainerBordersAndPaddingsSummaryValueLite()); this.SetStripMarginsLite(this.GetLeftIndentLite().offsetWidth, true); } this.RecalculateTabStripWidthLite(); this.AdjustPageContentsSizeLite(); this.PrepareStripsForIE(this.rtl ? "right" : "left", "none"); }, PrepareStripsForIE: function(indentClearAttribute, lineBreakClearAttribute) { if(__aspxIE && __aspxBrowserVersion < 8 && this.IsMultiRow()) { var leftIndent = this.GetLeftIndentLite(); leftIndent.style.clear = indentClearAttribute; var c = _aspxGetDescendantNodesByClassName(this.GetMainElement(), "dxtc-lineBreak"); for(var i = 0; i < c.length; i++) c[i].style.clear = lineBreakClearAttribute; } }, GetStripContainerBordersAndPaddingsSummaryValueLite: function() { if(this.IsTopBottomTabPosition() && !this.enableScrolling) return _aspxGetLeftRightBordersAndPaddingsSummaryValue(this.GetTabsCell()); if(this.enableScrolling) return _aspxGetLeftRightBordersAndPaddingsSummaryValue(this.GetScrollVisibleArea().parentNode); return _aspxGetTopBottomBordersAndPaddingsSummaryValue(this.GetTabsCell()); }, GetStripSizeLite: function() { var prevSize = 0; var size = 0; var tab; for(var i = 0; i < this.tabCount; i++) { tab = this.GetVisibleTabElement(i); if(!tab) continue; if(_aspxElementHasCssClass(tab, "dxtc-n")) { prevSize = prevSize < size ? size : prevSize; size = 0; } size += this.GetElementSizeLite(tab) + this.GetElementSizeLite(this.GetSeparatorElement(i)); } return prevSize < size ? size : prevSize; }, GetTabRows: function() { var rows = []; var rowIndex = -1; var tabIndex = 0; while(tabIndex < this.tabCount) { if(!this.GetVisibleTabElement(tabIndex)) { tabIndex++; continue; } if(rowIndex < 0 || _aspxElementHasCssClass(this.GetVisibleTabElement(tabIndex), "dxtc-n")) { rowIndex++; rows[rowIndex] = []; } rows[rowIndex].push(tabIndex); tabIndex++; } return rows; }, SetStripSizeLite: function(size) { var spacerSize = this.GetTabSpaceSizeLite(); var rows = this.GetTabRows(); for(var i = 0; i < rows.length; i++) { var count = rows[i].length; var rowSize = size - spacerSize * (count - 1); var tabSize = Math.floor(rowSize / count); for(var index = 0; index < count; index++) { var s = tabSize + (index == count - 1 ? rowSize - count * tabSize : 0); this.SetElementSizeLite(this.GetTabElement(rows[i][index], true), s); this.SetElementSizeLite(this.GetTabElement(rows[i][index], false), s); } } }, GetTabSpaceSizeLite: function() { var spacers = _aspxGetChildNodesByClassName(this.GetTabsCell(), "dxtc-spacer"); if(spacers.length > 0) return this.GetElementSizeLite(spacers[0]); return 0; }, RecalculateTabStripWidthLite: function() { if(!this.IsTopBottomTabPosition()) return; var tabStrip = this.GetTabsCell(); var tabStripActualWidth = 0; _aspxSetOffsetWidth(tabStrip, 10000); var c = _aspxGetChildNodes(tabStrip, function(e) { return e.className && (_aspxElementHasCssClass(e, "dxtc-leftIndent") || _aspxElementHasCssClass(e, "dxtc-rightIndent")); }); for(var i = 0; i < c.length; i++) tabStripActualWidth += this.GetElementSizeLite(c[i]); tabStripActualWidth += this.GetStripSizeLite() + this.GetStripContainerBordersAndPaddingsSummaryValueLite(); if(this.enableScrolling) tabStripActualWidth += this.scrollingFillerElementWidth; if(__aspxIE) { if(__aspxBrowserVersion < 7) tabStripActualWidth += 3; if(__aspxBrowserVersion > 8) tabStripActualWidth = this.PrepareWidthForIE9(tabStripActualWidth); } _aspxSetOffsetWidth(tabStrip, tabStripActualWidth); if(__aspxIE) var silly = this.GetMainElement().offsetWidth; }, PrepareWidthForIE9: function(widthValue) { var res = Math.floor(widthValue); while(res < widthValue) res += 0.1; return res; }, CorrectTabsWidthLite: function() { if(!(__aspxIE && __aspxBrowserVersion < 8 && !this.IsTopBottomTabPosition())) return; var tabStrip = this.GetTabsCell(); var collection = _aspxGetElementNodes(tabStrip); var width = tabStrip.offsetWidth - _aspxGetLeftRightBordersAndPaddingsSummaryValue(tabStrip); if(this.prevTabStripWidth && this.prevTabStripWidth == width) return; for(var i = 0; i < collection.length; i++) _aspxSetOffsetWidth(collection[i], width); this.prevTabStripWidth = width; }, GetElementSizeLite: function(elem) { if(!elem) return 0; return this.IsTopBottomTabPosition() ? this.GetElementOffsetSizeLite(elem, "width") : this.GetElementOffsetSizeLite(elem, "height"); }, SetElementSizeLite: function(elem, newSize) { if(elem == null) return; if(this.IsTopBottomTabPosition()) _aspxSetOffsetWidth(elem, newSize); else _aspxSetOffsetHeight(elem, newSize); }, GetLeftIndentLite: function() { return _aspxGetChildrenByPartialClassName(this.GetMainElement(), 'dxtc-leftIndent')[0]; }, GetRightIndentLite: function() { return _aspxGetChildrenByPartialClassName(this.GetMainElement(), 'dxtc-rightIndent')[0]; }, GetTabsCellID: function() { return "_TC"; }, GetTabsCell: function() { return this.GetChild(this.GetTabsCellID()); }, GetTabElementID: function(index, active) { return "_" + (active ? "A" : "") + "T" + index; }, GetTabElement: function(index, active) { return this.GetChild(this.GetTabElementID(index, active)); }, GetVisibleTabElement: function(index) { return this.GetChild(this.GetTabElementID(index, index == this.activeTabIndex)); }, GetContentsCellID: function() { return "_CC"; }, GetContentsCell: function() { return this.GetChild(this.GetContentsCellID()); }, GetContentElementID: function(index) { return "_C" + index; }, GetContentElement: function(index) { return this.GetChild(this.GetContentElementID(index)); }, GetSeparatorElementID: function(index) { return "_T" + index + "S"; }, GetSeparatorElement: function(index) { return this.GetChild(this.GetSeparatorElementID(index)); }, GetLeftAlignCellElement: function() { return this.GetChild("_LAC"); }, GetRightAlignCellElement: function() { return this.GetChild("_RAC"); }, GetScrollVisibleAreaID: function() { return "_SVA"; }, GetScrollVisibleArea: function() { return this.GetChild(this.GetScrollVisibleAreaID()); }, GetScrollableArea: function() { if(this.liteRender) return this.GetTabsCell(); return _aspxGetChildByTagName(this.GetScrollVisibleArea(), "table", 0); }, GetScrollLeftButtonID: function() { return "_SBL"; }, GetScrollLeftButtonElement: function() { return this.GetChild(this.GetScrollLeftButtonID()); }, GetScrollLeftButtonContainer: function() { if(this.liteRender) return this.GetScrollLeftButtonElement().parentNode; return _aspxGetParentByTagName(this.GetScrollLeftButtonElement().parentNode, "TD"); }, GetScrollRightButtonID: function() { return "_SBR"; }, GetScrollRightButtonElement: function() { return this.GetChild(this.GetScrollRightButtonID()); }, GetScrollRightButtonContainer: function() { if(this.liteRender) return this.GetScrollRightButtonElement().parentNode; return _aspxGetParentByTagName(this.GetScrollRightButtonElement().parentNode, "TD"); }, GetTabLayoutElement: function(element) { if(!this.IsTopBottomTabPosition() && !this.liteRender) return element.parentNode; return element; }, GetActiveTabIndexInputElement: function(index) { return _aspxGetElementById(this.name + "ATI"); }, IsTopBottomTabPosition: function() { return (this.tabPosition == "Top" || this.tabPosition == "Bottom"); }, CorrrectCellsBounds: function(initialization) { if(this.isInitialized || initialization) window.setTimeout("aspxTCCorrectBounds(\"" + this.name + "\");", 1); }, CorrrectCellsBoundsTimer: function() { var mainElement = this.GetMainElement(); if(mainElement == null || mainElement.offsetWidth == 0 || mainElement.offsetHeight == 0) return; mainElement.corrected = true; if(__aspxIE && !this.emptyHeight && this.tabAlign != "Justify") { if(this.IsTopBottomTabPosition()) this.CorrectContentCellHeight(); else this.CorrectAlignCellsHeight(); } if((__aspxFirefox || __aspxWebKitFamily) && !this.emptyHeight && this.tabAlign == "Center") { if(!this.IsTopBottomTabPosition()) this.CorrectAlignCellsHeight(); } if((this.emptyHeight || __aspxOpera) && !this.IsTopBottomTabPosition()) { this.CorrectTabsCellHeight(); if(__aspxIE) this.CorrectAlignCellsHeight(); } if(this.emptyWidth && this.IsTopBottomTabPosition() && this.tabAlign != "Justify") this.CorrectTabsCellWidth(); this.CorrectOperaTabsCellAlignment(); this.CorrectOperaTabCellsAlignment(); }, CorrectTabsCellHeight: function() { var mainElement = this.GetMainElement(); var tabsCell = this.GetTabsCell(); if(mainElement != null && tabsCell) { var leftAlignCell = this.GetLeftAlignCellElement(); if(leftAlignCell != null) leftAlignCell.style.height = "auto"; var rightAlignCell = this.GetRightAlignCellElement(); if(rightAlignCell != null) rightAlignCell.style.height = "auto"; var tabsTable = tabsCell.firstChild; var tabsTableHeightCorrectionRequired = (__aspxChrome || __aspxSafari && __aspxBrowserVersion >= 4 || __aspxIE && __aspxBrowserVersion >= 8 || __aspxOpera) && !this.IsTopBottomTabPosition(); if(tabsTableHeightCorrectionRequired) tabsTable.style.height = "auto"; tabsCell.style.height = "auto"; tabsCell.style.height = mainElement.offsetHeight + "px"; if(tabsTableHeightCorrectionRequired) tabsTable.style.height = _aspxGetClearClientHeight(tabsCell) + "px"; if(leftAlignCell != null && rightAlignCell == null) leftAlignCell.style.height = "100%"; if(leftAlignCell == null && rightAlignCell != null) rightAlignCell.style.height = "100%"; if(leftAlignCell != null && rightAlignCell != null) { leftAlignCell.style.height = "50%"; rightAlignCell.style.height = "50%"; } } }, CorrectTabsCellWidth: function() { var mainElement = this.GetMainElement(); var tabsCell = this.GetTabsCell(); if(mainElement != null && tabsCell) { var leftAlignCell = this.GetLeftAlignCellElement(); if(leftAlignCell != null) leftAlignCell.style.width = "auto"; var rightAlignCell = this.GetRightAlignCellElement(); if(rightAlignCell != null) rightAlignCell.style.width = "auto"; tabsCell.style.width = "auto"; tabsCell.style.width = mainElement.clientWidth; if(leftAlignCell != null && rightAlignCell == null) leftAlignCell.style.width = "100%"; if(leftAlignCell == null && rightAlignCell != null) rightAlignCell.style.width = "100%"; if(leftAlignCell != null && rightAlignCell != null) { leftAlignCell.style.width = "50%"; rightAlignCell.style.width = "50%"; } } }, CorrectContentCellHeight: function() { var mainElement = this.GetMainElement(); var tabsCell = this.GetTabsCell(); var contentsCell = this.GetContentsCell(); if(mainElement != null && tabsCell != null && contentsCell != null) { if(this.tabsHeight == null) this.tabsHeight = tabsCell.clientHeight; tabsCell.style.height = this.tabsHeight + "px"; contentsCell.style.height = "auto"; contentsCell.style.height = (mainElement.clientHeight - this.tabsHeight) + "px"; } }, CorrectAlignCellsHeight: function() { var mainElement = this.GetMainElement(); var tabsCell = this.GetTabsCell(); if(mainElement != null && tabsCell != null) { var leftAlignCell = this.GetLeftAlignCellElement(); var rightAlignCell = this.GetRightAlignCellElement(); var tabsTable = tabsCell.firstChild; if(tabsTable != null) { if(leftAlignCell != null || rightAlignCell != null) { var tabsHeight = 0; for(var i = 0; i < tabsTable.rows.length; i++) { var cell = tabsTable.rows[i].cells[0]; if(cell != leftAlignCell && cell != rightAlignCell) tabsHeight += cell.offsetHeight; } if(leftAlignCell != null) leftAlignCell.style.height = "auto"; if(rightAlignCell != null) rightAlignCell.style.height = "auto"; var correctionHeight = mainElement.clientHeight - tabsHeight; if(correctionHeight < 0) correctionHeight = 0; if(leftAlignCell != null) leftAlignCell.style.height = ((rightAlignCell != null) ? Math.round(correctionHeight / 2) : correctionHeight) + "px"; if(rightAlignCell != null) rightAlignCell.style.height = ((leftAlignCell != null) ? Math.round(correctionHeight / 2) : correctionHeight) + "px"; } } } }, CorrectOperaTabsCellAlignment: function() { if(!__aspxOpera || this.tabAlign != "Justify") return; if(!this.IsTopBottomTabPosition() && !this.emptyHeight) return; var element = this.GetTabsCell(); _aspxSetElementDisplay(element, false); _aspxSetElementDisplay(element, true); }, CorrectOperaTabCellsAlignment: function() { if(!__aspxOpera || !this.IsTopBottomTabPosition()) return; var element = this.GetLeftAlignCellElement(); if(element != null) { _aspxSetElementDisplay(element, false); _aspxSetElementDisplay(element, true); } element = this.GetRightAlignCellElement(); if(element != null) { _aspxSetElementDisplay(element, false); _aspxSetElementDisplay(element, true); } }, FixControlSize: function() { this.FixElementSize(this.GetMainElement()); if(!this.liteRender) this.FixElementSize(this.GetContentsCell()); else { var c = this.GetContentsCell(); if(!c) return; var width = c.offsetWidth - _aspxGetLeftRightBordersAndPaddingsSummaryValue(c); var height = c.offsetHeight - _aspxGetTopBottomBordersAndPaddingsSummaryValue(c); _aspxChangeStyleAttribute(c, "width", width + "px"); _aspxChangeStyleAttribute(c, "height", height + "px"); } }, UnfixControlSize: function() { this.UnfixElementSize(this.GetMainElement()); this.UnfixElementSize(this.GetContentsCell()); }, FixElementSize: function(element) { if(element == null) return; _aspxChangeStyleAttribute(element, "width", (__aspxIE ? element.clientWidth : element.offsetWidth) + "px"); _aspxChangeStyleAttribute(element, "height", (__aspxIE ? element.clientHeight : element.offsetHeight) + "px"); }, UnfixElementSize: function(element) { if(element == null) return; _aspxRestoreStyleAttribute(element, "width"); _aspxRestoreStyleAttribute(element, "height"); }, AdjustSize: function() { this.AdjustControlCore(); }, AdjustControlCore: function() { ASPxClientControl.prototype.AdjustControlCore.call(this); if(this.liteRender) { if(!this.enableScrolling) this.AdjustTabControlSizeLite(); } else { aspxTCCorrectBounds(this.name); } if(this.enableScrolling) this.AdjustTabScrolling(true, false); }, CanLoadTabOnCallback: function(index) { return _aspxIsFunction(this.callBack); }, ChangeTabState: function(index, active) { var element = this.GetTabElement(index, true); if(element != null) _aspxSetElementDisplay(this.GetTabLayoutElement(element), active); element = this.GetTabElement(index, false); if(element != null) _aspxSetElementDisplay(this.GetTabLayoutElement(element), !active); element = this.GetContentElement(index); if(element != null) _aspxSetElementDisplay(element, active); }, ChangeActiveTab: function(index, hasLink) { var processingMode = this.RaiseActiveTabChanging(index); if(processingMode == "Client" || processingMode == "ClientWithReload") { var element = this.GetContentElement(index); if(this.CanLoadTabOnCallback(index) && element != null && (!element.loaded || processingMode == "ClientWithReload")) { if(this.callbackCount == 0) this.FixControlSize(); this.DoChangeActiveTab(index); if(!element.loading) { this.callbackCount++; element.loading = true; this.tabsContentRequest.push(index); this.ShowLoadingPanel(); this.CreateCallback(index); } if(!this.liteRender) this.CorrectOperaTabCellsAlignment(); } else { this.DoChangeActiveTab(index); if(!this.liteRender) { this.CorrrectCellsBounds(false); this.CorrectOperaTabCellsAlignment(); } if(this.GetMainElement()) { var activeContentElement = this.GetContentElement(this.activeTabIndex); var collection = aspxGetControlCollection(); var checkSizeCorrected = !this.IsPercentageSize(this.GetMainElement(), "width") && __aspxCheckSizeCorrectedFlag; collection.AdjustControls(activeContentElement, checkSizeCorrected); } this.RaiseActiveTabChanged(index); } } else if(processingMode == "Server" && !hasLink) this.SendPostBack("ACTIVATE:" + index); }, IsMultiRow: function() { if(!_aspxIsExists(this.isMultiRow)) this.isMultiRow = _aspxElementHasCssClass(this.GetMainElement(), this.liteRender ? "dxtc-multiRow" : "dxtcMultiRow"); return this.isMultiRow; }, PlaceActiveTabRowToBottom: function(activeTabIndex) { if(!this.liteRender) { var tabElement = this.GetTabElement(activeTabIndex, true); if(!tabElement) return; var activeTabRowTable = _aspxGetParentByTagName(tabElement, "table"); if(!activeTabRowTable) return; var tabStripContainer = activeTabRowTable.parentNode; var currentTabRowTable; if(_aspxGetElementNodes(tabStripContainer).length > 1) { if(this.tabPosition == "Top") { currentTabRowTable = tabStripContainer.lastChild; currentTabRowTable.style.marginBottom = activeTabRowTable.style.marginBottom; activeTabRowTable.style.marginBottom = ""; } else { currentTabRowTable = tabStripContainer.firstChild; currentTabRowTable.style.marginTop = activeTabRowTable.style.marginTop; activeTabRowTable.style.marginTop = ""; } var temp = currentTabRowTable.className; currentTabRowTable.className = ""; activeTabRowTable.className = temp; tabStripContainer.insertBefore(currentTabRowTable, activeTabRowTable); tabStripContainer.insertBefore(activeTabRowTable, this.tabPosition == "Top" ? null : tabStripContainer.firstChild); } } else { var strip = this.GetTabsCell(); var leftIndent = this.GetLeftIndentLite(); var rightIndent = this.GetRightIndentLite(); strip.insertBefore(rightIndent, this.tabPosition == "Top" ? null : strip.firstChild); strip.insertBefore(leftIndent, rightIndent); var newActiveRow = this.GetTabRowByTabElementLite(this.GetVisibleTabElement(activeTabIndex)); var currentActiveRow = this.GetActiveTabRowLite(); this.InsertTabRowBeforeLite(currentActiveRow, newActiveRow[0]); this.InsertTabRowBeforeLite(newActiveRow, rightIndent); this.SetStripMarginsLite(0, false); this.SetStripMarginsLite(leftIndent.offsetWidth, true); this.AdjustStripSpacesLite(); this.ReplaceCssClassLite(currentActiveRow, this.ActiveRowItemCssClass, ""); this.ReplaceCssClassLite(newActiveRow, "", this.ActiveRowItemCssClass); } }, ReplaceCssClassLite: function(collection, className, newClassName) { for(var i = 0; i < collection.length; i++) { if(!collection[i]) continue; var c = collection[i].className.replace(className, ""); collection[i].className = _aspxTrim(c); if(newClassName != "") collection[i].className += " " + newClassName; } }, InsertTabRowBeforeLite: function(row, refElement) { var strip = this.GetTabsCell(); for(var i = 0; i < row.length; i++) strip.insertBefore(row[i], refElement); }, GetTabRowByTabElementLite: function(tabElement) { var c = _aspxGetChildNodes(this.GetTabsCell(), function(e) { return e.className && !_aspxElementHasCssClass(e, "dxtc-leftIndent") && !_aspxElementHasCssClass(e, "dxtc-rightIndent"); }); var start = 0; var end = 0; var found = false; for(var i = 0; i < c.length; i++) { if(!found) found = c[i].id == tabElement.id; if(_aspxElementHasCssClass(c[i], "dxtc-lineBreak")) { if(found) { end = i; break; } else start = i + 1; } end = c.length; } return c.slice(start, end); }, GetActiveTabRowLite: function() { var c = _aspxGetElementNodes(this.GetTabsCell()); var index = 0; for(var i = 0; i < c.length; i++) { if(_aspxElementHasCssClass(c[i], "dxtc-tab") || _aspxElementHasCssClass(c[i], "dxtc-activeTab")) { index = i; if(this.tabPosition == "Bottom") break; } } return this.GetTabRowByTabElementLite(c[index]); }, SetStripMarginsLite: function(marginSize, excludeCurrentStrip) { var c = _aspxGetChildNodesByClassName(this.GetTabsCell(), "dxtc-n"); var count = c.length; var startIndex = 0; if(this.tabPosition == "Top") count -= excludeCurrentStrip ? (this.autoPostBack ? 1 : 2) : 0; else startIndex = excludeCurrentStrip ? (this.autoPostBack ? 1 : 2) : 0; for(var i = startIndex; i < count; i++) { if(this.rtl) c[i].style.marginRight = marginSize + "px"; else c[i].style.marginLeft = marginSize + "px"; } }, AdjustStripSpacesLite: function() { var c = _aspxGetElementNodesByPredicate(this.GetTabsCell(), function(e) { return !_aspxElementHasCssClass(e, "dxtc-lineBreak"); }); var indent = this.GetTabSpaceSizeLite(); for(var i = 0; i < c.length; i++) { if(this.tabPosition == "Bottom") c[i].style.marginBottom = indent + "px"; else c[i].style.marginTop = indent + "px"; } var lastStrip = this.GetLastTabStrip(); for(var i = 0; i < lastStrip.length; i++) { if(this.tabPosition == "Bottom") lastStrip[i].style.marginBottom = "0px"; else lastStrip[i].style.marginTop = "0px"; } }, GetLastTabStrip: function() { var c = _aspxGetElementNodes(this.GetTabsCell()); var index = 0; for(var i = 0; i < c.length; i++) { if(_aspxElementHasCssClass(c[i], "dxtc-tab") || _aspxElementHasCssClass(c[i], "dxtc-activeTab")) { index = i; if(this.tabPosition == "Top") break; } } return this.GetTabRowByTabElementLite(c[index]); }, DoChangeActiveTab: function(index) { if(__aspxFirefox && __aspxBrowserVersion >= 3) { var contentsCell = this.GetContentsCell(); var isContentsCellExists = _aspxIsExistsElement(contentsCell); if(isContentsCellExists) _aspxSetElementVisibility(contentsCell, false); this.ChangeTabState(index, true); this.ChangeTabState(this.activeTabIndex, false); this.activeTabIndex = index; if(isContentsCellExists) _aspxSetElementVisibility(contentsCell, true); } else { this.ChangeTabState(this.activeTabIndex, false); this.activeTabIndex = index; this.ChangeTabState(this.activeTabIndex, true); } if(this.enableScrolling) { this.AdjustTabScrolling(true, true); } else if(this.liteRender) this.AdjustTabControlSizeLite(); if(this.IsMultiRow()) this.PlaceActiveTabRowToBottom(index); this.UpdateActiveTabIndexInputElement(); this.UpdateActiveTabIndexCookie(); }, SetActiveTabIndexInternal: function(index, hasLink) { if(this.activeTabIndex == index) return; var lastScrollYPos = _aspxGetDocumentScrollTop(); this.ChangeActiveTab(index, hasLink); var scrollY = _aspxGetDocumentScrollTop(); if(lastScrollYPos != scrollY) window.scrollTo(_aspxGetDocumentScrollLeft(), lastScrollYPos); this.UpdateHoverState(index); }, UpdateActiveTabIndexCookie: function() { if(this.cookieName == "") return; _aspxDelCookie(this.cookieName); _aspxSetCookie(this.cookieName, this.activeTabIndex); }, UpdateActiveTabIndexInputElement: function() { var element = this.GetActiveTabIndexInputElement(); if(element != null) element.value = this.activeTabIndex; }, UpdateHoverState: function(index) { if(!this.IsStateControllerEnabled()) return; var element = this.GetTabElement(index, true); if(element != null) aspxGetStateController().SetCurrentHoverElementBySrcElement(element); }, OnResize: function() { var mainElement = this.GetMainElement(); if(mainElement && !mainElement.corrected) this.CorrrectCellsBounds(false); }, OnTabClick: function(evt, index) { var processingMode = this.RaiseTabClick(index, evt); var clickedLinkElement = _aspxGetParentByTagName(_aspxGetEventSource(evt), "A"); var isLinkClicked = (clickedLinkElement != null && clickedLinkElement.href != __aspxAccessibilityEmptyUrl); var element = this.GetTabElement(index, false); var linkElement = (element != null) ? _aspxGetChildByTagName(element, "A", 0) : null; if(linkElement != null && linkElement.href == __aspxAccessibilityEmptyUrl) linkElement = null; if(processingMode != "Handled") { var hasLink = isLinkClicked || linkElement != null; if(processingMode == "Server" && !hasLink) this.SendPostBack("CLICK:" + index); else this.SetActiveTabIndexInternal(index, hasLink); if(this.handleClickOnWholeTab && !isLinkClicked && linkElement != null) _aspxNavigateByLink(linkElement); } }, OnCallbackInternal: function(html, index, isError) { this.SetCallbackContent(html, index, isError); if(!isError) this.RaiseActiveTabChanged(index); _aspxArrayRemoveAt(this.tabsContentRequest, 0); }, OnCallback: function(result) { this.OnCallbackInternal(result.html, result.index, false); }, OnCallbackError: function(result, data) { this.OnCallbackInternal(result, data, true); }, OnCallbackGeneralError: function(result) { var callbackTabIndex = (this.tabsContentRequest.length > 0) ? this.tabsContentRequest[0] : this.activeTabIndex; this.SetCallbackContent(result, callbackTabIndex, true); _aspxArrayRemoveAt(this.tabsContentRequest, 0); }, ShowLoadingPanel: function() { if(_aspxArrayIndexOf(this.tabsContentRequest, this.activeTabIndex) > -1) { var element = this.GetContentElement(this.activeTabIndex); this.CreateLoadingPanelWithAbsolutePosition(element, this.GetContentsCell()); } }, SetCallbackContent: function(html, index, isError) { var element = this.GetContentElement(index); if(element != null) { if(!isError) element.loaded = true; element.loading = false; _aspxSetInnerHtml(element, html); this.callbackCount--; if(this.callbackCount == 0) { this.UnfixControlSize(); if(!this.liteRender) { this.CorrrectCellsBounds(false); this.CorrectOperaTabCellsAlignment(); } } } }, CreateTabs: function(tabsProperties) { for(var i = 0; i < tabsProperties.length; i++) { var tabName = tabsProperties[i][0] || ""; var tab = new ASPxClientTab(this, i, tabName); this.CreateTabProperties(tab, tabsProperties[i]); this.tabs.push(tab); } }, CreateTabProperties: function(tab, tabProperties) { if(_aspxIsExists(tabProperties[1])) tab.enabled = tabProperties[1]; if(_aspxIsExists(tabProperties[2])) tab.clientEnabled = tabProperties[2]; if(_aspxIsExists(tabProperties[3])) tab.visible = tabProperties[3]; if(_aspxIsExists(tabProperties[4])) tab.clientVisible = tabProperties[4]; }, RaiseTabClick: function(index, htmlEvent) { var processingMode = this.autoPostBack || this.IsServerEventAssigned("TabClick") ? "Server" : "Client"; if(!this.TabClick.IsEmpty()) { var htmlElement = this.GetTabElement(index, this.activeTabIndex == index); var args = new ASPxClientTabControlTabClickEventArgs(processingMode == "Server", this.GetTab(index), htmlElement, htmlEvent); this.TabClick.FireEvent(this, args); if(args.cancel) processingMode = "Handled"; else processingMode = args.processOnServer ? "Server" : "Client"; } return processingMode; }, RaiseActiveTabChanged: function(index) { if(!this.ActiveTabChanged.IsEmpty()) { var args = new ASPxClientTabControlTabEventArgs(this.GetTab(index)); this.ActiveTabChanged.FireEvent(this, args); } }, RaiseActiveTabChanging: function(index) { var processingMode = this.autoPostBack ? "Server" : "Client"; if(!this.ActiveTabChanging.IsEmpty()) { var args = new ASPxClientTabControlTabCancelEventArgs(processingMode == "Server", this.GetTab(index)); this.ActiveTabChanging.FireEvent(this, args); if(args.cancel) processingMode = "Handled"; else if(args.processOnServer) processingMode = "Server"; else processingMode = args.reloadContentOnCallback ? "ClientWithReload" : "Client"; } return processingMode; }, SetEnabled: function(enabled) { for(var i = this.GetTabCount() - 1; i >= 0; i--) { var tab = this.GetTab(i); tab.SetEnabled(enabled, true ); } }, GetActiveTab: function() { return (this.activeTabIndex > -1) ? this.GetTab(this.activeTabIndex) : null; }, SetActiveTab: function(tab) { if(this.IsTabVisible(tab.index)) this.SetActiveTabIndexInternal(tab.index, false); }, GetActiveTabIndex: function() { return this.activeTabIndex; }, SetActiveTabIndex: function(index) { if(index < 0 || index >= this.tabs.length) return; if(this.IsTabVisible(index)) this.SetActiveTabIndexInternal(index, false); }, GetTabCount: function() { return this.tabs.length; }, GetTab: function(index) { return (0 <= index && index < this.tabs.length) ? this.tabs[index] : null; }, GetTabByName: function(name) { for(var i = 0; i < this.tabs.length; i++) if(this.tabs[i].name == name) return this.tabs[i]; return null; }, IsTabEnabled: function(index) { return this.tabs[index].GetEnabled(); }, SetTabEnabled: function(index, enabled, initialization, doNotChangeActiveTab) { if(!this.tabs[index].enabled) return; if(!initialization || !enabled) this.ChangeTabEnabledStateItems(index, enabled); this.ChangeTabEnabledAttributes(index, enabled, doNotChangeActiveTab); }, ChangeTabEnabledAttributes: function(index, enabled, doNotChangeActiveTab) { if(enabled) { this.ChangeTabElementsEnabledAttributes(index, _aspxRestoreAttribute, _aspxRestoreStyleAttribute); var isActiveTabEnabled = this.activeTabIndex != -1 ? this.IsTabEnabled(this.activeTabIndex) : false; if(!doNotChangeActiveTab && !isActiveTabEnabled && this.IsTabVisible(index)) this.SetActiveTabIndexInternal(index, false); } else { if(this.activeTabIndex == index && !doNotChangeActiveTab) { for(var i = 0; i < this.GetTabCount(); i++) { if(this.IsTabVisible(i) && this.IsTabEnabled(i) && i != index) { this.SetActiveTabIndexInternal(i, false); break; } } } this.ChangeTabElementsEnabledAttributes(index, _aspxResetAttribute, _aspxResetStyleAttribute); } }, ChangeTabElementsEnabledAttributes: function(index, method, styleMethod) { var element = this.GetTabElement(index, false); if(element) { method(element, "onclick"); styleMethod(element, "cursor"); var link = this.GetInternalHyperlinkElement(element, 0); if(link != null) { method(link, "href"); styleMethod(link, "cursor"); } link = this.GetInternalHyperlinkElement(element, 1); if(link != null) { method(link, "href"); styleMethod(link, "cursor"); } } var activeElement = this.GetTabElement(index, true); if(activeElement) { method(activeElement, "onclick"); styleMethod(activeElement, "cursor"); } }, ChangeTabEnabledStateItems: function(index, enabled) { if(!this.IsStateControllerEnabled()) return; var element = this.GetTabElement(index, false); if(element != null) aspxGetStateController().SetElementEnabled(element, enabled); var activeElement = this.GetTabElement(index, true); if(activeElement != null) aspxGetStateController().SetElementEnabled(activeElement, enabled); }, GetTabTextCell: function(index, active) { return this.GetChild("_" + (active ? "A" : "") + "T" + index + "T"); }, GetTabImageCell: function(index, active) { return this.GetChild("_" + (active ? "A" : "") + "T" + index + "I"); }, GetTabImageUrl: function(index, active) { if(this.liteRender) { var imgEl = this.GetTabInsideElement(index, active, "dxtc-img"); if(imgEl) return imgEl.src; } else { var element = this.GetTabImageCell(index, active); if(element != null) { var img = _aspxGetChildByTagName(element, "IMG", 0); if(img != null) return img.src; } } return ""; }, SetTabImageUrl: function(index, active, url) { if(this.liteRender) { var imgEl = this.GetTabInsideElement(index, active, "dxtc-img"); if(imgEl) imgEl.src = url; } else { var element = this.GetTabImageCell(index, active); if(element != null) { var img = _aspxGetChildByTagName(element, "IMG", 0); if(img != null) img.src = url; } } }, GetTabNavigateUrl: function(index) { if(this.liteRender) { var linkEl = this.GetTabInsideElement(index, false, "dxtc-link"); if(linkEl) return linkEl.href; } else { var element = this.GetTabTextCell(index, false) || this.GetTabImageCell(index, false); if(element != null) { var link = _aspxGetChildByTagName(element, "A", 0); if(link != null) return link.href; } } return ""; }, SetTabNavigateUrl: function(index, url) { if(this.liteRender) { var linkEl = this.GetTabInsideElement(index, false, "dxtc-link"); if(linkEl) linkEl.href = url; } else { this.SetTabNavigateUrlInternal(index, url, this.GetTabTextCell(index, false)); this.SetTabNavigateUrlInternal(index, url, this.GetTabImageCell(index, false)); } }, SetTabNavigateUrlInternal: function(index, url, parentElem) { if(parentElem != null) { var link = _aspxGetChildByTagName(parentElem, "A", 0); if(link != null) link.href = url; } }, GetTabText: function(index) { if(this.liteRender) { var text = this.GetTabInsideElement(index, false, "dxtc-text"); if(text) return text.innerHTML; } else { var element = this.GetTabTextCell(index, false); if(element != null) { var link = this.GetInternalHyperlinkElement(element, 0); if(link != null) return link.innerHTML; else return element.innerHTML; } } return ""; }, SetTabText: function(index, text) { this.SetTabTextInternal(index, false, text); this.SetTabTextInternal(index, true, text); if(this.liteRender) this.AdjustControlCore(); }, SetTabTextInternal: function(index, isActive, text) { if(this.liteRender) { var textEl = this.GetTabInsideElement(index, isActive, "dxtc-text"); if(textEl) textEl.innerHTML = text; } else { var element = this.GetTabTextCell(index, isActive); if(element != null) { var link = this.GetInternalHyperlinkElement(element, 0); if(link != null) link.innerHTML = text; else element.innerHTML = text; } } }, GetTabInsideElement: function(index, isActive, insideClassName) { var tabElement = this.GetTabElement(index, isActive); if(!tabElement) return null; var c = _aspxGetDescendantNodesByClassName(tabElement, insideClassName); return null || (c.length > 0 && c[0]); }, IsTabVisible: function(index) { return this.tabs[index].GetVisible(); }, IsTabStartOutOfScrollArea: function(index) { var width = 0; for(var i = 0; i < index; i++) { width += this.GetVisibleTabElement(index).offsetWidth; var separator = this.GetSeparatorElement(index); if(separator) width += separator.offsetWidth; } return Math.abs(this.scrollManager.GetScrolledAreaPosition()) > width; }, SetTabVisible: function(index, visible, initialization) { if(!this.tabs[index].visible) return; if(visible && initialization) return; var element = this.GetTabElement(index, false); if(element != null) element = this.GetTabLayoutElement(element); var currentShiftWidth = 0, visibleTabElement = this.GetVisibleTabElement(index), separatorElement = this.GetSeparatorElement(index); if(visibleTabElement) currentShiftWidth = visibleTabElement.offsetWidth; if(separatorElement) currentShiftWidth += separatorElement.offsetWidth; var activeElement = this.GetTabElement(index, true); if(activeElement != null) activeElement = this.GetTabLayoutElement(activeElement); var contentElement = this.GetContentElement(index); if(!visible) { if(this.activeTabIndex == index) { for(var i = 0; i < this.GetTabCount(); i++) { if(this.IsTabVisible(i) && this.IsTabEnabled(i) && i != index) { this.SetActiveTabIndexInternal(i, false); break; } } for(var i = 0; i < this.GetTabCount(); i++) { if(this.IsTabVisible(i) && i != index) { this.SetActiveTabIndexInternal(i, false); break; } } if(this.activeTabIndex == index) { this.activeTabIndex = -1; _aspxSetElementDisplay(this.GetMainElement(), false); } } if(element != null) _aspxSetElementDisplay(element, false); if(activeElement != null) _aspxSetElementDisplay(activeElement, false); if(contentElement != null) _aspxSetElementDisplay(contentElement, false); } else { if(element != null) _aspxSetElementDisplay(element, this.activeTabIndex != index); if(activeElement != null) _aspxSetElementDisplay(activeElement, this.activeTabIndex == index); if(contentElement != null) _aspxSetElementDisplay(contentElement, this.activeTabIndex == index); if(this.activeTabIndex == -1) { _aspxSetElementDisplay(this.GetMainElement(), true); this.SetActiveTabIndexInternal(index, false); } else if(!this.IsTabEnabled(this.activeTabIndex) && this.IsTabEnabled(index)) this.SetActiveTabIndexInternal(index, false); } this.SetSeparatorsVisiblility(); if(this.liteRender && !this.enableScrolling) this.AdjustTabControlSizeLite(); if(!this.liteRender) this.CorrrectCellsBounds(false); if(this.enableScrolling) { this.AdjustTabScrolling(false, false); if(this.IsTabStartOutOfScrollArea(index)) { currentShiftWidth = visible ? (this.GetVisibleTabElement(index).offsetWidth + this.GetSeparatorElement(index).offsetWidth) * (-1) : currentShiftWidth; this.CorrectScrollArea(currentShiftWidth); } if(this.firstShownTabIndex == index && !visible) { var newShownTabIndex = this.GetNextVisibleTabIndex(index); if(newShownTabIndex < 0) { newShownTabIndex = this.GetPrevVisibleTabIndex(index); if(newShownTabIndex < 0) return; } this.ScrollToShowTab(newShownTabIndex, true); } } }, CorrectScrollArea: function(value) { var rtlCorrect = this.rtl ? -1 : 1; var newPostion = (this.scrollManager.GetScrolledAreaPosition() + value * rtlCorrect); this.scrollManager.SetScrolledAreaPosition((newPostion * rtlCorrect) <= 0 ? newPostion : 0); }, SetSeparatorsVisiblility: function() { for(var i = 0; i < this.tabs.length; i++) { var separatorVisible = this.tabs[i].GetVisible() && this.GetNextVisibleTabIndex(i) > -1; var separatorElement = this.GetSeparatorElement(i); if(separatorElement != null) { separatorElement = this.GetTabLayoutElement(separatorElement); _aspxSetElementDisplay(separatorElement, separatorVisible); } } }, GetNextVisibleTabIndex: function(index) { for(var i = index + 1; i < this.tabs.length; i++) { if(this.tabs[i].GetVisible()) return i; } return -1; }, GetPrevVisibleTabIndex: function(index) { for(var i = index - 1; i >= 0; i--) { if(this.tabs[i].GetVisible()) return i; } return -1; } }); ASPxClientTabControl = _aspxCreateClass(ASPxClientTabControlBase, { SetHeight: function(height) { } }); ASPxClientTabControl.Cast = ASPxClientControl.Cast; ASPxClientPageControl = _aspxCreateClass(ASPxClientTabControlBase, { constructor: function(name){ this.constructor.prototype.constructor.call(this, name); this.handleClickOnWholeTab = false; }, GetTabContentHTML: function(tab){ var element = this.GetContentElement(tab.index); return (element != null) ? element.innerHTML : ""; }, SetTabContentHTML: function(tab, html){ var element = this.GetContentElement(tab.index); if(element != null) { _aspxSetInnerHtml(element, html); if(!this.liteRender) this.CorrrectCellsBounds(false); } }, ShouldHideExistingLoadingPanel: function() { return false; } }); ASPxClientPageControl.Cast = ASPxClientControl.Cast; ASPxClientTab = _aspxCreateClass(null, { constructor: function(tabControl, index, name){ this.tabControl = tabControl; this.index = index; this.name = name; this.enabled = true; this.clientEnabled = true; this.visible = true; this.clientVisible = true; }, GetEnabled: function(){ return this.enabled && this.clientEnabled; }, SetEnabled: function(value, doNotChangeActiveTab){ if (this.clientEnabled != value) { this.clientEnabled = value; this.tabControl.SetTabEnabled(this.index, value, false, doNotChangeActiveTab); } }, GetImageUrl: function(active){ return this.tabControl.GetTabImageUrl(this.index, active); }, SetImageUrl: function(value, active){ this.tabControl.SetTabImageUrl(this.index, active, value); }, GetActiveImageUrl: function(){ return this.tabControl.GetTabImageUrl(this.index, true); }, SetActiveImageUrl: function(value){ this.tabControl.SetTabImageUrl(this.index, true, value); }, GetNavigateUrl: function(){ return this.tabControl.GetTabNavigateUrl(this.index); }, SetNavigateUrl: function(value){ this.tabControl.SetTabNavigateUrl(this.index, value); }, GetText: function(){ return this.tabControl.GetTabText(this.index); }, SetText: function(value){ this.tabControl.SetTabText(this.index, value); }, GetVisible: function(){ return this.visible && this.clientVisible; }, SetVisible: function(value){ if (this.clientVisible != value) { this.clientVisible = value; this.tabControl.SetTabVisible(this.index, value, false); } } }); ASPxClientTabControlTabEventArgs = _aspxCreateClass(ASPxClientEventArgs, { constructor: function(tab, htmlElement, htmlEvent){ this.constructor.prototype.constructor.call(this); this.tab = tab; } }); ASPxClientTabControlTabCancelEventArgs = _aspxCreateClass(ASPxClientProcessingModeCancelEventArgs, { constructor: function(processOnServer, tab){ this.constructor.prototype.constructor.call(this, processOnServer); this.tab = tab; this.reloadContentOnCallback = false; } }); ASPxClientTabControlTabClickEventArgs = _aspxCreateClass(ASPxClientTabControlTabCancelEventArgs, { constructor: function(processOnServer, tab, htmlElement, htmlEvent){ this.constructor.prototype.constructor.call(this, processOnServer, tab); this.htmlElement = htmlElement; this.htmlEvent = htmlEvent; } }); function aspxTCResize(name){ var tc = aspxGetControlCollection().Get(name); if(tc != null) tc.OnResize(); } function aspxTCCorrectBounds(name){ var tc = aspxGetControlCollection().Get(name); if(tc != null && !tc.liteRender) tc.CorrrectCellsBoundsTimer(); } function aspxTCTClick(evt, name, index){ var tc = aspxGetControlCollection().Get(name); if(tc != null) tc.OnTabClick(evt, index); if(!__aspxNetscapeFamily) evt.cancelBubble = true; } } /* playback timings (ms): exclusion.robots: 0.186 load_resource: 71.116 PetaboxLoader3.datanode: 89.252 (4) esindex: 0.014 exclusion.robots.policy: 0.171 CDXLines.iter: 23.296 (3) captures_list: 103.311 LoadShardBlock: 75.012 (3) PetaboxLoader3.resolve: 30.487 RedisCDXSource: 0.995 */