function showOverlayBoxOne() {
	//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
	$('.overlayBoxOne').css({
		left:'50%',
		"margin-left":"-320px",
		top:'100px',
		position:'fixed'
	});
	// set the window background for the overlay. i.e the body becomes darker
	$('.bgCover').css({
		
		width: $(window).width(),
		height:$(window).height()
	});
}
function showOverlayBoxTwo() {
	//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
	$('.overlayBoxTwo').css({
		left:'50%',
		"margin-left":"-388px",
		top:'100px',
		position:'fixed'
	});
	// set the window background for the overlay. i.e the body becomes darker
	$('.bgCover').css({
		
		width: $(window).width(),
		height:$(window).height()
	});
}
function doOverlayOpenOne() {
	//set status to open
	isOpen = true;
	showOverlayBoxOne();
	$('.bgCover').css( 'display', 'block' );
	$('.overlayBoxOne').css( 'display', 'block' );
	// dont follow the link : so return false.
	return false;
}
function doOverlayOpenTwo() {
	//set status to open
	isOpen = true;
	showOverlayBoxTwo();
	$('.bgCover').css( 'display', 'block' );
	$('.overlayBoxTwo').css( 'display', 'block' );
	// 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.
	$('.overlayBoxOne').css( 'display', 'none' );
	$('.overlayBoxTwo').css( 'display', 'none' );
	$('.bgCover').css( 'display', 'none' );
	$('.bgCover').css( 'display', 'none' );
	
}
// if window is resized then reposition the overlay box
$(window).bind('resize',showOverlayBoxOne);
$(window).bind('resize',showOverlayBoxTwo);
// activate when the link with class launchLink is clicked
$('a.overlayOne').click( doOverlayOpenOne );
$('a.overlayTwo').click( doOverlayOpenTwo );
// close it when closeLink is clicked
//$('.overlayBoxOne img').click( doOverlayClose);
//$('.overlayBoxTwo img').click( doOverlayClose);
$('.bgCover').click( doOverlayClose );
$('.closeOverlay').click( doOverlayClose );
isOpen = false;
$(function() {
$('.overlayBox').bgiframe();
});

function callMe() {
    // if window is resized then reposition the overlay box
    $(window).bind('resize',showOverlayBoxOne);
    $(window).bind('resize',showOverlayBoxTwo);
    // activate when the link with class launchLink is clicked
    $('a.overlayOne').click( doOverlayOpenOne );
    $('a.overlayTwo').click( doOverlayOpenTwo );
    // close it when closeLink is clicked
  //  $('.overlayBoxOne img').click( doOverlayClose);
  //  $('.overlayBoxTwo img').click( doOverlayClose);
	$('.closeOverlay').click( doOverlayClose );
    $('.bgCover').click( doOverlayClose );
    isOpen = false;
    $(function() {
    $('.overlayBox').bgiframe();
    });
}


