// ---------------------------------------------------
/*	5/03/10  Darren 
	Custom Lightbox functions to implement a modal dialog box
*/
// ---------------------------------------------------
var curr_lb_div;
var is_modal = false;

// function to retrieve styles that are not inline.
function getStyle(el, cssprop){
	if (el.currentStyle) //IE
		return el.currentStyle[cssprop]
	else if (document.defaultView && document.defaultView.getComputedStyle) //Firefox
		return document.defaultView.getComputedStyle(el, "")[cssprop]
	else //try and get inline style
		return el.style[cssprop]
}

function ShowLightBox(lb_div, isModal)
{
	var lbDiv = document.getElementById(lb_div);
	var lbWidth = parseInt(getStyle( lbDiv, 'width'))
	var lbHeight = parseInt(getStyle( lbDiv, 'height'))
	var lbPaddingTop = parseInt(getStyle( lbDiv, 'paddingTop'))
	var lbPaddingBottom = parseInt(getStyle( lbDiv, 'paddingBottom'))

//	Adjust the margin-top and minimum-height of the wrapper
//	to vertically center the div and prevent it from being moved
//	off the page.
	var mTop = (0-Math.ceil((lbHeight+lbPaddingTop+lbPaddingBottom)/2))+'px';
	document.getElementById('lb-wrapper').style.marginTop=mTop;
	document.getElementById('lb-wrapper').style.minWidth=lbWidth;
	document.getElementById('lb-wrapper').style.display='block';
	document.getElementById(lb_div).style.display='block';
    document.getElementById('page-fade').style.display='block';
    curr_lb_div = lb_div;
    if (isModal) is_modal = true;
    else is_modal = false;
}

function HideLightBox()
{
    if (document.getElementById(curr_lb_div))
    {
		document.getElementById('lb-wrapper').style.display='none';
        document.getElementById(curr_lb_div).style.display='none';
        document.getElementById('page-fade').style.display='none';
        curr_lb_div = '';
    }
}
// ---------------------------------------------------
