
var popupWindow = null;
var childWindow = null;

function popupWin(url,name, w, h) 
{
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;//120
	
	var settings ='height='+h+',';
	settings +='width='+w+',';
	settings +='top='+wint+',';
	settings +='left='+winl+',';
	settings +='menubar=no,';
	settings +='toolbar=no,';
	settings +='status=no,';
	settings +='scrollbars=no,';
	settings +='resizable=no';
	
	if(arguments[4] == null)
		popupWindow = window.open(url,name,settings);
	else if(arguments[4] == true)
		childWindow = window.open(url,name,settings);
		
}
if (!document.all) 
{
	document.captureEvents (Event.CLICK);
}

document.onclick = function() 
{
	if (popupWindow != null && !popupWindow.closed) 
	{
		popupWindow.focus();
	}
	else if(childWindow != null && !childWindow.closed) 
	{
		childWindow.focus();
	}
}

