(function(e){e.fn.carousel=function(f){var f=e.extend({loop:true,nextBtn:"<span>&nbsp;</span>",prevBtn:"<span>&nbsp;</span>",fixedHeight:411,autoSlide:true,autoSlideInterval:9000,delayAutoSlide:0,direction:"horizontal",dispItems:2,pagination:false,paginationPosition:"inside",btnsPosition:"inside",nextBtnInsert:"appendTo",prevBtnInsert:"prependTo",combinedClasses:false,effect:"slide",slideEasing:"swing",animSpeed:"normal",equalWidths:true,callback:function(){}},f);if(f.btnsPosition=="outside"){f.prevBtnInsert="insertBefore";f.nextBtnInsert="insertAfter"}return this.each(function(){var g={$elts:{},params:f,launchOnLoad:[]};g.$elts.carousel=e(this).addClass("js");g.$elts.content=e(this).children().css({position:"absolute",top:0});g.$elts.wrap=g.$elts.content.wrap('<div class="carousel-wrap"></div>').parent().css({overflow:"hidden",position:"relative"});g.steps={first:0,count:g.$elts.content.find(">*").length};g.steps.last=g.steps.count-1;g.$elts.prevBtn=e(f.prevBtn)[f.prevBtnInsert](g.$elts.carousel).addClass("carousel-control previous carousel-previous").data("firstStep",-(g.params.dispItems));g.$elts.nextBtn=e(f.nextBtn)[f.nextBtnInsert](g.$elts.carousel).addClass("carousel-control next carousel-next").data("firstStep",g.params.dispItems);d(g,function(h){b(h,this,g)});if(g.params.pagination){a(g)}e(function(){var h=g.$elts.content.find(">*:eq(0)");g.itemWidth=h.outerWidth();if(f.direction=="vertical"){g.contentWidth=g.itemWidth}else{if(f.equalWidths){g.contentWidth=g.itemWidth*g.steps.count}else{g.contentWidth=(function(){var i=0;g.$elts.content.find(">*").each(function(){i+=e(this).outerWidth()});return i})()}}g.$elts.content.width(g.contentWidth);g.itemHeight=h.outerHeight();if(f.direction=="vertical"){g.$elts.content.css({height:g.itemHeight*g.steps.count+"px"});g.$elts.content.parent().css({height:g.itemHeight*g.params.dispItems+"px"})}else{if(f.fixedHeight){g.$elts.content.parent().css({height:f.fixedHeight+"px"})}else{g.$elts.content.parent().css({height:g.itemHeight})}}c(g);e.each(g.launchOnLoad,function(j,k){k()});if(g.params.autoSlide){window.setTimeout(function(){g.autoSlideInterval=window.setInterval(function(){g.$elts.nextBtn.click()},g.params.autoSlideInterval)},g.params.delayAutoSlide)}})})};function b(j,g,h){var i=e(g);var f=i.data("firstStep");h.params.callback(f);switch(h.params.effect){case"no":if(h.params.direction=="vertical"){h.$elts.content.css("top",-(h.itemHeight*f)+"px")}else{h.$elts.content.css("left",-(h.itemWidth*f)+"px")}break;case"fade":if(h.params.direction=="vertical"){h.$elts.content.hide().css("top",-(h.itemHeight*f)+"px").fadeIn(h.params.animSpeed)}else{h.$elts.content.hide().css("left",-(h.itemWidth*f)+"px").fadeIn(h.params.animSpeed)}break;default:if(h.params.direction=="vertical"){h.$elts.content.stop().animate({top:-(h.itemHeight*f)+"px"},h.params.animSpeed,h.params.slideEasing)}else{h.$elts.content.stop().animate({left:-(h.itemWidth*f)+"px"},h.params.animSpeed,h.params.slideEasing)}}h.steps.first=f;c(h);if(!!j.clientX&&h.autoSlideInterval){window.clearInterval(h.autoSlideInterval)}}function c(f){f.$elts.prevBtn.data("firstStep",f.steps.first-f.params.dispItems);f.$elts.nextBtn.data("firstStep",f.steps.first+f.params.dispItems);if(f.$elts.prevBtn.data("firstStep")<0){if(f.params.loop&&f.steps.count>f.params.dispItems){f.$elts.prevBtn.data("firstStep",f.steps.count-f.params.dispItems);f.$elts.prevBtn.trigger("enable")}else{f.$elts.prevBtn.trigger("disable")}}else{f.$elts.prevBtn.trigger("enable")}if(f.$elts.nextBtn.data("firstStep")>=f.steps.count){if(f.params.loop&&f.steps.count>f.params.dispItems){f.$elts.nextBtn.data("firstStep",0);f.$elts.nextBtn.trigger("enable")}else{f.$elts.nextBtn.trigger("disable")}}else{f.$elts.nextBtn.trigger("enable")}if(f.params.pagination){f.$elts.paginationBtns.removeClass("active").filter(function(){return(e(this).data("firstStep")==f.steps.first)}).addClass("active")}}function d(g,f){g.$elts.nextBtn.add(g.$elts.prevBtn).bind("enable",function(){var h=e(this).bind("click",f).removeClass("disabled");if(g.params.combinedClasses){h.removeClass("next-disabled previous-disabled")}}).bind("disable",function(){var h=e(this).unbind("click").addClass("disabled");if(g.params.combinedClasses){if(h.is(".next")){h.addClass("next-disabled")}else{if(h.is(".previous")){h.addClass("previous-disabled")}}}});g.$elts.nextBtn.add(g.$elts.prevBtn).hover(function(){e(this).addClass("hover")},function(){e(this).removeClass("hover")})}function a(f){f.$elts.pagination=e('<div class="center-wrap"><div class="carousel-pagination"><p></p></div></div>')[((f.params.paginationPosition=="outside")?"insertAfter":"appendTo")](f.$elts.carousel).find("p");f.$elts.paginationBtns=e([]);f.$elts.content.find("li").each(function(g){if(g%f.params.dispItems==0){f.$elts.paginationBtns=f.$elts.paginationBtns.add(e('<a role="button"><span>'+(f.$elts.paginationBtns.length+1)+"</span></a>").data("firstStep",g))}});f.$elts.paginationBtns.appendTo(f.$elts.pagination);f.$elts.paginationBtns.slice(0,1).addClass("active");f.launchOnLoad.push(function(){f.$elts.paginationBtns.click(function(g){b(g,this,f)})})}})(jQuery);