



function ILoader(images)
{
	
	var compFnc;
	var id = 0;
	var progFnc;
	var imgagesAr = new Array();
	var ts;
	this.loadImages = function ()
	{
		ts = this;
		images[id].init(ts.nextImage);
		//imgagesAr.push(new SImage(images[id], this)); 
	}
	

	
	this.nextImage = function ()
	{		
		id++
		progres();
		if(id < images.length)
		{
			ts.loadImages();
		}
		else
		{
			if(compFnc)
			{
				setTimeout(compFnc, 0);
			}
		}
		
	}
	
	progres = function()
	{
		var percent = id /  images.length;
		if(progFnc)
		{
			progFnc(percent);
		}
	}
	
	
	this.getProgressPercent = function()
	{
		return id /  images.length;
	}
	
	

	this.onProgress = function(fnc)
	{
		progFnc = fnc;
	}
	
	
	
	this.onComplete = function(fnc)
	{
		compFnc = fnc;
	}
	
}
