slideshow = null;
var width=0;
var height=0;

function popGal() {

	if(slideshow == null) {
		slideshow = new Slideshow('show', data, {controller: true, height: 690, thumbnails: false, width: 900});
	} 	

	showOverlay();
	positionWindow();

}

function positionWindow() {
	
	if (width == '0'){ width = $("show").getWidth();}
	if (height == '0'){ height = $("show").getHeight();}
	//width = $("show").getWidth();
	//height = $("show").getHeight();
	$("show").style.position = 'absolute';
	$("show").style.top = ($(window).getHeight() / 2) - (height / 2) + "px";
    $("show").style.left = ($(window).getWidth() / 2) - (width / 2) + "px";
	$("show").style.display = '';
}

function showOverlay() {

	$(window).addEvent('resize', positionWindow);
	$("overlay").style.width = $('main').getWidth() + "px";
	$("overlay").style.height = $('main').getHeight() + "px";
	$("overlay").style.display = '';
	$("overlay").addEvent('click', hideOverlay);
	//$("footer").style.display = '';
	$("overlay").setStyle('alpha','1');
	if(typeof sIFR == "function" && !sIFR.UA.bIsIEMac && (!sIFR.UA.bIsWebKit || sIFR.UA.nWebKitVersion >= 100)){
		sIFR.bHideBrowserText = false;
		sIFR.setup();
	};

}

function hideOverlay() {
	/*$("show").style.display="none";*/
	$("overlay").style.display = 'none';
	$("show").style.display = 'none';
	$(window).removeEvent('resize');
	$("overlay").removeEvent('click');
	//$("footer").style.display = '';
	if(typeof sIFR == "function" && !sIFR.UA.bIsIEMac && (!sIFR.UA.bIsWebKit || sIFR.UA.nWebKitVersion >= 100)){
		sIFR.bHideBrowserText = false;
		sIFR.setup();
	};
}

