Is there any trick how to start a function in javascript, which starts when the page is completely loaded?
If you really want your Javascript to run once 'everything' all your HTML is loaded, you can with
window.onload = function(){ // Do stuff }