If you are using jQuery and want/need to execute javascript after the page has completely loaded, you can use to the following snippet.
$(window).bind("load", function() { // insert your code here });
NOTE: this is meant to be used outside of the standard DOM ready method
$(document).ready(function() { });