/* 
Budweiser.com Container Controller JavaScript file 
Used for sizing and positioning of containers on the screen.
*/

Container = {
	adjust:function(){
		// height definitions
		var width = {
			'min':1012,
			'max':1920,
			'screen':$(window).width()
		};
		// width definitions
		var height = {
			'min':608,
			'max':1200,
			'screen':$(window).height(),
			'content':$('#content').height(),
			'foot':$('#footer-container').height()
		}
		// middle width
		if(width.screen > width.min && width.screen < width.max){
			$('#container').css('width', '100%');
			$('#content').css('left', (width.screen-width.min)/2+'px');
		}
		// minimum width
		else if(width.screen <= width.min){
			$('#container').css('width', width.min+'px');
			$('#content').css('left', '0');
		}
		// maximum width
		else {
			$('#container').css('width', width.max+'px');
			$('#content').css('left', (width.max-width.min)/2+'px');
		}
		// middle height
		if(height.screen > height.min && height.screen < height.max){
			$('#container').css('height', height.screen+'px');
			$('#content').css('top', ((height.screen-height.foot)-height.content)/2+'px')
		}
		// minimum height
		else if(height.screen <= height.min){
			$('#container').css('height', height.min+'px');
			$('#content').css('top', '0')
		}
		// maximum height
		else {
			$('#container').css('height', height.max+'px');
			$('#content').css('top', ((height.max-height.foot)-height.content)/2+'px')
		}
	}
}


$(document).ready(function(){
	Container.adjust();
	$("body").css('visibility', 'visible');
	$(window).bind('resize', Container.adjust);
});





