!function(t){t.fn.extend({easyResponsiveTabs:function(a){var e={type:"default",width:"auto",fit:!0,closed:!1,activate:function(){}},a=t.extend(e,a),s=a,i=s.type,r=s.fit,n=s.width,c="vertical",o="accordion";t(this).bind("tabactivate",function(t,e){"function"==typeof a.activate&&a.activate.call(e,t)}),this.each(function(){function e(){i==c&&s.addClass("resp-vtabs"),1==r&&s.css({width:"100%",margin:"0px"}),i==o&&(s.addClass("resp-easy-accordion"),s.find(".resp-tabs-list").css("display","none"))}var s=t(this),d=s.find("ul.resp-tabs-list");s.find("ul.resp-tabs-list li").addClass("resp-tab-item"),s.css({display:"block",width:n}),s.find(".resp-tabs-container > div").addClass("resp-tab-content"),e();var l;s.find(".resp-tab-content").before("<div class='resp-accordion' role='tab'><span class='resp-arrow'></span></div>");var p=0;s.find(".resp-accordion").each(function(){l=t(this);var a=s.find(".resp-tab-item:eq("+p+")").html();s.find(".resp-accordion:eq("+p+")").append(a),l.attr("aria-controls","tab_item-"+p),p++});var b,v=0;s.find(".resp-tab-item").each(function(){$tabItem=t(this),$tabItem.attr("aria-controls","tab_item-"+v),$tabItem.attr("role","tab"),a.closed===!0||"accordion"===a.closed&&!d.is(":visible")||"tabs"===a.closed&&d.is(":visible")||(s.find(".resp-tab-item").first().addClass("resp-tab-active"),s.find(".resp-accordion").first().addClass("resp-tab-active"),s.find(".resp-tab-content").first().addClass("resp-tab-content-active").attr("style","display:block"));var e=0;s.find(".resp-tab-content").each(function(){b=t(this),b.attr("aria-labelledby","tab_item-"+e),e++}),v++}),s.find("[role=tab]").each(function(){var a=t(this);a.click(function(){var e=a.attr("aria-controls");return a.hasClass("resp-accordion")&&a.hasClass("resp-tab-active")?(s.find(".resp-tab-content-active").slideUp("",function(){t(this).addClass("resp-accordion-closed")}),a.removeClass("resp-tab-active"),!1):(!a.hasClass("resp-tab-active")&&a.hasClass("resp-accordion")?(s.find(".resp-tab-active").removeClass("resp-tab-active"),s.find(".resp-tab-content-active").slideUp().removeClass("resp-tab-content-active resp-accordion-closed"),s.find("[aria-controls="+e+"]").addClass("resp-tab-active"),s.find(".resp-tab-content[aria-labelledby = "+e+"]").slideDown().addClass("resp-tab-content-active")):(s.find(".resp-tab-active").removeClass("resp-tab-active"),s.find(".resp-tab-content-active").removeAttr("style").removeClass("resp-tab-content-active").removeClass("resp-accordion-closed"),s.find("[aria-controls="+e+"]").addClass("resp-tab-active"),s.find(".resp-tab-content[aria-labelledby = "+e+"]").addClass("resp-tab-content-active").attr("style","display:block")),void a.trigger("tabactivate",a))}),t(window).resize(function(){s.find(".resp-accordion-closed").removeAttr("style")})})})}})}(jQuery);
