function PreLoader(tab,progressBar)
{
	this.tab = tab;
	this.progressBar = progressBar;
	this.progressBar.height = 10;
	this.progressBar.maxWidth = 200;
	this.progressBar.color = "#FF0000";
	this.progressBar.itemCount = this.tab.length;
	this.progressBar.update = update;
	
	this.img = new Image();
	this.img.myLoader = this;
	
	this.start = start;
	this.loadIt = loadIt;
	
	function start()
	{
		this.progressBar.style.visibility = "";
		this.progressBar.style.position = "absolute";
		this.progressBar.style.backgroundColor = this.progressBar.color;
		this.progressBar.style.height = this.progressBar.height + "px";
		this.progressBar.style.width = '1px';
		this.loadIt(0);
	}
	
	function loadIt(i)
	{
		progressBar.update(i+1);
		this.img.onload = function()
		{
			if(i+1 == this.myLoader.tab.length)
			{
				this.myLoader.onload();
			}
			else
			{
				this.myLoader.loadIt(i+1);
			}
		};
		this.img.src = this.tab[i];
	}
	
	function update(i)
	{
		this.style.width = Math.floor(((i+1)/this.itemCount)*this.maxWidth) + "px";
	}
}
