

function OnLoad()
{
	this.callbacks = new Array();
	this.bLoaded=false;
	
	this.registerOnLoad=function(func)
	{
		if (this.bLoaded==true)
		{
			func();
		}
		else
		{
			if (func!=null)
			{
				this.callbacks[this.callbacks.length] = func;
			}
		}
	};
	
	this.onLoadEvent=function()
	{
		//alert('onload!');
		this.bLoaded=true;
		var i;
		for(i=0; i<this.callbacks.length; i++)
		{
			(this.callbacks[i])();
		}
		this.callbacks= new Array();
	};
	
	this.isLoaded=function()
	{
		return this.bLoaded;
	};
	
	return this;
}

var TheLoader =new OnLoad();

if (window.onload!=null)
{
	TheLoader.registerOnLoad(window.onload);//lol untested...!
}

window.onload=function(){TheLoader.onLoadEvent();};//();