
function ImgMovie(){
  this.Img=new Array();
  this.Title=new Array();
  this.Summary=new Array();
  this.ImgPrv=new Array();
  this.Link=new Array();
  this.LinkType=new Array();
  this.movCount=0;
  this.curImg=0;
  this.Target="_self";
  this.TargetExt="";
  
  this.ImgBox=null;
  this.TitleBox=null;  
  this.SummaryBox=null;
  this.Style=0; //0Í¸Ã÷¹ý¶É£¬1Ëæ»úÇÐ»»
  
  this.AddMov=addMov;
  this.OpenUrl=openUrl;
  this.Play=nextMov;
  this.PlayStyle=playStyle;
  this.SetStyle=setStyle;
  this.ExecEvent=execEvent;
}

function execEvent(){ 
  if(this.Link[this.curImg]!=""){
    eval(this.Link[this.curImg]);
  }
}

function addMov(imgurl,tit,msg,linkurl,linkType){  
  this.Img[this.movCount]="";
  this.Title[this.movCount]="";  
  this.Summary[this.movCount]="";
  this.Link[this.movCount]="";
  this.LinkType[this.movCount]="URL";
  
  if(imgurl){
	this.Img[this.movCount]=imgurl; 
    this.ImgPrv[this.movCount]=new Image();
    this.ImgPrv[this.movCount].src=imgurl;
  }
  if(tit)this.Title[this.movCount]=tit;  
  if(msg)this.Summary[this.movCount]=msg;
  if(linkurl)this.Link[this.movCount]=linkurl;
  if(linkType)this.LinkType[this.movCount]=linkType;
  this.movCount++;
}
  
function setStyle(){
   if (this.ImgBox!=null){
	  switch (this.Style){
		 case 0: 
		   eval(this.ImgBox+".filters.blendTrans.apply()");
		   break;
		 case 1:
		   eval(this.ImgBox+".filters.revealTrans.Transition=Math.floor(Math.random()*20)");
		   eval(this.ImgBox+".filters.revealTrans.apply()");
		   break;
		 default:
		   eval(this.ImgBox+".filters.blendTrans.apply()");
		   break;
	  }
   }
}

function playStyle(){
   if (this.ImgBox!=null){
	  switch (this.Style){
		 case 0: 
           eval(this.ImgBox+".filters.blendTrans.play()");
		   break;
		 case 1:
           eval(this.ImgBox+".filters.revealTrans.play()");
		   break;
		 default:
           eval(this.ImgBox+".filters.blendTrans.play()");
		   break;
	  }
   }
}

function nextMov(){
   if(this.curImg<this.movCount-1)this.curImg++ ;
   else this.curImg=0;
   this.SetStyle();
   if(this.ImgBox!=null)document.images[this.ImgBox].src=this.Img[this.curImg];
   if(this.TitleBox!=null)eval(this.TitleBox+".innerText=this.Title["+this.curImg+"]");
   if (this.SummaryBox!=null)eval(this.SummaryBox+".innerText=this.Summary["+this.curImg+"]");
   this.PlayStyle();
}

function openUrl(){
   var jumpUrl=this.Link[this.curImg];
   if(this.Target=='')this.Target='_self';
   if (jumpUrl=='') return false;
   
   if (this.LinkType[this.curImg]=="EVENT"){
	   this.ExecEvent();
   }else{
     if(this.TargetExt!=''){
       window.open(jumpUrl,this.Target,this.TargetExt);
	 }else{	 
       window.open(jumpUrl,this.Target);
	 }
   }
}

function PlayImgMov(mov,timeout){
	eval(mov+".Play()");
	eval("Timer_"+mov+"=window.setTimeout(\"PlayImgMov('"+mov+"','"+timeout+"')\","+timeout+")");
}