function undef(e)
{
	if (typeof(e) == 'undefined') return true;
	if (e === null) return true;
	return false;
}

function findtag(obj, tag)
{
	if (undef(obj) || undef(tag) || tag.length < 1) return false;
	if (obj.childNodes.length < 1) return false;
	
	for (var i =0; i < obj.childNodes.length; i++)
	{
		var ch = obj.childNodes[i];
		if (ch.nodeName.toLowerCase() != tag ) continue;
		return ch;
	}	
	return false;
}

function uptab( _cls )
{
	if (undef(_cls) || undef(_cls.className)) return;
	_cls.style.backgroundColor = "#ffffff";

	var f = findtag(_cls, 'a');
	if (f === false ) return;
	f.style.color="#791214";

	var im = findtag(f, 'img');
	if (im === false) return;	
	im.src = im.src.replace('inactive','active');
}



function downtab( _cls )
{
	if (undef(_cls) || undef(_cls.className)) return;
	_cls.style.backgroundColor = "#791214";

	var f = findtag(_cls, 'a');
	if (f === false ) return;
	f.style.color="#ffffff";
	f.style.fontWeight="normal";

	var im = findtag(f, 'img');
	if (im === false) return;
	im.src = im.src.replace('_active','_inactive');
}
