var SC_Tabs = {
	
	tabs : [],
	
	start : function(buttons, contents)	{
		var tab = new this.newTabs(buttons, contents);
		this.tabs[tab.id] = tab;
	},
	
	newTabs : function(buttons, contents)	{
		var _id = SC_Tabs.tabs.length;
		var _interval = 10;
		SC_Tabs.tabs[_id] = this;
		
		this.swap = function()	{
			if(_interval > 0)	{
				clearInterval(SC_Tabs.tabs[_id]._swapInterval);
				SC_Tabs.tabs[_id]._currentContent.style.zoom = 1;
				SC_Tabs.tabs[_id]._nextContent = this._corresponds;
				SC_Tabs.tabs[_id]._swapInterval = setInterval('SC_Tabs.tabs[' + _id + '].hideCurrent()', 30);
			}
			else	{
				SC_Tabs.tabs[_id]._currentContent.style.display = "none";
				SC_Tabs.tabs[_id]._currentContent.style.zoom = 0;
				SC_Tabs.tabs[_id]._currentContent = SC_Tabs.tabs[_id]._nextContent;
				SC_Tabs.tabs[_id]._currentContent.style.display = "block";
				SC_Tabs.tabs[_id]._currentContent.style.zoom = 1;
				SC_Tabs.tabs[_id]._swapInterval = setInterval('SC_Tabs.tabs[' + _id + '].showCurrent()', 30);
			}
		};
		
		this.hideCurrent = function()	{
			if(_interval > -1)	{
				this._currentContent.style.opacity = _interval / 10;
				this._currentContent.style.filter = "alpha(opacity=" + _interval * 10 + ")";
				_interval--;
			}
			else	{
				clearInterval(this._swapInterval);
				this.swap();
			}
		};
		
		this.showCurrent = function()	{
			if(_interval < 11)	{
				this._currentContent.style.opacity = _interval / 10;
				this._currentContent.style.filter = "alpha(opacity=" + _interval * 10 + ")";
				_interval++;
			}
			else	{
				clearInterval(this._swapInterval);
				this._currentContent.style.zoom = 0;
			}
		};
		
		var i = buttons.length;
		while(i--)	{
			if(buttons[i].tagName == "a")	{
				buttons[i].removeAttribute("href");
			}
			buttons[i]._corresponds = contents[i];
			buttons[i].onclick = SC_Tabs.tabs[_id].swap;
		}
		
		i = contents.length;
		while(i--)	{
			if(i != 0)	{
				contents[i].style.display = "none";
				contents[i].style.opacity = 0;
				contents[i].style.filter = "alpha(opacity=0)";
			}
			else	{
				this._currentContent = contents[i];
			}
		}
	}
	
}
