 		else if typeof tab is "string"
 			obj = @getTab(tab)
 		if obj
+
 			if @get("currentTab") is obj
 
 				tabDom = obj._dom;

	getTabBarDom: ()->
		@_doms ?= {}
		unless @_doms.tabBar
			dom = @_doms.tabBar = $.xCreate({
				tagName: "nav"
				class: "tab-bar"
			})
			@_dom.appendChild(dom)
		return @_doms.tabBar

	getTabsContainer: ()->
		@_doms ?= {}
		unless @_doms.tabs
			dom = @_doms.tabs = $.xCreate({
				tagName: "tabs"
				class: "tabs"
			})
			@getTabBarDom().appendChild(dom)
		return @_doms.tabs

	getContentsContainer: ()->

		dom = tab.getDom()
		if dom.parentNode isnt container
			container.appendChild(dom)
		contentDom = tab.getContentDom()

		if not contentDom?.parentNode
			d = $.xCreate({
				tagName: "content",
				name: tab.get("name")
			})
			tab.set("contentContainer", d)
			@getContentsContainer().appendChild(d)
			d.appendChild(contentDom)

		return

	addTab: (tab)->
		if tab.constructor == Object::constructor
			tab = new cola.TabButton(tab)
		tab.set("parent", @)

		@_tabRender(tab)if @_dom
		@refreshNavButtons()

		return tab

	getTab: (index)->
		tabs = @getTabsContainer()
		tabButtonDom = null

		if typeof index == "string"
			$tabDom = $(tabs).find(">tab[name='" + index + "']")
			if $tabDom.length > 0
				tabButtonDom = $tabDom[0]

		else if typeof index == "number"
			$tabDom = $(tabs).find(">tab")
			if index < $tabDom.length
				tabButtonDom = $tabDom[index]
		else if index instanceof cola.TabButton
			return index
		if tabButtonDom
			return cola.widget(tabButtonDom)

		return null

	removeTab: (tab)->
		if tab instanceof cola.TabButton
