var Timer   = new Array();

function slider_move(cnt,objid,direct,slow,mshift,auto,pause)

{

	if(obj = document.getElementById(objid))

	{

		mshift = parseInt(mshift);

		auto = parseInt(auto);

		slow = parseInt(slow);

		if(!slow) slow = 4;

		pause = parseInt(pause);

		if(!pause) pause = 4;



		var startauto = (auto && !cnt && !Timer[objid]) ? 1 : 0;

		

		if(Timer[objid])

		{

			if(cnt == 0)

			{

				if(!auto)

					return;

				else

				{

					clearTimeout(Timer[objid]);

					Timer[objid] = null;

				}

			}

			if(!auto && cnt >= mshift)

			{

				clearTimeout(Timer[objid]);

				Timer[objid] = null;

				return;

			}

		}

		//sblocks = obj.childNodes;

		sblocks = obj.getElementsByTagName('div');

		allblocks = sblocks.length;  

		sliderDim = mshift * allblocks;

		

		cshift = (auto) ? auto : parseInt((mshift - cnt)/slow);

		if(cshift <= 0) cshift = 1;

		cnt = parseInt(cnt) + parseInt(cshift);

		if(!auto && cnt > mshift)

			cshift = mshift - cnt + cshift;

		var firstpos = 0;

		for(j=0;j < allblocks; ++j)

		{

			if(!sblocks[j].style) continue;

			curPos = parseInt(sblocks[j].style.left);

			curPos = (direct=='left') ? (curPos + cshift) : (curPos - cshift);

			if(curPos + mshift >= sliderDim)

				curPos -= sliderDim;

			if(curPos <= -mshift)

				curPos += sliderDim;

			if(!startauto)

			{

					sblocks[j].style.left = curPos + 'px';

			}

			if(curPos==0)

				firstpos = 1;

		}

		var tm = (auto && (firstpos || startauto)) ? pause*1000 : 40;

		

		Timer[objid] = setTimeout("slider_move('" + cnt + "','" + objid + "','" + direct + "','" + slow +"','" + mshift + "','" + auto + "','" + pause + "')",tm);

	}

}


