function Preloader() {
	this.onFinish = null;
	this.queue = [];
	this.reported = 0;
	
	this.addQueue = function(q) {
		if (typeof q != "array" && typeof q != "object") q = [q];
		for (i in q) {
			this.queue.push(q[i]);
		}
	}
	
	this.load = function() {
		for (i in this.queue) {
			var q = this.queue[i];
			if (q.type == "js") {
				var newFile = document.createElement('script');
				newFile.type = "text/javascript";
				newFile.src = q.url;
				$('head').get(0).appendChild(newFile);
			}
			else {
				$('<img src="'+q.url+'" />').bind('load',function(){
					project.Preloader.reportImg(this);
				}).appendTo('#preloader');
			}
		}
	}
	
	this.reportFile = function() {
		this.reported++;
		if (this.reported==this.queue.length) {
			this.onFinish();
		}
	}
	
	this.reportImg = function(obj) {
		for (i in this.queue) {
			if (this.queue[i].url == obj.src) {
				if (typeof this.queue[i].onFinish == "function") this.queue[i].onFinish();
			}
		}
		this.reportFile();
	}
}