﻿$(document).ready(function() {
		var postsHeight = $("#posts")[0].scrollHeight;
		var pageHeight = $("#midcontainerdyn #inner-wrap-middle").height() - $("#posts").height() + postsHeight;

		// Resize the page and turn overflow scrolling off
		if (postsHeight > 253) {
				$("#posts").css("overflow", "visible");
				$("#posts").height(postsHeight);
				$("#midcontainerdyn #inner-wrap-middle").height(pageHeight);
		}

		// When the page is at it's smallest, the background gets cut off by the inner-wrap-bottom
		// so we'll inject some HTML into it and repeat the background positioning it so it flows
		// into that section.
		if (pageHeight < 500) {
				// Stupid IE6 and IE7 don't offset the background the same as FF, Safari and Chrome
				var bgOffset = pageHeight;
				/*if ($.browser.msie && ($.browser.version == "6.0" || $.browser.version == "7.0" || $.browser.version.number < 8.0)) {
				bgOffset += 235;
				}*/

				$("#inner-wrap-bottom").wrapInner("<div id=\"background-overflow\"></div>");
				var bgPos = "0px -" + (bgOffset) + "px";
				$("#inner-wrap-bottom > div").css("background-position", bgPos);

				$("#scrollformore").hide();
		}
});