// -- By YZH -- //
var imgUrl	= new Array();
var imgLink	= new Array();
var imgTip	= new Array();

var nCurrent= 0, nCount, nRandom;
var oInterval	= null;
var swapTime	= 5000;
var strJustAct;

function el(id)
{
	return document.getElementById(id);
}


// 显示图片
function showPic()
{
	var st;
	nRandom = parseInt (24*Math.random());
	document.all.item (imgID).filters.revealTrans.Transition = nRandom;
	document.all.item (imgID).filters.revealTrans.apply();
	document.all.item (imgID).filters.revealTrans.play();
	document.all.item (imgID).src = imgUrl [nCurrent];
	st = el("CoursePicList1_labUrl");
	st.innerHTML = imgTip [nCurrent];
	if (imgTip[nCurrent] = null) {
	 showPic();	
	}
	oInterval = setInterval (strJustAct, swapTime);
}

//显示指定的一张图
function showMypic(nIndex)
{
	nCurrent= nIndex;
	if (null != oInterval)
	clearInterval (oInterval);
	showPic();
}

// 显示前一张
function forward(){
	if (nCurrent > 0)
		nCurrent--;
	else
		nCurrent = nCount-1;
		
	if (null != oInterval)
		clearInterval (oInterval);
		
	strJustAct = "forward()";
	showPic();
}

// 显示后一张
function next(){
	if (nCurrent < nCount - 1)
		nCurrent++;
	else
		nCurrent = 0;
		
	if (null != oInterval)
		clearInterval (oInterval);
		
	strJustAct = "next()";
	showPic();
}

// 打开 URL 链接
function goUrl()
{
	jumpUrl = imgLink[ nCurrent ];
	jumpTarget = '_blank';
	if (jumpUrl != '')
	{
		if (jumpTarget != '')
			window.open (jumpUrl, jumpTarget);
		else
			location.href = jumpUrl;
	}
}

// 鼠标移到图片上时的事件处理
function mouseOver()
{
	if (null != oInterval)
		clearInterval (oInterval);
}

// 鼠标移出图片时的事件处理
function mouseOut()
{
	oInterval = setInterval (strJustAct, swapTime);
}
