document.ready runs even if window.load is loaded
<p>What to write to check if window is fully loaded then do some functions and if not then do <code>document.ready</code> functions....i.e :  i have a preload image which appears if windows isnt fully loaded and i call it in <code>docuemnt.ready</code>.....and if window is fully loaded i hide this preload image....it runs correctly if window isnt fully loaded and disappear after window get loaded.....but <code>document.ready</code> get called even if window is already loaded ...so how to check if window is loaded then dont do <code>document.ready</code> and if not then do <code>document.ready</code></p>

<pre><code>$(document).ready(function (e) {
    $("#loding").css("visibility", "visible");
    $("body").css('overflow', 'hidden');
    $("#container").css("opacity", 0);
});
$(window).load(function (e) {
    $("#loding").animate({
        opacity: 0
    }, 500, function () {
        $("#loding").css("width", "70%");
        $("#loding").css("visibility", "hidden");
    });
    $("#container").css("opacity", 1);
    $("body").css('overflow', 'auto');
});
</code></pre>
