var __bar_timeout = '';
var __bar_go = 0;
 
function __bar_perform(dest, dest2, speed)
{
	var el = $(dest);
	var el2 = $(dest2);
	var scrollnew = el.scrollLeft + speed;
	
	var wid = parseInt(el.style.width);
	var wid2 = parseInt(el2.style.width);
	
	if(speed < 0 && scrollnew <= 0)	scrollnew = 0;
	if(speed > 0 && scrollnew >= (wid2 - wid))
	{
		scrollnew = (wid2 - wid)
	};

	el.scrollLeft = scrollnew;
	
	__bar_timeout = setTimeout("__bar_perform('"+dest+"', '"+dest2+"', "+speed+")",40);
}
 
function __bar_stop()
{
	clearTimeout(__bar_timeout);
	__bar_source = __bar_destination;
	browser_finish();
}
 
function __bar_start(dest, dest2, speed, direction)
{
	if(direction == 'r' || direction == 'right')
		speed = speed * -1;
		
	clearTimeout(__bar_timeout);
	__bar_perform(dest, dest2, speed);
}
