	var scrollerWidth;
	$(document).ready(function() {
		scrollerWidth = $('#scroller').width();
		startScrollTimer();
		
		// Button configuration
		$("#scroller-right .activeButton").click(function() {
			$('#scroller').stopTime('autoscroll');
			scrollRight();
			startScrollTimer();
		});
		$("#scroller-left .activeButton").click(function() {
			$('#scroller').stopTime('autoscroll');
			scrollLeft();
			startScrollTimer();
		});
		checkScrollerButtons();
		
		//
	});
	
	function startScrollTimer() {
		$('#scroller').everyTime(10000, 'autoscroll', autoScroll);
	}
	
	function checkScrollerButtons() {
		if ( (scrollerWidth + $('#scroller').attr('scrollLeft')) < $('#scroller').attr('scrollWidth')) {
			$("#scroller-right .activeButton").show();
			$("#scroller-right .disabledButton").hide();
		} else {
			$("#scroller-right .activeButton").hide();
			$("#scroller-right .disabledButton").show();
		}
		if ($('#scroller').attr('scrollLeft')==0) {
			$("#scroller-left .activeButton").hide();
			$("#scroller-left .disabledButton").show();
		} else {
			$("#scroller-left .activeButton").show();
			$("#scroller-left .disabledButton").hide();
		}
	}
	
	function scrollRight() {
		$('#scroller').scrollTo('+='+scrollerWidth+'px', {axis: 'x', duration: 1000});
		if ( ($('#scroller').attr('scrollWidth') - $('#scroller').attr('scrollLeft')) >= $('#scroller').attr('offsetWidth')) {
			$("#scroller-right img").toggle();
			$("#scroller-left img").toggle();
		}
	}
	
	function scrollLeft() {
		$('#scroller').scrollTo('-='+scrollerWidth+'px', {axis: 'x', duration: 1000});
		if ( ($('#scroller').attr('scrollWidth') - $('#scroller').attr('scrollLeft')) <= $('#scroller').attr('offsetWidth')) {
			$("#scroller-right img").toggle();
			$("#scroller-left img").toggle();
		}
	}
	
	function autoScroll() {
		if ( (scrollerWidth + $('#scroller').attr('scrollLeft')) < $('#scroller').attr('scrollWidth')) {
			scrollRight();
			return;
		} else {
			scrollLeft();
			return;
		}
	}