function PopupWindow(mylink,windowname,refocus,windowsettings)
	//Function:		Create a pop-up window.
	//Parameters:   mylink			- Link to the contents of the popup window.
	//              windowname		- Unique name (to distinguish between window already open and not.
	//				refocus			- Indicate that the popup window shall have focus.
	//				windowsettings	- Optional parameters to feed the 'window.open' function:
	//								  width=xxx			!Window width in px
	//								  height=xxx    	!Window height in px
	//								  top=xxx       	!Position of window top
	//							      left=xxx			!Position of window left side
	//								  scrollbars=yes/no	!Window with/without scrollbars     [no]
	//								  resizable=1/0		!Window resizable/not-resizable     [1]
	//							  	  status=1/0		!Show status bar yes/no             [0]
	//								  menubar=1/0		!Show menu bar yes/no               [0]
	//							      toolbar=1/0		!Show toolbar yes/no                [0]
	//								  location=1/0		!Show file location yes/no          [0]
	//								  directories=1/0	!Show directories yes/no            [0]
	//								  Format: 'par1=xxx;par2=yyy;par3=zzz'
	//Author:		Endeavour
	//Modified:		26-Mar-2005	- First release
	//Notes:		Developed for Firefox 1.0.
	//Suggestions: 	1. 	Set default values for all 'windowsettings' parameters, and have them replaced by
	//					user defined settings.
	//				2.  Eliminate the minimum window height of some 110px. Problem originates from within Windows? 
	{
	var mylink,windowname,refocus,windowsettings;
	var mywin,href,position;
	var string=""

//D	window.alert('Function PopupWindow:'
//D		+ '\nMylink:     ' + mylink
//D		+ '\nWindowname: ' + windowname
//D		+ '\nRefocus:    ' + refocus
//D		+ '\nSettings:   ' + windowsettings);

    //Check if there are any window settings specified through the 'windowsettings' parameter.
	if (windowsettings&&windowsettings!="")
		{
		//Parse the settings parameter string and build the string for use in the 'window.open' function.
//D		window.alert('Function PopupWindow:'
//D			+ '\nWindowsettings: User settings specified');

		prevpos=0;
		nextpos=windowsettings.indexOf(';',prevpos);
		while (nextpos!=-1)
			{
			string=string+windowsettings.substring(prevpos,nextpos)+",";
			prevpos=nextpos+1;
			nextpos=windowsettings.indexOf(';',prevpos)

//D			window.alert('Function PopupWindow:'
//D				+ '\nSettings separator (;) found on position: ' + nextpos
//D				+ '\nSubstring: ' + windowsettings.substring(prevpos,nextpos));
			}
		string=string+windowsettings.substring(prevpos,999)
		}
	else
		{
		//Set default window settings
//D		window.alert('Function PopupWindow:'
//D			+ '\nWindowsettings: No user settings specified, set default window settings');

		string='width=600,height=450,top=180,left=150,scrollbars=yes,resizable=1'
		}     
		
//D	window.alert('Function PopupWindow:'
//D		+ '\nString: ' + string);
    
   	href=mylink;
   	//set default
	mywin = window.open('',windowname,string);

	//Check if the window is already open
	if (mywin.closed ||(! mywin.document.URL)||(mywin.document.URL.indexOf("about") == 0))
		//Window was not yet open
   		mywin.location=href;
	else
		//Window was already open
		if (refocus='refocus') mywin.focus();
	return false;

	}

