jQuery.fn.slider = function(options) {
	var defaults = {
		itemWidth : 200,    
     	itemMargin : 0,
     	paddingLeft : 0,
     	paddingRight: 0,
     	next : ".btnSeguinte",
     	previous : ".btnAnterior", 
     	speed	: 300,       	  
		debug	  : true,
		visibleItems : 1
	  };
 	var options = $.extend(defaults, options);


  		
  	var currentItem=0
  	var totalItems=0
  	var container=null;
	
	return this.each(function(){   
		container = jQuery(this)
		totalItems=jQuery("ul li ",this).length
		
		jQuery(container).css({"position" : "relative"});
		
		jQuery("ul",container).css({
			"position"	: "absolute",
			"width"		: totalItems*options.itemWidth+totalItems*options.itemMargin+options.paddingLeft+options.paddingRight
		});								
		
		jQuery(options.previous,container).css({"z-index" : 9999});
		jQuery(options.next,container).css({"z-index" : 9999});
					
		jQuery(options.previous,this).click(function() {
			currentItem--;
			if (currentItem<0) {
				currentItem=totalItems-options.visibleItems;
			}			
			jQuery("ul",container).animate({"left": -currentItem*options.itemWidth-options.itemMargin*currentItem}, options.speed);									
		})
		
		jQuery(options.next,this).click(function() {
			currentItem++;
			if (currentItem>(totalItems-options.visibleItems)) {
				currentItem=0
			}			
			jQuery("ul",container).animate({"left" : -currentItem*options.itemWidth-options.itemMargin*currentItem}, options.speed);						
			
		})
		
		
	});  
   

	    
	    
  	
};