(function($) 
{

	$.fn.easySlider = function(options)
	{
	  
	var defaults = 
	{			
		speed: 	1000,
		pause:	7000,
	}; 
		
	var options = $.extend(defaults, options);  
				
	this.each(function() 
	{  
		var obj = $(this); 				
		var s = $("li", obj).length;
		var w = $("li", obj).width(); 
		var h = $("li", obj).height(); 
		obj.width(w); 
		obj.height(h); 
		obj.css("overflow","hidden");
		var ts = s-1;
		var t = 0;
		$("ul", obj).css('width',s*w);			
			
		$("ul", obj).prepend($("ul li:last-child", obj).clone().css("margin-left","-"+ w +"px"));
		$("ul", obj).append($("ul li:nth-child(2)", obj).clone());
		$("ul", obj).css('width',(s+1)*w);
			
		$("li", obj).css('float','left');
								
		function adjust()
		{
			if(t>ts) t=0;		
			if(t<0) t=ts;	
			$("ul",obj).css("margin-left",(t*w*-1));
		};
			
		function animate(dir,clicked)
		{
				var ot = t;				
				t = t+1;						
				var diff = Math.abs(ot-t);
				var speed = diff*options.speed;	
					
				p = (t*w*-1);
				$("ul",obj).animate(
					{ marginLeft: p }, 
					{ queue:false, duration:speed, complete:adjust }
				);				
									
				timeout = setTimeout(function() {animate("next",false);},diff*options.speed+options.pause);
		};

		var timeout;
		timeout = setTimeout(function(){ animate("next",false); },options.pause);
				
	});
	  
};

})(jQuery);




