var no_nCurrPos = 1;
var no_nMaxItems = 1;
var no_nScrollPos = 0;
var no_nEvent = null;
var no_nEventScr = null;

function initNewsOffers(nNumItems)
{
	no_nMaxItems = nNumItems;
	no_nCurrPos = 1;

	if(nNumItems > 1)
	{
		no_nEvent = setInterval(doNewsOffersUpdate, 10000);
	}
}

function doNewsOffersUpdate()
{
	// no_nCurrPos ++;

	no_nScrollPos = 0;
	no_nEventScr = setInterval(doNewsOffersScroll, 10);

	// setNewsOffersItem(no_nCurrPos);	
}

function setNewsOffersItem(nItem)
{
	document.getElementById("newsOffersSlider").style.left = (-748 * (nItem - 1)) + "px";
}

function calcNewsOffersItemPos(nItem)
{
	return(-748 * (nItem - 1));
}

function doNewsOffersScroll()
{
	var nStartX = calcNewsOffersItemPos(no_nCurrPos);

	no_nScrollPos += 20;

	if(no_nScrollPos > 748)
	{
		clearInterval(no_nEventScr);

		no_nScrollPos = 748;
		no_nCurrPos ++;

		if(no_nCurrPos > no_nMaxItems)
		{
			no_nCurrPos = 1;
		}
	}

	document.getElementById("newsOffersSlider").style.left = (nStartX - no_nScrollPos) + "px";
}


