// Page formatting
function bodyStretch(load)
{
	if((load || loaded) && document.getElementById /*&& document.compatMode*/)
	{
		// Ensure function is only run once the document has finished loading
		loaded = true;
		
		// Find the elements
		var content = document.getElementById("layoutPopupTableContent");
		var head = document.getElementById("layoutPopupTableHead");
		var foot = document.getElementById("layoutPopupTableFooter");

		// Find the height of the view in pixels
		var viewHeight = null;
		var headHeight = null;
		var footHeight = null;
		if(window.innerHeight)
		{
			viewHeight = window.innerHeight + "px";
		}
		else if(document.documentElement && document.documentElement.clientHeight)
		{
			viewHeight = document.documentElement.clientHeight;
		}
		else if(document.all && document.all.tags("body"))	// Required for IE5 - documentElement is not defined/html
		{
			viewHeight = document.all.tags("body")[0].clientHeight;
		}

		// Find the height of the head and foot tables
		if(document.defaultView && document.defaultView.getComputedStyle)
		{
			var headStyle = document.defaultView.getComputedStyle(head,"");
			var footStyle = document.defaultView.getComputedStyle(foot,"");
			headHeight = headStyle.getPropertyValue("height");
			footHeight = footStyle.getPropertyValue("height");
		}
		else if(head && foot && head.clientHeight && foot.clientHeight)
		{
			headHeight = head.clientHeight;
			footHeight = foot.clientHeight;
		}
		
		// Set the height of the body element
		var pixelRegExp = /px/;
		viewHeight = Number(String(viewHeight).replace(pixelRegExp,""));
		headHeight = Number(String(headHeight).replace(pixelRegExp,""));
		footHeight = Number(String(footHeight).replace(pixelRegExp,""));
		
		if(viewHeight && content && content.style)
		{
			content.style.height = (viewHeight - headHeight - footHeight)+"px";
		}
	}
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function openPopup( windowURL, windowName, windowFeatures ) { 
  return window.open( windowURL, windowName, windowFeatures ) ; 
}
