
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.tabAlign = "Left";
        this.tabPosition = "Top";
        this.tabCount = 0;
        this.tabs = [];
        this.tabsContentRequest = [];
        this.TabClick = new ASPxClientEvent();
        this.ActiveTabChanged = new ASPxClientEvent();
        this.ActiveTabChanging = new ASPxClientEvent();    
        
        this.InitializeOnResize();
	},
	Initialize: function(){
        this.CorrrectCellsBounds();
        this.constructor.prototype.Initialize.call(this);
	},
    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);
    },
    GetLeftAlignCellElement: function(){
        return this.GetChild("_LAC");
    },
    GetRightAlignCellElement: function(){
        return this.GetChild("_RAC");
    },
    GetTabLayoutElement: function(element){
        if(!this.IsTopBottomTabPosition())
            return _aspxGetParentNode(element);
        return element;
    },

    GetActiveTabIndexInputElement: function(index){
        return _aspxGetElementById(this.name + "ATI");
    },

    IsTopBottomTabPosition: function(){
        return (this.tabPosition == "Top" || this.tabPosition == "Bottom");
    },

    CorrrectCellsBounds: 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(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";
                
            tabsCell.style.height = "auto";
            tabsCell.style.height = mainElement.offsetHeight + "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){
            var tabsHeight = tabsCell.offsetHeight;
            tabsCell.style.height = tabsHeight + "px";
            contentsCell.style.height = "auto";
            contentsCell.style.height = (mainElement.clientHeight - 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(){ // Fix for __aspxOpera bug
        if(!__aspxOpera || this.tabAlign != "Justify") return;
        if(!this.IsTopBottomTabPosition() && !this.emptyHeight) return;
        
        var element = this.GetTabsCell();
        _aspxSetElementDisplay(element, false);
        _aspxSetElementDisplay(element, true);
    },
    CorrectOperaTabCellsAlignment: function(){ // Fix for __aspxOpera bug
        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");
    },
    
    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.autoPostBack ? "Server" : "Client";
        if(_aspxIsExists(this.RaiseActiveTabChanging))
            processingMode = this.RaiseActiveTabChanging(index);
        if(processingMode == "Client"){
            var element = this.GetContentElement(index);
            if(_aspxIsFunction(this.callBack) && element != null && !element.loaded){
                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();
                this.CorrectOperaTabCellsAlignment();
                
                var activeContentElement = this.GetContentElement(this.activeTabIndex);
                var collection = aspxGetControlCollection();
                collection.AdjustControlsSize(activeContentElement, __aspxCheckSizeCorrectedFlag);

                if(_aspxIsExists(this.RaiseActiveTabChanged))
                    this.RaiseActiveTabChanged(index);
            }
        }
        else if(processingMode == "Server"  && !hasLink)
            this.SendPostBack("ACTIVATE:" + index);
    },
    DoChangeActiveTab: function(index){
        this.ChangeTabState(this.activeTabIndex, false);
        this.activeTabIndex = index;
        this.ChangeTabState(this.activeTabIndex, true);
        
        this.UpdateActiveTabIndexInputElement();
        this.UpdateActiveTabIndexCookie();
    },
    SetActiveTabIndexInternal: function(index, findLink, hasLink){
        if(this.activeTabIndex == index) return;
        
        if(findLink){
            var element = this.GetTabElement(index, false);
            var linkElement = (element != null) ? _aspxGetChildByTagName(element, "A", 0) : null;
            hasLink = (linkElement != null);
        }
        this.ChangeActiveTab(index, hasLink);
        if(findLink && linkElement != null){
            _aspxNavigateUrl(linkElement.href, linkElement.target);
        }
        this.UpdateHoverState(index);            
    },
    
    UpdateActiveTabIndexCookie: function(){
        if(this.cookieName == "") return;

        _aspxDelCookie(this.cookieName, this.activeTabIndex);
        _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();
    },
    OnTabClick: function(evt, index){            
        var processingMode = this.autoPostBack || this.IsServerEventAssigned("TabClick") ? "Server" : "Client";
        if(_aspxIsExists(this.RaiseTabClick))
            processOnServer = this.RaiseTabClick(index, evt);
            
        var isLinkClicked = (_aspxGetParentByTagName(_aspxGetEventSource(evt), "A") != null);
        var element = this.GetTabElement(index, false);
        var linkElement = (element != null) ? _aspxGetChildByTagName(element, "A", 0) : null;
        if (processingMode == "Client" || linkElement != null)
            this.SetActiveTabIndexInternal(index, !isLinkClicked, true);
        else if (!isLinkClicked && processingMode == "Server")
            this.SendPostBack("CLICK:" + index);
    },
    OnCallbackInternal: function(result, isError){
        var pos = result.indexOf(__aspxCallBackSeparator);
        if(pos == -1) {
            if(this.tabsContentRequest.length > 0)
                result = this.tabsContentRequest[0] + __aspxCallBackSeparator + result;
            pos = result.indexOf(__aspxCallBackSeparator);
        }
        if(pos > -1){
            var callBackTabIndex = parseInt(result.substr(0, pos));
            var element = this.GetContentElement(callBackTabIndex);
            if(element != null) {
                result = result.substring(pos + __aspxCallBackSeparator.length);
                if(result != ""){
                    element.loaded = true;
                    element.loading = false;
                    element.innerHTML = result;
                    
                    this.callBackCount--;
                    if(this.callBackCount == 0){
                        this.UnfixControlSize();
                        this.CorrrectCellsBounds();
                        this.CorrectOperaTabCellsAlignment();
                    }
                    
                    if(!isError && _aspxIsExists(this.RaiseActiveTabChanged))
                        this.RaiseActiveTabChanged(callBackTabIndex);
                }
                else
                    this.SendPostBack("");
            }
        }
        _aspxArrayRemoveAt(this.tabsContentRequest, 0);
    },
    OnCallback: function(result){
        this.OnCallbackInternal(result, false);
    },
    OnCallbackError: function(result){
        this.OnCallbackInternal(result, true);
    },
    // API
    CreateTabs: function(tabsProperties){
        for(var i = 0; i < tabsProperties.length; i ++){
            var tab = new ASPxClientTab(this, i, tabsProperties[i][0]);
            _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 
                processingMode = args.processOnServer ? "Server" : "Client";
        }
        return processingMode;
    },
    GetActiveTab: function(){
        return (this.activeTabIndex > -1) ? this.GetTab(this.activeTabIndex) : null;
    },
    SetActiveTab: function(tab){
        if(this.GetTabVisible(tab.index))
            this.SetActiveTabIndexInternal(tab.index, true, true);
    },
    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;
    },
    
    ChangeEnabledAttributes: function(index, method, styleMethod){
        var element = this.GetTabElement(index, false);
        if(_aspxIsExists(element)){
            method(element, "onclick");
            styleMethod(element, "cursor");
   	        var link = _aspxGetChildByTagName(element, "A", 0);
   	        if(link != null){
   	            method(link, "href");
   	            styleMethod(link, "cursor");
            }
   	        link = _aspxGetChildByTagName(element, "A", 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");
        }
    },
	GetTabEnabled: function(index){
        var element = this.GetTabElement(index, false);
	    if(element != null)
	        return !_aspxIsExists(element.enabled) || element.enabled;
	    return true;
	},
	SetTabEnabled: function(index, enabled){
	    if(this.GetTabEnabled(index) == enabled) return;	
	    
	    var element = this.GetTabElement(index, false);
	    var activeElement = this.GetTabElement(index, true);
	    if(element != null && activeElement != null){
	        element.enabled = enabled;
	        if(enabled){
	            aspxGetStateController().EnableElement(element);
	            aspxGetStateController().EnableElement(activeElement);
	            this.ChangeEnabledAttributes(index, _aspxRestoreAttribute, _aspxRestoreStyleAttribute);
	            
                if(!this.GetTabEnabled(this.activeTabIndex) && this.GetTabVisible(index))
                    this.SetActiveTabIndexInternal(index, false, false);
	         }
	        else{
                if(this.activeTabIndex == index){
                    for(var i = 0; i < this.GetTabCount(); i ++){
                        if(this.GetTabVisible(i) && this.GetTabEnabled(i) && i != index){
                            this.SetActiveTabIndexInternal(i, false, false);
                            break;
                        }
                    }
                }

	            aspxGetStateController().DisableElement(element);
	            aspxGetStateController().DisableElement(activeElement);
	            this.ChangeEnabledAttributes(index, _aspxResetAttribute, _aspxResetStyleAttribute);
	        }
	    }
	},
    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 = _aspxGetChildByTagName(element, "A", 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 = _aspxGetChildByTagName(element, "A", 0);
	        if(link != null)
	            link.innerHTML = text;
	        else
	            element.innerHTML = text;
	    }
	    element = this.GetTabTextCell(index, true);
	    if(element != null){
	        var link = _aspxGetChildByTagName(element, "A", 0);
	        if(link != null)
	            link.innerHTML = text;
	        else
	            element.innerHTML = text;
	    }
	},
	GetTabVisible: function(index){
        var element = this.GetTabLayoutElement(this.GetTabElement(index, false));
        var activeElement = this.GetTabLayoutElement(this.GetTabElement(index, true));
	    return (element != null && activeElement != null) ? _aspxGetElementDisplay(element) || _aspxGetElementDisplay(activeElement) : false;
	},
	SetTabVisible: function(index, visible){
        var element = this.GetTabLayoutElement(this.GetTabElement(index, false));
        var activeElement = this.GetTabLayoutElement(this.GetTabElement(index, true));
        var contentElement = this.GetContentElement(index);
        if(!visible){
            if(this.activeTabIndex == index){
                for(var i = 0; i < this.GetTabCount(); i ++){
                    if(this.GetTabVisible(i) && this.GetTabEnabled(i) && i != index){
                        this.SetActiveTabIndexInternal(i, false, false);
                        break;
                    }
                }
                for(var i = 0; i < this.GetTabCount(); i ++){
                    if(this.GetTabVisible(i) && i != index){
                        this.SetActiveTabIndexInternal(i, false, 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, false);
            }
            else if(!this.GetTabEnabled(this.activeTabIndex) && this.GetTabEnabled(index))
                this.SetActiveTabIndexInternal(index, false, false);
        }
        this.CorrrectCellsBounds();
	}    
});
ASPxClientTabControl = _aspxCreateClass(ASPxClientTabControlBase, {
});
ASPxClientPageControl = _aspxCreateClass(ASPxClientTabControlBase, {
	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) {
	        element.innerHTML = html;
            this.CorrrectCellsBounds();
	    }
	}
});
ASPxClientTab = _aspxCreateClass(null, {
	constructor: function(tabControl, index, name){
	    this.tabControl = tabControl;
        this.index = index;
        this.name = name;
	},
	GetEnabled: function(){
	    return this.tabControl.GetTabEnabled(this.index);
	},
	SetEnabled: function(value){
	    this.tabControl.SetTabEnabled(this.index, value);
	},
	GetImageUrl: function(active){
	    if(!_aspxIsExists(active)) active = false; //for backward capability
	    return this.tabControl.GetTabImageUrl(this.index, active);
	},
	SetImageUrl: function(value, active){
	    if(!_aspxIsExists(active)) active = false; //for backward capability
	    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.tabControl.GetTabVisible(this.index);
	},
	SetVisible: function(value){
	    this.tabControl.SetTabVisible(this.index, value);
	}    
});
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;
	}
});
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 aspxTCTClick(evt, name, index){
    var tc = aspxGetControlCollection().Get(name);
    if(tc != null) tc.OnTabClick(evt, index);
    evt.cancelBubble = true;
    return true;
}