(function($) {					
	$.fn.slider = function(options){

	// default configuration properties
	var defaults = {
		prevId: 		'btnPrev',
		prevText: 		'Previous',
		nextId: 		'btnNext',	
		nextText: 		'Next',
		orientation:	'', //  'vertical' is optional;
		speed: 			800			
	}; 
	
	var options = $.extend(defaults, options); 	
		
	return this.each(function(){
	var obj, objs, objw, objts, objt, vertical;
	obj = $(this);
	objs = $('li', obj).length;
	objw = obj.width();
	objts = objs-1;
	objt = 0;
	vertical = (options.orientation == 'vertical');
	$('ul', obj).css('width', objs*objw);
	if (!vertical) $('li', obj).css('float', 'left');
	$('a', '#'+options.prevId).css({opacity: 0.5});
	$('a', '#'+options.nextId).css({opacity: 0.5});
	$('a', '#'+options.prevId).addClass(options.prevId + 'Passive');
	$('a', '#'+options.nextId).addClass(options.nextId + 'Passive');
	$('a', '#'+options.nextId).click(function(){
	animate('next');
	if (objt>=objts){
		$(this).animate({opacity: 0.5});
		$(this).addClass(options.nextId + 'Passive');
	}
	
	$('a', '#'+options.prevId).animate({opacity: 1});
	$('a', '#'+options.prevId).removeClass(options.prevId + 'Passive');
	return false;
	});
	
	$('a', '#'+options.prevId).click(function(){
	animate('prev');
	if (objt<=0){
		$(this).animate({opacity: 0.5});
		$(this).addClass(options.prevId + 'Passive');
	}
	$('a', '#'+options.nextId).animate({opacity: 1});
	$('a', '#'+options.nextId).removeClass(options.nextId + 'Passive');
	return false;
	});
	
	if (objs>1) {
		$('a', '#'+options.nextId).css({opacity: 1});
		$('a', '#'+options.nextId).removeClass(options.nextId + 'Passive');
	}
	
	function animate(type){
	if (type == 'next')
	objt = (objt>=objts) ? objts : objt+1;
	else
	objt = (objt<=0) ? 0 : objt-1;
	
		if (!vertical) {
			p = (objt*objw*-1);
			$('ul', obj).animate(
				{ marginLeft: p },
				options.speed
			);
		} else {
			p = (objt*objh*-1);
			$('ul', obj).animate(
				{ marginTop: p },
				options.speed
			);
		}
	}
	});
	}
})(jQuery);

