This script gives the ability to run javascript functions after the page has loaded. I definitely can't take credit for this, as it's one I found, but I use it constantly.
1
2 window.onloadListeners=new Array();
3
4 window.addOnLoadListener = function (listener) {
5 window.onloadListeners[window.onloadListeners.length]=listener;
6 }
7
8 window.onload=function(){
9 for(var i=0;i<window.onloadListeners.length;i++){
10 func = window.onloadListeners[i];
11 func.call();
12 }
13 }
14
15 //window.addOnLoadListener(function);