var WndPopUp;

function WindowPopUp(iUrl, iWidth, iHeight)
{
	var popW = iWidth, popH = iHeight;
	var ns = (document.layers) ? true : false;
	var scrnW = (ns) ? window.innerWidth : document.body.offsetWidth;
	var scrnH = (ns) ? window.innerHeight: document.body.offsetHeight;
	var posX, posY;
	if (scrnW && scrnH)
	{
		posX = (scrnW / 2) - (popW / 2);
		if (posX < 0)
		{
			posX = 10;
		}
		posY = (scrnH / 2) - (popH / 2);
		if (posY < 0)
		{
			posY = 10;
		}
	}
	else
	{
		posX = 10;
		posY = 10;
	}
	if (WndPopUp)
	{
		WndPopUp.close();
	};
	WndPopUp = window.open(iUrl, '', 'resizable=yes,scrollbars=yes,width=' + popW + ',height=' + popH + ',left=' + posX + ',top=' + posY);
	WndPopUp.focus();
}

function AddToFavourite()
{
	if (document.all)
	{
		window.external.AddFavorite(location.href, document.title);
	}
	else
	{
		alert(	'This feature only available to Internet Explorer 4 and above.\n' +
				'Please use your browser\'s bookmark feature instead.');
	}
}

function LinkClick(iNewWindow, iTargetUrl)
{
	if (iNewWindow == 'YES')
	{
		window.open(iTargetUrl);
	}
	else
	{
		window.opener.location.href = iTargetUrl;
	};
	window.close();
}

function ExternalLinkClick(iUrl, iNewWindow, iWidth, iHeight)
{
	iUrl = '/ExtDisclaimer.aspx?newwin=' + iNewWindow + '&targeturl=' + escape(iUrl);
	WindowPopUp(iUrl, 500, 405);
	return false;
}

function OpenExternalLink(iHomePage, iRelativePathToDisclaimer, iUrl, iNewWindow, iWidth, iHeight)
{
	iUrl = iRelativePathToDisclaimer + 'ExtDisclaimer.aspx?newwin=' + iNewWindow + '&targeturl=' + escape(iUrl);
	WindowPopUp(iUrl, 500, 405);
	if (iHomePage != '')
	{
		window.location.href = iHomePage;
	}
	return false;
}

function ActionClick(iAction)
{
	window.opener.location.href = iAction;
	window.close();
}
