(function(a){a.fn.juicyslider=function(j){var e=a.extend({mode:"cover",width:"100%",height:"100%",mask:"raster",bgcolor:"#000",autoplay:4000,shuffle:false,show:{effect:"fade",duration:1500},hide:{effect:"fade",duration:1500},},j),c=this.find("li"),f=c.length,g=0,i=function(l){var k=1;if(l){l.preventDefault();k=l.data.step}if(e.shuffle){k=Math.floor(Math.random()*(f-1)+1)}a(c[g]).hide(e.hide);g=(((g+k)%f)+f)%f;a(c[g]).css({display:"block"});d();a(c[g]).css({display:"none"});a(c[g]).show(e.show)},b=a(window),h=this;this.css("background-color",e.bgcolor);this.find(".mask").css("background-image",e.mask=="none"?"none":"url(./img/"+e.mask+".png)");this.find(".nav.next").click({step:1},i);this.find(".nav.prev").click({step:-1},i);if(e.autoplay>0){setInterval(i,e.autoplay)}function d(){h.width(e.width==null?b.width():e.width);h.height(e.height==null?b.height():e.height);vieww=h.width();viewh=h.height();viewRatio=vieww/viewh;bgimg=a(c[g]).find("img");var k=function(){imgRatio=bgimg.width()/bgimg.height();if((viewRatio<imgRatio&&e.mode=="contain")||(viewRatio>=imgRatio&&e.mode=="cover")){bgimg.removeClass("maxh").addClass("maxw").css({top:(viewh-vieww/imgRatio)/2,left:0})}else{bgimg.removeClass("maxw").addClass("maxh").css({top:0,left:(vieww-imgRatio*viewh)/2})}};bgimg.get(0).complete?k():bgimg.load(k)}b.resize(d).trigger("resize");return this}}(jQuery));