/*
 * Opens new window named wName containing wUri with scrollbars and
 * resizable by default. To fix it, pass 0 as wScroll, wResizable.
 */
function openWin(wUri, wName, wWidth, wHeight, wScroll, wResizable) {
	var scrollBars = wScroll!=0 ? 1 : 0;
	var resizable = wResizable!=0 ? 1 : 0;
	var positionLeft = (screen.width - wWidth) / 2;
	var positionTop = (screen.height - wHeight) / 2;
	var rest = 'location=no,status=0,menubar=0,titlebar=0,toolbar=0,directories=0,hotkeys=0';
	var myW = window.open(wUri, wName, 'width='+wWidth+',height='+wHeight+',top='+positionTop+',left='+positionLeft+',resizable='+resizable+',scrollbars='+scrollBars+','+rest);
	try { myW.focus(); /* can fail if content loads long */ }
	catch(e) { myW.onload = function(e) { this.focus(); }; }
	return false;
}

