// JavaScript Document mainBannerResizer.js
//DESIGN CONSTANTS
var bannerWidth=883;
var bannerHeight=485;
var idOne="mainBanner";
var idTwo="mainBannerHidden";
var otherHeightSum=100;
var containerSize=980;
var maxHeight=0.8;
var maxWidth=0.9;
//FUNCTIONS
function bannerResize()
{
	var ratio=bannerWidth/bannerHeight;
	var screenWidth=screen.availWidth;
	var screenHeight=screen.availHeight;
	if(isOversized(bannerWidth,bannerHeight,screenWidth,screenHeight)==true)
	{
		bannerHeight=Math.round(screenHeight*(maxHeight-(otherHeightSum/screenHeight)));
		bannerWidth=Math.round(ratio*bannerHeight);
		if(isOversized(bannerWidth,bannerHeight,screenWidth,screenHeight)==true)
		{
			bannerWidth=Math.round(screenWidth*maxWidth)
			bannerHeight=Math.round(bannerWidth/ratio);
		}
		try
		{
			document.getElementById(idOne).width=bannerWidth;
			document.getElementById(idOne).height=bannerHeight;
		}catch(error){}
		try
		{
			document.getElementById(idTwo).width=bannerWidth;
			document.getElementById(idTwo).height=bannerHeight;
		}catch(error){}
		setSize("reset");
	}
}
function isOversized(width,height,screenWidth,screenHeight)
{
	var returnValue=false;
	var otherHeightSumRatio=otherHeightSum/screenHeight;
	if(Math.round(screenWidth*maxWidth)<width)
	{
		returnValue=true;
	}
	if(Math.round(screenHeight*(maxHeight-otherHeightSumRatio))<height)
	{
		returnValue=true;
	}
	return returnValue;
}