(function(){$.fn.bigCarousel=function(opts){this.each(function(){new BigCarousel(this,opts);});};function BigCarousel(el,opts){this.el=$(el);this.opts=opts;this.items=this.el.find('li');this.current=0;this.prev_button=$('<div class="prev"></div>').appendTo(this.el);this.next_button=$('<div class="next"></div>').appendTo(this.el);this.pager=$('<p class="pager"></p>').appendTo(this.el);this.init();if($(this.opts.connect_with).length){this.connect();}}
BigCarousel.prototype.extend=$.extend;BigCarousel.prototype.extend({init:function(){this.items.hide();this.show(0);var self=this;this.prev_button.click(function(){self.prev();});this.next_button.click(function(){self.next();});},show:function(n){if(n<0){n=this.items.length-1;}else if(n>=this.items.length){n=0;}
this.items.eq(this.current).hide();this.current=n;var $item=this.items.eq(n),$image=$item.children('img');$item.fadeIn();this.pager.html((n+1)+' de '+this.items.length);},next:function(){this.show(this.current+1);},prev:function(){this.show(this.current-1);},connect:function(){var self=this;$(this.opts.connect_with).find('a').each(function(i){$(this).click(function(e){e.preventDefault();self.show(i);});});}});})(jQuery);
