(function($){
$.ui=$.ui||{};
$.fn.extend({accordion:function(_2,_3){
var _4=Array.prototype.slice.call(arguments,1);
return this.each(function(){
if(typeof _2=="string"){
var _5=$.data(this,"ui-accordion");
_5[_2].apply(_5,_4);
}else{
if(!$(this).is(".ui-accordion")){
$.data(this,"ui-accordion",new $.ui.accordion(this,_2));
}
}
});
},activate:function(_6){
return this.accordion("activate",_6);
}});
$.ui.accordion=function(_7,_8){
this.options=_8=$.extend({},$.ui.accordion.defaults,_8);
this.element=_7;
$(_7).addClass("ui-accordion");
if(_8.navigation){
var _9=$(_7).find("a").filter(_8.navigationFilter);
if(_9.length){
if(_9.filter(_8.header).length){
_8.active=_9;
}else{
_8.active=_9.parent().parent().prev();
_9.addClass("current");
}
}
}
_8.headers=$(_7).find(_8.header);
_8.active=findActive(_8.headers,_8.active);
if(_8.fillSpace){
var _a=$(_7).parent().height();
_8.headers.each(function(){
_a-=$(this).outerHeight();
});
var _b=0;
_8.headers.next().each(function(){
_b=Math.max(_b,$(this).innerHeight()-$(this).height());
}).height(_a-_b);
}else{
if(_8.autoheight){
var _a=0;
_8.headers.next().each(function(){
_a=Math.max(_a,$(this).outerHeight());
}).height(_a);
}
}
_8.headers.not(_8.active||"").next().hide();
_8.active.parent().andSelf().addClass(_8.selectedClass);
if(_8.event){
$(_7).bind((_8.event)+".ui-accordion",clickHandler);
}
};
$.ui.accordion.prototype={activate:function(_c){
clickHandler.call(this.element,{target:findActive(this.options.headers,_c)[0]});
},enable:function(){
this.options.disabled=false;
},disable:function(){
this.options.disabled=true;
},destroy:function(){
this.options.headers.next().css("display","");
if(this.options.fillSpace||this.options.autoheight){
this.options.headers.next().css("height","");
}
$.removeData(this.element,"ui-accordion");
$(this.element).removeClass("ui-accordion").unbind(".ui-accordion");
}};
function scopeCallback(_d,_e){
return function(){
return _d.apply(_e,arguments);
};
}
function completed(_f){
if(!$.data(this,"ui-accordion")){
return;
}
var _10=$.data(this,"ui-accordion");
var _11=_10.options;
_11.running=_f?0:--_11.running;
if(_11.running){
return;
}
if(_11.clearStyle){
_11.toShow.add(_11.toHide).css({height:"",overflow:""});
}
$(this).triggerHandler("change.ui-accordion",[_11.data],_11.change);
}
function toggle(_12,_13,_14,_15,_16){
var _17=$.data(this,"ui-accordion").options;
_17.toShow=_12;
_17.toHide=_13;
_17.data=_14;
var _18=scopeCallback(completed,this);
_17.running=_13.size()==0?_12.size():_13.size();
if(_17.animated){
if(!_17.alwaysOpen&&_15){
$.ui.accordion.animations[_17.animated]({toShow:jQuery([]),toHide:_13,complete:_18,down:_16,autoheight:_17.autoheight});
}else{
$.ui.accordion.animations[_17.animated]({toShow:_12,toHide:_13,complete:_18,down:_16,autoheight:_17.autoheight});
}
}else{
if(!_17.alwaysOpen&&_15){
_12.toggle();
}else{
_13.hide();
_12.show();
}
_18(true);
}
}
function clickHandler(_19){
var _1a=$.data(this,"ui-accordion").options;
if(_1a.disabled){
return false;
}
if(!_19.target&&!_1a.alwaysOpen){
_1a.active.parent().andSelf().toggleClass(_1a.selectedClass);
var _1b=_1a.active.next(),_1c={instance:this,options:_1a,newHeader:jQuery([]),oldHeader:_1a.active,newContent:jQuery([]),oldContent:_1b},_1d=_1a.active=$([]);
toggle.call(this,_1d,_1b,_1c);
return false;
}
var _1e=$(_19.target);
if(_1e.parents(_1a.header).length){
while(!_1e.is(_1a.header)){
_1e=_1e.parent();
}
}
var _1f=_1e[0]==_1a.active[0];
if(_1a.running||(_1a.alwaysOpen&&_1f)){
return false;
}
if(!_1e.is(_1a.header)){
return;
}
_1a.active.parent().andSelf().toggleClass(_1a.selectedClass);
if(!_1f){
_1e.parent().andSelf().addClass(_1a.selectedClass);
}
var _1d=_1e.next(),_1b=_1a.active.next(),_1c={instance:this,options:_1a,newHeader:_1e,oldHeader:_1a.active,newContent:_1d,oldContent:_1b},_20=_1a.headers.index(_1a.active[0])>_1a.headers.index(_1e[0]);
_1a.active=_1f?$([]):_1e;
toggle.call(this,_1d,_1b,_1c,_1f,_20);
return false;
}
function findActive(_21,_22){
return _22!=undefined?typeof _22=="number"?_21.filter(":eq("+_22+")"):_21.not(_21.not(_22)):_22===false?$([]):_21.filter(":eq(0)");
}
$.extend($.ui.accordion,{defaults:{selectedClass:"selected",alwaysOpen:true,animated:"slide",event:"click",header:"a",autoheight:true,running:0,navigationFilter:function(){
return this.href.toLowerCase()==location.href.toLowerCase();
}},animations:{slide:function(_23,_24){
_23=$.extend({easing:"swing",duration:300},_23,_24);
if(!_23.toHide.size()){
_23.toShow.animate({height:"show"},_23);
return;
}
var _25=_23.toHide.height(),_26=_23.toShow.height(),_27=_26/_25;
_23.toShow.css({height:0,overflow:"hidden"}).show();
_23.toHide.filter(":hidden").each(_23.complete).end().filter(":visible").animate({height:"hide"},{step:function(now){
var _29=(_25-now)*_27;
if($.browser.msie||$.browser.opera){
_29=Math.ceil(_29);
}
_23.toShow.height(_29);
},duration:_23.duration,easing:_23.easing,complete:function(){
if(!_23.autoheight){
_23.toShow.css("height","auto");
}
_23.complete();
}});
},bounceslide:function(_2a){
this.slide(_2a,{easing:_2a.down?"bounceout":"swing",duration:_2a.down?1000:200});
},easeslide:function(_2b){
this.slide(_2b,{easing:"easeinout",duration:700});
}}});
})(jQuery);


