var isIE4 = (navigator.appVersion.indexOf("MSIE 4") != -1) ? true : false;
var isMac = (navigator.appVersion.indexOf("Mac") != -1) ? true : false;

var newwin;
var winposition;
var winproperties; 
//Get the width and height of the user's screen
var w = screen.width;
var h = screen.height;

function launchwin(winurl,winname,win_w,win_h,winfeatures) {

	//Calculate the center point of the screen
	var w_loc = (w - parseInt(win_w))/2;
	var h_loc = (h - parseInt(win_h))/2;

	//Set the starting window position as the center of the screen
	winposition = "top=" + h_loc + ",left=" + w_loc + ",screenX=" + w_loc + ",screenY=" + h_loc;
	
	//Combine width and height with window position and feature settings
	winproperties = "height=" + win_h + ",width=" + win_w + "," + winfeatures + "," + winposition;
	
	//This launches a new window and then
	//focw.focus() is supported.uses it if windo
	newwin = window.open(winurl,winname,winproperties);
	
	if(javascript_version > 1.0) {
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',350);
	}
	
	if(isMac && isIE4) {
		//This moves the new window to the center of the screen
		newwin.moveTo(w_loc,h_loc);
	}
	
}