// This opens a new window.
//
// Use it like this:
// <head>
// <script src="/common_scripts/open_win.js" language="javascript"></script>
// </head>
// ...
// <a href="javascript:open_win('my_file.html', 'windowName', 300, 150, true, false, false, true);">Click here</a>


// Open a new window with
// - a URL
// - a window name
// - height and width
// - scroll bars (or none): Default is "true".
// - menu bar (or none): Default is "false".
// - tool bar (or none): Default is "false".
// - resizable window frame (or none): Default is "true".

function open_win (url, windowName, windowWidth, windowHeight, scrollbarFlag, menubarFlag, toolbarFlag, resizeFlag) {
	// Turn scrolling on or off?
	var scrollbarString = 'scrollbars=yes,';
	if ((scrollbarFlag != null) && (scrollbarFlag == false)) {
		scrollbarString = '';
	}
	// Turn menu on or off?
	var menubarString = 'menubar=no,';
	if ((menubarFlag != null) && (menubarFlag == true)) {
		menubarString = 'menubar=yes,';
	}
	// Turn toolbar on or off? Default is off.
	var toolbarString = 'toolbar=no,';
	if ((toolbarFlag != null) && (toolbarFlag == true)) {
		toolbarString = 'toolbar=yes,';
	}
	// Turn resizing on or off? Default is on.
	var resizeString = 'resizable=yes,';
	if ((resizeFlag != null) && (resizeFlag == false)) {
		resizeString = 'resizable=no,';
	}

	// Create the parameter string and open the window
	var parameterString = 'toolbar=no,location=no,status=no,' + menubarString + toolbarString + scrollbarString + resizeString +'width=' + windowWidth + ',height=' + windowHeight;
	var newWindow = window.open(url, windowName, parameterString);
	newWindow.focus();

	return;
}