Check popup window status
<p>When someone requests a chat, an entry is made in the database. I have an hidden iframe on our dashboard that checks the database every 20 seconds to see if there is a chat and if there is it launches a popup window. Even if the popup is open the iframe still refreshes the popup every 20 seconds. Want I am trying to achieve is a javascript to check the status of the popup. If it is closed I want it to reopen it... if it is open then it bring it into focus... but I dont want the popup to refresh.. as I have an ajax script doing this..</p>

<p>Here is my code:</p>

<pre><code>&lt;script language="javascript" type="text/javascript"&gt;
function myOpenWindow(winURL, winName, winFeatures, winObj)
{
     var theWin;
     if (winObj != null)
     {
          if (!winObj.closed)
          {
               winObj.focus();
               return winObj;
          }
     }
     else
     {
          theWin = window.open(winURL, winName, winFeatures);
          return theWin;
     }
} 
&lt;/script&gt;
&lt;% IF ChatSessionID &lt;&gt; "" THEN %&gt;
&lt;script language="javascript" type="text/javascript"&gt;
var gmyWin = null;
window.onload = function()
{
     var w = 900;
     var h = 500;
     var l = (screen.width-w)/2;
     var t = (screen.height-h)/2;
     var params = 'status=0,resizable=0,scrollbars=0,width=' + w + ',height=' + h + ',left=' + l + ',top=' + t;
     gmyWin = myOpenWindow("/chat/chat_window.asp?ChatSession=&lt;%=ChatSessionID%&gt;&amp;id=3", "myWin", params, gmyWin)
}
&lt;/script&gt;
&lt;% END IF %&gt;
</code></pre>

<p>Any help you could provide would be greatly appreciated..</p>

<p>Best Regards,
Paul</p>
