title: How to properly preload images, js and css files?
body: <p>I'm creating a website from scratch and I was really into this in the late 90's but the web has changed alot since then! And I'm more of a designer so when I started putting this site together, I basically did a system of php includes to make the site more "dynamic"</p>
  
  <p>When you first visit the site, you'll be presented to a logon screen, if you're not already logged on (cookies). If you're not logged on, a page called access.php is introdused. 
  I thought I'd preload the most heavy images at this point. So that when the user is done logging on, the images are already cached. And this is working as I want. But I still notice that the biggest image still isn't rendered immediatly anyway. So it's seems kinda pointless.</p>
  
  <p>All of this has made me rethink how the site is structured and how scripts and css files are loaded. Using FireBug and YSlow with Firefox I see a few pointers like expires headers and reducing the size of each script. But is this really the culprit?</p>
  
  <p>For example, would this be really really stupid in the main index.php? The entire site is basically structured like this</p>
  
  <pre><code>&lt;?php
  require("dbconnect.php");
  ?&gt;
  
  &lt;?php
  include ("head.php");
  ?&gt;
  </code></pre>
  
  <p>And below this is basically just the body and the content of the site. 
  Head.php however consists of the doctype, head portions, linking of two css style sheets, jQuery library, jQuery validation engine, Cufon and Cufon font file, and then the small Cufon.Replace snippet.</p>
  
  <p>The rest of the body comes with the index.php file, but at the bottom of this again is an include of a file called "footer.php" which basically consists of loading of a couple of jsLoader scripts and a slidepanel and then a js function.
  All of this makes the end page source look like a typical complete webpage, but I'm wondering if any of you can see immediatly that "this is really really stupid" and "don't do that, do this instead" etc. :) Are includes a bad way to go?</p>
  
  <p>This site is also pretty image intensive and I can probably do a little more optimization.
  But I don't think that's its the primary culprit. YSlow gives me a report of what takes up the most space:</p>
  
  <pre><code>doc(1) - 5.8K
  js(5) - 198.7K
  css(2) - 5.6K
  cssimage(8) - 634.7K
  image(6) - 110.8K
  </code></pre>
  
  <p>I know it looks like it's cssimage(8) that weighs the most, but I've already preloaded these images from before and it doesn't really affect the rendering.</p>