(function($) {

	$.fn.easySlider = function(options){

		// default configuration properties
		var defaults = {
			prevId: 		'prevBtn',
			nextId: 		'nextBtn',
			itemWidth:		250,
			shownItems:		1,
			slideItems:		1,
			orientation:	'', //  'vertical' is optional;
			speed: 			600
		};

		var options = $.extend(defaults, options);

		return this.each(function() {
			obj = $(this);
			var s = $("li", obj).length;
			var w = options.itemWidth;
			var h = obj.height();
			var ts = s - options.shownItems;
			var index = 0;

			$("ul", obj).css('width', s*w);
			$("a","#"+options.nextId).click(function(){
				animate(true);
			});
			$("a","#"+options.prevId).click(function(){
				animate(false);
			});
			function animate(dir){
				if(dir){
					index = (index >= ts) ? 0 : index+1;
				} else {
					index = (index <= 0) ? ts : index-1;
				};
				p = (index*w*-options.slideItems);
				$("ul",obj).animate(
					{ marginLeft: p },
					options.speed
				);
			};
		});

	};

})(jQuery);
