/*  Create a global variable for the pop-up window name so that it can be

referenced by other functions as/if needed.  */



var windowName

	

/* Here is the function which creates the pop-up window  */



function selectPopUpWindow(filename) {



/*  The destination variable below is only used to concatenate the pop-up

folder name with the file name so the script knows where to look

for the files.  The "filename" is passed as a parameter from within the 

statement that calls the function.*/ 



	var destination = filename;



/*  To make sure the correct parameters are being passed I sometimes

use a JavaScript alert function to display information. I left this one

here to demonstrate its use and commented it out of the script.   */



	//alert(destination);



/*  On the left side of the equation below we use a variable

to create the window. However, the name of the window

which appears as the second parameter in the open() method,

is required to identify  the pop-up window for closing and

for passing data. Do not use spaces in this name or you will

get script errors. 



The first attribute  is the URL of the file to be opened in 

the window. In the example below "destination" is already a 

string value and there is no need to put it in quotes. However, 

when placing a URL directly in the method, use quotes.



The third parameter is a string of attributes describing the Window. 

Is it resizable? Does it have scrollbars? Where it is positioned,

and how big it is?  These are only a few of the possible attributes.  */



windowName = window.open(destination, "windowName", "resizable=yes, scrollbars=yes, top=10, left=10, width=600, height=600");



/*  In case the window is hidden we use the focus() method to bring it to the front.  */



	windowName.focus()

}



/*  The close function,  shown below, checks to see if there is a window name

and that the window is not already closed.  If the window exists 

and is open, then this function closes it.   */

	

function closePopUpWindow()		{

	if (windowName && !windowName.closed)  {

		windowName.close();

	}

}


