// -----------------------------------------------------------------------------------
//	
//  Lightbox 2.0 Validator
//	
//	This function enables to change the way images are recognised as sets
//	
//	{{{ 'rel="lightbox[setname]" }}}
//  
//   can be replaced with
//  
//	{{{ rel="lightbox" class="lightbox-setname" }}}
//
//  Function should be triggered before lightbox initialsation, 
//  it has support for multiple class names
//
// -----------------------------------------------------------------------------------
function initLightboxValidator() 
{ 
	for (var i=0; (a = document.getElementsByTagName('a')[i]); i++)
	{
		if (a.getAttribute('rel') == 'lightbox')
		{
			var classes = new String(Element.classNames(a));
			
			if (classes)
			{
				var x = classes.split(/\s+/);
				for (var ii=0; ii < x.length; ii++)
				{
					if (/^lightbox-/.test(x[ii]))
					{
						a.setAttribute('rel', 'lightbox['+x[ii].substr(9)+']');
					}
				}
			}
		}
	}
}

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