$(document).ready(function(){
						   
	$(window).resize(function(){

		var leftmargin = ($(window).width() - $('#container').outerWidth())/2;
		if(leftmargin<0) leftmargin = 0;
		
		var topmargin = ($(window).height() - $('#container').outerHeight())/2;
		if(topmargin<0) topmargin = 0;

		$('#container').css({
			position:'absolute',
			left: leftmargin,
			top: topmargin
		});
		
	});
	// To initially run the function:
	$(window).resize();    
});
