How to display new window in the middle of the screen in javascript?
<p>I have code in js:</p>

<pre><code>&lt;script&gt;
function displayWindow(url, w, h)
{
  var win = window.open("zoom.htm","displayWindow",'width='+w+', height='+h+',resizable=yes,scrollbars=yes,menubar=no' );
  win.document.write("&lt;html&gt;&lt;body onclick=window.close()&gt;");
  win.document.write("&lt;img id=fullimg src=" + url+"&gt;");
  win.document.write("&lt;/body&gt;&lt;/html&gt;");
  var image = win.document.getElementById("fullimg");
  win.resizeTo(image.width + 50, image.height + 50);
}
&lt;/SCRIPT&gt;
</code></pre>

<p>Java Script open new window (file zoom.html) and resize it o X and Y of image (url varriable). But problem  is that new window displays in the upper right corner of the screen and also goes out of the screen. How to display window in the middle of the screen?</p>
