$(document).ready(function() {

	$.fn.slide = function(options){
	  
			var defaults = { controlsShow:true,controlsFade:true,vertical:true,speed:800 }; 
			var options = $.extend(defaults, options);  
			this.each(function() {  
			var object = $(this); 				
			var count = $(".one_li", object).length;
			var w = $(".slide", object).width(); 
			var h = $(".slide", object).height(); 
			object.width(w); 
			object.height(h); 
			object.css("overflow","hidden");
			var ts = count-3;
			var t = 0;
			$("#all", object).css('width',count*w);			
			if(!options.vertical) $(".slide", object).css('float','left');
			
			$(".slide").css("display", "block");

			$("#down").click(function(){ animate("down"); });
			$("#up").click(function(){ animate("up"); });	
			
			function animate(dir){
				var ot = t;				
				switch(dir)
				{
					case "down": t = (ot>=ts) ? ts : t+1; break; 
					case "up": t = (t<=0) ? ts : t-1; break; 
					default: break; 
				};	
				
				var diff = Math.abs(ot-t);
				var speed = diff*options.speed;						
				p = (t*68*-1);
				$("#all",object).animate( { marginTop: p },speed);					
				
				if(!options.continuous && options.controlsFade){					
					if(t==ts){ $("#down").hide(); $("#downnot").show(); } else { $("#down").show(); $("#downnot").hide();	};
					if(t==0) { $("#up").hide(); $("#upnot").show();	} else { $("#up").show();	$("#upnot").hide(); };					
				};							
			};
		});
	};
});
