function set_rel_lb()
{
	var anchors = document.getElementsByTagName('a');
	for (var i=0; i<anchors.length; i++)
	{
		var anchor = anchors[i];
		var titleAttribute = String(anchor.getAttribute('title'));
		if ((anchor.getAttribute('href') && (!titleAttribute.match('null'))))
		{
			if	(titleAttribute.toLowerCase().match(' lb$'))
			{
				anchor.setAttribute("title",titleAttribute.substring(0,titleAttribute.length-3));
				anchor.setAttribute("rel",'lightbox');
			}
			if (titleAttribute.match(/ lb\{(\w+)\}$/))
			{
				var txt = RegExp.$1;
				anchor.setAttribute("title",titleAttribute.substring(0,titleAttribute.length-txt.length-4));
				anchor.setAttribute("rel",'lightbox['+txt+']');
			}
		}
	}
}

Event.observe(window, 'load', set_rel_lb, false);
