(function(k,c,l){var f=c.event,g;f.special.smartresize={setup:function(){c(this).bind("resize",f.special.smartresize.handler)},teardown:function(){c(this).unbind("resize",f.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize";g&&clearTimeout(g);g=setTimeout(function(){jQuery.event.handle.apply(c,d)},"execAsap"===b?0:100)}};c.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])};c.Slideshow=function(a,b){this.$el=
c(b);this.$list=this.$el.find("ul.ei-slider-large");this.$imgItems=this.$list.children("li");this.itemsCount=this.$imgItems.length;this.$images=this.$imgItems.find("img:first");this.$sliderthumbs=this.$el.find("ul.ei-slider-thumbs").hide();this.$sliderElems=this.$sliderthumbs.children("li");this.$sliderElem=this.$sliderthumbs.children("li.ei-slider-element");this.$thumbs=this.$sliderElems.not(".ei-slider-element");this._init(a)};c.Slideshow.defaults={animation:"sides",autoplay:!1,slideshow_interval:3E3,
speed:800,easing:"",titlesFactor:0.6,titlespeed:800,titleeasing:"",thumbMaxWidth:150,slidesLoaded:function(){}};c.Slideshow.prototype={_init:function(a){this.options=c.extend(!0,{},c.Slideshow.defaults,a);this.$imgItems.css("opacity",0);this.$imgItems.find("div.ei-title > *").css("opacity",0);this.current=0;var b=this;c(".ei-slider-loading").length=0;this.$loading=c(".ei-slider-loading");c.when(this._preloadImages()).done(function(){b.$loading.hide();b._setImagesSize();b._initThumbs();b.$imgItems.eq(b.current).css({opacity:1,
"z-index":10}).show().find("div.ei-title > *").css("opacity",1);b.options.autoplay&&b._startSlideshow();b._initEvents()});b.options.slidesLoaded()},_preloadImages:function(){var a=this,b=0;return c.Deferred(function(e){a.$images.each(function(d){c("<img/>").load(function(){++b===a.itemsCount&&e.resolve()}).attr("src",c(this).attr("src"))})}).promise()},_setImagesSize:function(){this.elWidth=this.$el.width();var a=this;this.$images.each(function(b){b=c(this);imgDim=a._getImageDim(b.attr("src"));b.css({width:imgDim.width,
height:imgDim.height,marginLeft:imgDim.left,marginTop:imgDim.top})})},_getImageDim:function(a){var b=new Image;b.src=a;a=this.elWidth;var c=this.$el.height(),d=b.height/b.width;c/a>d?(b=c,d=c/d):(b=a*d,d=a);return{width:d,height:b,left:(a-d)/2,top:(c-b)/2}},_initThumbs:function(){this.$sliderElems.css({"max-width":this.options.thumbMaxWidth+"px",width:100/this.itemsCount+"%"});this.$sliderthumbs.css("max-width",this.options.thumbMaxWidth*this.itemsCount+"px").show()},_startSlideshow:function(){var a=
this;this.slideshow=setTimeout(function(){var b;a.current===a.itemsCount-1?b=0:b=a.current+1;a._slideTo(b);a.options.autoplay&&a._startSlideshow()},this.options.slideshow_interval)},_slideTo:function(a){if(a===this.current||this.isAnimating)return!1;this.isAnimating=!0;var b=this.$imgItems.eq(this.current),e=this.$imgItems.eq(a),d=this,f={zIndex:10},g={opacity:1};"sides"===this.options.animation&&(f.left=a>this.current?-1*this.elWidth:this.elWidth,g.left=0);e.find("div.ei-title > h2").css("margin-right",
"50px").stop().delay(this.options.speed*this.options.titlesFactor).animate({marginRight:"0px",opacity:1},this.options.titlespeed,this.options.titleeasing).end().find("div.ei-title > h3").css("margin-right","-50px").stop().delay(this.options.speed*this.options.titlesFactor).animate({marginRight:"0px",opacity:1},this.options.titlespeed,this.options.titleeasing);c.when(b.css("z-index",1).find("div.ei-title > *").stop().fadeOut(this.options.speed/2,function(){c(this).show().css("opacity",0)}),e.css(f).stop().animate(g,
this.options.speed,this.options.easing),this.$sliderElem.stop().animate({left:this.$thumbs.eq(a).position().left},this.options.speed)).done(function(){b.css("opacity",0).find("div.ei-title > *").css("opacity",0);d.current=a;d.isAnimating=!1})},_initEvents:function(){var a=this;c(k).bind("smartresize.eislideshow",function(b){a._setImagesSize();a.$sliderElem.css("left",a.$thumbs.eq(a.current).position().left)});this.$thumbs.bind("click.eislideshow",function(b){a.options.autoplay&&(clearTimeout(a.slideshow),
a.options.autoplay=!1);b=c(this).index()-1;a._slideTo(b);return!1})}};var h=function(a){this.console&&console.error(a)};c.fn.eislideshow=function(a){if("string"===typeof a){var b=Array.prototype.slice.call(arguments,1);this.each(function(){var e=c.data(this,"eislideshow");e?c.isFunction(e[a])&&"_"!==a.charAt(0)?e[a].apply(e,b):h("no such method '"+a+"' for eislideshow instance"):h("cannot call methods on eislideshow prior to initialization; attempted to call method '"+a+"'")})}else this.each(function(){c.data(this,
"eislideshow")||c.data(this,"eislideshow",new c.Slideshow(a,this))});return this}})(window,jQuery);