/* This script uses MooTools. This script copyright of Gregory Athons.*/

function animatedSlider_vertical(div,down,up) {
	
	var p = this;
	this.marginTop = 0;
	this.totalPages = 0;
	this.animation = false;
	this.windowHeight = $(div).getParent().getStyle("height").toInt();
	
	//set totalPages
	this.totalPages = Math.ceil($(div).getStyle("height").toInt() / this.windowHeight);
	
	
	//move up
	$(up).addEvent("click", function() {
		if(p.animation) { return; }
		if(p.marginTop != 0) {
			new Fx.Tween($(div),{
				duration:1000,
				onComplete:function() { p.animation = false; }
			}).start("margin-top",p.marginTop,(p.marginTop + p.windowHeight));
			p.animation = true;
			p.marginTop += p.windowHeight;
		}
	});
	
	//move down
	$(down).addEvent('click', function() {
		if(p.animation) { return; }
		if(p.marginTop != (((p.totalPages - 1) * p.windowHeight) * -1)) {
			new Fx.Tween($(div), {
				duration:1000,
				onComplete:function() { p.animation = false; }
			}).start("margin-top",p.marginTop,(p.marginTop - p.windowHeight));
			p.animation = true;
			p.marginTop -= p.windowHeight;
		}
	});
	
} //end function