/** * RightJS-UI Tabs v2.2.2 * http://rightjs.org/ui/tabs * * Copyright (C) 2009-2011 Nikolay Nemshilov */ var Tabs=RightJS.Tabs=function(a,b,c){function w(a,b,d){if(c.Cookie){var e=v();e=e.without.apply(e,b.map("id")),e.push(d.target.id),r.set("right-tabs-indexes",e.uniq().join(","),a)}}function v(){return f(c.Cookie?(r.get("right-tabs-indexes")||"").split(","):[])}function d(a,b){b||(b=a,a="DIV");var d=new c.Class(c.Element.Wrappers[a]||c.Element,{initialize:function(b,d){this.key=b;var e=[{"class":"rui-"+b}];this instanceof c.Input||this instanceof c.Form||e.unshift(a),this.$super.apply(this,e),c.isString(d)&&(d=c.$(d)),d instanceof c.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return c.Wrapper.Cache[c.$uid(this._)]=this},setOptions:function(a,b){b&&(a=c.Object.merge(a,(new Function("return "+(b.get("data-"+this.key)||"{}")))())),a&&c.Options.setOptions.call(this,c.Object.merge(this.options,a));return this}}),e=new c.Class(d,b);c.Observer.createShortcuts(e.prototype,e.EVENTS||[]);return e}var e=new c.Class(c.Element,{initialize:function(a){this.$super("div",{"class":"rui-spinner"}),this.dots=[];for(var b=0;b<(a||4);b++)this.dots.push(new c.Element("div"));this.dots[0].addClass("glowing"),this.insert(this.dots),c(this.shift).bind(this).periodical(300)},shift:function(){if(this.visible()){var a=this.dots.pop();this.dots.unshift(a),this.insert(a,"top")}}}),f=c,g=c.$,h=c.$$,i=c.$w,j=c.$E,k=c.Fx,l=c.Object,m=c.Browser,n=c.isArray,o=c.isNumber,p=c.Class,q=c.Element,r=c.Cookie,s=new d("UL",{extend:{version:"2.2.2",EVENTS:i("select hide load disable enable add remove move"),Options:{idPrefix:"",tabsElement:null,resizeFx:"both",resizeDuration:400,scrollTabs:!1,scrollDuration:400,selected:null,disabled:null,closable:!1,loop:!1,loopPause:!0,url:!1,cache:!1,Xhr:null,Cookie:null},rescan:function(b){g(b||a).find(".rui-tabs,*[data-tabs]").each(function(a){a=a instanceof s?a:new s(a)})}},initialize:function(a,b){this.$super("tabs",a).setOptions(b).addClass("rui-tabs"),this.isHarmonica=this._.tagName==="DL",this.isCarousel=this.hasClass("rui-tabs-carousel"),this.isSimple=!this.isHarmonica&&!this.isCarousel,this.findTabs().initScrolls().findCurrent().setStyle("visibility:visible"),this.options.disabled&&this.disable(this.options.disabled),this.options.loop&&this.startLoop()},select:function(a){return this.callTab(a,"select")},disable:function(a){return this.callTab(a,"disable")},enable:function(a){return this.callTab(a,"enable")},current:function(){return this.tabs.first("current")},enabled:function(){return this.tabs.filter("enabled")},callTab:function(a,b){f(n(a)?a:[a]).each(function(a){o(a)&&(a=this.tabs[a]),a&&a instanceof t&&a[b]()},this);return this},findTabs:function(){this.tabsList=this.isHarmonica?this:g(this.options.tabsElement)||this.first(".rui-tabs-list")||(this.first("UL")||j("UL").insertTo(this)).addClass("rui-tabs-list"),this.tabs=f([]),this.tabsList.children(this.isHarmonica?"dt":null).map(function(a){this.tabs.push(new t(a,this))},this);for(var a=0,b=this.tabsList.get("childNodes");a=g&&f-c&&g<=a.width()-c&&(f=a.width()-c)}this.scrollTo(f)}},justScroll:function(a){if(!this.scroller)return this;var c=b(this.tabsList.getStyle("left")||0,10),d=this.scroller.size().x;this.scrollTo(c+d*a)},scrollTo:function(a){var b=this.scroller.size().x,c=this.tabs.map("width").sum();a0&&(a=0),this.tabsList.morph({left:a+"px"},{duration:this.options.scrollDuration}),this.checkScrollButtons(c,b,a)},checkScrollButtons:function(a,b,c){var d=!1,e=!1;if(this.isCarousel){var f=this.enabled(),g=f.first("current");if(g){var h=f.indexOf(g);d=h>0,e=hb-a;this.prevButton[d?"removeClass":"addClass"]("rui-tabs-scroller-disabled"),this.nextButton[e?"removeClass":"addClass"]("rui-tabs-scroller-disabled")}}),s.include({findCurrent:function(){var a=this.enabled(),b=this.tabs[this.options.selected]||this.tabs[this.urlIndex()]||this.tabs[this.cookieIndex()]||a.first("current")||a[0];b&&b.select(),this.options.Cookie&&this.onSelect(f(w).curry(this.options.Cookie,this.tabs));return this},urlIndex:function(){var b=-1,c=a.location.href.split("#")[1];if(c)for(var d=0;d