/* 
USAA Army and Navy Container Controller JavaScript file 
Used for sizing and positioning of containers on the screen.
*/

Container = {
	adjust:function(){
		// width definitions
		var width = {
			'min':1024,
			'max':1600,
			'screen':$(window).width()
		};
		// height definitions
		var height = {
			'screen':$(window).height(),
			'contentCon':$('#content-container').height(),
			'headFoot':$('#header-nav').height()+$('#footer-nav').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');
		}
		
		if(height.screen > (height.contentCon+height.headFoot)){
			$('#container').css('height', height.screen+'px');
			$('#content-container').css('height', height.screen-height.headFoot+'px');
		}

	}
}

$(function(){
	Container.adjust();
	$(window).bind('resize', Container.adjust);
});