function ImgLoop_Init(id,sRa,uRa,fRa,sec)
{
//-------------------------------------------------------
//圖片輪撥初始化
//-------------------------------------------------------
//id	物件id
//sRa	圖檔路徑陣列
//uRa	連結頁面陣列
//fRa	連結框架陣列	"",_blank,_self,框架名稱
//sec	輪撥秒數(1000=1秒)
//-------------------------------------------------------

	var o=document.getElementById(id);
	if(!o){return false;}

	var tRa=[];
	for(var i=0;i<sRa.length;i++)
	{
		var tImg=new Image();
		tImg.src=sRa[i];
		tRa[i]=tImg;
	}
	
	o.inx	=0;
	o.sec	=sec;
	o.timer	="";
	o.sRa	=tRa;
	o.uRa	=uRa;
	o.fRa	=fRa;
	o.src	=tRa[0].src;

	return o;
}

function ImgLoop_Show(id,sec)
{
//-------------------------------------------------------
//圖片輪撥
//-------------------------------------------------------
//id	物件id
//sec	輪撥秒數(1000=1秒)
//-------------------------------------------------------

	var o=document.getElementById(id);
	if(!o){return false;}

	inx		=parseInt(o.inx);	
	sec		=o.sec;	
	timer	=o.timer;		
	sRa		=o.sRa;
	uRa		=o.uRa;
	fRa		=o.fRa;
	o.src	=o.sRa[inx].src;	

	try{
		window.clearTimeout(timer);
	}
	catch(e){};

	o.onmouseover=function()
	{
		this.style.border="1px solid #FF6666";
		this.style.cursor="pointer";
		try{
			window.clearTimeout(this.timer);
		}
		catch(e){};		
	}

	o.onmouseout=function()
	{
		this.style.border="0px solid #FF6666";
		this.style.cursor="";
		ImgLoop_Show(id,sec);
	}

	o.onclick=function()
	{
		try{
			window.clearTimeout(timer);
		}
		catch(e){};		
		
		var Url		=uRa[inx];
		var Target	=fRa[inx];

		if((Url!="")&&(Target!=""))
		{
			if(Target.toLowerCase()=="_self")
			{
				self.location.href=Url;
			}
			else if(Target.toLowerCase()=="_top")
			{
				top.location.href=Url;				
			}
			else if(Target.toLowerCase()=="_blank")
			{
				window.open(Url);				
			}
			else
			{
				var oIF=document.getElementById(Target);
				if(oIF)
				{
					oIF.src=Url;
				}
			}
		}
	}
	
	if(inx<sRa.length-1)
	{
		o.inx=inx+1;
	}
	else
	{
		o.inx=0;
	}

	var AStr="";
	AStr+="ImgLoop_Show('"+id+"',"+sec+")";
	o.timer=window.setTimeout(AStr,sec);
}