title: Redirect after loading images
body: <p>So I have been recently developing a site, The problem is the backgrounds for each page are images, and as a result, on slower connections (which is the case of some of the target audience) the images load progressivly as they are downloaded, to resolve this I am trying to make a preloading page that does the following :</p>
  
  <ul>
  <li>Loads the Images</li>
  <li><p>Once the loading is done, redirects the user to the requested page</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  &lt;!--//--&gt;&lt;![CDATA[//&gt;&lt;!--
      var images = new Array()
      var count=0;
      function preload() {
          for (i = 0; i &lt; preload.arguments.length; i++) {
              images[i] = new Image()
              images[i].src = preload.arguments[i]
          }
      if(count==4) {
      window.location = "index.html";
      }
      }
      preload(
          "backgrounds/bg1.jpg",
          "backgrounds/bg2.jpg",
          "backgrounds/bg3.jpg",
          "backgrounds/bg4.jpg"
      )
  //--&gt;&lt;!]]&gt;
  </code></pre>
  
  <p></p></li>
  </ul>
  
  <p>The problem is it redirects directly (I assume that it just starts the download of the image then directly adds one to the counter variable, quickly reaching 4 and not giving the image the time to download.</p>
  
  <p>Any ideas how I can either make it signal me when the images have finished downloading, or only execute the redirect after it has done downloading the images ?</p>