function changeItem(opcode)
{
	
	if (navigator.appName != "Netscape")
	{
		imageElement.style.filter = 'blendTrans(duration = 0)';
		imageElement.filters.blendTrans.Apply();
		imageElement.filters.blendTrans.Play();
	}
	
	CM_clearTimeout();
	
	curIndex += opcode;
	
	if(curIndex >= imageList.length)
		curIndex = 0;
	else if (curIndex < 0)
		curIndex = imageList.length - 1;
	
	imageElement.src = "pics/" + imageList[curIndex] + ".jpg";
	
	linkElement.href = "index.php?module=news&news_id=" + idList[curIndex] + "&cat_id=" + idList[curIndex];
	
	if(prevItem > -1)
		document.getElementById("h_sep_" + prevItem).style.color = "#888888";
	
	document.getElementById("h_sep_" + curIndex).style.color = "#DE0000";
	
	prevItem = curIndex;
	
	if(isChangeable)
		timeoutIndex = setTimeout(timeoutFunction, 8000);
}

function CM_clearTimeout()
{
	if(timeoutIndex != "")
	{
		clearTimeout(timeoutIndex);
		timeoutIndex = "";
	}
}

function getDetail(idx)
{
	window.location = "index.php?module=news&news_id=" + idList[idx];
	return false;
}

function jumpTo(idx)
{
	if(idx == prevItem)
		return;
	
	isChangeable = 0;
	
	CM_clearTimeout();
	
	changeItem(idx - prevItem);
}

function forwClick()
{
	isChangeable = 1;
	
	timeoutFunction = "changeItem(1)";
	
	if(curIndex == -1)
	{
		changeItem(1);
		return;
	}
	
	CM_clearTimeout();
	
	timeoutIndex = setTimeout(timeoutFunction, 8000);
}

function backClick()
{
	isChangeable = 1;
	timeoutFunction = "changeItem(-1)";
	changeItem(-1);
}

var isChangeable = 1;
var curIndex = -1;
var prevItem = -1;
var timeoutFunction = "changeItem(1)";
var timeoutIndex = "";
var imageList = Array();
var idList = Array();
var catList = Array();
