var sw = screen.availWidth;
var sh = screen.availHeight;

function pop(file, nwWidth, nwHeight, id) {
	var w = (nwWidth + 40);
	var h = (nwHeight + 30);
	var x = (sw / 2) - (w / 2);
	var y = (sh / 2) - (h / 2);

	newWin = window.open(file, 'help', 'width=' + w + ',height=' + h + ',channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0,left=' + x + ',top=' + y + ',screenX=' + x + ',screenY=' + y);
	
	if (newWin.outerWidth != w || newWin.outerHeight != h ) {
		newWin.resizeTo((w + 10), (h + 35));
	}
	newWin.document.innerHTML = newWin.innerWidth;
	fixPosition(newWin, x, y);
	newWin.focus();
	return false;
}

function fixPosition(win, x, y) {
	if (window.screenLeft < 0 || window.screenX < 0) {
		if (win.screenLeft >= 0) {
			win.moveBy(- sw,0);
		  }
		if (win.screenLeft >= 0 || win.screenX >= 0) {
			win.moveTo(x,y);
			}
	}
}