window.onload executing before the web is loaded
<p>Im using this code to fire a function right after the page is loaded:</p>

<pre><code>function loadpapi(){
    alert("Hello World!");
}

function pctaddLoadEvent(func) {
  var oldonload = document.onload;
  if (typeof document.onload != 'function') {
    document.onload = func;
  } else {
    document.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

pctaddLoadEvent(loadpapi());
</code></pre>

<p>But is starting before the page loads, you can try it here: <a href="http://jsfiddle.net/KuTxh/" rel="nofollow">http://jsfiddle.net/KuTxh/</a></p>
