function preloaderObject(pr) {
	var preload, preloaded;
	var onload, onprogress;
	var me=this;

	if ($.isArray(pr))
		preload = pr;
	else
		preload = [];
	preloaded = [];

	this.img = function(n) {
		return preloaded[n];
	};
	this.load = function(l) {
		if (l === undefined) {
			if (this.onload !== undefined)
				this.onload();
		} else if ($.isFunction(l))
			this.onload = l;
	};
	this.progress = function(l) {
		if (l === undefined) {
			if (this.onprogress !== undefined)
				this.onprogress();
		} else if ($.isFunction(l))
			this.onprogress = l;
	};
	this.queue = function(o) {
		preload.push(o);
	};
	this.run_old = function() {
		var n = preloaded.length,m=preload.length;

		if (this.onprogress !== undefined)
			this.onprogress(n,m);
		var deq = function(e) {
			if (e.target.parentNode === null) {/* IE bug */
				$(this).unbind("error");
				$(this).unbind("load");
				setTimeout(function(){me.run.call(me)}, 200);
			}
		};
		if (n < m) {
			preloaded[n] = $("<img/>").load(deq).error(deq).attr({src:preload[n]}); 
			return;
		}

		if (this.onload !== undefined)
			this.onload();
	};
	this.run = function() {
		var n = 0,m=preload.length;

		var deq = function(e) {
			if (e.target.parentNode === null) {/* IE bug */
				$(this).unbind("error");
				$(this).unbind("load");
				n++;
				if (me.onprogress !== undefined)
					me.onprogress(n,m);
				if (n < m)
					return;
				if (me.onload !== undefined)
					me.onload();
			}
		};
		for (var i=0;i<m;i++)
			preloaded[i] = $("<img/>").load(deq).error(deq).attr({src:preload[i]}); 
	};

	this.waitLoad = function(coda) {
		var setup=false;
		var n=0;
		var m=coda.length;
		var deq = function(e) {
			$(this).unbind("load");
			$(this).unbind("error");
			var elemento = coda.filter("[src="+e.target.src+"]");
			n += elemento.length;

			if (me.onprogress !== undefined)
				me.onprogress(n, m);

			if (n < m)
				return;

			if (me.onload !== undefined)
				me.onload();
		};

		coda.each(function(){
			if (!$(this).attr("complete")) {
				setup=true;
				$(this).load(deq).error(deq).attr({
					src: $(this).attr("src")
				});
			} else
				m--;
		});
		if (!setup && (me.onload !== undefined))
			me.onload();
	
	}

}