/* LICENSE AGREEMENT (GPLv2). If folded, press za here to unfold and read license {{{
   vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4 foldmethod=marker:
   +-----------------------------------------------------------------------------+
   | Copyright (c) 2005 Sérgio Gonçalves Carvalho                                |
   +-----------------------------------------------------------------------------+
   | This file is part of kWindowOnLoad.                                         |
   |                                                                             |
   | kWindowOnLoad is free software; you can redistribute it and/or modify       |
   | it under the terms of the GNU Lesser General Public License as published by |
   | the Free Software Foundation; either version 2.1 of the License, or         |
   | (at your option) any later version.                                         |
   |                                                                             |
   | kWindowOnLoad is distributed in the hope that it will be useful,            |
   | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
   | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
   | GNU Lesser General Public License for more details.                         |
   |                                                                             |
   | You should have received a copy of the GNU Lesser General Public License    |
   | along with Structures_Graph; if not, write to the Free Software             |
   | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                    |
   | 02111-1307 USA                                                              |
   +-----------------------------------------------------------------------------+
   | Author: Sérgio Carvalho <sergio.carvalho@portugalmail.com>                  |
   +-----------------------------------------------------------------------------+
}}} */
// kWindowOnLoad. Guarded against being included twice {{{
if (typeof kWindowOnLoad == 'undefined') {
    var kWindowOnLoad = new Object();
    // Properties {{{
    kWindowOnLoad.handlers = new Array();
    // }}}
    // addEventListener(listener) {{{
    kWindowOnLoad.addEventListener = function(listener) {
        if (typeof listener == 'function') {
            l = new Object();
            l.handleEvent = listener;
            listener = l;
        }
        this.handlers[this.handlers.length] = listener;
    }
    // }}}
    // window.onload {{{
    if (typeof window.onload == 'function') {
        kWindowOnLoad.cascadeHandler = window.onload;
    }
    window.onload = function(event) {
        if (kWindowOnLoad.cascadeHandler) kWindowOnLoad.cascadeHandler(event);
        for (i=0; i < kWindowOnLoad.handlers.length; i++) {
            kWindowOnLoad.handlers[i].handleEvent(event);
        }
    }
    // }}}
}
// }}} 
