var active = 0;
var MyPopup = new Array();
var args = new Array();
var bName = navigator.appName;
var bType = navigator.appVersion;
var browserName;
var browserPlatform;
var centerSwitch = false;
var fromStartPage = false;

var screenwidth = 0;
var screenheight = 0;
	
// Browser
if (bName.indexOf('Netscape')>=0) browserName = '0';
else if (bName.indexOf('MSIE')>=0 || bName.indexOf('Microsoft Internet Explorer')>=0) browserName = '1';

// Platform
if (bType.indexOf('Win')>=0) browserPlatform = '0';
else if (bType.indexOf('Mac')>=0 || bType.indexOf('PPC')>=0) browserPlatform = '1';
else browserPlatform = '3';

// Browserversion
var browserVersion = (browserName == '1')? parseInt(bType.slice(22,bType.length)):parseInt(bType);

// Screenresolution
if (browserVersion > 3){ 
	screenwidth = screen.width;
	screenheight = screen.height;
	}
	
// determing Window Open Capabilities 
if ((browserName == '0' && browserVersion >= 3) || (browserName == '1' && browserVersion >= 3)) active=1 // only openWindow
if ((browserName == '0' && browserVersion >= 4) || (browserName == '1' && browserVersion >= 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>3){
		x_mac_netsc = args[3];
		y_mac_netsc = args[4];
		x_mac_expl = args[5];
		y_mac_expl = args[6];
		x_win_netsc = args[7];
		y_win_netsc = args[8];
		x_win_expl = args[9];
		y_win_expl = args[10];
		centerSwitch = args[11];
		fromStartPage = args[12];
		if (browserName == '0'){
			if (browserPlatform = '1'){
				x=x+x_mac_netsc;
				y=y+y_mac_netsc;
				}
			else{
				x=x+x_win_netsc;
				y=y+y_win_netsc;
				}
			}
		
		if (browserName == '1'){
			if (browserPlatform = '1'){
				x=x+x_mac_expl;
				y=y+y_mac_expl;
				}
			else{ 
				x=x+x_win_expl;
				y=y+y_win_expl;
				}
			}
		parameterString ='width='+x+',height='+y+',scrollbars=no,scrolling=no,menubar=no,location=no,border=no,toolbar=no,resizable=no,status=no';
		if (args.length>13){
			parameterString = 'width='+x+',height='+y+','+ args[14];
			}
		}	

 	if (active!=0){
 		if (fromStartPage == true) InitialPopup = window.open(url,"RefreshYourself",parameterString);
 		else MyPopup[MyPopup.length] = window.open(url,"Quicktime",parameterString);
		if (active==2){
			x_position = (centerSwitch == true)? Math.round((screen.width-x)/2):0;
			y_position = (centerSwitch == true)? Math.round((screen.height-y)/2):0;
			if (fromStartPage == true) window.setTimeout('InitialPopup.moveTo(x_position,y_position)',200);
			else window.setTimeout('MyPopup[MyPopup.length-1].moveTo(x_position,y_position)',200);
			if (fromStartPage == true) InitialPopup.focus();
			else MyPopup[MyPopup.length-1].focus();
			}
		}
	}