3 * $Revision: 1.3 $ $Date: 2003/03/17 03:44:20 $
\r
6 /* ***** BEGIN LICENSE BLOCK *****
\r
7 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
\r
9 * The contents of this file are subject to the Mozilla Public License Version
\r
10 * 1.1 (the "License"); you may not use this file except in compliance with
\r
11 * the License. You may obtain a copy of the License at
\r
12 * http://www.mozilla.org/MPL/
\r
14 * Software distributed under the License is distributed on an "AS IS" basis,
\r
15 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
\r
16 * for the specific language governing rights and limitations under the
\r
19 * The Original Code is Bob Clary code.
\r
21 * The Initial Developer of the Original Code is
\r
23 * Portions created by the Initial Developer are Copyright (C) 2000
\r
24 * the Initial Developer. All Rights Reserved.
\r
26 * Contributor(s): Bob Clary <bc@bclary.com>
\r
28 * ***** END LICENSE BLOCK ***** */
\r
30 if (!document.getElementById || navigator.userAgent.indexOf('Opera') != -1)
\r
32 // assign error handler for downlevel browsers
\r
33 // Note until Opera improves it's overall support
\r
34 // for JavaScript and the DOM, it must be considered downlevel
\r
36 window.onerror = defaultOnError;
\r
38 function defaultOnError(msg, url, line)
\r
40 // handle bug in NS6.1, N6.2
\r
41 // where an Event is passed to error handlers
\r
42 if (typeof(msg) != 'string')
\r
44 msg = 'unknown error';
\r
46 if (typeof(url) != 'string')
\r
48 url = document.location;
\r
51 alert('An error has occurred at ' + url + ', line ' + line + ': ' + msg);
\r
55 function xbLibrary(path)
\r
57 if (path.charAt(path.length-1) == '/')
\r
59 path = path.substr(0, path.length-1)
\r
64 // dynamically loaded scripts
\r
66 // it is an error to reference anything from the dynamically loaded file inside the
\r
67 // same script block. This means that a file can not check its dependencies and
\r
68 // load the files for it's own use. someone else must do this.
\r
70 xbLibrary.prototype.loadScript =
\r
71 function (scriptName)
\r
73 document.write('<script language="javascript" src="' + this.path + '/' + scriptName + '"><\/script>');
\r
76 // default xbLibrary
\r
78 xblibrary = new xbLibrary('./');
\r