function PageLoad()
{
	if (typeof OnPageLoad == 'function')
	{
		OnPageLoad();
	}
}

function Rectangle(top, left, width, height)
{
	this.top = top;
	this.left = left;
	this.width = width;
	this.height = height;
	this.CenterWindow = CenterWindow;
}

function GetWindowWidth()
{
	if (screen)
	  var xMax = screen.width;
	else
	  if (document.layers)
	      var xMax = window.outerWidth;
	 else
	      var xMax = 300;
	      
	return xMax;
}

function GetWindowHeight()
{
	if (screen)
	  var yMax = screen.height;
	else
	  if (document.layers)
	      var yMax = window.outerHeight;
	 else
	      var yMax = 200;
	      
	return yMax;
}

function CenterWindow(lngMaxWidth, lngMaxHeight)
{
	if (this.left + this.width > 1000)
	{
		this.left = (lngMaxWidth - this.width)/2; 
		if (this.left < 0)
		{
			this.left = 0;
			if (this.left+this.width>lngMaxWidth)
				this.width = lngMaxWidth;
		}
	}

	if (this.top + this.height > 750)
	{
		this.top = (lngMaxHeight - this.height - 40)/2;
		if (this.top < 0)
		{
			this.top = 0;
			if (this.top+this.height>lngMaxHeight)
				this.height = lngMaxHeight;
		}
	}
}

function PopupWindow(strURL, strName, lngWidth, lngHeight)
{
	xMax = GetWindowWidth()
	yMax = GetWindowHeight();
	var rectSize = new Rectangle(300, 200, lngWidth, lngHeight);
	rectSize.CenterWindow(xMax, yMax);

	var newWindow = window.open(strURL, strName, "width="+rectSize.width+",height="+rectSize.height+",screenX="+rectSize.left+",screenY="+rectSize.top+",top="+rectSize.top+",left="+rectSize.left+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no");
}

function SetCookie(cookieName, cookieValue, nDays) 
{
	var today = new Date();
	var expire = new Date();
	
	if (nDays==null || nDays==0)
		nDays=1;
	
	expire.setTime(today.getTime() + 3600000 * 24 * nDays);
	
	// Save the new cookie at the root:
	document.cookie = cookieName + "=" + escape(cookieValue) + ";expires=" + expire.toGMTString() + ";path=/";
}