You need to store the current window.onload function in a temporary var, attach your method as the window.onload function, then call the temporary var to trigger the old window onload…
Remove the onload attribute of the body element and insert this javascript into the head of your design.
Just after posting I had a look at the source and noticed it is the technique used by Matrix when entering simple edit, it seems to work well.
Thanks James.