﻿var galleryIsScrolling = false;
var timeouts;

function galleryMotionMustStopImmediately()
{
	clearTimeout(timeouts);
	galleryIsScrolling = false;
}

function actuallyMoveGalleryLeft()
{
	var gal = document.getElementById("scrollableGallery");
	gal.scrollLeft = gal.scrollLeft + 5;
	if (galleryIsScrolling)
		timeouts = window.setTimeout('actuallyMoveGalleryLeft()', 100);
}
			
function actuallyMoveGalleryRight()
{
	var gal = document.getElementById("scrollableGallery");
	gal.scrollLeft = gal.scrollLeft - 5;
	if (galleryIsScrolling)
		timeouts = window.setTimeout('actuallyMoveGalleryRight()', 100);
}
		
function moveGalLeft()
{
	galleryIsScrolling = true;
	timeouts = window.setTimeout('actuallyMoveGalleryLeft()', 100);
}
			
function moveGalRight()
{
	galleryIsScrolling = true;
	timeouts = window.setTimeout('actuallyMoveGalleryRight()', 100);
}
			
function stopGalleryMotion()
{
	galleryIsScrolling = false;
}