﻿var Tabs = {

	groups: new Array(),

	InitGroup: function(groupCode, data)
	{
		var x;
		for (x = 0; x < this.groups.length; x++)
		{
			if (groupCode == this.groups[x].code) return;
		}
		this.groups.push({ code: groupCode, data: data });
	},

	FocusTab: function(groupCode, tabCode)
	{
		var g, t;
		for (g = 0; g < this.groups.length; g++)
		{
			if (groupCode == this.groups[g].code)
			{
				for (t = 0; t < this.groups[g].data.length; t++)
				{
					if (tabCode == this.groups[g].data[t].code)
					{
						if (document.getElementById(this.groups[g].data[t].tabId)) document.getElementById(this.groups[g].data[t].tabId).className = 'Tab TabActive';
						if (document.getElementById(this.groups[g].data[t].contentId)) document.getElementById(this.groups[g].data[t].contentId).style.display = 'block';
					}
					else
					{
						if (document.getElementById(this.groups[g].data[t].tabId)) document.getElementById(this.groups[g].data[t].tabId).className = 'Tab';
						if (document.getElementById(this.groups[g].data[t].contentId)) document.getElementById(this.groups[g].data[t].contentId).style.display = 'none';
					}
				}
				return;
			}
		}
	}

};