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.
Check this: http://api.jquery.com/ready/
jQuery(document).ready(function($) {
// Code using $ as usual goes here.
});
$( window ).bind( 'load', function()
{
//your code in here
} );