function Tabs(id, args)
{
  this.ID = id;
	this.Args = args;
	
	this.GetHeaderCellID = function(index)
	{
		return this.ID + "_H_" + index;
	}

	this.SetTab = function(newIdx)
	{
		var cell = $get(this.GetHeaderCellID(newIdx));
		var tr = cell.parentNode;
		
		var cells = tr.cells;
		
		for (var i=0; i<cells.length; i++)
		{
			var cell = cells[i];
			
			var idx = cell.getAttribute("_tab");
			if (idx != null)
			{
				var div = this.GetContentDiv(idx);
				div.style.display = (idx == newIdx ? '' : 'none');
				cell.className = (idx == newIdx ? this.Args.HeaderActiveCSS : this.Args.HeaderCSS);
			}
		}
		
		if (this.Args.OnSelectedTabChanged)
		{
			eval(this.Args.OnSelectedTabChanged + "(newIdx)");
		}
	}
	
	this.GetContentDiv = function(index)
	{
		return document.getElementById(this.ID + '_' + index);
	}
}
