function Tabs(id, color)
{
	this.id = id;
	this.color = color;
	this.items = new Array();
	this.active = 0;
	this.initialized = false;
	this.left = new Array();
	this.center = new Array();
	this.right = new Array();
	this.link = new Array();
	this.image = new Array();
	this.content = new Array();
	this.lines = new Array();
	return this;
}

Tabs.prototype.Add = function(index, twoLine, activeImg, inactiveImg)
{
	this.items[this.items.length] = {index:index, twoLine:twoLine, activeImg:activeImg, inactiveImg:inactiveImg};
}

Tabs.prototype.Initialize = function()
{
	this.initialized = true;
	for(i = 0; i < this.items.length; i++)
	{
		this.link[this.link.length] = document.getElementById(this.id + '_maLink' + i);
		this.left[this.left.length] = document.getElementById(this.id + '_TabLeft' + i);
		this.center[this.center.length] = document.getElementById(this.id + '_TabCenter' + i);
		this.right[this.right.length] = document.getElementById(this.id + '_TabRight' + i);
		this.content[this.content.length] = document.getElementById(this.id + '_Content' + i);
		this.image[this.image.length] = document.getElementById(this.id + '_mimgTab' + i);
		this.lines[this.lines.length] = (this.link[this.link.length-1].className.indexOf('TwoLine') > 0);
	}
}
Tabs.prototype.Activate = function(obj, index)
{
	var lines = '';
	
	if(this.active != index)
	{
		if(!this.initialized)
			this.Initialize(obj);
			
		this.DeActivate();
		this.link[index].className = 'TabActiveLink';	
		
		if(this.items[index].twoLine)
			lines = '_TwoLine';

		this.left[index].className = '';
		this.left[index].childNodes[0].src = '/global/images/TabActiveBgRepeat' + this.color + lines + '.jpg';
		
		if(this.items[index].activeImg == null)
			this.center[index].className = 'TabActive' + this.color + lines;
		else
			this.image[index].src = this.items[index].activeImg;

		this.right[index].className = '';
		this.right[index].childNodes[0].src = '/global/images/TabActiveBgRepeat' + this.color + lines + '.jpg';
		
		this.content[index].style.display = 'inline';
		this.active = index;
	}
	return false;
}

Tabs.prototype.DeActivate = function()
{
	var lines = '';
	
	if(this.items[this.active].twoLine)
		lines = '_TwoLine';

	this.link[this.active].className = 'TabInactiveLink';
	this.left[this.active].className = 'TabInactiveEnd' + this.color + lines;
	this.left[this.active].childNodes[0].src = '/global/images/TabInactiveBgRepeat' + this.color + lines + '.jpg';

	if(this.items[this.active].activeImg == null)		
		this.center[this.active].className = 'TabInactiveCenter' + this.color + lines;
	else
		this.image[this.active].src = this.items[this.active].inactiveImg;
	
	this.right[this.active].className = 'TabInactiveEnd' + this.color + lines;
	this.right[this.active].childNodes[0].src = '/global/images/TabInactiveBgRepeat' + this.color + lines + '.jpg';

	this.content[this.active].style.display = 'none';
}
