$(window).load(function () {
    $('#page-background').css('display', 'block');
	var theWindow = $(window),
			$bg = $("#page-background"),
			aspectRatio = $bg.width() / $bg.height();
	function resizeBg() {
		if ((theWindow.width() / theWindow.height()) < aspectRatio) {
			$bg.removeClass().addClass('bgheight');
		} else {
			$bg.removeClass().addClass('bgwidth');
		}
	}
	theWindow.resize(function () {
		resizeBg();
	}).trigger("resize");
});
