var getFFVersion=navigator.userAgent.indexOf("Firefox") > -1 ? navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1] : 0;
var getIEVersion=navigator.userAgent.indexOf("IE") > -1 ? navigator.userAgent.substring(navigator.userAgent.indexOf("IE")).split(" ")[1] : 0;
var FFextraHeight=parseFloat(getFFVersion)>=0.1? -5 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight=parseFloat(getFFVersion)>=2.0? -8 : FFextraHeight //extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraWidth=parseFloat(getFFVersion)>=0.1? -22 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraWidth=parseFloat(getFFVersion)>=2.0? -12 : FFextraWidth //extra height in px to add to iframe in FireFox 1.0+ browsers
var IEextraHeight=parseFloat(getIEVersion)>=7.0?0:0;
var IEextraWidth=parseFloat(getIEVersion)>=7.0?30:30;

function resizeWindow()
{
	var height = 0;
	var width = 0;
	if (document && !window.opera)
	{
		if (document && document.body.offsetHeight) //ns6 syntax
			height = document.body.offsetHeight + FFextraHeight + IEextraHeight; 
		else if (document && document.body.scrollHeight) //ie5+ syntax
			height = document.body.scrollHeight;
		
		if (document && document.body.offsetWidth) //ns6 syntax
			width = document.body.offsetWidth + FFextraWidth; 
		else if (document && document.body.scrollWidth) //ie5+ syntax
			width = document.body.scrollWidth;
	}
	if (height < screen.availHeight - 100)
		window.resizeTo(width + FFextraWidth + IEextraWidth, height + 100);
	else
	    window.resizeTo(width + FFextraWidth + IEextraWidth, screen.availHeight - 100);
}
function addNodes()
{
	var b = document.getElementById("help");
	var elm = createNode("div", "help-header");
	b.insertBefore(elm,b.childNodes[0]);
	elm = createNode("div", "help-footer");
	if (elm.id=="help-footer")
	{
		elm.innerHTML = '<a id="close_page" href="#" onclick="window.close();"><img id="Img1" src="/images/forms/close_page.gif" alt="Close Page" width="68" height="15"/></a>';
	}
	elm = b.appendChild(elm);
}
function createNode(nodeName, idName)
{
	var elm;
	if (document.getElementById(idName) == null)
	{
		elm = document.createElement(nodeName, elm);
		var att = document.createAttribute("id");
		elm.setAttributeNode(att);
		att.value = idName;
	}
	else
	{
		elm = document.createElement("",elm);
	}
	return elm;
}
if (document.addEventListener)
	window.addEventListener("load", addNodes, false);
if (navigator.userAgent.indexOf("Opera") == -1)
{
	if (document.addEventListener)
		window.addEventListener("load", resizeWindow, false);
	else if (document.attachEvent){
		window.detachEvent("onload", resizeWindow); // Bug fix line
		window.attachEvent("onload", resizeWindow);
	}
}
if (document.attachEvent){
	window.detachEvent("onload", addNodes);
	window.attachEvent("onload", addNodes);
}

