
var first = {
	loaded : false,
	timer : null,
	functionsToCallOnload : [], 
	init : function (){
		if(first.loaded) return;
		first.loaded = true;
		first.load();
	},
	
	load : function (){
		if(this.timer){
			clearInterval(this.timer);
		}
		for(var i=0; i<this.functionsToCallOnload.length; i++){
			try{
				eval(this.functionsToCallOnload[i]);
			}
			catch(e){
				
			}
		}
	}
};

if (document.addEventListener) {
	document.addEventListener("DOMContentLoaded", first.init, false);
}
// ---
/* Safari */
if(navigator.userAgent.search(/WebKit/i) != -1){
    first.timer = setInterval(function (){
		if(document.readyState.search(/loaded|complete/i) != -1) {
			first.init();
		}
	}, 10);
}

window.onload = first.init;
