jQuery(document).ready(function($){
	// REPOSITION ELEMENTS ON WINDOW RESIZE
	function resizeWindow() {
		var viewportWidth = $(window).width();
		var viewportHeight = window.innerHeight ? window.innerHeight : $(window).height();
		var reservedHeight = 70;
		var reservedWidth = 229;
		var maxContentWidth = 1280;
		var outerWidth = viewportWidth-reservedWidth-20;
		var ratio = 1.185;
		var contentHeight = viewportHeight-reservedHeight;
		var contentWidth = Math.round(contentHeight*ratio);
		if (contentWidth > outerWidth) {
			contentWidth = outerWidth;
			contentHeight = Math.round(contentWidth/ratio);
		}
		if (contentWidth > maxContentWidth) {
			contentWidth = maxContentWidth;
			contentHeight = Math.round(contentWidth/ratio);
		}
		//var outerContentWidth = contentWidth;
		//var innerLeft = 0;
		var leftPadding = 0;
		if (outerWidth > contentWidth && contentWidth > 700) {
			var m = maxContentWidth-700;
			var n = contentWidth-700;
			leftPadding = Math.round((n/m)*180);
			if (leftPadding+contentWidth > outerWidth) {
				leftPadding = outerWidth-contentWidth;
			}
		}
		$("#outer-content").css("width",outerWidth-leftPadding+"px");
		$("#outer-content").css("height",contentHeight+"px");
		$("#outer-content").css("padding-left",leftPadding+"px");
		$("#main-content").css("width",contentWidth+"px");
		$("#main-content").css("height",contentHeight+"px");
		$("#footer").css("width",contentWidth+"px");
		$("#logo").css("width",contentWidth+"px");

        if ($("#content-table1").length) {
            $("#content-table1").css("width",outerWidth-leftPadding-20+"px");
        }

		var slideShowHeight = Math.round(contentWidth/1.7777);
		$("#slideshow").css("height",slideShowHeight+"px");
	}

	$(window).resize(function(){
		resizeWindow();
	});

	resizeWindow();
 });