<!--

	function tabsHandler()
	{
		this.tabs = null;
		this.submenus = null;
		this.schema = null;
		this.x24_skin = null;
		this.object_name = null;
		this.tabs_place = null;
		this.submenus_place = null;
		this.width = null;
		this.gfx = null;
		this.active_tab = null;
		
		this.setTabs = tabsHandler_setTabs;
		this.setSubmenus = tabsHandler_setSubmenus;
		this.renderTabs = tabsHandler_renderTabs;
		this.setSchema = tabsHandler_setSchema;
		this.setX24Skin = tabsHandler_setX24Skin;
		this.renderTab = tabsHandler_renderTab;
		this.setObjectName = tabsHandler_setObjectName;
		this.setTabsPlace = tabsHandler_setTabsPlace;
		this.setSubmenusPlace = tabsHandler_setSubmenusPlace;
		this.setWidth = tabsHandler_setWidth;
		this.setGfx = tabsHandler_setGfx;
		this.getActiveTab = tabsHandler_getActiveTab;
	}

	function tabsHandler_getActiveTab()
	{
		return this.active_tab;
	}

	function tabsHandler_setGfx(s)
	{
		this.gfx = s;
	}

	function tabsHandler_setWidth(i)
	{
		this.width = i;
	}

	function tabsHandler_setTabsPlace(o)
	{
		this.tabs_place = o;
	}

	function tabsHandler_setSubmenusPlace(o)
	{
		this.submenus_place = o;
	}

	function tabsHandler_setSchema(s)
	{
		this.schema = s;
	}
	
	function tabsHandler_setX24Skin(s)
	{
		this.x24_skin = s;
	}
	
	function tabsHandler_setTabs(a)
	{
		this.tabs = a;
	}

	function tabsHandler_setSubmenus(a)
	{
		this.submenus = a;
	}
	
	function tabsHandler_renderTabs(iActive)
	{
		// Tabs >>>

		var sHTML = '';
		var sTab = '';
		var sOnClick = '';
		var sTDClass = 'tab_' + this.schema;
		var sLink = '';
		
		this.active_tab = iActive;
		
		sHTML = '<table cellpadding="0" cellspacing="0" border="0" width="' + this.width + '" height="25"><tr><td background="' + this.gfx + '/tabs/%schema%/mid_3%x24_skin%.gif">';
		sHTML += '<table cellpadding="0" cellspacing="0" border="0" height="25"><tr>';

		for (index in this.tabs)
		{
			if (iActive == index)
				sLinkClass = 'tab_' + this.schema + '_hi';
			else
				sLinkClass = 'tab_' + this.schema + '_lo';

			if (this.tabs[index]['target'] == '')
				this.tabs[index]['target'] = 'self';

			sOnClick = this.object_name + '.renderTabs(' + index + ');';

			sLink = this.tabs[index]['link'];
			if (sLink.indexOf('javascript:') != -1)
			{
				var r = new RegExp('javascript:', "g");
				sOnClick += sLink.replace(r, '');
				sLink = '#';
			}

			sTab = '<td><img width="3" height="25" src="' + this.gfx + '/tabs/%schema%/left_%1%%x24_skin%.gif"/></td>';
			sTab += '<td background="' + this.gfx + '/tabs/%schema%/mid_%2%%x24_skin%.gif" class="tab ' + sTDClass + ' bold" valign="top">&nbsp;';
			sTab += '<a target="_' + this.tabs[index]['target'] + '" onClick="' + sOnClick + '" href="' + sLink + '" class="' + sLinkClass + ' bold">' + this.tabs[index]['res'] + '</a>';
			sTab += '</td>';
			sTab += '<td><img width="9" height="25" src="' + this.gfx + '/tabs/%schema%/right_%3%%x24_skin%.gif"/></td>';

			if ((iActive == index) && (iActive == 0) && (this.tabs.length == 1))
				sTab = this.renderTab(sTab, Array(4, 2, 3));
			if ((iActive == index) && (iActive == 0) && (this.tabs.length > 1))
				sTab = this.renderTab(sTab, Array(4, 2, 2));
			if ((iActive == index) && (iActive != 0) && (index != this.tabs.length - 1))
				sTab = this.renderTab(sTab, Array(2, 2, 2));
			if ((iActive == index) && (iActive != 0) && (index == this.tabs.length - 1))
				sTab = this.renderTab(sTab, Array(2, 2, 3));

			if ((iActive != index) && (index == (iActive + 1)) && (index != (this.tabs.length - 1)))
				sTab = this.renderTab(sTab, Array(3, 1, 1));
			if ((iActive != index) && (index == (iActive - 1)) && (index != (this.tabs.length - 1)))
				sTab = this.renderTab(sTab, Array(1, 1, 5));
			if ((iActive != index) && (index == (iActive + 1)) && (index == (this.tabs.length - 1)))
				sTab = this.renderTab(sTab, Array(3, 1, 4));
			if ((iActive != index) && (Math.abs(iActive - index) > 1) && (index != (this.tabs.length - 1)))
				sTab = this.renderTab(sTab, Array(1, 1, 1));
			if ((iActive != index) && (Math.abs(iActive - index) > 1) && (index == (this.tabs.length - 1)))
				sTab = this.renderTab(sTab, Array(1, 1, 4));

			sHTML += sTab;
		}

		sHTML += '</tr></table>';
		sHTML += '</td></tr></table>';
		sHTML = sHTML.replace(/%schema%/g, this.schema);
		sHTML = sHTML.replace(/%x24_skin%/g, this.x24_skin);
		this.tabs_place.innerHTML = sHTML;

		// <<< Tabs

		// Submenu >>>
		
		if (this.submenus.length > 0)
		{
			sHTML = '';
			aHTML = new Array();
			i = iActive * 10;
			iIndex = 0;
			sLinkClass = 'tab_' + this.schema + '_hi';
			sInstantJS = '';

			if (this.submenus[i])
			{
				sHTML += '<table cellpadding="0" cellspacing="0" border="0"><tr><td class="' + sLinkClass + '">';
				while (this.submenus[i])
				{
					if (this.submenus[i]['html'] != '')
					{
						aHTML[iIndex] = this.submenus[i]['html'];
						sLink = this.submenus[i]['link'];
						if (sLink.indexOf(';') != -1)
							sInstantJS += sLink;
					}
					else
						aHTML[iIndex] = '<a class="' + sLinkClass + '" href="' + this.submenus[i]['link'] + '">' + this.submenus[i]['res'] + '</a>';
					iIndex++;
					i = iActive * 10 + iIndex;
				}
				sHTML += aHTML.join('</td><td class="' + sLinkClass + '">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;');
				sHTML += '</td></tr></table>';
			}
			else
				sHTML = '&nbsp;';

			this.submenus_place.innerHTML = sHTML;
			setTimeout(sInstantJS, 1);
		}
		
		// <<< Submenu
	}
	
	function tabsHandler_renderTab(sTab, aConfig)
	{
		sTab = sTab.replace(/%1%/g, aConfig[0]);
		sTab = sTab.replace(/%2%/g, aConfig[1]);
		sTab = sTab.replace(/%3%/g, aConfig[2]);
		return sTab;
	}
	
	function tabsHandler_setObjectName(s)
	{
		this.object_name = s;
	}

//-->
