The jQuery document ready function is very nice, but for some applications it takes to long to trigger. On those occasions, I’ve started using the nofunc onload script:

function $(v) { return(document.getElementById(v)); }
function init() { $('example').innerHTML=(time()-loadTime)+'ms'; }
function time() { return(new Date().getTime()); }
function quick() {
    if(!$('example')) {
        if(time()-loadTime<=5000) setTimeout("quick()",50);
        else window.onload=init;
    }
    else init();
}

var loadTime=time();

setTimeout("quick()",10);

I’m using it with the PHP image replacement script, but with gdofcgi as the back-end. To keep it compatible with jQuery I had to make some changes, but I think its an excellent replacement. You can view the changes I made here in the mt.js file.