/*
    AnythingSlider v1.7.8
    Original by Chris Coyier: http://css-tricks.com
    Get the latest version: https://github.com/ProLoser/AnythingSlider

    To use the navigationFormatter function, you must have a function that
    accepts two paramaters, and returns a string of HTML text.

    index = integer index (1 based);
    panel = jQuery wrapped LI item this tab references
    @return = Must return a string of HTML/Text

    navigationFormatter: function(index, panel){
        return "Panel #" + index; // This would have each tab with the text 'Panel #X' where X = index
    }
*/

(function(d){d.anythingSlider=function(h,l){var a=this,b;a.el=h;a.$el=d(h).addClass("anythingBase").wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');a.$el.data("AnythingSlider",a);a.init=function(){a.options=b=d.extend({},d.anythingSlider.defaults,l);a.initialized=!1;d.isFunction(b.onBeforeInitialize)&&a.$el.bind("before_initialize",b.onBeforeInitialize);a.$el.trigger("before_initialize",a);a.$wrapper=a.$el.parent().closest("div.anythingSlider").addClass("anythingSlider-"+
b.theme);a.$window=a.$el.closest("div.anythingWindow");a.win=window;a.$win=d(a.win);a.$controls=d('<div class="anythingControls"></div>').appendTo(null!==b.appendControlsTo&&d(b.appendControlsTo).length?d(b.appendControlsTo):a.$wrapper);a.$startStop=d('<a href="#" class="start-stop"></a>');b.buildStartStop&&a.$startStop.appendTo(null!==b.appendStartStopTo&&d(b.appendStartStopTo).length?d(b.appendStartStopTo):a.$controls);a.$nav=d('<ul class="thumbNav" />').appendTo(null!==b.appendNavigationTo&&d(b.appendNavigationTo).length?
d(b.appendNavigationTo):a.$controls);a.flag=!1;a.playing=b.autoPlay;a.slideshow=!1;a.hovered=!1;a.panelSize=[];a.currentPage=b.startPanel=parseInt(b.startPanel,10)||1;b.changeBy=parseInt(b.changeBy,10)||1;a.adj=b.infiniteSlides?0:1;a.width=a.$el.width();a.height=a.$el.height();a.outerPad=[a.$wrapper.innerWidth()-a.$wrapper.width(),a.$wrapper.innerHeight()-a.$wrapper.height()];b.playRtl&&a.$wrapper.addClass("rtl");b.expand&&(a.$outer=a.$wrapper.parent(),a.$window.css({width:"100%",height:"100%"}),
a.checkResize());b.buildStartStop&&a.buildAutoPlay();b.buildArrows&&a.buildNextBackButtons();b.autoPlay||(b.autoPlayLocked=!1);a.updateSlider();a.$lastPage=a.$currentPage;a.runTimes=d("div.anythingSlider").index(a.$wrapper)+1;a.regex=RegExp("panel"+a.runTimes+"-(\\d+)","i");1===a.runTimes&&a.makeActive();d.isFunction(d.easing[b.easing])||(b.easing="swing");b.pauseOnHover&&a.$wrapper.hover(function(){a.playing&&(a.$el.trigger("slideshow_paused",a),a.clearTimer(!0))},function(){a.playing&&(a.$el.trigger("slideshow_unpaused",
a),a.startStop(a.playing,!0))});a.setCurrentPage(a.gotoHash()||b.startPage,!1);a.slideControls(!1);a.$wrapper.bind("mouseenter mouseleave",function(b){a.hovered="mouseenter"===b.type?!0:!1;a.slideControls(a.hovered,!1)});d(document).keyup(function(c){if(b.enableKeyboard&&a.$wrapper.is(".activeSlider")&&!c.target.tagName.match("TEXTAREA|INPUT|SELECT"))switch(c.which){case 39:a.goForward();break;case 37:a.goBack()}});a.$items.delegate("a","focus.AnythingSlider",function(c){var e=d(this).closest(".panel"),
f=a.$items.index(e)+a.adj;a.$items.find(".focusedLink").removeClass("focusedLink");d(this).addClass("focusedLink");a.$window.scrollLeft(0);!e.is(".activePage")&&a.currentPage+b.showMultiple-1>f&&(a.gotoPage(f),c.preventDefault())});var c="slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" ");d.each("onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "),function(g,e){d.isFunction(b[e])&&
a.$el.bind(c[g],b[e])});d.isFunction(b.onSlideComplete)&&a.$el.bind("slide_complete",function(){setTimeout(function(){b.onSlideComplete(a)},0)});a.initialized=!0;a.$el.trigger("initialized",a);a.startStop(a.playing)};a.updateSlider=function(){a.$el.children(".cloned").remove();a.$nav.empty();a.currentPage=a.currentPage||1;a.$items=a.$el.children();a.pages=a.$items.length;b.showMultiple=parseInt(b.showMultiple,10)||1;1<b.showMultiple&&(b.showMultiple>a.pages&&(b.showMultiple=a.pages),a.adjustMultiple=
b.infiniteSlides&&1<a.pages?0:b.showMultiple-1,a.pages=a.$items.length-a.adjustMultiple);a.$controls.add(a.$nav).add(a.$startStop).add(a.$forward).add(a.$back)[1>=a.pages?"hide":"show"]();1<a.pages&&a.buildNavigation();b.infiniteSlides&&1<a.pages&&(a.$el.prepend(a.$items.filter(":last").clone().removeAttr("id").addClass("cloned")),1<b.showMultiple?a.$el.append(a.$items.filter(":lt("+b.showMultiple+")").clone().removeAttr("id").addClass("cloned").addClass("multiple")):a.$el.append(a.$items.filter(":first").clone().removeAttr("id").addClass("cloned")),
a.$el.find(".cloned").each(function(){d(this).find("a,input,textarea,select,button,area").attr("disabled","disabled");d(this).find("[id]").removeAttr("id")}));a.$items=a.$el.children().addClass("panel");a.setDimensions();b.resizeContents?(a.$items.css("width",a.width),a.$wrapper.css("width",a.getDim(a.currentPage)[0]),a.$wrapper.add(a.$items).css("height",a.height)):a.$win.load(function(){a.setDimensions()});a.currentPage>a.pages&&(a.currentPage=a.pages);a.setCurrentPage(a.currentPage,!1);a.$nav.find("a").eq(a.currentPage-
1).addClass("cur")};a.buildNavigation=function(){if(b.buildNavigation&&1<a.pages){var c,g;a.$items.filter(":not(.cloned)").each(function(e){var f=e+1;c=(1===f?"first":"")+(f===a.pages?"last":"");g=d('<a href="#"></a>').addClass("panel"+f).wrap('<li class="'+c+'" />');a.$nav.append(g.parent());d.isFunction(b.navigationFormatter)?(c=b.navigationFormatter(f,d(this)),g.html("<span>"+c+"</span>"),0>parseInt(g.find("span").css("text-indent"),10)&&g.addClass(b.tooltipClass).attr("title",c)):g.html("<span>"+
f+"</span>");g.bind(b.clickControls,function(c){!a.flag&&b.enableNavigation&&(a.flag=!0,setTimeout(function(){a.flag=!1},100),a.gotoPage(f),b.hashTags&&a.setHash(f));c.preventDefault()})});!1!==b.navigationSize&&parseInt(b.navigationSize,10)<a.pages&&(a.$controls.find(".anythingNavWindow").length||a.$nav.before('<ul><li class="prev"><a href="#"><span>'+b.backText+"</span></a></li></ul>").after('<ul><li class="next"><a href="#"><span>'+b.forwardText+"</span></a></li></ul>").wrap('<div class="anythingNavWindow"></div>'),
a.navWidths=a.$nav.find("li").map(function(){return d(this).innerWidth()}).get(),a.navLeft=1,a.$nav.width(a.navWidth(1,a.pages+1)+5),a.$controls.find(".anythingNavWindow").width(a.navWidth(1,b.navigationSize+1)).end().find(".prev,.next").bind(b.clickControls,function(c){a.flag||(a.flag=!0,setTimeout(function(){a.flag=!1},200),a.navWindow(a.navLeft+b.navigationSize*(d(this).is(".prev")?-1:1)));c.preventDefault()}))}};a.navWidth=function(c,b){for(var d=Math.min(c,b),f=Math.max(c,b),k=0;d<f;d++)k+=a.navWidths[d-
1]||0;return k};a.navWindow=function(c){var d=a.pages-b.navigationSize+1;c=1>=c?1:1<c&&c<d?c:d;c!==a.navLeft&&(a.$controls.find(".anythingNavWindow").animate({scrollLeft:a.navWidth(1,c),width:a.navWidth(c,c+b.navigationSize)},{queue:!1,duration:b.animationTime}),a.navLeft=c)};a.buildNextBackButtons=function(){a.$forward=d('<span class="arrow forward"><a href="#"><span>'+b.forwardText+"</span></a></span>");a.$back=d('<span class="arrow back"><a href="#"><span>'+b.backText+"</span></a></span>");a.$back.bind(b.clickBackArrow,
function(c){b.enableArrows&&!a.flag&&(a.flag=!0,setTimeout(function(){a.flag=!1},100),a.goBack());c.preventDefault()});a.$forward.bind(b.clickForwardArrow,function(c){b.enableArrows&&!a.flag&&(a.flag=!0,setTimeout(function(){a.flag=!1},100),a.goForward());c.preventDefault()});a.$back.add(a.$forward).find("a").bind("focusin focusout",function(){d(this).toggleClass("hover")});a.$back.appendTo(null!==b.appendBackTo&&d(b.appendBackTo).length?d(b.appendBackTo):a.$wrapper);a.$forward.appendTo(null!==b.appendForwardTo&&
d(b.appendForwardTo).length?d(b.appendForwardTo):a.$wrapper);a.$arrowWidth=a.$forward.width()};a.buildAutoPlay=function(){a.$startStop.html("<span>"+(a.playing?b.stopText:b.startText)+"</span>").bind(b.clickSlideshow,function(c){b.enableStartStop&&(a.startStop(!a.playing),a.makeActive(),a.playing&&!b.autoPlayDelayed&&a.goForward(!0));c.preventDefault()}).bind("focusin focusout",function(){d(this).toggleClass("hover")})};a.checkResize=function(c){clearTimeout(a.resizeTimer);a.resizeTimer=setTimeout(function(){var d=
a.$outer.width()-a.outerPad[0],e=("BODY"===a.$outer[0].tagName?a.$win.height():a.$outer.height())-a.outerPad[1];if(a.width*b.showMultiple!==d||a.height!==e)a.setDimensions(),a.gotoPage(a.currentPage,a.playing,null,1);"undefined"===typeof c&&a.checkResize()},500)};a.setDimensions=function(){var c,g,e,f=0,k=1<b.showMultiple?a.width||a.$window.width()/b.showMultiple:a.$window.width(),h=a.$win.width();b.expand&&(c=a.$outer.width()-a.outerPad[0],a.height=g=a.$outer.height()-a.outerPad[1],a.$wrapper.add(a.$window).add(a.$items).css({width:c,
height:g}),a.width=k=1<b.showMultiple?c/b.showMultiple:c);a.$items.each(function(l){e=d(this).children();b.resizeContents?(c=a.width,d(this).css({width:c,height:a.height}),e.length&&"EMBED"===e[0].tagName&&e.attr({width:"100%",height:"100%"}),1===e.length&&e.css({width:"100%",height:"100%"})):(c=d(this).width(),1===e.length&&c>=h&&(c=e.width()>=h?k:e.width(),e.css("max-width",c)),d(this).css("width",c),g=d(this).outerHeight(),d(this).css("height",g));a.panelSize[l]=[c,g,f];f+=c});a.$el.css("width",
f)};a.getDim=function(c){if(1>a.pages||isNaN(c))return[a.width,a.height];c=b.infiniteSlides&&1<a.pages?c:c-1;var d,e=a.panelSize[c][0],f=a.panelSize[c][1];if(1<b.showMultiple)for(d=1;d<b.showMultiple;d++)e+=a.panelSize[(c+d)%b.showMultiple][0],f=Math.max(f,a.panelSize[c+d][1]);return[e,f]};a.goForward=function(c){a.gotoPage(a.currentPage+b.changeBy*(b.playRtl?-1:1),c)};a.goBack=function(c){a.gotoPage(a.currentPage+b.changeBy*(b.playRtl?1:-1),c)};a.gotoPage=function(c,d,e,f){!0!==d&&(d=!1,a.startStop(!1),
a.makeActive());1!==b.changeBy&&(0>c&&(c+=a.pages),c>a.pages&&(c-=a.pages));1>=a.pages||(a.$lastPage=a.$currentPage,"number"!==typeof c&&(c=b.startPanel,a.setCurrentPage(c)),d&&b.isVideoPlaying(a)||(c>a.pages+1-a.adj&&(c=b.infiniteSlides||b.stopAtEnd?a.pages:1),c<a.adj&&(c=b.infiniteSlides||b.stopAtEnd?1:a.pages),a.currentPage=c>a.pages?a.pages:1>c?1:a.currentPage,a.$currentPage=a.$items.eq(a.currentPage-a.adj),a.exactPage=c,a.$targetPage=a.$items.eq(0===c?a.pages-a.adj:c>a.pages?1-a.adj:c-a.adj),
f=f||b.animationTime,1<f&&a.$el.trigger("slide_init",a),a.slideControls(!0,!1),!0!==d&&(d=!1),(!d||b.stopAtEnd&&c===a.pages)&&a.startStop(!1),1<f&&a.$el.trigger("slide_begin",a),setTimeout(function(){if(!b.resizeContents){var d=a.getDim(c);a.$wrapper.filter(":not(:animated)").animate({width:d[0]||a.width,height:d[1]||a.height},{queue:!1,duration:f,easing:b.easing})}a.$el.filter(":not(:animated)").animate({left:-a.panelSize[b.infiniteSlides&&1<a.pages?c:c-1][2]},{queue:!1,duration:f,easing:b.easing,
complete:function(){a.endAnimation(c,e,f)}})},parseInt(b.delayBeforeAnimate,10)||0)))};a.endAnimation=function(c,d,e){0===c?(a.$el.css("left",-a.panelSize[a.pages][2]),c=a.pages):c>a.pages&&(a.$el.css("left",-a.panelSize[1][2]),c=1);a.exactPage=c;a.setCurrentPage(c,!1);a.$items.removeClass("activePage").eq(c-a.adj).addClass("activePage");a.hovered||a.slideControls(!1);1<e&&a.$el.trigger("slide_complete",a);"function"===typeof d&&d(a);b.autoPlayLocked&&!a.playing&&setTimeout(function(){a.startStop(!0)},
b.resumeDelay-(b.autoPlayDelayed?b.delay:0))};a.setCurrentPage=function(c,d){c=parseInt(c,10);if(!(1>a.pages||0===c||isNaN(c))){c>a.pages+1-a.adj&&(c=a.pages-a.adj);c<a.adj&&(c=1);b.buildNavigation&&a.$nav.find(".cur").removeClass("cur").end().find("a").eq(c-1).addClass("cur");!b.infiniteSlides&&b.stopAtEnd&&(a.$wrapper.find("span.forward")[c===a.pages?"addClass":"removeClass"]("disabled").end().find("span.back")[1===c?"addClass":"removeClass"]("disabled"),c===a.pages&&a.playing&&a.startStop());if(!d){var e=
a.getDim(c);a.$wrapper.css({width:e[0],height:e[1]}).add(a.$window).scrollLeft(0);a.$el.css("left",-a.panelSize[b.infiniteSlides&&1<a.pages?c:c-1][2])}a.currentPage=c;a.$currentPage=a.$items.removeClass("activePage").eq(c-a.adj).addClass("activePage")}};a.makeActive=function(){a.$wrapper.is(".activeSlider")||(d(".activeSlider").removeClass("activeSlider"),a.$wrapper.addClass("activeSlider"))};a.gotoHash=function(){var c=a.win.location.hash,g=c.indexOf("&"),e=c.match(a.regex);null!==e||/^#&/.test(c)?
null!==e&&(e=b.hashTags?parseInt(e[1],10):null):(c=c.substring(0,0<=g?g:c.length),e=d(c).closest(".anythingBase")[0]===a.el?d(c).closest(".panel").index():null);return e};a.setHash=function(c){var b="panel"+a.runTimes+"-",d=a.win.location.hash;"undefined"!==typeof d&&(a.win.location.hash=0<d.indexOf(b)?d.replace(a.regex,b+c):d+"&"+b+c)};a.slideControls=function(c){var d=c?"slideDown":"slideUp",e=c?0:b.animationTime,f=c?b.animationTime:0,h=c?1:0;c=c?0:1;b.toggleControls&&a.$controls.stop(!0,!0).delay(e)[d](b.animationTime/
2).delay(f);b.buildArrows&&b.toggleArrows&&(!a.hovered&&a.playing&&(c=1,h=0),a.$forward.stop(!0,!0).delay(e).animate({right:c*a.$arrowWidth,opacity:h},b.animationTime/2),a.$back.stop(!0,!0).delay(e).animate({left:c*a.$arrowWidth,opacity:h},b.animationTime/2))};a.clearTimer=function(b){a.timer&&(a.win.clearInterval(a.timer),!b&&a.slideshow&&(a.$el.trigger("slideshow_stop",a),a.slideshow=!1))};a.startStop=function(c,d){!0!==c&&(c=!1);(a.playing=c)&&!d&&(a.$el.trigger("slideshow_start",a),a.slideshow=
!0);b.buildStartStop&&(a.$startStop.toggleClass("playing",c).find("span").html(c?b.stopText:b.startText),0>parseInt(a.$startStop.find("span").css("text-indent"),10)&&a.$startStop.addClass(b.tooltipClass).attr("title",c?b.stopText:b.startText));c?(a.clearTimer(!0),a.timer=a.win.setInterval(function(){b.isVideoPlaying(a)?b.resumeOnVideoEnd||a.startStop():a.goForward(!0)},b.delay)):a.clearTimer()};a.init()};d.anythingSlider.defaults={theme:"default",expand:!1,resizeContents:!0,showMultiple:!1,easing:"swing",
buildArrows:!0,buildNavigation:!0,buildStartStop:!0,appendForwardTo:null,appendBackTo:null,appendControlsTo:null,appendNavigationTo:null,appendStartStopTo:null,toggleArrows:!1,toggleControls:!1,startText:"Start",stopText:"Stop",forwardText:"&raquo;",backText:"&laquo;",tooltipClass:"tooltip",enableArrows:!0,enableNavigation:!0,enableStartStop:!0,enableKeyboard:!0,startPanel:1,changeBy:1,hashTags:!0,infiniteSlides:!0,navigationFormatter:null,navigationSize:!1,autoPlay:!1,autoPlayLocked:!1,autoPlayDelayed:!1,
pauseOnHover:!0,stopAtEnd:!1,playRtl:!1,delay:3E3,resumeDelay:15E3,animationTime:600,delayBeforeAnimate:0,clickForwardArrow:"click",clickBackArrow:"click",clickControls:"click focusin",clickSlideshow:"click",resumeOnVideoEnd:!0,addWmodeToObject:"opaque",isVideoPlaying:function(d){return!1}};d.fn.anythingSlider=function(h,l){return this.each(function(){var a,b=d(this).data("AnythingSlider");(typeof h).match("object|undefined")?b?b.updateSlider():new d.anythingSlider(this,h):/\d/.test(h)&&!isNaN(h)&&
b&&(a="number"===typeof h?h:parseInt(d.trim(h),10),1<=a&&a<=b.pages&&b.gotoPage(a,!1,l))})}})(jQuery);