(function(e){e.fn.etoslider=function(){this.each(function(){function E(){u=t.width();a=Math.ceil(u/o*100);f=Math.ceil(i/100*a);f=f>=i?f:i;l=u>=o?u:o;c=(s-f)/2;h=(u-l)/2;n.each(function(t,n){e(this).width(l).height(f).css("margin-top",c).css("margin-left",h).css("position","absolute").css("left",0).css("top",0)})}function S(){n.each(function(t,r){t++;e(this).css("opacity",t==1?1:0).addClass(t==1?"current-slide first-slide":"").addClass(t==n.length?"last-slide":"").addClass("eto-slide-"+t);y+='<span class="eto-slide-'+t+'"></span>'});v=t.find(".first-slide");m=t.find(".last-slide");t.append('<div class="slider-buttons" style="position:absolute; bottom:40px; right:40px; z-index:100;">'+y+"</div>");b=t.find(".slider-buttons").children("span");b.each(function(n,i){e(this).click(function(n){clearInterval(t.si);t.find(".slider-buttons span").removeClass("active");r=t.find("img."+e(this).attr("class"));e(this).addClass("active");t.find("img").removeClass("current-slide").animate({opacity:0},{queue:false,duration:"slow"});r.addClass("current-slide").animate({opacity:1},{queue:false,duration:"slow"});t.si=setInterval(x,7e3)})});T();t.si=setInterval(x,7e3)}function x(){p=t.find(".current-slide");if(!p.hasClass("last-slide")){d=p.next("img");p.removeClass("current-slide").animate({opacity:0},{queue:false,duration:"slow"});d.addClass("current-slide").animate({opacity:1},{queue:false,duration:"slow"})}else{m.removeClass("current-slide").animate({opacity:0},{queue:false,duration:"slow"});v.addClass("current-slide").animate({opacity:1},{queue:false,duration:"slow"})}T()}function T(){t.find(".slider-buttons span").removeClass("active");buttonClass=t.find(".current-slide").attr("class").replace("first-slide","").replace("last-slide","").replace("current-slide","").replace(/^\s+|\s+$/g,"");t.find(".slider-buttons span."+buttonClass).addClass("active")}var t=e(this),n=t.children("img"),r,i=n.height(),s=t.height(),o=n.width(),u,a,f,l,c,h,p,d,v,m,g,y="",b,w;n.removeAttr("width").removeAttr("height");t.css("position","relative");E();e(window).resize(function(e){E()});S()})}})(jQuery)