title: How to create a custom "confirm" & pause js execution until user clicks button?
body: <p>Ok, I'm doing a bunch of RIA/AJAX stuff and need to create a "pretty", custom confirm box which is a DIV (not the built-in javascript confirm). I'm having trouble determining how to accomplish a pause in execution to give the user a chance to accept or decline the condition before either resuming or halting execution. (depending upon their answer) </p>
  
  <p>So here's the general flow of logic I'm dealing with:</p>
  
  <ol>
  <li>User selects an item from dropdown and clicks button.</li>
  <li>In client-side javascript eventhandler for button, I need to check a (this is the key) SERIES of conditions for the item they chose in dropdown. </li>
  <li>These conditions could possibly result in not showing any confirmation at all or possibly only some of the conditions may evaluate to true which means I'll need to ask the user to accept or decline the condition before proceeding. Only one confirmation should be show at a time.</li>
  </ol>
  
  <p>To demonstrate the logic:</p>
  
  <pre><code>function buttonEventHandler() {
  
  if (condition1) {
    if(!showConfirmForCondition1) // want execution to pause while waiting for user response.
       return; // discontinue execution
  }
  
  if (condition2) {
    if (!showConfirmForCondition2) // want execution to pause while waiting for user response.
  
       return; // discontinue execution
  }
  
  if (condition3) {
    if (!showConfirmForCondition3) // want execution to pause while waiting for user response.
  
       return; // discontinue execution
  }
  
  ...  
  }
  
  </code></pre>
  
  <p>If anybody has dealt with this challenge before and found a solution, help would be greatly appreciated. As a note, I'm also using the <b>MS Ajax</b> and <b>jQuery</b> libraries although I haven't found any functionality that may already be included in those for this problem.</p>