/**
 *	ObjectLoader - Used for Loading embedded Objects
 */
var ObjectLoader = {
	loaded : false,
	timer : null,
	functionsToCallOnload : [], // Type in functions as strings here. e.g. "myFunction()"

	init : function (){
		if(ObjectLoader.loaded) return;
		ObjectLoader.loaded = true;
		ObjectLoader.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){
				// Handle error here
			}
		}
	}
};

/* Mozilla/Opera 9 */
if (document.addEventListener) {
	document.addEventListener("DOMContentLoaded", ObjectLoader.init, false);
}

/* Safari */
if(navigator.userAgent.search(/WebKit/i) != -1){
    ObjectLoader.timer = setInterval(function (){
		if(document.readyState.search(/loaded|complete/i) != -1) {
			ObjectLoader.init();
		}
	}, 10);
}

/* Other web browsers */
window.onload = ObjectLoader.init;

