Add fade in effect on onload
<p>How can i add fade in for this specefic code? I want the pictures to fade in on onload.
Have done some research on Stackoverflow, but couldn't find anything useful. Some help would be appreciated.</p>

<pre><code>&lt;script type="text/javascript"&gt;
window.onload = function(){
       var img = document.getElementById('img')
       if(img.clientHeight&lt;$('#div').height()){
            img.style.height=$('#div').height()+"px";
       }
       if(img.clientWidth&lt;$('#div').width()){
            img.style.width=$('#div').width()+"px";
       } 
}
&lt;/script&gt;
</code></pre>

<p>Extra question: Is it also possible to add a load-function to this code? </p>
