function showOverlayBox() {
	//if box is not set to open then don't do anything
	if( isOpen == false ) return;
	// set the properties of the overlay box, the left and top positions
	$('.overlayBox').css({
		display:'block',
		left:( $(window).width() - $('.overlayBox').width() )/2,
		top:"30px",
		position:'absolute'
	});
	// set the window background for the overlay. i.e the body becomes darker
	$('.bgCover').css({
		
		width: $(window).width(),
		height:$('#pageWrapper').height()
	});
}
function doOverlayOpen() {
	//set status to open
	isOpen = true;
	showOverlayBox();
	$('.bgCover').css( 'display', 'block' );
	$('.overlayBox').css( 'display', 'block' );
	$('html, body').animate({scrollTop:0}, 'slow');

	// dont follow the link : so return false.
	return false;
}
function doOverlayClose() {
	//set status to closed
	isOpen = false;
	
	// now animate the background to fade out to opacity 0
	// and then hide it after the animation is complete.
	$('.overlayBox').css( 'display', 'none' );
	$('.bgCover').css( 'display', 'none' );
	
}
// if window is resized then reposition the overlay box
$(window).bind('resize',showOverlayBox);
// activate when the link with class launchLink is clicked
$('.mapContent').click( doOverlayOpen );
// close it when closeLink is clicked
$('.closeOverlay').click( doOverlayClose );
$('.bgCover').click( doOverlayClose );
isOpen = false;
$(function() {
$('.overlayBox').bgiframe();
});

