/* mTab: Responsive Tabbing/Accordion Plugin - Maulin Pandya - MIT License */
!function(a){a.fn.mTab=function(s){var e=a.extend({navigation:".tabNav",container:".tabContainer",activeTab:1,activeClass:"active",scrollOffset:!0,accordScreen:768,animation:false,toggleClose:!1,openWithUrl:!1,callbackonclick:function(){},callback:function(){}},s);return this.each(function(){var s=a(this),t=s.find(e.navigation),l=t.children(),i=t.children().find("a"),n=s.find(e.container),d=n.children(),c=t.children(":nth-of-type("+e.activeTab+")"),o=c.children("a").attr("href"),r="transitionend webkitTransitionEnd oTransitionEnd otransitionend";s.addClass("mResTabAccord"),t.addClass("mResTabNav"),t.children().addClass("mResTabNavTab"),d.addClass("mTabContent defaultState"),t.children().find("a").addClass("mResTabAnchor"),e.animation?(s.addClass("mTabAnimated"),d.wrapInner('<div class="animBlock"></div>')):s.addClass("mTabSimple");var C,v,m=i.length;for(C=0;m>C;++C)v=a(i[C]).parent(),a(v.html()).insertBefore(d[C]);var f=n.children("a");f.addClass("mResTabAccordA"),i.addClass("mResTabAccordA"),f.removeClass("mResTabAnchor").addClass("mResAccordAnchor"),f.wrapInner("<span></span>"),c.addClass(e.activeClass),a(o).removeClass("defaultState").addClass("mTabActive");var h=n.children("a:nth-of-type("+e.activeTab+")");if(h.addClass(e.activeClass),e.openWithUrl){var b=window.location.hash,T=b.split("#"),A=T[1],u="#"+A;a(u).length&&window.setTimeout(function(){i.parent().removeClass(e.activeClass),f.removeClass(e.activeClass),d.removeClass("mTabActive").addClass("defaultState"),t.find('a[href="'+u+'"]').addClass(e.activeClass),a(u).prev(".mResAccordAnchor").addClass(e.activeClass),n.find(u).removeClass("defaultState").addClass("mTabActive"),e.callbackonclick.call()},1e3)}i.on("click touchstart",function(s){s.preventDefault();var t=a(this),l=t.parent().index(),c=a(this).attr("href");a(c).hasClass("mTabActive")||(i.parent().removeClass(e.activeClass),t.parent().addClass(e.activeClass),f.removeClass(e.activeClass),f.eq(l).addClass(e.activeClass),d.removeClass("mTabActive").addClass("defaultState"),e.animation&&(d.removeClass("hideAfterAnim animationEnd"),n.find(c).one(r,function(){d.not(c).addClass("hideAfterAnim")})),n.find(c).removeClass("defaultState").addClass("mTabActive"),e.callbackonclick.call())}),f.on("click touchstart",function(s){s.preventDefault();var t=a(this),i=f.index(this),c=a(this).attr("href");a(c).hasClass("mTabActive")?1==e.toggleClose&&(l.removeClass(e.activeClass),f.removeClass(e.activeClass),d.removeClass("mTabActive").addClass("defaultState"),e.scrollOffset&&a("html,body").animate({scrollTop:t.offset().top},700)):(l.removeClass(e.activeClass),f.removeClass(e.activeClass),t.addClass(e.activeClass),l.eq(i).addClass(e.activeClass),d.removeClass("mTabActive").addClass("defaultState"),n.find(c).removeClass("defaultState").addClass("mTabActive"),e.scrollOffset&&a("html,body").animate({scrollTop:t.offset().top},700)),e.callbackonclick.call()}),a(window).on("resize",function(){ww=document.body.clientWidth,ww>e.accordScreen?(s.removeClass("mResAccordion").addClass("mResTabbing"),d.hasClass("mTabActive")||(c.addClass(e.activeClass),a(o).removeClass("defaultState").addClass("mTabActive"),h.addClass(e.activeClass))):s.removeClass("mResTabbing").addClass("mResAccordion")}).trigger("resize"),e.callback.call()})}}(jQuery);