function SetStyles(obj, to, replace)
{
	obj.className = (replace ? to : obj.className+' '+to);
}

function SetEvents(what, from, to, replace)
{
	if(what && from && (to || (!to && replace)))
	{
		var res = document.getElementsByTagName(what);
		for(i=0;i<res.length;i++)
		{
			if(res[i].className==from || res[i].className.substr(0, Number(from.length)+1)==from+' ')
			{
				var to_old = res[i].className;
				if(document.all)
				{
					res[i].onmouseover = function() { SetStyles(this, to, replace); };
					res[i].onmouseout = function() { SetStyles(this, to_old, true); };
				}
				else
				{
					res[i].setAttribute("onMouseOver", "SetStyles(this, '"+to+"', "+replace+")");
					res[i].setAttribute("onMouseOut", "SetStyles(this, '"+to_old+"', true)");
				}
			}
		}
	}
}
