title: Preloading img elements
body: <p>I currently have a preloading image javascript script:</p>
  
  <pre><code>function MM_preloadImages() { 
    var d = document; 
  
    if(d.images){ 
       if(!d.MM_p )
          d.MM_p=new Array();
  
       var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
  
       for(i=0; i&lt;a.length; i++){
          if (a[i].indexOf("#")!=0){
             d.MM_p[j]=new Image; 
             d.MM_p[j++].src= '/img' + a[i];
          }
       }
    }
  }
  </code></pre>
  
  <p>The problem is that i have to manually update the array when images are added deleted etc.</p>
  
  <p>Is there anyway of automating this or is there a library.</p>
  
  <p>Most of the image urls are  element hrefs.</p>
  
  <p>Obviously I could write something server side but I want to check if there is something out there already.</p>