
/* Script for opening a webpage in a new, smaller window */

//note: winName, setWidth, and setHeight are treated as optional parameters
function openWindow(url, winName, setWidth, setHeight) {
	
	var detailsWindow
	
	//check for setWidth
	if (setWidth == null) { var w = window.screen.availWidth * .5; }
	else { var w = setWidth; }
	
	//check for setHeight
	if (setHeight == null) { var h = window.screen.availHeight * .5; }
	else { var h = setHeight; }

	//check for winName
	if (winName == null) { var windowName = "newWindow"; }
	else { var windowName = winName; }

	/* for centering window */
	var cw = (screen.availWidth-w)/2;
	var ch = (screen.availHeight-h)/2;

	detailsWindow = window.open(url,windowName,'width=' + w + ',height=' + h + ',scrollbars=yes,resizable=yes' + ',top=' + ch + ',left=' + cw);

	detailsWindow.focus();
}