Script that runs in background gets stopped when theres a popUp
<p>I have this javascript method that needs to run in the background</p>

<pre><code>window.setInterval(function(){
 validateCaseStatus();
}, 3000);        
</code></pre>

<p>On the same page I have a button that asks the user if he wants to submit uploaded documents. But I noticed when the popUp msg(alert) is up the script on the page wont run.</p>

<p>Is there a way to keep the script running?</p>

<p>I use this method to check if the case status is changed and disable window.onbeforeunload. 
My question is if theres a way I can keep the script above running even when a popUp alert is shown. </p>

<pre><code>//cancels onbefore close popup when docs are submitted
function validateCaseStatus(){

     caseStatus = sforce.apex.execute("IFAP_WebService","CheckCaseStatus", {!$caseId});  

    if (caseStatus == "Uploaded" || caseStatus == "Submitted")
    {
         submitted = true; 
        window.onbeforeunload  = null;
        validateCaseStatus = null;
    }
}
</code></pre>
