Is there any trick how to start a function in javascript, which starts when the page is completely loaded?
You are looking for the window load event.
In jQuery you attach the load event as follows:
$(document).ready(function() { $(window).load(function() { } }
Note that you need to place this inside a document ready for some browsers, IE8 OTTOMH.