window.addEvent('domready', function(){

var rightcount = 1;
var leftcount = 0;
var reload = true;
var maxcount = 8;
 var scroll = new Fx.Scroll('demo-wrapper', {
	wait: false,
	duration: 500,
	offset: {'x': 0, 'y': 0},
	transition: Fx.Transitions.Quad.easeInOut
});


$('link1').addEvent('click', function(event) {
	rightcount = rightcount + 1;
	if(	rightcount <= maxcount)	{
			event = new Event(event).stop();
			scroll.toElement('content'+rightcount);
		} else {
      if(reload == true){
          rightcount = 1;
    			event = new Event(event).stop();
    			scroll.toElement('content'+rightcount);
        } else  {
          rightcount = maxcount;
        }

		}
});

 $('link0').addEvent('click', function(event) {
	rightcount = rightcount - 1
	if(	rightcount >= 1)	{
		event = new Event(event).stop();
		scroll.toElement('content'+rightcount);
	} else	{
		rightcount = maxcount;
		event = new Event(event).stop();
		scroll.toElement('content'+rightcount);
	}
});

});
/*
var fx = function() {
	rightcount = rightcount + 1;
	if(	rightcount <= maxcount)	{
			scroll.toElement('content'+rightcount);
		} else {
      if(reload == true){
          rightcount = 1;
    			scroll.toElement('content'+rightcount);
        } else  {
          rightcount = maxcount;
        }

		}
}

$('start').addEvent('click', function() {
	fx();
	periodical = fx.periodical(1700);
});

$('stop').addEvent('click', function() {
	$clear(periodical);
});
*/
