var timer,amount,speed,DHTML,offset,minx;

function initMatScroller()
{
	DHTML = (document.getElementById || document.all || document.layers);
	materials = new getObj('mat_holder');
	materials.style.top = '0px';
	materials.style.left = '0px';
	m_width = materials.obj.offsetWidth;
	offset = 0;
	container = new getObj('mat_container');
	c_width = container.obj.offsetWidth;
	if (m_width > c_width)
	{
		minx = -(m_width-c_width);
		
	}
}
function scrollMaterials(amt,spd)
{
	if (!DHTML) return;
	materials = new getObj('mat_holder');
	if (!materials) return;
	amount = amt;
	speed = spd;
	startScroll();
}

function startScroll()
{
	if (!DHTML) return;
	
	var m = new getObj('mat_holder');
	if (document.getElementById || document.all)
	{
		offset += amount;
		if ( offset > minx && offset <= 0)
		{
			m.style.left = offset+'px';
		}
		else
		{
			offset -= amount;
		}
		
	}
	
	timer = setTimeout('startScroll()',speed);
}

function stopScroll()
{
	if (timer) clearTimeout(timer);
}

