﻿
    //
    // See: http://dean.edwards.name/weblog/2005/09/busted/
    //
    
    //
    // Mozilla and Opera had trouble with adding an object-based event listener
    // (i.e. Common.HandleLoad), so an auxilliary object-independent function
    // named "HandleLoad" was added to this script to call Common.HandleLoad()
    // indirectly.
    //    
    function HandleLoad() {
        Common.HandleLoad();
    }
    
    //
    // Mozilla
    //
    if (document.addEventListener) {
        document.addEventListener("DOMContentLoaded", HandleLoad, false);
    }

    //
    // Internet Explorer
    //
    /*@cc_on @*/
    /*@if (@_win32)
        HandleLoad();
    /*@end @*/

    //
    // Safari
    //
    if (/WebKit/i.test(navigator.userAgent)) {
        var _timer = setInterval(function() {
            if (/loaded|complete/.test(document.readyState)) {
                clearInterval(_timer);
                HandleLoad();
            }
        }, 10);
    }

    //
    // Other Browsers
    //
    window.onload = HandleLoad;

