I know there are some ways to get notified when the page body has loaded (before all the images and 3rd party resources load which fires the window.onload e
Just take the relevant piece of code from jQuery, John Resig has covered most of the bases on this issue already in jQuery.