!function(t){t.fn.tab=function(a){var n=t.extend({},t.fn.tab.defaults,a),i=arguments;return this.each(function(){function e(){t(b).addClass("gts-tab"),t(m).addClass("gts-tab-title"),o(),r();var a=n.selected;a=a?a:0,d(a)}function o(){0==y.length&&(y=t("<div></div>").addClass("gts-tab-items"),t(b).append(y)),t(p).each(function(){var a=t(t(this).attr("href"),b);a.addClass("gts-tab-item").hide(),y.append(a)})}function r(){t(p).bind("click",function(){return p.index(this)==b.data("curTabIdx")?!1:(d(p.index(this)),n.autoPlay&&l(),!1)}),n.keyNavigation&&t(document).keyup(function(t){39==t.which?(g(),n.autoPlay&&l()):37==t.which&&(v(),n.autoPlay&&l())}),n.autoPlay&&(n.stopOnFocus&&(t(b).bind("mouseover",function(){return f(),!0}),t(b).bind("mouseleave",function(){return c(),!0})),c())}function d(t){return b.data("isAnimating")?!1:(u(t),void 0)}function u(a){if(b.data("isAnimating"))return!1;var i=p.eq(b.data("curTabIdx")),e=p.eq(a);if(b.data("isAnimating",!0),n.direction=n.direction.toLowerCase(),t.isFunction(n.onLeaveTab)&&!n.onLeaveTab.call(this,t(i)))return!1;if("horizontal"==n.direction){var o,r,d,u,s=y.width();a>b.data("curTabIdx")?(o=0,r=-1*(s+10),d=s+10,u=0):(o=0,r=s+10,d=-1*(s+10),u=0),i.length>0&&t(i.attr("href"),b).css("left",o).animate({left:r},n.duration,n.animation,function(){t(this).hide()}),t(e.attr("href"),b).css("left",d).width(s).show().animate({left:u},n.duration,n.animation,function(){t(this).show(),h(a,i,e)})}else if("vertical"==n.direction){var c,l,f,g,v=(y.height(),t(i.attr("href"),b)),m=t(e.attr("href"),b);a>b.data("curTabIdx")?(c=0,l=-1*(v.height()+10),f=m.height()+10,g=0):(c=0,l=v.height()+10,f=-1*(m.height()+10),g=0),i.length>0&&v.css("top",c).animate({top:l},n.duration,n.animation,function(){v.hide()}),m.css("top",f).show().animate({top:g},n.duration,n.animation,function(){t(this).show(),h(a,i,e)})}else i.length>0&&t(i.attr("href"),b).hide(),t(e.attr("href"),b).show(),h(a,i,e);return!0}function s(a){n.autoHeight&&y.animate({height:t(a.attr("href")).height()},n.duration)}function h(a,i,e){return i.removeClass("active"),e.addClass("active"),b.data("curTabIdx",a),b.data("isAnimating",!1),s(e),t.isFunction(n.onShowTab)&&!n.onShowTab.call(this,t(e))?!1:!0}function c(){b.data("autoPlayId")||b.data("autoPlayId",setInterval(g,n.interval))}function l(){f(),c()}function f(){b.data("autoPlayId")&&(clearInterval(b.data("autoPlayId")),b.data("autoPlayId",null))}function g(){var t=b.data("curTabIdx")-0+1;p.length<=t&&(t=0),d(t)}function v(){var t=b.data("curTabIdx")-0-1;0>t&&(t=p.length-1),d(t)}var b=t(this),m=t("ul:first",b),p=t("li > a",m),y=t(".gts-tab-items",b);if(b.data("options")?n=b.data("options"):b.data("options",n),a&&"init"!==a&&"object"!=typeof a){if("showTab"===a){var w=Array.prototype.slice.call(i,1);return w[0]==b.data("curTabIdx")?!1:(d(w[0]),!0)}t.error("Method "+a+" does not exist")}else e()})},t.fn.tab.defaults={animation:"swing",selected:0,autoPlay:0,duration:500,interval:5e3,direction:"horizontal",keyNavigation:!1,stopOnFocus:!1,autoHeight:!0,onLeaveTab:null,onShowTab:null}}(jQuery);