//
//windowname a string (this becomes the actual windowOBJECT. and the NAME of the object)
//windowURL a URL
//windowWidth a number
//windowHeight a number
//windowLeft a number (or "center" to center on screen)
//windowTop a number (or "center" to center on screen)
//directories yes/no
//menubar yes/no
//resizable yes/no
//status yes/no
//toolbar yes/no
//scrollbars yes/no
//



function PopupWindow(windowname,windowURL,windowWidth,windowHeight,windowLeft,windowTop,directories,menubar,resizable,status,toolbar,scrollbars)
	{
//not good for down-level browsers
//	try
//		{
		//try to close and then focus the popup window
		//this routine will help this function RE-USE
		//windows if they already exist with the same
		//name.
//		windowname.close();
//		windowname.focus();
//		}
//	catch(err)
//		{
		//do nothing on error
		//an error only proves that no window exists
		//with this 'windowname' value
//		}

	w = windowWidth;
	h = windowHeight;

		//the Left and Top properties accept a number
		//and, out of convenience, the term 'center' can
		//be used.
		if(windowLeft=='center')
			{
			l = (screen.width) ? (screen.width-w)/2 : 0;
			} else {
			l = windowLeft;
			}

		if(windowTop=='center')
			{
			t = (screen.height) ? (screen.height-h)/2 : 0;
			} else {
			t = windowTop;
			}


	settings = 'directories='+directories+',menubar='+menubar+',resizable='+resizable+',status='+status+',toolbar='+toolbar+',height='+h+',width='+w+',top='+t+',left='+l+',scrollbars='+scrollbars;
	windowname = window.open(windowURL,windowname,settings)

//	try
//		{
		//try to resize the popup window
		//this routine is necessary only IF the
		//first try/catch routine fails. (i.e. if
		//there's already a window of THIS windowname
		//and the first try/catch routine failed to close
		//it.  (This is still weird and deserves further
		//investigation.)
//		windowname.resizeTo(w,h);
//		}
//	catch(err)
//		{
		//do nothing on error
//		}

		if(windowname.focus){windowname.focus();}

	return windowname;

	//this function returns
	//an object with the same
	//name as the new window
	//this is helpful if you wish
	//to further manipulate this object
	}