
// Initial resize: DOM is not loaded. use window for width
(function() {
	var windowWidth  = document.documentElement.clientWidth-20;
	var contentWidth = 950;
	var colWidth = (windowWidth > contentWidth)? Math.floor((windowWidth - contentWidth) / 2) : 0;
	document.write('<style type="text/css" media="screen">');
	document.write('#left-col  { width: ' + colWidth + 'px; height: '+ window.innerHeight +'px } ');
	document.write('#right-col { width: ' + colWidth + 'px; height: '+ window.innerHeight +'px } ');
	document.write('</style>');
})();


// When DOM is loaded, use document.body for width
windowResized = function() {
	var windowWidth   = jQuery(document.body).width();
	var contentWidth  = parseInt(jQuery('#main').css('width'));
	var contentHeight = jQuery('#main').height();
	var colWidth = (windowWidth > contentWidth)? Math.floor((windowWidth - contentWidth) / 2) : 0;
	jQuery('#left-col' ).css('width', colWidth).css('height', contentHeight);
	jQuery('#right-col').css('width', colWidth).css('height', contentHeight);
	jQuery('.footer').css('top', contentHeight - 200);

	// Set min-width on home page for IE6
	if (jQuery.browser == 'msie' && jQuery.browser.version[0] <= 6) {
		var minWidth = jQuery('#wrapper').css('min-width');
		if (minWidth)
			jQuery('#wrapper').css('width', Math.max(jQuery(window).width(), parseInt(minWidth)));
	}
}

// Window resized by user
jQuery(window).bind('resize', function() { windowResized(); });

// When document loads
jQuery(document).ready(function() { windowResized(); });

// Once all events are processed and images loaded 
jQuery(window).bind('load', function() { windowResized(); });

