(function(a){a.fn.bxSlider=function(S){var g={mode:"horizontal",infiniteLoop:true,hideControlOnEnd:false,controls:true,speed:400,easing:"swing",pager:false,pagerSelector:null,pagerType:"full",pagerLocation:"bottom",pagerShortSeparator:"/",pagerActiveClass:"pager-active",nextText:"next",nextImage:"",nextSelector:".viewport",prevText:"prev",prevImage:"",prevSelector:".viewport",captions:false,captionsSelector:null,auto:true,autoDirection:"next",autoControls:false,autoControlsSelector:null,autoStart:true,autoHover:true,autoDelay:0,pause:7000,startText:"start",startImage:"",stopText:"stop",stopImage:"",ticker:false,tickerSpeed:5000,tickerDirection:"next",tickerHover:false,wrapperClass:"bx-wrapper",startingSlide:0,displaySlideQty:1,moveSlideQty:1,randomStart:false,onBeforeSlide:function(){},onAfterSlide:function(){},onLastSlide:function(){},onFirstSlide:function(){},onNextSlide:function(){},onPrevSlide:function(){},buildPager:null};var S=a.extend(g,S);var M=this;var I="";var X="";var o="";var W="";var d="";var A="";var t="";var K="";var x="";var h="";var D="";var Z="";var k="";var s="";var y="";var m=true;var Y=false;var T=0;var l=0;var Q=0;var z=0;var V=0;var O=0;var R=0;var q=0;var F=0;var w=false;var p=0;var U=o.length-1;this.goToSlide=function(aa,ab){if(!w){w=true;Q=aa;S.onBeforeSlide(Q,o.length,o.eq(Q));if(typeof(ab)=="undefined"){var ab=true}if(ab){if(S.auto){M.stopShow(true)}}slide=aa;if(slide==p){S.onFirstSlide(Q,o.length,o.eq(Q))}if(slide==U){S.onLastSlide(Q,o.length,o.eq(Q))}if(S.mode=="horizontal"){I.animate({left:"-"+c(slide,"left")+"px"},S.speed,S.easing,function(){w=false;S.onAfterSlide(Q,o.length,o.eq(Q))})}else{if(S.mode=="vertical"){I.animate({top:"-"+c(slide,"top")+"px"},S.speed,S.easing,function(){w=false;S.onAfterSlide(Q,o.length,o.eq(Q))})}else{if(S.mode=="fade"){b()}}}C();if(S.moveSlideQty>1){aa=Math.floor(aa/S.moveSlideQty)}i(aa);u()}};this.goToNextSlide=function(ad){if(typeof(ad)=="undefined"){var ad=true}if(ad){if(S.auto){M.stopShow(true)}}if(!S.infiniteLoop){if(!w){var aa=false;Q=(Q+(S.moveSlideQty));if(Q<=U){C();S.onNextSlide(Q,o.length,o.eq(Q));M.goToSlide(Q)}else{Q-=S.moveSlideQty}}}else{if(!w){w=true;var aa=false;Q=(Q+S.moveSlideQty);if(Q>U){Q=Q%o.length;aa=true}S.onNextSlide(Q,o.length,o.eq(Q));S.onBeforeSlide(Q,o.length,o.eq(Q));if(S.mode=="horizontal"){var ab=(S.moveSlideQty*t);I.animate({left:"-="+ab+"px"},S.speed,S.easing,function(){w=false;if(aa){I.css("left","-"+c(Q,"left")+"px")}S.onAfterSlide(Q,o.length,o.eq(Q))})}else{if(S.mode=="vertical"){var ac=(S.moveSlideQty*l);I.animate({top:"-="+ac+"px"},S.speed,S.easing,function(){w=false;if(aa){I.css("top","-"+c(Q,"top")+"px")}S.onAfterSlide(Q,o.length,o.eq(Q))})}else{if(S.mode=="fade"){b()}}}if(S.moveSlideQty>1){i(Math.ceil(Q/S.moveSlideQty))}else{i(Q)}u()}}};this.goToPreviousSlide=function(ad){if(typeof(ad)=="undefined"){var ad=true}if(ad){if(S.auto){M.stopShow(true)}}if(!S.infiniteLoop){if(!w){var aa=false;Q=Q-S.moveSlideQty;if(Q<0){Q=0;if(S.hideControlOnEnd){a(".prev",W).hide()}}C();S.onPrevSlide(Q,o.length,o.eq(Q));M.goToSlide(Q)}}else{if(!w){w=true;var aa=false;Q=(Q-(S.moveSlideQty));if(Q<0){negativeOffset=(Q%o.length);if(negativeOffset==0){Q=0}else{Q=(o.length)+negativeOffset}aa=true}S.onPrevSlide(Q,o.length,o.eq(Q));S.onBeforeSlide(Q,o.length,o.eq(Q));if(S.mode=="horizontal"){var ab=(S.moveSlideQty*t);I.animate({left:"+="+ab+"px"},S.speed,S.easing,function(){w=false;if(aa){I.css("left","-"+c(Q,"left")+"px")}S.onAfterSlide(Q,o.length,o.eq(Q))})}else{if(S.mode=="vertical"){var ac=(S.moveSlideQty*l);I.animate({top:"+="+ac+"px"},S.speed,S.easing,function(){w=false;if(aa){I.css("top","-"+c(Q,"top")+"px")}S.onAfterSlide(Q,o.length,o.eq(Q))})}else{if(S.mode=="fade"){b()}}}if(S.moveSlideQty>1){i(Math.ceil(Q/S.moveSlideQty))}else{i(Q)}u()}}};this.goToFirstSlide=function(aa){if(typeof(aa)=="undefined"){var aa=true}M.goToSlide(p,aa)};this.goToLastSlide=function(){if(typeof(aa)=="undefined"){var aa=true}M.goToSlide(U,aa)};this.getCurrentSlide=function(){return Q};this.getSlideCount=function(){return o.length};this.stopShow=function(aa){clearInterval(D);if(typeof(aa)=="undefined"){var aa=true}if(aa&&S.autoControls){Z.html(s).removeClass("stop").addClass("start");m=false}};this.startShow=function(aa){if(typeof(aa)=="undefined"){var aa=true}L();if(aa&&S.autoControls){Z.html(y).removeClass("start").addClass("stop");m=true}};this.stopTicker=function(aa){I.stop();if(typeof(aa)=="undefined"){var aa=true}if(aa&&S.ticker){Z.html(s).removeClass("stop").addClass("start");m=false}};this.startTicker=function(aa){if(S.mode=="horizontal"){if(S.tickerDirection=="next"){var ac=parseInt(I.css("left"));var ae=(O+ac)+o.eq(0).width()}else{if(S.tickerDirection=="prev"){var ac=-parseInt(I.css("left"));var ae=(ac)-o.eq(0).width()}}var ad=(ae*S.tickerSpeed)/O;f(q,ae,ad)}else{if(S.mode=="vertical"){if(S.tickerDirection=="next"){var ab=parseInt(I.css("top"));var ae=(R+ab)+o.eq(0).height()}else{if(S.tickerDirection=="prev"){var ab=-parseInt(I.css("top"));var ae=(ab)-o.eq(0).height()}}var ad=(ae*S.tickerSpeed)/R;f(F,ae,ad);if(typeof(aa)=="undefined"){var aa=true}if(aa&&S.ticker){Z.html(y).removeClass("start").addClass("stop");m=true}}}};this.initShow=function(){I=a(this);X=I.clone();o=I.children();W="";d=I.children(":first");A=d.width();T=0;t=d.outerWidth();l=0;K=E();x=v();w=false;h="";Q=0;z=0;V=0;D="";Z="";k="";s="";y="";m=true;Y=false;O=0;R=0;q=0;F=0;p=0;U=o.length-1;o.each(function(ab){if(a(this).outerHeight()>l){l=a(this).outerHeight()}if(a(this).outerWidth()>T){T=a(this).outerWidth()}});if(S.randomStart){var aa=Math.floor(Math.random()*o.length);Q=aa;z=t*(S.moveSlideQty+aa);V=l*(S.moveSlideQty+aa)}else{Q=S.startingSlide;z=t*(S.moveSlideQty+S.startingSlide);V=l*(S.moveSlideQty+S.startingSlide)}N();if(S.pager&&!S.ticker){if(S.pagerType=="full"){j("full")}else{if(S.pagerType=="short"){j("short")}}}if(S.controls&&!S.ticker){H()}if(S.auto||S.ticker){if(S.autoControls){P()}if(S.autoStart){setTimeout(function(){M.startShow(true)},S.autoDelay)}else{M.stopShow(true)}if(S.autoHover&&!S.ticker){e()}}if(S.moveSlideQty>1){i(Math.ceil(Q/S.moveSlideQty))}else{i(Q)}C();if(S.captions){u()}S.onAfterSlide(Q,o.length,o.eq(Q))};this.destroyShow=function(){clearInterval(D);a(".next, .prev, .bx-pager, .bx-auto",W).remove();I.unwrap().unwrap().removeAttr("style");I.children().removeAttr("style").not(".pager").remove();o.removeClass("pager")};this.reloadShow=function(){M.destroyShow();M.initShow()};function N(){r(S.startingSlide);if(S.mode=="horizontal"){var aa=z*2;I.wrap('<div class="'+S.wrapperClass+'" style="width:'+K+'px; position:relative;"></div>').wrap('<div class="bx-window" style="position:relative; width:'+K+'px;"></div>').css({width:"99999px",position:"relative",left:"-"+(aa)+"px"});I.children().css({width:A,"float":"left",listStyle:"none"});W=I.parent().parent();o.addClass("pager")}else{if(S.mode=="vertical"){I.wrap('<div class="'+S.wrapperClass+'" style="width:'+T+'px; position:relative;"></div>').wrap('<div class="bx-window" style="width:'+T+"px; height:"+x+'px; position:relative;"></div>').css({height:"99999px",position:"relative",top:"-"+(V)+"px"});I.children().css({listStyle:"none",height:l});W=I.parent().parent();o.addClass("pager")}else{if(S.mode=="fade"){I.wrap('<div class="'+S.wrapperClass+'" style="width:'+T+'px; position:relative;"></div>').wrap('<div class="bx-window" style="height:'+l+"px; width:"+T+'px; position:relative;"></div>');I.children().css({listStyle:"none",position:"absolute",top:0,left:0,zIndex:98});W=I.parent().parent();o.not(":eq("+Q+")").fadeTo(0,0);o.eq(Q).css("zIndex",99)}}}if(S.captions&&S.captionsSelector==null){W.append('<div class="bx-captions"></div>')}}function r(){if(S.mode=="horizontal"||S.mode=="vertical"){var ag=(o.length+S.moveSlideQty);var ac=o.length-S.displaySlideQty;var ab=ag-ac;var ae=n(o,0,ab,"backward");a.each(ae,function(ah){I.prepend(a(this))});var ad=(o.length+S.moveSlideQty);var ac=o.length-S.displaySlideQty;var aa=ad-ac;var af=n(o,0,aa,"forward");if(S.infiniteLoop){a.each(af,function(ah){I.append(a(this))})}}}function H(){if(S.nextImage!=""){nextContent=S.nextImage;nextType="image"}else{nextContent=S.nextText;nextType="text"}if(S.prevImage!=""){prevContent=S.prevImage;prevType="image"}else{prevContent=S.prevText;prevType="text"}G(nextType,nextContent,prevType,prevContent)}function L(){if(S.auto){if(!S.infiniteLoop){if(S.autoDirection=="next"){D=setInterval(function(){Q+=S.moveSlideQty;if(Q>U){Q=Q%o.length}M.goToSlide(Q,false)},S.pause)}else{if(S.autoDirection=="prev"){D=setInterval(function(){Q-=S.moveSlideQty;if(Q<0){negativeOffset=(Q%o.length);if(negativeOffset==0){Q=0}else{Q=(o.length)+negativeOffset}}M.goToSlide(Q,false)},S.pause)}}}else{if(S.autoDirection=="next"){D=setInterval(function(){M.goToNextSlide(false)},S.pause)}else{if(S.autoDirection=="prev"){D=setInterval(function(){M.goToPreviousSlide(false)},S.pause)}}}}else{if(S.ticker){S.tickerSpeed*=10;a(".pager",W).each(function(aa){O+=a(this).width();R+=a(this).height()});if(S.tickerDirection=="prev"&&S.mode=="horizontal"){I.css("left","-"+(O+z)+"px")}else{if(S.tickerDirection=="prev"&&S.mode=="vertical"){I.css("top","-"+(R+V)+"px")}}if(S.mode=="horizontal"){q=parseInt(I.css("left"));f(q,O,S.tickerSpeed)}else{if(S.mode=="vertical"){F=parseInt(I.css("top"));f(F,R,S.tickerSpeed)}}if(S.tickerHover){J()}}}}function f(ab,ac,aa){if(S.mode=="horizontal"){if(S.tickerDirection=="next"){I.animate({left:"-="+ac+"px"},aa,"linear",function(){I.css("left",ab);f(ab,O,S.tickerSpeed)})}else{if(S.tickerDirection=="prev"){I.animate({left:"+="+ac+"px"},aa,"linear",function(){I.css("left",ab);f(ab,O,S.tickerSpeed)})}}}else{if(S.mode=="vertical"){if(S.tickerDirection=="next"){I.animate({top:"-="+ac+"px"},aa,"linear",function(){I.css("top",ab);f(ab,R,S.tickerSpeed)})}else{if(S.tickerDirection=="prev"){I.animate({top:"+="+ac+"px"},aa,"linear",function(){I.css("top",ab);f(ab,R,S.tickerSpeed)})}}}}}function P(){if(S.startImage!=""){startContent=S.startImage;startType="image"}else{startContent=S.startText;startType="text"}if(S.stopImage!=""){stopContent=S.stopImage;stopType="image"}else{stopContent=S.stopText;stopType="text"}B(startType,startContent,stopType,stopContent)}function e(){W.find(".bx-window").hover(function(){if(m){M.stopShow(false)}},function(){if(m){M.startShow(false)}})}function J(){I.hover(function(){if(m){M.stopTicker(false)}},function(){if(m){M.startTicker(false)}})}function b(){o.not(":eq("+Q+")").fadeTo(S.speed,0).css("zIndex",98);o.eq(Q).css("zIndex",99).fadeTo(S.speed,1,function(){w=false;S.onAfterSlide(Q,o.length,o.eq(Q))})}function i(aa){if(S.pagerType=="full"&&S.pager){a("a",h).removeClass(S.pagerActiveClass);a("a",h).eq(aa).addClass(S.pagerActiveClass)}else{if(S.pagerType=="short"&&S.pager){a(".bx-pager-current",h).html(Q+1)}}}function G(af,ae,aa,ab){var ac=a('<a href="" class="next"></a>');var ad=a('<a href="" class="prev"></a>');if(af=="text"){ac.html(ae)}else{ac.html('<img src="'+ae+'" />')}if(aa=="text"){ad.html(ab)}else{ad.html('<img src="'+ab+'" />')}if(S.prevSelector){a(S.prevSelector).append(ad)}else{W.append(ad)}if(S.nextSelector){a(S.nextSelector).append(ac)}else{W.append(ac)}ac.click(function(){M.goToNextSlide();return false});ad.click(function(){M.goToPreviousSlide();return false})}function j(ad){var ac=o.length;if(S.moveSlideQty>1){if(o.length%S.moveSlideQty!=0){ac=Math.ceil(o.length/S.moveSlideQty)}else{ac=o.length/S.moveSlideQty}}var ae="";if(S.buildPager){for(var aa=0;aa<ac;aa++){ae+=S.buildPager(aa,o.eq(aa*S.moveSlideQty))}}else{if(ad=="full"){for(var aa=1;aa<=ac;aa++){ae+='<a href="" class="pager-link pager-'+aa+'">'+aa+"</a>"}}else{if(ad=="short"){ae='<span class="bx-pager-current">'+(S.startingSlide+1)+"</span> "+S.pagerShortSeparator+' <span class="bx-pager-total">'+o.length+"<span>"}}}if(S.pagerSelector){a(S.pagerSelector).append(ae);h=a(S.pagerSelector)}else{var ab=a('<div class="bx-pager"></div>');ab.append(ae);if(S.pagerLocation=="top"){W.prepend(ab)}else{if(S.pagerLocation=="bottom"){W.append(ab)}}h=a(".bx-pager",W)}h.children().click(function(){if(S.pagerType=="full"){var af=h.children().index(this);if(S.moveSlideQty>1){af*=S.moveSlideQty}M.goToSlide(af)}return false})}function u(){var aa=a("img",o.eq(Q)).attr("title");if(aa!=""){if(S.captionsSelector){a(S.captionsSelector).html(aa)}else{a(".bx-captions",W).html(aa)}}else{if(S.captionsSelector){a(S.captionsSelector).html(" ")}else{a(".bx-captions",W).html(" ")}}}function B(ab,ac,aa,ad){Z=a('<a href="" class="bx-start"></a>');if(ab=="text"){s=ac}else{s='<img src="'+ac+'" />'}if(aa=="text"){y=ad}else{y='<img src="'+ad+'" />'}if(S.autoControlsSelector){a(S.autoControlsSelector).append(Z)}else{W.append('<div class="bx-auto"></div>');a(".bx-auto",W).html(Z)}Z.click(function(){if(S.ticker){if(a(this).hasClass("stop")){M.stopTicker()}else{if(a(this).hasClass("start")){M.startTicker()}}}else{if(a(this).hasClass("stop")){M.stopShow(true)}else{if(a(this).hasClass("start")){M.startShow(true)}}}return false})}function C(){if(!S.infiniteLoop&&S.hideControlOnEnd){if(Q==p){a(".prev",W).hide()}else{a(".prev",W).show()}if(Q==U){a(".next",W).hide()}else{a(".next",W).show()}}}function c(ac,ab){if(ab=="left"){var aa=a(".pager",W).eq(ac).position().left}else{if(ab=="top"){var aa=a(".pager",W).eq(ac).position().top}}return aa}function E(){var aa=d.outerWidth()*S.displaySlideQty;return aa}function v(){var aa=d.outerHeight()*S.displaySlideQty;return aa}function n(ag,af,ad,ae){var ac=[];var ab=ad;var aa=true;if(ae=="backward"){ag=a.makeArray(ag);ag.reverse()}while(ab>0){a.each(ag,function(ah,ai){if(ab>0){if(!aa){if(ah==af){aa=true;ac.push(a(this).clone());ab--}}else{ac.push(a(this).clone());ab--}}else{return false}})}return ac}this.each(function(){M.initShow()});return this}})(jQuery);
