title: jQuery pause function execution and do something else while paused
body: <p>I have something like this:</p>
  
  <pre><code>function doSomething() {
     var obj = $('somediv');
  
     ...
  
     waitAndDoSomethingElse(obj);
  
     ...
  
     $('somediv').show();
     ...
  }
  
  
  function waitAndDoSomethingElse(obj) {
     obj.fadeIn();
     ....
  }
  </code></pre>
  
  <p>I want doSomething() to pause... execute waitAndDoSomethingElse() and then continue...
  Any ideas?</p>
  
  <p>Thank you</p>
  
  <p>EDIT:</p>
  
  <p>I'll try to explain better, sorry if my question was confused...</p>
  
  <pre><code>function showSomething() {
     var whatToShow = $('#div');
  
     doSomethingElse();
  
     whatToShow.fadeIn('slow');
  }
  
  
  function doSomethingElse() {
     $('#someDiv').appendTo($('#someOtherDiv'));
     $('#somethingElse').fadeIn('slow');
     ...
  }
  </code></pre>
  
  <p>In this example whatToShow.fadeIn will fire without waiting for doSomethingElse to end...</p>