// pan the scroller images to the left, and then to the right
$(function() {
	
	var scroller = {
	
		width: function()
		{
			
			var width = +$('#scrollWrap').css('width').replace('px', '');
			width = (width - 1279) * -1; // 1279: offset for container width
			return width;
			
		},
		
		duration: function()
		{
			
			return this.width() * -28; // for uniform speed no matter how many images
			
		},
		
		moveRight: function()
		{
			
			$('#scrollWrap').animate(
				{'marginLeft': '0px'},
				this.duration(),
				'linear',
				function() {
					scroller.moveLeft();
				}
			);
			
		},
		
		moveLeft: function()
		{
			
			$('#scrollWrap').animate(
				{'marginLeft': this.width() + 'px'},
				this.duration(),
				'linear',
				function() {
					scroller.moveRight();
				}
			);
			
		}
		
	}
	
	scroller.moveLeft(); // That wasn't so tricky, now was it?
	
});
