// --------------------------------------------------
// -------- OPEN POPUP ------------------------------
// --------------------------------------------------
// the following fields should be 0 or 1
//	* p_centered 
//	* p_menubar
//	* p_toolbar
//	* p_location
//	* p_directories
//	* p_status
//	* p_scrollbars
//	* p_resizable
//
// Mind that if p_centered equals 1, the following lines should be entered in the popup page (behind </html>)
//
//	<%if request("posX") <> "" and request("posY") <> "" then%>
//		<script>window.moveTo(<%=cint(request("posX"))%>,<%=cint(request("posY"))%>);</script>
//	<%end if%>

function openPopUp(p_width, p_height, p_url, p_name, p_centered, p_menubar, p_toobar, p_location, p_directories, p_status, p_scrollbars, p_resizable){

	var winWidth, winHeight;
	var str_url, str_position;
	
	winWidth = p_width;
	winHeight = p_height;
	
	str_url = p_url;
	
	if (isPosInteger(p_centered)){
		var posX = (screen.availWidth / 2) - (winWidth / 2);
		var posY = (screen.availHeight / 2) - (winHeight / 2);
// LSA 2001-04-24 Using parseInt to remove any decimals from the result
		posX = parseInt(posX);
		posY = parseInt(posY);
		if (str_url.indexOf("?") >= 0) {
			str_position = "&posX=" + posX + "&posY=" + posY;
		}				
		else{
			str_position = "?posX=" + posX + "&posY=" + posY;
		}
		str_url += (parseInt(p_centered) == 1) ? str_position : "";
	}
	str_window = "width=" + winWidth 
				+ ", height=" + winHeight
				+ ",menubar=" + parseInt(p_menubar) 
				+ ",toolbar=" + parseInt(p_toobar)
				+ ",location=" + parseInt(p_location) 
				+ ",directories=" + parseInt(p_directories)
				+ ",status=" + parseInt(p_status) 
				+ ",scrollbars=" + parseInt(p_scrollbars)
				+ ",resizable=" + parseInt(p_resizable);
	window.open(str_url, p_name, str_window);
	return true;		
}