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