function phphaberci_changeItem(opcode)
{
	if (navigator.appName != "Netscape")
	{
		imageElement.style.filter = 'blendTrans(duration = 0)';
		imageElement.filters.blendTrans.Apply();
		imageElement.filters.blendTrans.Play();
		
		titleElement.style.filter = 'blendTrans(duration = 0)';
		titleElement.filters.blendTrans.Apply();
		titleElement.filters.blendTrans.Play();
	}
	
	phphaberci_clearTimeout();
	
	phphaberci_curIndex += opcode;
	
	if(phphaberci_curIndex >= phphaberci_imageList.length)
		phphaberci_curIndex = 0;
	else if (phphaberci_curIndex < 0)
		phphaberci_curIndex = phphaberci_imageList.length - 1;
	
	imageElement.src = phphaberci_imageList[phphaberci_curIndex];
	linkElement.href = phphaberci_seoList[phphaberci_curIndex];
	
	titleElement.innerHTML = phphaberci_titleList[phphaberci_curIndex];
	
	document.getElementById("news_arrow").style.backgroundPosition = (7 + phphaberci_curIndex * 58 ) + "px 0px";
	
	
	phphaberci_prevItem = phphaberci_curIndex;
	
	if(phphaberci_isChangeable)
		phphaberci_timeoutIndex = setTimeout(timeoutFunction, 8000);
}

function phphaberci_clearTimeout()
{
	if(phphaberci_timeoutIndex != "")
	{
		clearTimeout(phphaberci_timeoutIndex);
		phphaberci_timeoutIndex = "";
	}
}

function phphaberci_jumpTo(idx)
{
	if(idx == phphaberci_prevItem)
		return;
	phphaberci_isChangeable = 0;
	phphaberci_clearTimeout();
	phphaberci_changeItem(idx - phphaberci_prevItem);
}

function phphaberci_forwClick()
{
	phphaberci_isChangeable = 1;
	
	timeoutFunction = "phphaberci_changeItem(1)";
	
	if(phphaberci_curIndex == -1)
	{
		phphaberci_changeItem(1);
		return;
	}
	
	phphaberci_clearTimeout();
	
	phphaberci_timeoutIndex = setTimeout(timeoutFunction, 8000);
}

function phphaberci_backClick()
{
	phphaberci_isChangeable = 1;
	phphaberci_timeoutFunction = "phphaberci_changeItem(-1)";
	phphaberci_changeItem(-1);
}

var phphaberci_isChangeable = 1;
var phphaberci_curIndex = -1;
var phphaberci_prevItem = -1;
var phphaberci_timeoutFunction = "phphaberci_changeItem(1)";
var phphaberci_timeoutIndex = "";
var phphaberci_imageList = Array();
var phphaberci_idList = Array();
var phphaberci_titleList = Array();
var phphaberci_seoList = Array();
var imageElement = document.getElementById("news_image");
var linkElement = document.getElementById("news_link");
var titleElement = document.getElementById("news_title");
