/* 
	Name:       flexible_popup.js
	Version:    2.0
	Date:       16.05.00

	Author:     Michael Steynes 

	Parameters: url, x, y

	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="popup.js" language="javascript"></script>. 
	if you want to  use the function, write
	
	<a href="javascript:openPopup2(url,x,y)">Link Title</a>.
	
	Because of size-differences between most browsers, you can change the values for x and y for the most used browsers.
	
	Specified browsers:
	Netscape (3.0 or higher), Explorer (3.0 or higher), OmniWeb (3.0 or higher) 
	

*/


// -------------------------------------
// Make corrections for window-size here
// -------------------------------------

x_mac_netsc_difference = 0;
y_mac_netsc_difference = 0;    
x_mac_expl_difference = 0;  
y_mac_expl_difference = 0;
x_win_netsc_difference = 0;
y_win_netsc_difference = 0;
x_win_expl_difference = 0;
y_win_expl_difference = 0;


// -------------------------------------
// Operations: (Don't change!)
// -------------------------------------

var active = 0
var popnumber = -1
var MyPopup = 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_tools(url,x,y){
	if (bName.indexOf('Netsc')>=0){
		if (bApp.indexOf('Mac')>=0) {x=x+x_mac_netsc_difference;y=y+y_mac_netsc_difference;}
		else {x=x+x_win_netsc_difference;y=y+y_win_netsc_difference;}
		}
	if (bName.indexOf('Expl')>=0){
		if (bApp.indexOf('Mac')>=0) {x=x+x_mac_expl_difference;y=y+y_mac_expl_difference;}
		else{ x=x+x_win_expl_difference;y=y+y_win_expl_difference;}
		}
	popnumber++
	parameterString = "width="+x+",height="+y+",scrollbars=yes,menubar=yes,location=no,border=no,toolbar=yes,resizable=no,status=no"
 	if (active!=0) {
		MyPopup[popnumber] = open(url,"popup",parameterString)
		if (active==2) {
			x_position = Math.round((screen.width-x)/2)
			y_position = Math.round((screen.height-y)/2)
			window.setTimeout("MyPopup[popnumber].moveTo(x_position,y_position)",200)
			MyPopup[popnumber].focus()
		}
	
	}
}
