function el(id)
{
	return document.getElementById(id);
}

function toggleElement(id)
{
	var elm = el(id);
	if (elm) elm.style.display = elm.style.display == "" ? "none" : "";
}


var TabViewer =
{
	_lastTab: {},
	_lastControl: {},

	show: function(id, index)
	{
		if (typeof this._lastControl[id] != "undefined")
		{
			this._lastTab[id].style.display = "none";
			this._lastControl[id].className = "";
		}

		this._lastTab[id] = el("tab-"+id+"-"+index);
		if (this._lastTab[id])
		{
			this._lastTab[id].style.display = "block";
			this._lastControl[id] = el("tab-control-"+id+"-"+index);
			this._lastControl[id].className = "tab-control-active";
			return true;
		}

		return false;
	},

	hide: function(id, index)
	{
		var tab = el("tab-"+id+"-"+index);
		if (tab) {
			tab.style.display = "none";
			return true;
		}

		return false;
	},

	activateFirst: function(id)
	{
		this.show(id, 0);
		for (index = 1; this.hide(id, index); index++);
	}

};

