function initLightbox() 
{ 
	
	setupHSBox(); //HSbox params
	var bodyTag = document.getElementsByTagName("body")[0];
	var lightboxElements = getLightboxElements(bodyTag); //get all elements with rel=lightbox
	
	//assign events if >0 elements
	if(lightboxElements)
	{
		assignHSbox(lightboxElements);
	}	
}

function getLightboxElements(rootElement)
{
	if(rootElement.tagName==null) { return false; } //must be a DOM element
	else
	{
		var lb_anchors = new Array(); //array for lightbox anchors found
		var anchors = rootElement.getElementsByTagName("a"); //get all anchors and loop
		for(var i=0;i<anchors.length;i++)
		{
			if(anchors[i].rel.match("lightbox")) //if rel is lightbox
			{
				lb_anchors.push(anchors[i]); //store
			}
		}
		if(lb_anchors.length>0)
			return lb_anchors;
		else
			return false;
	}

}
function assignHSbox(lb_anchors)
{

	for(i=0;i<lb_anchors.length;i++)
	{		
		if(!hasCssClass(lb_anchors[i])) //add css class
		{
			lb_anchors[i].className = "highslide";
			lb_anchors[i].rel = "highslide";
		}
		else
		{
			lb_anchors[i].className = lb_anchors[i].className + " highslide";
			lb_anchors[i].rel = "highslide";
		}
		
		//events
		lb_anchors[i].onclick = function () { return hs.expand(this); };	
	}
}
function hasCssClass(element)
{
	if(element.className != "") { return true; }	
	else { return false; }	
}
function setupHSBox()
{
	if(hs)
	{
		hs.graphicsDir = 'Utils/highslide/graphics/';
		hs.align = 'center';
		hs.transitions = ['expand', 'crossfade'];
		hs.fadeInOut = true;
		hs.outlineType = 'rounded-white';
		hs.headingEval = 'this.a.title';
		hs.numberPosition = 'heading';
		hs.useBox = true;
		hs.width = 800;
		hs.height = 800;
		hs.showCredits = false;
		//hs.dimmingOpacity = 0.8;

		// Add the slideshow providing the controlbar and the thumbstrip
		hs.addSlideshow({
			//slideshowGroup: 'group1',
			interval: 5000,
			repeat: false,
			useControls: true,
			fixedControls: 'fit',
			overlayOptions: {
				position: 'top right',
				offsetX: 200,
				offsetY: -65
			},
			thumbstrip: {
				position: 'rightpanel',
				mode: 'float',
				relativeTo: 'expander',
				width: '210px'
			}
		});
	}

}






