// JavaScript Document


var x,y;
x=0;
y=0;
if (self.innerHeight) // all except Explorer
{
	x = self.innerWidth;
	y = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)// Explorer 6 Strict Mode
{
	x = document.documentElement.clientWidth;
	y = document.documentElement.clientHeight;
}
else if (document.body) // other Explorers
{
	x = document.body.clientWidth;
	y = document.body.clientHeight;
}


var yPosition = (y/2) - 160;
var xPosition = ((x-750)/2)-228+750;
//start random number
//ni is the number of available images
var ni = 31;
	nb=Math.random()*ni;
	atmoNb = Math.round(nb);
// end random number
//alert(x);
//alert(xPosition);
if (x > 1258)
	{
	document.write("<div style=\"position:absolute; left:" + xPosition + "px; top:" + yPosition + "px; z-index:-100; background-image:url(http://www.browning.com/support/images/atmo" + atmoNb + ".jpg); background-position:left center; background-repeat:no-repeat; width:437px; height:321px\"></div>");
	
	}
if (x < 1259)
	{
		//alert("TOO SMALL!");
		var boxSizeVar = 0;
		boxSizeVar = x - 818;
	document.write("<div style=\"position:absolute; left:800px; top:0px; z-index:99; background-image:url(http://www.browning.com/support/images/blackbox.jpg); background-position:left center; background-repeat:no-repeat; width:" + boxSizeVar + "px; height:90px\"></div>");
	
	}





function findPos(obj)
{

document.getElementById("adjustToFit").style.height = '0px';

	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	
	//alert('Image Postion= ' + curtop);
	//alert("Available Y space= " + y);
	if(curtop+130 < y)
	{
	//alert("so far so good.");
	document.getElementById("adjustToFit").style.height = y-280 + "px";
	document.getElementById("adjustToFit").style.width = '1px';
	//alert(document.getElementById("adjustToFit").style.height);
	}
	//alert("Adjust to fit height is now " + document.all("adjustToFit").style.height);
	
}
			function findPos2(obj)
			{
			document.getElementById("adjustToFit").style.height = '0px';
						var x,y;
						x=0;
						y=0;
						if (self.innerHeight) // all except Explorer
						{
							x = self.innerWidth;
							y = self.innerHeight;
						}
						else if (document.documentElement && document.documentElement.clientHeight)// Explorer 6 Strict Mode
						{
							x = document.documentElement.clientWidth;
							y = document.documentElement.clientHeight;
						}
						else if (document.body) // other Explorers
						{
							x = document.body.clientWidth;
							y = document.body.clientHeight;
						}
			var curleft = curtop = 0;
				if (obj.offsetParent) {
					curleft = obj.offsetLeft
					curtop = obj.offsetTop
					while (obj = obj.offsetParent) {
						curleft += obj.offsetLeft
						curtop += obj.offsetTop
					}
				}
				
				//alert('Image Postion= ' + curtop);
				//alert("Available Y space= " + y);
				if(curtop+130 < y)
				{
				document.getElementById("adjustToFit").style.height = y-260 + "px";
				document.getElementById("adjustToFit").style.width = '1px';
				}
			//alert("Adjust to fit height is now " + document.all("adjustToFit").style.height);
			}

//start of portlet shuffle on home page

function shufflePortletsFcn()
{
}
/*function shufflePortletsFcn()
			{
			document.getElementById("item1a").style.display = "none";
			document.getElementById("item2a").style.display = "none";
			//document.getElementById("item3a").style.display = "none";
			document.getElementById("item1").style.display = "block";
			document.getElementById("item2").style.display = "block";
			//document.getElementById("item3").style.display = "block";
			}
function shufflePortletsFcn2()
			{
			if (document.getElementById("item1").style.display == "block"){
			document.getElementById("item1").style.display = "none";
			document.getElementById("item2").style.display = "none";
			//document.getElementById("item3").style.display = "none";
			document.getElementById("item1a").style.display = "block";
			document.getElementById("item2a").style.display = "block";
			//document.getElementById("item3a").style.display = "block";
			}
			else
			{
			dly=setTimeout('shufflePortletsFcn()',800);
			}
			}*/
			//end of portlet shuffle on home page