// Author:      lewiser
// Date:        2003-02-13
// Description: Opens a new pop-up window containing the given URL.
// Usage:
// open_win (        Opens a URL in a new window.
//    url            The URL to show.
//    windowName     The internal JavaScript name of the window. This must not contain any blanks or special characters!
//    width          The width of the new window.
//    height         The height of the new window.
//    showScrollbar  Should the scrollbars appear? Must be either "true" or "false", default is "true".
//    showMenubar    Should the menu bar appear? Must be either "true" or "false", default is "false".
//    showToolbar    Should the tool bar appear? Must be either "true" or "false", default is "false".
//    isResizable    Should the window be resizable?  Must be either "true" or "false", default is "true".
// )
// HTML usage:
// <head>
// <script src="/common_scripts/open_win.js" type="text/javascript" language="javascript"></script>
// </head>
// <body>
// <a href="javascript:open_win('my_file.html', 'windowName', 300, 150, true, false, false, true);">Click here</a>
// </body>

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;
}
