var IdNo = 0;
function loader() {
	this.id = "loader" + IdNo++;
	window[this.id] = this;
	this.timer = 5;
	this.action = null;
	this.timeout = null;
	this.start = function(f)
	{
		if(this.timer<=0)
		{
			if(this.action!=null) { return this.action(); }
			this.stop();
		}
		else
		{
			if(f){
				this.timer--;
				this.stop();
			}
			if(this.timeout==null) { this.timeout = setTimeout("window." + this.id + ".start(true)",1000); }
		}
	};
	this.stop = function()
	{
		clearTimeout(this.timeout);
		this.timeout = null;
	}
}
