/*
* jQuery UI Tabs 1.8rc3
*
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Tabs
*
* Depends:
* jquery.ui.core.js
* jquery.ui.widget.js
*/
(function(b){var a=0;b.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:'#{label}'},_create:function(){this._tabify(true)},_setOption:function(c,d){if(c=="selected"){if(this.options.collapsible&&d==this.options.selected){return}this.select(d)}else{this.options[c]=d;this._tabify()}},_tabId:function(c){return c.title&&c.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+(++a)},_sanitizeSelector:function(c){return c.replace(/:/g,"\\:")},_cookie:function(){var c=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+b.data(this.list[0]));return b.cookie.apply(null,[c].concat(b.makeArray(arguments)))},_ui:function(d,c){return{tab:d,panel:c,index:this.anchors.index(d)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var c=b(this);c.html(c.data("label.tabs")).removeData("label.tabs")})},_tabify:function(p){this.list=this.element.find("ol,ul").eq(0);this.lis=b("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return b("a",this)[0]});this.panels=b([]);var q=this,e=this.options;var d=/^#.+/;this.anchors.each(function(s,o){var r=b(o).attr("href");var u=r.split("#")[0],v;if(u&&(u===location.toString().split("#")[0]||(v=b("base")[0])&&u===v.href)){r=o.hash;o.href=r}if(d.test(r)){q.panels=q.panels.add(q._sanitizeSelector(r))}else{if(r!="#"){b.data(o,"href.tabs",r);b.data(o,"load.tabs",r.replace(/#.*$/,""));var x=q._tabId(o);o.href="#"+x;var w=b("#"+x);if(!w.length){w=b(e.panelTemplate).attr("id",x).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(q.panels[s-1]||q.list);w.data("destroy.tabs",true)}q.panels=q.panels.add(w)}else{e.disabled.push(s)}}});if(p){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(e.selected===undefined){if(location.hash){this.anchors.each(function(r,o){if(o.hash==location.hash){e.selected=r;return false}})}if(typeof e.selected!="number"&&e.cookie){e.selected=parseInt(q._cookie(),10)}if(typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length){e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}e.selected=e.selected||(this.lis.length?0:-1)}else{if(e.selected===null){e.selected=-1}}e.selected=((e.selected>=0&&this.anchors[e.selected])||e.selected<0)?e.selected:0;e.disabled=b.unique(e.disabled.concat(b.map(this.lis.filter(".ui-state-disabled"),function(r,o){return q.lis.index(r)}))).sort();if(b.inArray(e.selected,e.disabled)!=-1){e.disabled.splice(b.inArray(e.selected,e.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(e.selected>=0&&this.anchors.length){this.panels.eq(e.selected).removeClass("ui-tabs-hide");this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active");q.element.queue("tabs",function(){q._trigger("show",null,q._ui(q.anchors[e.selected],q.panels[e.selected]))});this.load(e.selected)}b(window).bind("unload",function(){q.lis.add(q.anchors).unbind(".tabs");q.lis=q.anchors=q.panels=null})}else{e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(e.cookie){this._cookie(e.selected,e.cookie)}for(var h=0,n;(n=this.lis[h]);h++){b(n)[b.inArray(h,e.disabled)!=-1&&!b(n).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(e.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(e.event!="mouseover"){var g=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.addClass("ui-state-"+o)}};var k=function(o,i){i.removeClass("ui-state-"+o)};this.lis.bind("mouseover.tabs",function(){g("hover",b(this))});this.lis.bind("mouseout.tabs",function(){k("hover",b(this))});this.anchors.bind("focus.tabs",function(){g("focus",b(this).closest("li"))});this.anchors.bind("blur.tabs",function(){k("focus",b(this).closest("li"))})}var c,j;if(e.fx){if(b.isArray(e.fx)){c=e.fx[0];j=e.fx[1]}else{c=j=e.fx}}function f(i,o){i.css({display:""});if(!b.support.opacity&&o.opacity){i[0].style.removeAttribute("filter")}}var l=j?function(i,o){b(i).closest("li").addClass("ui-tabs-selected ui-state-active");o.hide().removeClass("ui-tabs-hide").animate(j,j.duration||"normal",function(){f(o,j);q._trigger("show",null,q._ui(i,o[0]))})}:function(i,o){b(i).closest("li").addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");q._trigger("show",null,q._ui(i,o[0]))};var m=c?function(o,i){i.animate(c,c.duration||"normal",function(){q.lis.removeClass("ui-tabs-selected ui-state-active");i.addClass("ui-tabs-hide");f(i,c);q.element.dequeue("tabs")})}:function(o,i,r){q.lis.removeClass("ui-tabs-selected ui-state-active");i.addClass("ui-tabs-hide");q.element.dequeue("tabs")};this.anchors.bind(e.event+".tabs",function(){var o=this,s=b(this).closest("li"),i=q.panels.filter(":not(.ui-tabs-hide)"),r=b(q._sanitizeSelector(this.hash));if((s.hasClass("ui-tabs-selected")&&!e.collapsible)||s.hasClass("ui-state-disabled")||s.hasClass("ui-state-processing")||q._trigger("select",null,q._ui(this,r[0]))===false){this.blur();return false}e.selected=q.anchors.index(this);q.abort();if(e.collapsible){if(s.hasClass("ui-tabs-selected")){e.selected=-1;if(e.cookie){q._cookie(e.selected,e.cookie)}q.element.queue("tabs",function(){m(o,i)}).dequeue("tabs");this.blur();return false}else{if(!i.length){if(e.cookie){q._cookie(e.selected,e.cookie)}q.element.queue("tabs",function(){l(o,r)});q.load(q.anchors.index(this));this.blur();return false}}}if(e.cookie){q._cookie(e.selected,e.cookie)}if(r.length){if(i.length){q.element.queue("tabs",function(){m(o,i)})}q.element.queue("tabs",function(){l(o,r)});q.load(q.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(b.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var c=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var d=b.data(this,"href.tabs");if(d){this.href=d}var e=b(this).unbind(".tabs");b.each(["href","load","cache"],function(f,g){e.removeData(g+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if(b.data(this,"destroy.tabs")){b(this).remove()}else{b(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(c.cookie){this._cookie(null,c.cookie)}return this},add:function(f,e,d){if(d===undefined){d=this.anchors.length}var c=this,h=this.options,j=b(h.tabTemplate.replace(/#\{href\}/g,f).replace(/#\{label\}/g,e)),i=!f.indexOf("#")?f.replace("#",""):this._tabId(b("a",j)[0]);j.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var g=b("#"+i);if(!g.length){g=b(h.panelTemplate).attr("id",i).data("destroy.tabs",true)}g.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(d>=this.lis.length){j.appendTo(this.list);g.appendTo(this.list[0].parentNode)}else{j.insertBefore(this.lis[d]);g.insertBefore(this.panels[d])}h.disabled=b.map(h.disabled,function(l,k){return l>=d?++l:l});this._tabify();if(this.anchors.length==1){h.selected=0;j.addClass("ui-tabs-selected ui-state-active");g.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[d],this.panels[d]));return this},remove:function(c){var e=this.options,f=this.lis.eq(c).remove(),d=this.panels.eq(c).remove();if(f.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(c+(c+1=c?--h:h});this._tabify();this._trigger("remove",null,this._ui(f.find("a")[0],d[0]));return this},enable:function(c){var d=this.options;if(b.inArray(c,d.disabled)==-1){return}this.lis.eq(c).removeClass("ui-state-disabled");d.disabled=b.grep(d.disabled,function(f,e){return f!=c});this._trigger("enable",null,this._ui(this.anchors[c],this.panels[c]));return this},disable:function(d){var c=this,e=this.options;if(d!=e.selected){this.lis.eq(d).addClass("ui-state-disabled");e.disabled.push(d);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[d],this.panels[d]))}return this},select:function(c){if(typeof c=="string"){c=this.anchors.index(this.anchors.filter("[href$="+c+"]"))}else{if(c===null){c=-1}}if(c==-1&&this.options.collapsible){c=this.options.selected}this.anchors.eq(c).trigger(this.options.event+".tabs");return this},load:function(f){var d=this,h=this.options,c=this.anchors.eq(f)[0],e=b.data(c,"load.tabs");this.abort();if(!e||this.element.queue("tabs").length!==0&&b.data(c,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(f).addClass("ui-state-processing");if(h.spinner){var g=b("span",c);g.data("label.tabs",g.html()).html(h.spinner)}this.xhr=b.ajax(b.extend({},h.ajaxOptions,{url:e,success:function(j,i){b(d._sanitizeSelector(c.hash)).html(j);d._cleanup();if(h.cache){b.data(c,"cache.tabs",true)}d._trigger("load",null,d._ui(d.anchors[f],d.panels[f]));try{h.ajaxOptions.success(j,i)}catch(k){}},error:function(k,i,j){d._cleanup();d._trigger("load",null,d._ui(d.anchors[f],d.panels[f]));try{h.ajaxOptions.error(k,i,f,c)}catch(j){}}}));d.element.dequeue("tabs");return this},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},url:function(d,c){this.anchors.eq(d).removeData("cache.tabs").data("load.tabs",c);return this},length:function(){return this.anchors.length}});b.extend(b.ui.tabs,{version:"1.8rc3"});b.extend(b.ui.tabs.prototype,{rotation:null,rotate:function(e,g){var c=this,h=this.options;var d=c._rotate||(c._rotate=function(i){clearTimeout(c.rotation);c.rotation=setTimeout(function(){var j=h.selected;c.select(++j