//-----------------------------  Класс графических объектов
/*
function SetStatusLoadImageObj(obj,num){ //"this.ArrayStatusLoad[this.length]=1";
	obj.ArrayStatusLoad[num] = 1;
}//end function
*/
//-----------------------------  End

//-----------------------------  Общие функции коллекции картинок
function AddImage(ImageInfo, ImageSrc){
	var i = this.ArrayImage.length;
	this.ArrayStatusLoad[i] = 0;
	this.ArrayImageInfo[i] = ImageInfo;
	this.ArrayImage[i] = new Image();
	this.ArrayImage[i].src = ImageSrc;
	//this.ArrayImage[i].onLoad=SetStatusLoadImageObj(this,i); //"this.ArrayStatusLoad[this.length]=1";
}//end function

function GetNextImageSrc(){
	if (this.ArrayImage.length==0)
		return "";
	if (this.curOffset<0 || this.curOffset>=this.ArrayImage.length)
		this.curOffset = 0;
	var ImageSrc = this.ArrayImage[this.curOffset].src;
	this.curOffset++;
	return ImageSrc;
}//end function


function GetUrlBySrc(SomeSrc){
	var st="";
	for (var i=0; i<this.ArrayImage.length; i++){
		if (SomeSrc.indexOf(this.ArrayImage[i].src)>=0)
		{
			st = this.ArrayImageInfo[i];
			break;
		}
	}
	return st;
}
//-----------------------------  End

//-----------------------------  Класс клипов
function ShowNext()
{
	for (var i=0; i<this.PicArrayLength; i++){
		if (document.images[this.PicPrefix + i]!=null){
			SetSrc=this.GetNextImageSrc();
			if (SetSrc!="") {
				document.images[this.PicPrefix + i].src=SetSrc;
			}
		}
	}//end for
}


function ClipPlay(timeout){
	//-----------------
	this.ShowNext();
	this.ClipTimeout = setTimeout(this.ClassName+'.ClipPlay('+timeout+');', timeout);
}//end function


function doAction(SomeSrc)
{
	var Url = this.GetUrlBySrc(SomeSrc);
	//alert(Url);
	window.location=Url;
}

function ClipImageObj(ClassName, PicPrefix, PicArrayLength){
	this.ClassName=ClassName;
	this.PicPrefix = PicPrefix;
	this.PicArrayLength = PicArrayLength;

	this.curOffset = 0;
	this.ArrayImage = new Array();
	this.ArrayStatusLoad = new Array();
	this.ArrayImageInfo = new Array();
	this.AddImage=AddImage;
	this.GetNextImageSrc=GetNextImageSrc;
	this.ClipPlay=ClipPlay;
	this.ShowNext = ShowNext;
	this.GetUrlBySrc = GetUrlBySrc;
	this.ClipTimeout=null;
	this.doAction=doAction;
}//end class
//-----------------------------  End
