/****************************************************
     Author: Eric King
     Url: http://redrival.com/eak/index.shtml
     This script is free to use as long as this info is left in
     Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var popupWindow = null;
function NewWindow(mypage, myname, w, h, scrl, pos, resiz) {
	var wMax = (screen.width) ? (screen.width) : 1024, hMax = (screen.height) ? (screen.height) : 768;
	var x = 0, y = 0;
	var resizable = resiz || 'no';
	w = Math.min(w, wMax - 20);
	h = Math.min(h, hMax - 40);
	if (pos == "random") {
		x = (screen.width) ? Math.floor(Math.random() * (screen.width - w)) : 100;
		y = (screen.height) ? Math.floor(Math.random() * ((screen.height - h) - 75)) : 100;
	}
	else if (pos == "center") {
		x = (screen.width) ? (screen.width - w) / 2 : 100;
		y =(screen.height) ? (screen.height -h ) / 2 : 100;
	}
	settings = 'location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=' + resizable +
				',width=' + w + ',height=' + h + ',top=' + y + ',left=' + x + ',scrollbars=' + scrl;
	if (popupWindow && !popupWindow.closed)
		popupWindow.close();
	popupWindow = window.open(mypage, myname, settings);
	popupWindow.focus();
}
