// ver 2.2

nn4 = (document.layers) ? true : false;
ie4 = (document.all) ? true : false;
dom = (document.createTextNode)? true : false;

// 
function popupWindow(fileUrl, winW, winH, winN, scrollB) {
	var winWidth = (winW)? winW : 740;
	var winHeight = (winH)? winH : 520;
	var winName = (winN)? winN : 'popupWin';
	var scrollBars = (scrollB)? scrollB : '1';
	if (nn4 || ie4 || dom) {
		if (screen.width < winWidth + 50) { winWidth = screen.width - 50; scrollbars = 'yes' }
		if (screen.height < winHeight + 100) { winHeight = screen.height - 100; scrollbars = 'yes' }
		posX = Math.round((screen.width - winWidth) / 2);
		posY = Math.round((screen.height - winHeight) / 2);
		posCode = (nn4)? "screenX="+posX+",screenY="+posY : "left="+posX+",top="+posY;
	} else {
		posCode = "";
	}
	var popupWin = window.open(fileUrl, winName, "menubar=no,toolbar=no,scrollbars=" + scrollBars + ",status=yes,resizable=yes,width=" + winWidth + ",height=" + winHeight + "," + posCode);
	if (popupWin) popupWin.focus();
}

// 
function popupPic(winW, winH, winTitle, winFile) {
	var winWidth = (winW)? winW : 740;  // size X
	var winHeight = (winH)? winH : 520; // size Y 520
	if (nn4 || ie4 || dom) {
		if (screen.width < winWidth + 50) { winWidth = screen.width - 50; scrollbars = 'yes' }
		if (screen.height < winHeight + 100) { winHeight = screen.height - 100; scrollbars = 'yes' }
		posX = Math.round((screen.width - winWidth) / 2);
		posY = Math.round((screen.height - winHeight) / 2)-60;
		posCode = (nn4)? "screenX="+posX+",screenY="+posY : "left="+posX+",top="+posY;
	} else {
		posCode = "";
	}
	var w=window.open(winFile, '', config='height='+winHeight+',width='+winWidth+',menubar=0,statusbar=0,scrollbars=1,resizable=1,dependent=1,'+posCode);
	w.document.open();
	w.document.write('<html><head><title>'+winTitle+' '+winWidth+'x'+winHeight+' </title></head><body style="background:#fff; height:100%; margin:0; padding:0;"><table style="width:100%; height:100%; text-align:center;"><tr><td><a href="#" style="display:block;" onclick="javascript:window.close();"><img src="'+winFile+'" alt="'+winTitle+'" title="'+winTitle+'" border="0" style=""></a></td></tr></table></body></html>');
	if (w) w.focus();
	w.document.close();
}

