var to_scroll = false;
var step = 15;
var delay = 50;

function start_scroll()
{
	to_scroll = true;
}


function stop_scroll()
{
	to_scroll = false;
	
	var mot = document.getElementById('motiongallery');
	var left = parseInt(mot.style.left);
}


function scroll_right(_max)
{
	if ( to_scroll && (_max > 730) )
	{
		var mot = document.getElementById('motiongallery');
		var left = parseInt(mot.style.left);
		
		if ( (left+step) >= 0 )
		{
			mot.style.left = '0px';
		}
		else
		{
			mot.style.left = (left + step) + 'px';
		}
		
		setTimeout('scroll_right('+_max+')',delay);
	}
}


function scroll_left(_max)
{
	if ( to_scroll && (_max > 730) )
	{
		var mot = document.getElementById('motiongallery');
		var left = parseInt(mot.style.left);
		
		if ( (left-step) <= (730 - _max) )
		{
			mot.style.left = (730 - _max) + 'px';
		}
		else
		{
			mot.style.left = (left - step) + 'px';
		}
		
		setTimeout('scroll_left('+_max+')',delay);
	}
}