function resizeOverlay(){
	
		var width = 677;
		var height = 400;
		var aspectRatio = width / height;
		
		var	windowWidth = $(window).width();
		var	windowHeight = $(window).height();
		
		if(windowWidth<width || windowHeight<height) {
		
		// start by scaling to the height
		var newHeight = $(window).height() -50;
			newWidth = Math.round(newHeight * aspectRatio);
			
			if (newWidth > windowWidth) {
				// it's not going to fit so use the width to scale
				newWidth = $(window).width() -100;
				newHeight = Math.round(newWidth / aspectRatio);
			}
			
			$(".simple_overlay").css('width', newWidth+'px');
			$(".simple_overlay").css('height', newHeight+'px');
			var left = Math.round( (windowWidth - newWidth)/(2) );
			var top = Math.round( (windowHeight - newHeight)/(2) );
			$(".simple_overlay").css('left',left+'px');
			$(".simple_overlay").css('top',top+'px');

			$(".simple_overlay >img").attr('width',newWidth);
			$(".simple_overlay > img").attr('height',newHeight);
		}
	}

$(document).ready(function() {
	resizeOverlay();

	$(".simple_overlay").overlay({

	// custom top position
	//top: 100,
	
	

	// some mask tweaks suitable for facebox-looking dialogs
	mask: {

		// you might also consider a "transparent" color for the mask
		color: '#ccc',

		// load mask a little faster
		loadSpeed: 400,

		// very transparent
		opacity: 0.5
	},

	// disable this for modal dialog-type of overlays
	//closeOnClick: true,

	// load it immediately after the construction
	load: true

});

});
