/* function popWindow
 *		Opens a new popup with the following attributes.
 *
 *		o url			URL of the contained page
 *		o width			width in pixels of the resulting popup
 *		o height		height in pixels of the resulting popup
 *		o name			new popup window name
 *		o scrollbars	boolean used to display or not the scrollbars
 *
 * Author : HDE (2004.03.23)
 */
function popWindow(url, width, height, name, scrollbars){
	
	if (!width) width = 500;
	if (!height) height = 500;
	if (!name) name = "default_window";
	if (!scrollbars) scrollbars = false;
	
 	if (document.all){		
        var xMax = screen.width, yMax = screen.height;
    }else if (document.layers){       
        var xMax = screen.width, yMax = screen.height;
    }else if (document.getElementById){
		var xMax = screen.width, yMax = screen.height;
	}else{
		var xMax = 800, yMax=600;
	}
	var realW = (width)/2;
	var realH = (height)/2;
	var xOffset = ((xMax)/2) - realW, yOffset = (((yMax)/2)) - realH; 
	if (yMax==600)	yOffset = 0;

	if (scrollbars) var options = "directories=no,status=no,location=no,scrollbars=yes,menubar=no,toolbar=no,resizable=no" + ",screenX=" + xOffset + ",screenY=" + yOffset + ",top=" + yOffset + ",left=" + xOffset + ",width=" + width + ",height=" + height;
	else var options = "directories=no,status=no,location=no,scrollbars=no,menubar=no,toolbar=no,resizable=no" + ",screenX=" + xOffset + ",screenY=" + yOffset + ",top=" + yOffset + ",left=" + xOffset + ",width=" + width + ",height=" + height;

	popup = window.open(url,name,options);
	popup.focus();
}
