/*

OnloadScheduler.js

An object allowing tasks to be scheduled to run when the document has loaded

Created by Stephen Morley - http://code.stephenmorley.org/ - and released under
the terms of the CC0 1.0 Universal legal code:

http://creativecommons.org/publicdomain/zero/1.0/legalcode

*/

var OnloadScheduler=new function(){
var _1=false;
var _2=[];
var _3=[];
function _4(_5){
if(_5 instanceof Array){
for(var _6=0;_6<_5.length;_6++){
try{
_5[_6]();
}
catch(error){
}
}
}else{
if(!_1){
_1=true;
for(var _6=_2.length-1;_6>0;_6--){
_4(_2[_6]);
}
for(var _6=0;_6<_3.length;_6++){
_4(_3[_6]);
}
}
}
};
this.schedule=function(_7,_8){
if(!_8){
_8=0;
}
if(_7 instanceof Function){
if(_8<0){
if(!_2[-_8]){
_2[-_8]=[];
}
_2[-_8].push(_7);
}else{
if(!_3[_8]){
_3[_8]=[];
}
_3[_8].push(_7);
}
}else{
this.schedule(function(){
eval(_7);
},_8);
}
};
if("addEventListener" in document){
document.addEventListener("DOMContentLoaded",_4,false);
window.addEventListener("load",_4,false);
}else{
if("doScroll" in document.documentElement&&window==window.top){
(function(){
try{
document.documentElement.doScroll("left");
_4();
}
catch(error){
window.setTimeout(arguments.callee,0);
}
})();
}
document.attachEvent("onreadystatechange",function(){
if(document.readyState=="complete"){
_4();
}
});
window.attachEvent("onload",_4);
}
}();


