var newWindow = null; // used to track window so that it can be closed

document.body.onload = addPopupFeature;
 
// Scans through document looking with link tags (A)
// which open in a new window and attached the specialized
// popUpWin function to the onclick event
function addPopupFeature()
{
	var anchors = document.getElementsByTagName('A');
	var i=0;
	for (var i=0; i<anchors.length;i++ )
	{
		var anchor = anchors[i];
		if (anchor.target == '_blank')
		{
			anchor.onclick = function () { popUpWin(this.href);return false;};
		}
	}
}

function closeWin()
{
	if (newWindow != null)
		if(!newWindow.closed)
			newWindow.close();
}
 
function popUpWin(url)
{
	// closeWin(); - use this if the window needs to change properties
	newWindow = window.open(url, 'newWin', 'width=600,height=600,scrollbars=yes');
	newWindow.focus();
}



