var direction = 'right';
var windowWidth;
var strip
var stripWidth;
var scrollStrip;

function scroll()
{

	//var data = document.getElementById("data");
	//if(!data.style )
	//	data.style.top = "0px";
	/*var i = data.style.top.substring(0,data.style.top.length-2);
	var row = data.rows[0];
	if(headerHeight - i < row.offsetHeight)
	{
		data.style.top = data.style.top.substring(0,data.style.top.length-2) -1;
	}
	else
	{
		data.removeChild(row);
		if(data.lastChild.className == "alt row")
			row.className = "row";
		else
			row.className = "alt row";
		data.appendChild(row);
		data.style.top = headerHeight -1;
	}*/
	//parent.removeChild(row);
	//parent.appendChild(row);
	if(scrollStrip)
	{
		var position = strip.style.left.substring(0,strip.style.left.length-2);

		if(windowWidth - position >= stripWidth)
		{
			direction = 'left';
		}
		else if(position >= 0)
		{
			direction = 'right';
		}
		if(direction == 'right')
		{
			strip.style.left = position - 2 + 'px';
		}
		else
		{
			strip.style.left = position - -2 + 'px';
		}
	}
	t=setTimeout("scroll()",100);
}

function stop()
{
	scrollStrip = false;
}

function start()
{
	scrollStrip = true;
}

function left()
{
	direction = 'left';
}

function right()
{
	direction = 'right';
}

function scrollStart()
{
	var window = document.getElementById("agentsContainer");
	strip = document.getElementById("agentStrip");
	windowWidth = window.clientWidth;
	stripWidth = window.scrollWidth;
	strip.style.left = '0px';
	strip.onmouseover = stop;
	strip.onmouseout = start;
	document.getElementById("agentScrollLeft").onclick= left;
	document.getElementById("agentScrollRight").onclick= right;
	scrollStrip = true;
	scroll();
}
window.onload=scrollStart;




