function get_client_width()
{
	return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?  document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}

function get_client_height()
{
	return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
}

var popUpWin=0;
function popup_window(URLStr, w, h, scrollbars, resizable, menubar, toolbar, location, directories, status, copyhistory)
{
	if (scrollbars == ''){ scrollbars = 'no'; }
	if (resizable == ''){ resizable = 'no'; }
	if (menubar == ''){ menubar = 'no'; }
	if (toolbar == ''){ toolbar = 'no'; }
	if (location == ''){ location = 'no'; }
	if (directories == ''){ directories = 'no'; }
	if (status == ''){ status = 'no'; }
	if (copyhistory == ''){ copyhistory = 'no'; }
	if(popUpWin)
	{
		if(!popUpWin.closed) popUpWin.close();
	}
	var xsize = w;
	var ysize = h;

	var DocumentWidth = parseInt(get_client_width());
	var DocumentHeight = parseInt(get_client_height());
	
	if (window.screenX || window.screenY) 
	{
		var win_x = window.screenX;
		var win_y = window.screenY;
	}
	else // ie
	{
		var win_x = window.screenLeft;
		var win_y = window.screenTop;
		
		// for IE, subtract at least 100 pixels to account for
		// the browser title, menu, and tabs 
		win_y = win_y - 100;
		if (win_y < 0)
		{
				win_y = 0;
		}
	}
	
	if (self.screen) 
	{
		var sr=screen.width;
	} 
	else if (self.java) 
	{
		var j=java.awt.Toolkit.getDefaultToolkit();
		var s=j.getScreenSize();
		var sr=s.width;
	}
	var screen_width = sr;

	if (self.screen) 
	{
		var sr=screen.height;
	} 
	else if (self.java) 
	{
		var j=java.awt.Toolkit.getDefaultToolkit();
		var s=j.getScreenSize();
		var sr=s.height;
	}
	var screen_height = sr;

	if (true)
	{
		// new method - center of browser
		var browser_x_center = win_x + (DocumentWidth / 2);
		var x_half_of_popup = xsize / 2;
		var xpos = browser_x_center - x_half_of_popup;
		var browser_y_center = win_y + (DocumentHeight / 2);
		var y_half_of_popup = ysize / 2;
		var ypos = browser_y_center - y_half_of_popup;
	}
	else
	{
		// old method - center of screen
		var xpos = (screen_width/2)-(xsize/2);
		var ypos = (screen_height/2)-(ysize/2);
	}
	if (xpos < 0) { xpos = 0; }
	if (ypos < 0) { ypos = 0; }
	
	popUpWin = open(URLStr, 'popUpWin', 'toolbar='+toolbar+',location='+location+',directories='+directories+',status='+status+',menubar='+menubar+',scrollbars='+scrollbars+',resizable='+resizable+',copyhistory='+copyhistory+', width='+xsize+',height='+ysize+',left='+xpos+',top='+ypos);
	if (popUpWin.opener == null)
		popUpWin.opener = self;
	popUpWin.focus();
	return false;
}