Slowing Down mywindow.print()
<p>I'm using this nice printing script:</p>

<pre><code>&lt;script type="text/javascript"&gt; 
     function PrintElem(elem) 
    { 
        Popup($(elem).text()); 
    } 
     function Popup(data)  
    { 
        var mywindow = window.open('', 'my div', 'height=400,width=600'); 
        mywindow.document.write('&lt;html&gt;&lt;head&gt;&lt;title&gt;my div&lt;/title&gt;'); 
        /*optional stylesheet*/ //mywindow.document.write('&lt;link rel="stylesheet" href="main.css" type="text/css" /&gt;'); 
        mywindow.document.write('&lt;/head&gt;&lt;body &gt;'); 
        mywindow.document.write(data); 
        mywindow.document.write('&lt;/body&gt;&lt;/html&gt;'); 
        mywindow.document.close(); 
        mywindow.print(); 
        return true; 
    } 
&lt;/script&gt; 
&lt;/head&gt; 
&lt;body&gt; 
</code></pre>

<p>It works fine except for two things:</p>

<ol>
<li><code>mywindow.print()</code> is triggered before the page has completely loaded so you can't see the material in the window to be printed (if you select "Print" it prints correctly though).</li>
<li>The print dialog box opens on top of the window blocking the contents (presuming #1 is an easy fix).  How can it positioned?</li>
</ol>

<p>Thanks - TY</p>
