var Slider_Vertical = function(containerId){
	var thisCopy = this;

	this.container = $("#" + containerId);
	this.content = this.container.find(".sliderContent");
	this.arrows = {
		up: this.container.find(".arrow.u"),
		down: this.container.find(".arrow.d")
	}

	this.arrows.up.bind("click", function(){
		thisCopy.slide("up");
	});
	
	this.arrows.down.bind("click", function(){
		thisCopy.slide("down");
	});
	
	this.animated = false;
	this.redrawArrows();
}

Slider_Vertical.prototype.redrawArrows = function (){
	if (this.content.position().top > -1) {
		this.arrows.up.hide();
	} else {
		this.arrows.up.show();
	}
	
	if (this.content.height() - this.container.height() > Math.abs(this.content.position().top)) {
		this.arrows.down.show();
	} else {
		this.arrows.down.hide();
	}
}

Slider_Vertical.prototype.slide = function (direction){
	if (!this.animated){
		this.animated = true;
		var thisCopy = this;
		
		var increment = this.container.height();
		if (direction == "down")
			increment = increment * -1;
			
		if ( Math.abs(this.content.position().top + increment) > this.content.height() - this.container.height() ){
			increment = (this.content.height() - this.container.height() + this.content.position().top) * -1;
		}
		
		if ( this.content.position().top + increment > 0 ){
			increment = this.content.position().top * -1;
		}

		jTweener.addTween(
		        this.content,
		        {
		                top: "+=" + increment,
		                time: 0.8,
		                transition: 'easeincubic',
	        			onComplete: function() {
							thisCopy.animated = false;
							thisCopy.redrawArrows();
						}
				}
		);
	}
}
