window.ImageLoader=function(arrSrc,callBack)
{
	this.Images=arrSrc;	//要加载的图片数组
	this.Length=arrSrc.length;
	
	this.IsLoaded=false;	//是否全部加载完毕
	this.LoadedLen=0;	//已经被加载的图片个数
	var self=this;

	if(self.Length<1)
	{
		this.IsLoaded=true;
		callBack.call(self,null);
		return;
	}

	this.ReadyStateChange=function(imgEntity)
	{
		self.LoadedLen++;
		if(self.LoadedLen==self.Length)	self.IsLoaded=true;
		//状态改变事件
		//参数:刚被加载完毕的图片(在callBack里的this指针是本图片加载器的实体对象)
		callBack.call(self,imgEntity.src);
		if(self.LoadedLen<self.Length)	self.LoadImg();
	}

	this.LoadImg=function()
	{
		var tmpImg=new Image();
		tmpImg.src=arrSrc[self.LoadedLen];
		if(IE)
		{
			if(tmpImg.readyState=="complete")	self.ReadyStateChange(tmpImg);
			else	tmpImg.onreadystatechange=function()
			{
				if(this.readyState=="complete")	self.ReadyStateChange(this);
			}
		}
		else	tmpImg.onload=function(){self.ReadyStateChange(this);}
	}
	this.LoadImg();
	window.onunload=function(){self=null;}
}