/*
 * jQuery UI 1.0 - New Wave User Interface
 *
 * Copyright (c) 2007 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * jquery-ui.js + ui.accordion.js
 */
(function(B){B.dimensions={version:"@VERSION"};B.each(["Height","Width"],function(D,C){B.fn["inner"+C]=function(){if(!this[0]){return }var F=C=="Height"?"Top":"Left",E=C=="Height"?"Bottom":"Right";return this[C.toLowerCase()]()+A(this,"padding"+F)+A(this,"padding"+E)};B.fn["outer"+C]=function(F){if(!this[0]){return }var G=C=="Height"?"Top":"Left",E=C=="Height"?"Bottom":"Right";F=B.extend({margin:false},F||{});return this[C.toLowerCase()]()+A(this,"border"+G+"Width")+A(this,"border"+E+"Width")+A(this,"padding"+G)+A(this,"padding"+E)+(F.margin?(A(this,"margin"+G)+A(this,"margin"+E)):0)}});B.each(["Left","Top"],function(D,C){B.fn["scroll"+C]=function(E){if(!this[0]){return }return E!=undefined?this.each(function(){this==window||this==document?window.scrollTo(C=="Left"?E:B(window)["scrollLeft"](),C=="Top"?E:B(window)["scrollTop"]()):this["scroll"+C]=E}):this[0]==window||this[0]==document?self[(C=="Left"?"pageXOffset":"pageYOffset")]||B.boxModel&&document.documentElement["scroll"+C]||document.body["scroll"+C]:this[0]["scroll"+C]}});B.fn.extend({position:function(){var H=0,G=0,F=this[0],I,C,E,D;if(F){E=this.offsetParent();I=this.offset();C=E.offset();I.top-=A(F,"marginTop");I.left-=A(F,"marginLeft");C.top+=A(E,"borderTopWidth");C.left+=A(E,"borderLeftWidth");D={top:I.top-C.top,left:I.left-C.left}}return D},offsetParent:function(){var C=this[0].offsetParent;while(C&&(!/^body|html$/i.test(C.tagName)&&B.css(C,"position")=="static")){C=C.offsetParent}return B(C)}});var A=function(C,D){return parseInt(B.css(C.jquery?C[0]:C,D))||0}})(jQuery);(function(A){A.ui=A.ui||{};A.ui.accordion={};A.extend(A.ui.accordion,{defaults:{selectedClass:"selected",alwaysOpen:true,animated:"slide",event:"click",header:"a"},animations:{slide:function(B,D){B=A.extend({easing:"swing",duration:300},B,D);if(!B.toHide.size()){B.toShow.animate({height:"show"},{duration:B.duration,easing:B.easing,complete:B.finished});return }var C=B.toHide.height(),E=B.toShow.height(),F=E/C;B.toShow.css({height:0,overflow:"hidden"}).show();B.toHide.filter(":hidden").each(B.finished).end().filter(":visible").animate({height:"hide"},{step:function(G){B.toShow.height(Math.ceil((C-(G))*F))},duration:B.duration,easing:B.easing,complete:B.finished})},bounceslide:function(B){this.slide(B,{easing:B.down?"bounceout":"swing",duration:B.down?1000:200})},easeslide:function(B){this.slide(B,{easing:"easeinout",duration:700})}}});A.fn.extend({nextUntil:function(C){var B=[];this.each(function(){for(var D=this.nextSibling;D;D=D.nextSibling){if(D.nodeType!=1){continue}if(A.filter(C,[D]).r.length){break}B.push(D)}});return this.pushStack(B)},accordion:function(F){if(!this.length){return this}F=A.extend({},A.ui.accordion.defaults,F);if(F.navigation){var I=this.find("a").filter(function(){return this.href==location.href});if(I.length){if(I.filter(F.header).length){F.active=I}else{F.active=I.parent().parent().prev();I.addClass("current")}}}var B=this,D=B.find(F.header),E=C(F.active),H=0;if(F.fillSpace){var L=this.parent().height();D.each(function(){L-=A(this).outerHeight()});var K=0;D.nextUntil(F.header).each(function(){K=Math.max(K,A(this).innerHeight()-A(this).height())}).height(L-K)}else{if(F.autoheight){var L=0;D.nextUntil(F.header).each(function(){L=Math.max(L,A(this).height())}).height(L)}}D.not(E||"").nextUntil(F.header).hide();E.parent().andSelf().addClass(F.selectedClass);function C(N){return N!=undefined?typeof N=="number"?D.filter(":eq("+N+")"):D.not(D.not(N)):N===false?A("<div>"):D.filter(":eq(0)")}function G(N,P,Q,O,S){var R=function(T){H=T?0:--H;if(H){return }B.trigger("change",Q)};H=P.size()==0?N.size():P.size();if(F.animated){if(!F.alwaysOpen&&O){N.slideToggle(F.animated);R(true)}else{A.ui.accordion.animations[F.animated]({toShow:N,toHide:P,finished:R,down:S})}}else{if(!F.alwaysOpen&&O){N.toggle()}else{P.hide();N.show()}R(true)}}function J(R){if(!R.target&&!F.alwaysOpen){E.toggleClass(F.selectedClass);var P=E.nextUntil(F.header);var N=E=A([]);G(N,P);return }var Q=A(R.target);if(Q.parents(F.header).length){while(!Q.is(F.header)){Q=Q.parent()}}var O=Q[0]==E[0];if(H||(F.alwaysOpen&&O)||!Q.is(F.header)){return }E.parent().andSelf().toggleClass(F.selectedClass);if(!O){Q.parent().andSelf().addClass(F.selectedClass)}var N=Q.nextUntil(F.header),P=E.nextUntil(F.header),S=[Q,E,N,P],T=D.index(E[0])>D.index(Q[0]);E=O?A([]):Q;G(N,P,S,O,T);return !N.length}function M(O,N){if(arguments.length==1){return }J({target:C(N)[0]})}return B.bind(F.event,J).bind("activate",M)},activate:function(B){return this.trigger("activate",[B])}})})(jQuery)