/* 
	Name:       advanced_flexible_popup.js
	Version:    3.0
	Date:       16.05.2001

	Author:     Frank Hess, Christian Wilmanns 

	Parameters: url, x, y, [x_mac_netsc, y_mac_netsc, x_mac_expl, y_mac_expl, x_win_netsc, y_win_netsc, x_win_expl, y_win_expl, browserparam]

	Description:
	
	Flexible open-window-function. in case of NS/MSIE >=4.0 the popup-window is placed in the center of the screen.
	Embed this script into the head of any html document with <script src="advanced_flexible_popup.js" language="javascript"></script>. 
	if you want to  use the function, write:
	
	<a href="javascript:openPopup(url,x,y,x_mac_netsc,y_mac_netsc,x_mac_expl,y_mac_expl,x_win_netsc,y_win_netsc,x_win_expl,y_win_expl,x_mac_netsc6,y_mac_netsc6,x_win_netsc6,y_win_netsc6,browserparam)">Link Title</a>.
	
	If you just need a 'normal' popup you can just use the following syntax:
	
	<a href="javascript:openPopup(url,x,y)">Link Title</a>.
	
	Because of size-differences between most browsers (e.g. when the page has some form elements), you can change the values for x and y for the most used browsers.
	The values in the after the x and y dimension of the window depicts the explicit differece for the specified browser. Like for example the difference for Netscape
	Macintosh is 5 pixels for the width and 8 for the height of the popup-window you would like to write something like this (assumed that you don't care about the 
	difference of the other browsers):
	
	<a href="javascript:openPopup(url,x,y,5,8,0,0,0,0,0,0,'scrollbars=yes,loaction=yes')">Link Title</a>.
	
	Please note that 'browserparam' is optional if no browser parameters are named default values will be insert that set all parameters to 'no' which result
	displaying a common known popup window.
	
	Specified browsers:
	Netscape (3.0 or higher), Explorer (3.0 or higher), OmniWeb (3.0 or higher) 
	
	
	PLEASE DELETE THIS DESCRIPTION WHEN ACTUALY USING THIS SCRIPT FOR A WEBPAGE
*/

var active = 0;
var MyPopup = new Array();
var time = new Date();
var aRandomNumber = time.getTime();
var popupName = 'POPUP'+aRandomNumber;
var args = new Array();
bName = navigator.appName;
bApp = navigator.appVersion;
bVer = parseInt(navigator.appVersion);
if ((bName.indexOf('Netsc')>=0 && bVer>=3) || (bName.indexOf('Expl')>=0 && bVer>=3) || (bName.indexOf('OmniWeb')>=0 && bVer>=3)) active=1 // only openWindow
if ((bName.indexOf('Netsc')>=0 && bVer>=4) || (bName.indexOf('Expl')>=0 && bVer>=4)) active=2 // openWindow & setWindowPosition
		
function openPopup(){
	args = openPopup.arguments
	url = args[0];
	x = args[1];
	y = args[2];
	parameterString ='width='+x+',height='+y;
	if (args.length>4){
		x_mac_netsc = args[4];
		y_mac_netsc = args[5];
		x_mac_expl = args[6];
		y_mac_expl = args[7];
		x_win_netsc = args[8];
		y_win_netsc = args[9];
		x_win_expl = args[10];
		y_win_expl = args[11];
		x_mac_netsc6 = args[12];
		y_mac_netsc6 = args[13];
		x_win_netsc6 = args[14];
		y_win_netsc6 = args[15];
		
		if (bName.indexOf('Netsc')>=0){
			x = (bApp.indexOf('Mac')>=0 && bVer>=5 && top.document.getElementById)? x+x_mac_netsc6:(bApp.indexOf('Mac')>=0)? x+x_mac_netsc:(bApp.indexOf('Win')>=0 && bVer>=5 && top.document.getElementById)? x+x_win_netsc6:x+x_win_netsc;
			y = (bApp.indexOf('Mac')>=0 && bVer>=5 && top.document.getElementById)? y+y_mac_netsc6:(bApp.indexOf('Mac')>=0)? y+y_mac_netsc:(bApp.indexOf('Win')>=0 && bVer>=5 && top.document.getElementById)? y+y_win_netsc6:y+y_win_netsc;
			}
		if (bName.indexOf('Expl')>=0){
			x = (bApp.indexOf('Mac')>=0)? x+x_mac_expl:x+x_win_expl;
			y = (bApp.indexOf('Mac')>=0)? y+y_mac_expl:y+y_win_expl;
			}
		}
		
	if (active==2){
		x_position = Math.round((screen.width-x)/2);
		y_position = Math.round((screen.height-y)/2);
		}
	
	parameterString = 'width='+x+',height='+y+',left='+x_position+',top='+y_position;

	parameterString += (args.length>3)? ','+args[3]:',scrollbars=no,toolbar=0,status=0,location=0';

	if (active!=0){
 		MyPopup[MyPopup.length] = open(url,popupName,parameterString);
 		MyPopup[MyPopup.length-1].focus();
 		}
 		
	}