var maxa = 12;		// Total number of cells (excluding repeating cells)
var sdur = 1000;	// Scrolling animation duration
var dirc = false;	// true: Normal Direction - false: Reverse Direction

var scrid = 1;
var scriv;

function scrollme(){
	var scroll = new Fx.Scroll('vertical-wrapper', {
				wait: false,
				duration: sdur,
				transition: Fx.Transitions.Quad.easeInOut
	});

	if (dirc){
		scrid+=1;
		//alert('scroll down' + ' -- ' + scrid + ' -- ' + maxa);
		if (scrid >= maxa) {
			scrid = 0;
			// Setting duration to 0 for last element to first element animation, to start animation without delay while repeating
			scroll = new Fx.Scroll('vertical-wrapper', {
				wait: false,
				duration: 0,
				transition: Fx.Transitions.Quad.easeInOut
			});
			setTimeout(scrollme, 100);
		}
		scroll.toElement('content' + scrid);
	}else{
		scrid-=1;
		//alert('scroll up' + ' -- ' + scrid + ' -- ' + maxa);
		if (scrid < 1) {
			scrid = maxa + 1;
			// Setting duration to 0 for first element to last element animation, to start animation without delay while repeating
			scroll = new Fx.Scroll('vertical-wrapper', {
				wait: false,
				duration: 0,
				transition: Fx.Transitions.Quad.easeInOut
			});
			setTimeout(scrollme, 100);
		}
		scroll.toElement('content' + scrid);
	}
}

function frwd(){
	dirc = false;
	scrollme();
}

function bkwd(){
	dirc = true;
	scrollme();
}
