﻿function com_popwin(scriptName, winWidth, winHeight, winName, features) 
{
	var popwin;

	if (winWidth == null || winWidth == "")
		winWidth = "780";

	if (winHeight == null || winHeight == "")
		winHeight = "400";

	winWidth = winWidth;
	winHeight = winHeight;

	var posX = Math.floor((screen.availWidth - winWidth)/2);
	var posY = Math.floor((screen.availHeight - winHeight)/2) - 40;

	if (posX < 10)
		posX = 0;
	if (posY < 10)
		posY = 0;

	var popupFeature = 'width=' + winWidth.toString()
						+ ',height=' + winHeight.toString()
						+ ',screenX=' + posX
						+ ',screenY=' + posY
						+ ',left=' + posX
						+ ',top=' + posY
						+ ',resizable=yes'
						+ ',scrollbars=yes';

	if (features != null && features != "")
		popupFeature = popupFeature + "," + features;

	popwin = window.open(scriptName, winName, popupFeature);

	if (popwin != null)
		popwin.focus();
	return;
}



