title: Pause form from submitting with javascript
body: <p>I am trying to do a submit form with photos. After the user loads the photos he presses the submit button, I want the form to pause for 10 seconds, animate a progress bar for those 10 seconds and then submit the form, can you guys say what I did wrong, it doesn't seem to submit the form after 10 seconds. 
  Here is the code:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form action="uploadpic.php" method="post" id="upload_form"&gt;
  &lt;input type="text" name="title" id="title"&gt;
  &lt;p id="title_p"&gt;Title&lt;/p&gt;
  
  &lt;hr /&gt;
  
  &lt;input type="text" name="theme" id="picture_theme" size="40"/&gt;
  &lt;p id="theme"&gt;Picture Theme&lt;img src="../simages/info.gif" id="info" width="12" height="12" style="margin-left:10px;"&gt;&lt;/p&gt;
  &lt;hr /&gt;
  
  &lt;div class="custom-upload"&gt;
      &lt;input type="file" name="picture" id="true_pic" /&gt;
      &lt;div class="fake-file"&gt;
          &lt;input disabled="disabled" &gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;p id="upload_pic"&gt;Upload picture&lt;/p&gt;​
  
  &lt;input type="submit" name="submit" id="submit" value="Upload" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>JAVASCRIPT:</p>
  
  <pre><code>form = document.getElementById("upload_form");
      size=1;
      form.onsubmit = function()
      {
          if (size &lt; 10)
          {
              setTimeout(delayedSubmit,1000); 
          }
          return false;
      }
      function delayedSubmit() {
          size++;
              if (size&lt;5)
              {
                  setTimeout(delayedSubmit,1000);
                  alert("Counting "+size);    
              }
              else
              {
                  alert("Form submitted");
                  form.submit();
              }
      }
  </code></pre>
  
  <p>PHP : </p>
  
  <pre><code>&lt;?php
  
  if ($_POST['submit'])
  {
      $title = $_POST['title'];
      $theme = $_POST['picture_theme'];
      echo $title," ",$theme; 
  }
  
  
  
  
   ?&gt;
  </code></pre>
  
  <p>I can tell that the form won't submit anything by the fact that the php variables won't show anything, and then page doesn't load.</p>