title: jQuery Mobile popup does not open after closing previous popup
body: <p>I have a jQuery popup that takes in user input which can lead to errors.  I want to have a 2nd popup come up if there are errors, but I cannot get this working.</p>
  
  <p>Here is a boiled down example, which I also have in jsfiddle: <a href="http://jsfiddle.net/tz4ju/2/" rel="nofollow">http://jsfiddle.net/tz4ju/2/</a></p>
  
  <p>The HTML:</p>
  
  <pre><code>&lt;div data-role="page" id="home"&gt;
      &lt;div data-role="popup" id="errorDialog" class='ui-corner-none ui-content'&gt;
          &lt;p id="errormsg"&gt;&lt;/p&gt;
      &lt;/div&gt;
  
      &lt;div data-role="popup" id="addFolderDialog" class='ui-corner-none portalpopup'&gt;
          &lt;div data-role='content'&gt;
              &lt;p&gt;&lt;/p&gt;
              &lt;div data-role="fieldcontain"&gt;
                  &lt;label for="name"&gt;New Folder:&lt;/label&gt;
                  &lt;input type="text" name="name" id="newfolder_val" value="" class="ret_submit" rel="adddir_submit" /&gt;
              &lt;/div&gt;
              &lt;div class="clearfix"&gt;
                  &lt;a data-role="button" data-inline="true" data-theme="b" id="adddir_submit" onclick='create_folder_submit()'&gt;Add Folder&lt;/a&gt;
                  &lt;a data-role="button" data-inline="true" data-rel='back'&gt;Cancel&lt;/a&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;p&gt;&lt;a href="#addFolderDialog" data-rel="popup"&gt;Open Popup&lt;/a&gt;&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The JavaScript:</p>
  
  <pre><code>window.create_folder_submit = function () {
      $("#addFolderDialog").popup("close");
      $("#errormsg").text("ERROR!");
      $("#errorDialog").popup("open");
  }
  </code></pre>
  
  <p>By the way, if I call <code>$("#errorDialog").popup("open")</code> anywhere else, it works.  What am I doing wrong?</p>