$(document).ready(function() {
	var bSidebar, nContentMax, nContentOffcer, newHeight;
	bSidebar = $('#SIDEBAR').length;
	nContentMax = (bSidebar) ? 670 : 850;
	nContentOffset = (bSidebar) ? 250 : 30; 
	$("#CONTENT").width(Math.min($(document).width() - nContentOffset, nContentMax));
	$("#FOOTER").width(Math.min($(document).width() - 30, 850));
	newHeight = Math.max($("#CONTENT").height(), $("#SIDEBAR").height(), 650);
	$("#CONTENT").height(newHeight);
	if (bSidebar) {
		$("#SIDEBAR").height(newHeight);
	}
});
$(window).resize(function() {
	var bSidebar, nContentMax, nContentOffcer, newHeight;
	bSidebar = $('#SIDEBAR').length;
	nContentMax = (bSidebar) ? 670 : 850;
	nContentOffset = (bSidebar) ? 250 : 30; 
	$("#CONTENT").width(Math.min($(document).width() - nContentOffset, nContentMax));
	$("#FOOTER").width(Math.min($(document).width() - 30, 850));
	newHeight = Math.max($("#CONTENT").height(), $("#SIDEBAR").height(), 650);
	$("#CONTENT").height(newHeight);
	if (bSidebar) {
		$("#SIDEBAR").height(newHeight);
	}
});
