1/*
2*
3* Copyright (c) 2007 Andrew Tetlaw
4*
5* Permission is hereby granted, free of charge, to any person
6* obtaining a copy of this software and associated documentation
7* files (the "Software"), to deal in the Software without
8* restriction, including without limitation the rights to use, copy,
9* modify, merge, publish, distribute, sublicense, and/or sell copies
10* of the Software, and to permit persons to whom the Software is
11* furnished to do so, subject to the following conditions:
12*
13* The above copyright notice and this permission notice shall be
14* included in all copies or substantial portions of the Software.
15*
16* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23* SOFTWARE.
24* *
25*
26*
27* FastInit
28* http://tetlaw.id.au/view/javascript/fastinit
29* Andrew Tetlaw
30* Version 1.4.1 (2007-03-15)
31* Based on:
32* http://dean.edwards.name/weblog/2006/03/faster
33* http://dean.edwards.name/weblog/2006/06/again/
34* Help from:
35* http://www.cherny.com/webdev/26/domloaded-object-literal-updated
36*
37*/
38var FastInit = {
39	onload : function() {
40		if (FastInit.done) { return; }
41		FastInit.done = true;
42		for(var x = 0, al = FastInit.f.length; x < al; x++) {
43			FastInit.f[x]();
44		}
45	},
46	addOnLoad : function() {
47		var a = arguments;
48		for(var x = 0, al = a.length; x < al; x++) {
49			if(typeof a[x] === 'function') {
50				if (FastInit.done ) {
51					a[x]();
52				} else {
53					FastInit.f.push(a[x]);
54				}
55			}
56		}
57	},
58	listen : function() {
59		if (/WebKit|khtml/i.test(navigator.userAgent)) {
60			FastInit.timer = setInterval(function() {
61				if (/loaded|complete/.test(document.readyState)) {
62					clearInterval(FastInit.timer);
63					delete FastInit.timer;
64					FastInit.onload();
65				}}, 10);
66		} else if (document.addEventListener) {
67			document.addEventListener('DOMContentLoaded', FastInit.onload, false);
68		} else if(!FastInit.iew32) {
69			if(window.addEventListener) {
70				window.addEventListener('load', FastInit.onload, false);
71			} else if (window.attachEvent) {
72				return window.attachEvent('onload', FastInit.onload);
73			}
74		}
75	},
76	f:[],done:false,timer:null,iew32:false
77};
78/*@cc_on @*/
79/*@if (@_win32)
80FastInit.iew32 = true;
81document.write('<script id="__ie_onload" defer src="' + ((location.protocol == 'https:') ? '//0' : 'javascript:void(0)') + '"><\/script>');
82document.getElementById('__ie_onload').onreadystatechange = function(){if (this.readyState == 'complete') { FastInit.onload(); }};
83/*@end @*/
84FastInit.listen();
85