jQuery.fn.VerticalSlider = function(settings) {
	settings = jQuery.extend({	
		speed: 'normal',
		button_initCallback: null,
		buttonCallback: null
	}, settings);
	
	var e = $(this);
	var instance = this;
	
	$.fn.extend(this, {
	
	    setup: function() {
		this.elem = $(this);
		this.items = this.elem.find('.vs-item');
		this.count = this.items.length;
		this.height = $(this.items[0]).height();
		this.current = 0;
		this.isActive = false;
	
		this.elem.wrapInner('<div class="vslider"></div>');
		this.vslider = this.elem.find('.vslider:first');
		this.vslider.height(this.count*this.height);
		$(this.items[this.current]).addClass('visible');
	
		if(settings.button_initCallback != null) {
		    settings.button_initCallback(this);
		}
	    },
	    
	    up: function() {
		if(this.current == 0 || this.isActive) {
		    return false;
		}
		this.setActive();
		$(this.items[this.current]).removeClass('visible');
		this.current--;
		$(this.items[this.current]).addClass('visible');
		this.vslider.animate({top: (this.current*this.height*(-1))+'px'}, {duration: settings.speed, complete: moveCallback});
		return false;
	    },
	    
	    down: function() {
		if(this.current == this.count-1 || this.isActive) {
		    return false;
		}
		
		this.setActive();
		$(this.items[this.current]).removeClass('visible');
		this.current++;
		$(this.items[this.current]).addClass('visible');
		this.vslider.animate({top: (this.current*this.height*(-1))+'px'}, {duration: settings.speed, complete: moveCallback});
		return false;
	    },
	    
	    setActive: function() {
		this.isActive = true;
	    },
	    
	    setInactive: function() {
		this.isActive = false;
	    }
	    
	});	
	
	this.setup();
	
	function moveCallback() {
	    instance.isActive = false;
	    if(settings.buttonCallback != null) {
		settings.buttonCallback(instance);
	    }
	}
} 

