// Open a popup window
var popUpWin=0;
function popUpWindow(url, width, height) {
	// Determine where the window will show up on the screen
	var left = self.screen.availWidth/2 - width/2;
	var top = self.screen.availHeight/2 - height/2;
	
	// Before creating a new popup, close any others we previously opened
	if(popUpWin) {
		if(!popUpWin.closed) popUpWin.close();
	}
	
	popUpWin = open(url, 'popUpWin', 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top+'');
	
	return;
}

var popUpSubWin=0;
function popUpSubWindow(url, width, height) {
	// Determine where the window will show up on the screen
	var left = self.screen.availWidth/2 - width/2;
	var top = self.screen.availHeight/2 - height/2;
	
	// Before creating a new popup, close any others we previously opened
	if(popUpSubWin) {
		if(!popUpSubWin.closed) popUpSubWin.close();
	}
	
	popUpSubWin = open(url, 'popUpSubWin', 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top+'');
	
	return;
}

//Opens a popup window with alert
function popUpWindowWithAlert(url, alertStr) {
    alert(alertStr);
	popUpWindow(url,800,480); 
	return;
}