ASPxClientTabControlBase = _aspxCreateClass(ASPxClientControl, {
 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.handleClickOnWholeTab = true;
  this.TabClick = new ASPxClientEvent();
  this.ActiveTabChanged = new ASPxClientEvent();
  this.ActiveTabChanging = new ASPxClientEvent();
  this.InitializeOnResize();
 },
 Initialize: function(){
  this.constructor.prototype.Initialize.call(this);
  this.CorrrectCellsBounds(true); 
 },
 InlineInitialize: function(){
  this.InitializeEnabledAndVisible();
  this.CorrrectCellsBounds(true);
 },
 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(_aspxIsExists(element))
   element.onresize = new Function("aspxTCResize(\"" + this.name + "\");"); 
 },
 GetTabsCell: function(){
  return this.GetChild("_TC");
 },
 GetTabElement: function(index, active){
  return this.GetChild("_" + (active ? "A" : "") + "T" + index);
 },
 GetContentsCell: function(){
  return this.GetChild("_CC");
 },
 GetContentElement: function(index){
  return this.GetChild("_C" + index);
 },
 GetSeparatorElement: function(index){
  return this.GetChild("_T" + index + "S");
 },
 GetLeftAlignCellElement: function(){
  return this.GetChild("_LAC");
 },
 GetRightAlignCellElement: function(){
  return this.GetChild("_RAC");
 },
 GetTabLayoutElement: function(element){
  if(!this.IsTopBottomTabPosition())
   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 && !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) && !this.IsTopBottomTabPosition();
   if(tabsTableHeightCorrectionRequired)
    tabsTable.style.height = "auto"; 
   tabsCell.style.height = "auto";
   tabsCell.style.height = mainElement.offsetHeight + "px";
   if(tabsTableHeightCorrectionRequired)
    tabsTable.style.height = _aspxWebKit3TDRealInfo.GetClientHeight(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(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);
  }
  for(var i = 0; i < this.tabCount; i ++){
   if(this.activeTabIndex == i) continue;
   element = this.GetTabElement(i, false);
   if(element != null){
    _aspxSetElementDisplay(element, false);
    _aspxSetElementDisplay(element, true);
   }
  }
 },
 FixControlSize: function(){
  this.FixElementSize(this.GetMainElement());
  this.FixElementSize(this.GetContentsCell());
 },
 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.CorrrectCellsBounds(false);
 },
 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(_aspxIsFunction(this.callBack) && element != null && (!element.loaded || processingMode == "ClientWithReload")){
    if(this.callbackCount == 0)
     this.FixControlSize();
    this.DoChangeActiveTab(index);
    if(!element.loading){
     this.callbackCount++;
     element.loading = true;
     this.CreateLoadingPanelWithAbsolutePosition(element, this.GetContentsCell());
     this.CreateCallback(index);
     _aspxArrayPush(this.tabsContentRequest, index);
    }
    this.CorrectOperaTabCellsAlignment();
   }
   else{
    this.DoChangeActiveTab(index);
    this.CorrrectCellsBounds(false);
    this.CorrectOperaTabCellsAlignment();
    var activeContentElement = this.GetContentElement(this.activeTabIndex);
    var collection = aspxGetControlCollection();
    collection.AdjustControls(activeContentElement, __aspxCheckSizeCorrectedFlag);
    this.RaiseActiveTabChanged(index);
   }
  }
  else if(processingMode == "Server"  && !hasLink)
   this.SendPostBack("ACTIVATE:" + 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);
  }
  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){
  var element = this.GetTabElement(index, true);
  if(element != null) aspxGetStateController().SetCurrentHoverElementBySrcElement(element);
 },
 OnResize: function(){
  var mainElement = this.GetMainElement();
  if(mainElement != null && !_aspxIsExists(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) 
    _aspxNavigateUrl(linkElement.href, linkElement.target);
  }
 },
 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);
 },
 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();
    this.CorrrectCellsBounds(false);
    this.CorrectOperaTabCellsAlignment();
   }
  }
 },
 CreateTabs: function(tabsProperties){
  for(var i = 0; i < tabsProperties.length; i ++){
   var tabName = _aspxIsExists(tabsProperties[i][0]) ? tabsProperties[i][0] : "";
   var tab = new ASPxClientTab(this, i, tabName);
   if(_aspxIsExists(tabsProperties[i][1]))
    tab.enabled = tabsProperties[i][1];
   if(_aspxIsExists(tabsProperties[i][2]))    
    tab.clientEnabled = tabsProperties[i][2];
   if(_aspxIsExists(tabsProperties[i][3]))
    tab.visible = tabsProperties[i][3];
   if(_aspxIsExists(tabsProperties[i][4]))
    tab.clientVisible = tabsProperties[i][4];
   _aspxArrayPush(this.tabs, tab);
  }
 },
 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;
 },
 GetActiveTab: function(){
  return (this.activeTabIndex > -1) ? this.GetTab(this.activeTabIndex) : null;
 },
 SetActiveTab: function(tab){
  if(this.IsTabVisible(tab.index))
   this.SetActiveTabIndexInternal(tab.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){
  if(!this.tabs[index].enabled) return;
  if(!initialization || !enabled)
   this.ChangeTabEnabledStateItems(index, enabled);
  this.ChangeTabEnabledAttributes(index, enabled);
 },
 ChangeTabEnabledAttributes: function(index, enabled){
  if(enabled){
   this.ChangeTabElementsEnabledAttributes(index, _aspxRestoreAttribute, _aspxRestoreStyleAttribute);
   if(!this.IsTabEnabled(this.activeTabIndex) && this.IsTabVisible(index))
    this.SetActiveTabIndexInternal(index, false);
   }
  else{
   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;
     }
    }
   }
   this.ChangeTabElementsEnabledAttributes(index, _aspxResetAttribute, _aspxResetStyleAttribute);
  }
 },
 ChangeTabElementsEnabledAttributes: function(index, method, styleMethod){
  var element = this.GetTabElement(index, false);
  if(_aspxIsExists(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(_aspxIsExists(activeElement)){
   method(activeElement, "onclick");
   styleMethod(activeElement, "cursor");
  }
 },
 ChangeTabEnabledStateItems: function(index, enabled){
  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){
  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){
  var element = this.GetTabImageCell(index, active);
  if(element != null){
   var img = _aspxGetChildByTagName(element, "IMG", 0);
   if(img != null)
    img.src = url;
  }
 },
 GetTabNavigateUrl: function(index){
  var element = this.GetTabTextCell(index, false);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    return link.href;
  }
  element = this.GetTabImageCell(index, false);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    return link.href;
  }
  return "";
 },
 SetTabNavigateUrl: function(index, url){
  var element = this.GetTabTextCell(index, false);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    link.href = url;
  }
  var element = this.GetTabImageCell(index, false);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    link.href = url;
  }
 },
 GetTabText: function(index){
  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){
  var element = this.GetTabTextCell(index, false);
  if(element != null){
   var link = this.GetInternalHyperlinkElement(element, 0);
   if(link != null)
    link.innerHTML = text;
   else
    element.innerHTML = text;
  }
  element = this.GetTabTextCell(index, true);
  if(element != null){
   var link = this.GetInternalHyperlinkElement(element, 0);
   if(link != null)
    link.innerHTML = text;
   else
    element.innerHTML = text;
  }
 },
 IsTabVisible: function(index){
  return this.tabs[index].GetVisible();
 },
 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 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();
  this.CorrrectCellsBounds(false);
 },
 SetSeparatorsVisiblility: function(){
  for(var i = 0; i < this.tabs.length; i++){
   var separatorVisible = this.tabs[i].GetVisible() && this.HasNextVisibleTabs(i);
   var separatorElement = this.GetSeparatorElement(i);
   if(separatorElement != null) {
    separatorElement = this.GetTabLayoutElement(separatorElement);
    _aspxSetElementDisplay(separatorElement, separatorVisible);
   }
  }
 },
 HasNextVisibleTabs: function(index){
  for(var i = index + 1; i < this.tabs.length; i++){
   if(this.tabs[i].GetVisible())
    return true;
  }
  return false;
 }
});
ASPxClientTabControl = _aspxCreateClass(ASPxClientTabControlBase, {
});
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);
   this.CorrrectCellsBounds(false);
  }
 }
});
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){
  if (this.clientEnabled != value) {
   this.clientEnabled = value;
   this.tabControl.SetTabEnabled(this.index, value, false);
  }
 },
 GetImageUrl: function(active){
  if(!_aspxIsExists(active)) active = false; 
  return this.tabControl.GetTabImageUrl(this.index, active);
 },
 SetImageUrl: function(value, active){
  if(!_aspxIsExists(active)) active = false; 
  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(ASPxClientCancelEventArgs, {
 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.CorrrectCellsBoundsTimer();
}
function aspxTCTClick(evt, name, index){
 var tc = aspxGetControlCollection().Get(name);
 if(tc != null) tc.OnTabClick(evt, index);
 if(!__aspxNetscapeFamily)
  evt.cancelBubble = true;
}

