var tab_defBack, tab_defText, tab_selBack, tab_selText;

function TabInitDefault(defBack, defText, selBack, selText)
{
	tab_defBack = defBack;
	tab_defText = defText;
	tab_selBack = selBack;
	tab_selText = selText;
}

function TabAction(id, state, outText, outBack, onText, onBack)
{	return TabColorMaker(id, state,
		(onBack ? onBack : tab_selBack),
		(onText ? onText : tab_selText),
		(outBack ? outBack : tab_defBack),
		(outText ? outText : tab_defText)
	);
}

function TabActionOver(id, onText, onBack)
{	return TabColorMaker(id, true,
		(onBack ? onBack : tab_selBack),
		(onText ? onText : tab_selText),
		null,
		null
	);
}

function TabActionOut(id, outText, outBack)
{	return TabColorMaker(id, false,
		null,
		null,
		(outBack ? outBack : tab_defBack),
		(outText ? outText : tab_defText)
	);
}

function TabColorMaker(id,state,col1,col2,col3,col4)
{
	var td,font,selected;

	if (IE5 || NS6)
	{
		td	= document.getElementById("menu"+id);
		font	= document.getElementById("font"+id);
		selected= (font && td);

		if (state) {
			if (selected)	td.style.backgroundColor= col1;
			if (selected)	font.style.color	= col2;
		}
		else {
			if (selected)	td.style.backgroundColor= col3;
			if (selected)	font.style.color	= col4;
		}
	}
	return true;
}

