[jQuery] $(document).ready() jumping the gun?

[jQuery] $(document).ready() jumping the gun?

Is anyone experiencing problems with $(document).ready() firing before it should?
Two scenarios for me:
<span style="font-weight: bold;">1) $(document).ready() in an external .js file -- always fails! Am I misunderstanding something?
</span>
    $(document).ready(function(){
        document.getElementById("foo"); // Fails! -- claims element "foo" does not exists      
    });
<span style="font-weight: bold;">2) $(document).ready() in my .html file -- occasional rare failures.
<span style="font-weight: bold;"></span></span>if I put the same code in my .html file, it works NEARLY all the time, but I have seen it fail from time to time ( maybe 1 out of 75 times). A shift-reload has always remedied the problem on the next pageview. Anyone else experiencing this?
I'm FF <a href="http://1.5.0.3">1.5.0.3</a> on XP<span style="font-weight: bold;"><span style="font-weight: bold;"></span>
</span>Cheers, Andre<span style="font-weight: bold;"><br clear="all"></span>
--
<a href="mailto:andre.lewis@gmail.com">andre.lewis@gmail.com</a>
My blog (Web 2.0 Technologies, Ajax, & more): <a href="http://www.earthcode.com">www.earthcode.com</a>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/