var windowPopup = null;
function newWindow (URL,w,h) {    // optional (in this order): st,sc,rs,tb,mb,lft,tp

	st = 0;  // status bar [3]
	sc = 1;  // scrollbars [4]
	rs = 1;  // resizable [5]
	tb = 0;  // toolbar [6]
	mb = 0;  // menubar [7]
	lft = (screen.width - w)/2;  // left position [8]
	tp = (screen.height - h)/2;  // top position [9]

	if (arguments.length > 3 )
		st = arguments[3];
	if (arguments.length > 4 )
		sc = arguments[4];
	if (arguments.length > 5 )
		rs = arguments[5];
	if (arguments.length > 6 )
		tb = arguments[6];
	if (arguments.length > 7 )
		mb = arguments[7];
	if (arguments.length > 8 )
		lft = arguments[8];
	if (arguments.length > 9 )
		tp = arguments[9];

	if(windowPopup == null || windowPopup.closed) {
		top.document.windowPopup = window.open(URL, 'windowPopup', 'dependent=yes,toolbar=' + tb + ',menubar=' + mb + ',status=' + st + ',scrollbars=' + sc + ',resizable=' + rs + ',left=' + lft + ',top=' + tp + ',width=' + w + ',height=' + h);
		top.document.windowPopup.focus();
	} else {
		top.document.windowPopup.location = URL;
		top.document.windowPopup.focus();
		top.document.windowPopup.resizeTo(w,h);
	}
	windowPopup = top.document.windowPopup;
}
