ÿþ/ *  
   *   j Q u e r y   U I   A c c o r d i o n   1 . 7 . 1  
   *  
   *   C o p y r i g h t   ( c )   2 0 0 9   A U T H O R S . t x t   ( h t t p : / / j q u e r y u i . c o m / a b o u t )  
   *   D u a l   l i c e n s e d   u n d e r   t h e   M I T   ( M I T - L I C E N S E . t x t )  
   *   a n d   G P L   ( G P L - L I C E N S E . t x t )   l i c e n s e s .  
   *  
   *   h t t p : / / d o c s . j q u e r y . c o m / U I / A c c o r d i o n  
   *  
   *   D e p e n d s :  
   * 	 u i . c o r e . j s  
   * /  
 ( f u n c t i o n ( $ )   {  
  
 $ . w i d g e t ( " u i . a c c o r d i o n " ,   {  
  
 	 _ i n i t :   f u n c t i o n ( )   {  
  
 	 	 v a r   o   =   t h i s . o p t i o n s ,   s e l f   =   t h i s ;  
 	 	 t h i s . r u n n i n g   =   0 ;  
  
 	 	 / /   i f   t h e   u s e r   s e t   t h e   a l w a y s O p e n   o p t i o n   o n   i n i t  
 	 	 / /   t h e n   w e   n e e d   t o   s e t   t h e   c o l l a p s i b l e   o p t i o n  
 	 	 / /   i f   t h e y   s e t   b o t h   o n   i n i t ,   c o l l a p s i b l e   w i l l   t a k e   p r i o r i t y  
 	 	 i f   ( o . c o l l a p s i b l e   = =   $ . u i . a c c o r d i o n . d e f a u l t s . c o l l a p s i b l e   & &  
 	 	 	 o . a l w a y s O p e n   ! =   $ . u i . a c c o r d i o n . d e f a u l t s . a l w a y s O p e n )   {  
 	 	 	 o . c o l l a p s i b l e   =   ! o . a l w a y s O p e n ;  
 	 	 }  
  
 	 	 i f   (   o . n a v i g a t i o n   )   {  
 	 	 	 v a r   c u r r e n t   =   t h i s . e l e m e n t . f i n d ( " a " ) . f i l t e r ( o . n a v i g a t i o n F i l t e r ) ;  
 	 	 	 i f   (   c u r r e n t . l e n g t h   )   {  
 	 	 	 	 i f   (   c u r r e n t . f i l t e r ( o . h e a d e r ) . l e n g t h   )   {  
 	 	 	 	 	 t h i s . a c t i v e   =   c u r r e n t ;  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 t h i s . a c t i v e   =   c u r r e n t . p a r e n t ( ) . p a r e n t ( ) . p r e v ( ) ;  
 	 	 	 	 	 c u r r e n t . a d d C l a s s ( " u i - a c c o r d i o n - c o n t e n t - a c t i v e " ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 t h i s . e l e m e n t . a d d C l a s s ( " u i - a c c o r d i o n   u i - w i d g e t   u i - h e l p e r - r e s e t " ) ;  
 	 	  
 	 	 / /   i n   l a c k   o f   c h i l d - s e l e c t o r s   i n   C S S   w e   n e e d   t o   m a r k   t o p - L I s   i n   a   U L - a c c o r d i o n   f o r   s o m e   I E - f i x  
 	 	 i f   ( t h i s . e l e m e n t [ 0 ] . n o d e N a m e   = =   " U L " )   {  
 	 	 	 t h i s . e l e m e n t . c h i l d r e n ( " l i " ) . a d d C l a s s ( " u i - a c c o r d i o n - l i - f i x " ) ;  
 	 	 }  
  
 	 	 t h i s . h e a d e r s   =   t h i s . e l e m e n t . f i n d ( o . h e a d e r ) . a d d C l a s s ( " u i - a c c o r d i o n - h e a d e r   u i - h e l p e r - r e s e t   u i - s t a t e - d e f a u l t   u i - c o r n e r - a l l " )  
 	 	 	 . b i n d ( " m o u s e e n t e r . a c c o r d i o n " ,   f u n c t i o n ( ) {   $ ( t h i s ) . a d d C l a s s ( ' u i - s t a t e - h o v e r ' ) ;   } )  
 	 	 	 . b i n d ( " m o u s e l e a v e . a c c o r d i o n " ,   f u n c t i o n ( ) {   $ ( t h i s ) . r e m o v e C l a s s ( ' u i - s t a t e - h o v e r ' ) ;   } )  
 	 	 	 . b i n d ( " f o c u s . a c c o r d i o n " ,   f u n c t i o n ( ) {   $ ( t h i s ) . a d d C l a s s ( ' u i - s t a t e - f o c u s ' ) ;   } )  
 	 	 	 . b i n d ( " b l u r . a c c o r d i o n " ,   f u n c t i o n ( ) {   $ ( t h i s ) . r e m o v e C l a s s ( ' u i - s t a t e - f o c u s ' ) ;   } ) ;  
  
 	 	 t h i s . h e a d e r s  
 	 	 	 . n e x t ( )  
 	 	 	 	 . a d d C l a s s ( " u i - a c c o r d i o n - c o n t e n t   u i - h e l p e r - r e s e t   u i - w i d g e t - c o n t e n t   u i - c o r n e r - b o t t o m " ) ;  
  
 	 	 t h i s . a c t i v e   =   t h i s . _ f i n d A c t i v e ( t h i s . a c t i v e   | |   o . a c t i v e ) . t o g g l e C l a s s ( " u i - s t a t e - d e f a u l t " ) . t o g g l e C l a s s ( " u i - s t a t e - a c t i v e " ) . t o g g l e C l a s s ( " u i - c o r n e r - a l l " ) . t o g g l e C l a s s ( " u i - c o r n e r - t o p " ) ;  
 	 	 t h i s . a c t i v e . n e x t ( ) . a d d C l a s s ( ' u i - a c c o r d i o n - c o n t e n t - a c t i v e ' ) ;  
  
 	 	 / / A p p e n d   i c o n   e l e m e n t s  
 	 	 $ ( " < s p a n / > " ) . a d d C l a s s ( " u i - i c o n   "   +   o . i c o n s . h e a d e r ) . p r e p e n d T o ( t h i s . h e a d e r s ) ;  
 	 	 t h i s . a c t i v e . f i n d ( " . u i - i c o n " ) . t o g g l e C l a s s ( o . i c o n s . h e a d e r ) . t o g g l e C l a s s ( o . i c o n s . h e a d e r S e l e c t e d ) ;  
  
 	 	 / /   I E 7 - / W i n   -   E x t r a   v e r t i c a l   s p a c e   i n   l i s t s   f i x e d  
 	 	 i f   ( $ . b r o w s e r . m s i e )   {  
 	 	 	 t h i s . e l e m e n t . f i n d ( ' a ' ) . c s s ( ' z o o m ' ,   ' 1 ' ) ;  
 	 	 }  
  
 	 	 t h i s . r e s i z e ( ) ;  
  
 	 	 / / A R I A  
 	 	 t h i s . e l e m e n t . a t t r ( ' r o l e ' , ' t a b l i s t ' ) ;  
  
 	 	 t h i s . h e a d e r s  
 	 	 	 . a t t r ( ' r o l e ' , ' t a b ' )  
 	 	 	 . b i n d ( ' k e y d o w n ' ,   f u n c t i o n ( e v e n t )   {   r e t u r n   s e l f . _ k e y d o w n ( e v e n t ) ;   } )  
 	 	 	 . n e x t ( )  
 	 	 	 . a t t r ( ' r o l e ' , ' t a b p a n e l ' ) ;  
  
 	 	 t h i s . h e a d e r s  
 	 	 	 . n o t ( t h i s . a c t i v e   | |   " " )  
 	 	 	 . a t t r ( ' a r i a - e x p a n d e d ' , ' f a l s e ' )  
 	 	 	 . a t t r ( " t a b I n d e x " ,   " - 1 " )  
 	 	 	 . n e x t ( )  
 	 	 	 . h i d e ( ) ;  
  
 	 	 / /   m a k e   s u r e   a t   l e a s t   o n e   h e a d e r   i s   i n   t h e   t a b   o r d e r  
 	 	 i f   ( ! t h i s . a c t i v e . l e n g t h )   {  
 	 	 	 t h i s . h e a d e r s . e q ( 0 ) . a t t r ( ' t a b I n d e x ' , ' 0 ' ) ;  
 	 	 }   e l s e   {  
 	 	 	 t h i s . a c t i v e  
 	 	 	 	 . a t t r ( ' a r i a - e x p a n d e d ' , ' t r u e ' )  
 	 	 	 	 . a t t r ( ' t a b I n d e x ' ,   ' 0 ' ) ;  
 	 	 }  
  
 	 	 / /   o n l y   n e e d   l i n k s   i n   t a b o r d e r   f o r   S a f a r i  
 	 	 i f   ( ! $ . b r o w s e r . s a f a r i )  
 	 	 	 t h i s . h e a d e r s . f i n d ( ' a ' ) . a t t r ( ' t a b I n d e x ' , ' - 1 ' ) ;  
  
 	 	 i f   ( o . e v e n t )   {  
 	 	 	 t h i s . h e a d e r s . b i n d ( ( o . e v e n t )   +   " . a c c o r d i o n " ,   f u n c t i o n ( e v e n t )   {   r e t u r n   s e l f . _ c l i c k H a n d l e r . c a l l ( s e l f ,   e v e n t ,   t h i s ) ;   } ) ;  
 	 	 }  
  
 	 } ,  
  
 	 d e s t r o y :   f u n c t i o n ( )   {  
 	 	 v a r   o   =   t h i s . o p t i o n s ;  
  
 	 	 t h i s . e l e m e n t  
 	 	 	 . r e m o v e C l a s s ( " u i - a c c o r d i o n   u i - w i d g e t   u i - h e l p e r - r e s e t " )  
 	 	 	 . r e m o v e A t t r ( " r o l e " )  
 	 	 	 . u n b i n d ( ' . a c c o r d i o n ' )  
 	 	 	 . r e m o v e D a t a ( ' a c c o r d i o n ' ) ;  
  
 	 	 t h i s . h e a d e r s  
 	 	 	 . u n b i n d ( " . a c c o r d i o n " )  
 	 	 	 . r e m o v e C l a s s ( " u i - a c c o r d i o n - h e a d e r   u i - h e l p e r - r e s e t   u i - s t a t e - d e f a u l t   u i - c o r n e r - a l l   u i - s t a t e - a c t i v e   u i - c o r n e r - t o p " )  
 	 	 	 . r e m o v e A t t r ( " r o l e " ) . r e m o v e A t t r ( " a r i a - e x p a n d e d " ) . r e m o v e A t t r ( " t a b i n d e x " ) ;  
  
 	 	 t h i s . h e a d e r s . f i n d ( " a " ) . r e m o v e A t t r ( " t a b i n d e x " ) ;  
 	 	 t h i s . h e a d e r s . c h i l d r e n ( " . u i - i c o n " ) . r e m o v e ( ) ;  
 	 	 v a r   c o n t e n t s   =   t h i s . h e a d e r s . n e x t ( ) . c s s ( " d i s p l a y " ,   " " ) . r e m o v e A t t r ( " r o l e " ) . r e m o v e C l a s s ( " u i - h e l p e r - r e s e t   u i - w i d g e t - c o n t e n t   u i - c o r n e r - b o t t o m   u i - a c c o r d i o n - c o n t e n t   u i - a c c o r d i o n - c o n t e n t - a c t i v e " ) ;  
 	 	 i f   ( o . a u t o H e i g h t   | |   o . f i l l H e i g h t )   {  
 	 	 	 c o n t e n t s . c s s ( " h e i g h t " ,   " " ) ;  
 	 	 }  
 	 } ,  
 	  
 	 _ s e t D a t a :   f u n c t i o n ( k e y ,   v a l u e )   {  
 	 	 i f ( k e y   = =   ' a l w a y s O p e n ' )   {   k e y   =   ' c o l l a p s i b l e ' ;   v a l u e   =   ! v a l u e ;   }  
 	 	 $ . w i d g e t . p r o t o t y p e . _ s e t D a t a . a p p l y ( t h i s ,   a r g u m e n t s ) ; 	  
 	 } ,  
  
 	 _ k e y d o w n :   f u n c t i o n ( e v e n t )   {  
  
 	 	 v a r   o   =   t h i s . o p t i o n s ,   k e y C o d e   =   $ . u i . k e y C o d e ;  
  
 	 	 i f   ( o . d i s a b l e d   | |   e v e n t . a l t K e y   | |   e v e n t . c t r l K e y )  
 	 	 	 r e t u r n ;  
  
 	 	 v a r   l e n g t h   =   t h i s . h e a d e r s . l e n g t h ;  
 	 	 v a r   c u r r e n t I n d e x   =   t h i s . h e a d e r s . i n d e x ( e v e n t . t a r g e t ) ;  
 	 	 v a r   t o F o c u s   =   f a l s e ;  
  
 	 	 s w i t c h ( e v e n t . k e y C o d e )   {  
 	 	 	 c a s e   k e y C o d e . R I G H T :  
 	 	 	 c a s e   k e y C o d e . D O W N :  
 	 	 	 	 t o F o c u s   =   t h i s . h e a d e r s [ ( c u r r e n t I n d e x   +   1 )   %   l e n g t h ] ;  
 	 	 	 	 b r e a k ;  
 	 	 	 c a s e   k e y C o d e . L E F T :  
 	 	 	 c a s e   k e y C o d e . U P :  
 	 	 	 	 t o F o c u s   =   t h i s . h e a d e r s [ ( c u r r e n t I n d e x   -   1   +   l e n g t h )   %   l e n g t h ] ;  
 	 	 	 	 b r e a k ;  
 	 	 	 c a s e   k e y C o d e . S P A C E :  
 	 	 	 c a s e   k e y C o d e . E N T E R :  
 	 	 	 	 r e t u r n   t h i s . _ c l i c k H a n d l e r ( {   t a r g e t :   e v e n t . t a r g e t   } ,   e v e n t . t a r g e t ) ;  
 	 	 }  
  
 	 	 i f   ( t o F o c u s )   {  
 	 	 	 $ ( e v e n t . t a r g e t ) . a t t r ( ' t a b I n d e x ' , ' - 1 ' ) ;  
 	 	 	 $ ( t o F o c u s ) . a t t r ( ' t a b I n d e x ' , ' 0 ' ) ;  
 	 	 	 t o F o c u s . f o c u s ( ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
  
 	 	 r e t u r n   t r u e ;  
  
 	 } ,  
  
 	 r e s i z e :   f u n c t i o n ( )   {  
  
 	 	 v a r   o   =   t h i s . o p t i o n s ,   m a x H e i g h t ;  
  
 	 	 i f   ( o . f i l l S p a c e )   {  
 	 	 	  
 	 	 	 i f ( $ . b r o w s e r . m s i e )   {   v a r   d e f O v e r f l o w   =   t h i s . e l e m e n t . p a r e n t ( ) . c s s ( ' o v e r f l o w ' ) ;   t h i s . e l e m e n t . p a r e n t ( ) . c s s ( ' o v e r f l o w ' ,   ' h i d d e n ' ) ;   }  
 	 	 	 m a x H e i g h t   =   t h i s . e l e m e n t . p a r e n t ( ) . h e i g h t ( ) ;  
 	 	 	 i f ( $ . b r o w s e r . m s i e )   {   t h i s . e l e m e n t . p a r e n t ( ) . c s s ( ' o v e r f l o w ' ,   d e f O v e r f l o w ) ;   }  
 	  
 	 	 	 t h i s . h e a d e r s . e a c h ( f u n c t i o n ( )   {  
 	 	 	 	 m a x H e i g h t   - =   $ ( t h i s ) . o u t e r H e i g h t ( ) ;  
 	 	 	 } ) ;  
  
 	 	 	 v a r   m a x P a d d i n g   =   0 ;  
 	 	 	 t h i s . h e a d e r s . n e x t ( ) . e a c h ( f u n c t i o n ( )   {  
 	 	 	 	 m a x P a d d i n g   =   M a t h . m a x ( m a x P a d d i n g ,   $ ( t h i s ) . i n n e r H e i g h t ( )   -   $ ( t h i s ) . h e i g h t ( ) ) ;  
 	 	 	 } ) . h e i g h t ( M a t h . m a x ( 0 ,   m a x H e i g h t   -   m a x P a d d i n g ) )  
 	 	 	 . c s s ( ' o v e r f l o w ' ,   ' a u t o ' ) ;  
  
 	 	 }   e l s e   i f   (   o . a u t o H e i g h t   )   {  
 	 	 	 m a x H e i g h t   =   0 ;  
 	 	 	 t h i s . h e a d e r s . n e x t ( ) . e a c h ( f u n c t i o n ( )   {  
 	 	 	 	 m a x H e i g h t   =   M a t h . m a x ( m a x H e i g h t ,   $ ( t h i s ) . o u t e r H e i g h t ( ) ) ;  
 	 	 	 } ) . h e i g h t ( m a x H e i g h t ) ;  
 	 	 }  
  
 	 } ,  
  
 	 a c t i v a t e :   f u n c t i o n ( i n d e x )   {  
 	 	 / /   c a l l   c l i c k H a n d l e r   w i t h   c u s t o m   e v e n t  
 	 	 v a r   a c t i v e   =   t h i s . _ f i n d A c t i v e ( i n d e x ) [ 0 ] ;  
 	 	 t h i s . _ c l i c k H a n d l e r ( {   t a r g e t :   a c t i v e   } ,   a c t i v e ) ;  
 	 } ,  
  
 	 _ f i n d A c t i v e :   f u n c t i o n ( s e l e c t o r )   {  
 	 	 r e t u r n   s e l e c t o r  
 	 	 	 ?   t y p e o f   s e l e c t o r   = =   " n u m b e r "  
 	 	 	 	 ?   t h i s . h e a d e r s . f i l t e r ( " : e q ( "   +   s e l e c t o r   +   " ) " )  
 	 	 	 	 :   t h i s . h e a d e r s . n o t ( t h i s . h e a d e r s . n o t ( s e l e c t o r ) )  
 	 	 	 :   s e l e c t o r   = = =   f a l s e  
 	 	 	 	 ?   $ ( [ ] )  
 	 	 	 	 :   t h i s . h e a d e r s . f i l t e r ( " : e q ( 0 ) " ) ;  
 	 } ,  
  
 	 _ c l i c k H a n d l e r :   f u n c t i o n ( e v e n t ,   t a r g e t )   {  
  
 	 	 v a r   o   =   t h i s . o p t i o n s ;  
 	 	 i f   ( o . d i s a b l e d )   r e t u r n   f a l s e ;  
  
 	 	 / /   c a l l e d   o n l y   w h e n   u s i n g   a c t i v a t e ( f a l s e )   t o   c l o s e   a l l   p a r t s   p r o g r a m m a t i c a l l y  
 	 	 i f   ( ! e v e n t . t a r g e t   & &   o . c o l l a p s i b l e )   {  
 	 	 	 t h i s . a c t i v e . r e m o v e C l a s s ( " u i - s t a t e - a c t i v e   u i - c o r n e r - t o p " ) . a d d C l a s s ( " u i - s t a t e - d e f a u l t   u i - c o r n e r - a l l " )  
 	 	 	 	 . f i n d ( " . u i - i c o n " ) . r e m o v e C l a s s ( o . i c o n s . h e a d e r S e l e c t e d ) . a d d C l a s s ( o . i c o n s . h e a d e r ) ;  
 	 	 	 t h i s . a c t i v e . n e x t ( ) . a d d C l a s s ( ' u i - a c c o r d i o n - c o n t e n t - a c t i v e ' ) ;  
 	 	 	 v a r   t o H i d e   =   t h i s . a c t i v e . n e x t ( ) ,  
 	 	 	 	 d a t a   =   {  
 	 	 	 	 	 o p t i o n s :   o ,  
 	 	 	 	 	 n e w H e a d e r :   $ ( [ ] ) ,  
 	 	 	 	 	 o l d H e a d e r :   o . a c t i v e ,  
 	 	 	 	 	 n e w C o n t e n t :   $ ( [ ] ) ,  
 	 	 	 	 	 o l d C o n t e n t :   t o H i d e  
 	 	 	 	 } ,  
 	 	 	 	 t o S h o w   =   ( t h i s . a c t i v e   =   $ ( [ ] ) ) ;  
 	 	 	 t h i s . _ t o g g l e ( t o S h o w ,   t o H i d e ,   d a t a ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
  
 	 	 / /   g e t   t h e   c l i c k   t a r g e t  
 	 	 v a r   c l i c k e d   =   $ ( e v e n t . c u r r e n t T a r g e t   | |   t a r g e t ) ;  
 	 	 v a r   c l i c k e d I s A c t i v e   =   c l i c k e d [ 0 ]   = =   t h i s . a c t i v e [ 0 ] ;  
  
 	 	 / /   i f   a n i m a t i o n s   a r e   s t i l l   a c t i v e ,   o r   t h e   a c t i v e   h e a d e r   i s   t h e   t a r g e t ,   i g n o r e   c l i c k  
 	 	 i f   ( t h i s . r u n n i n g   | |   ( ! o . c o l l a p s i b l e   & &   c l i c k e d I s A c t i v e ) )   {  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
  
 	 	 / /   s w i t c h   c l a s s e s  
 	 	 t h i s . a c t i v e . r e m o v e C l a s s ( " u i - s t a t e - a c t i v e   u i - c o r n e r - t o p " ) . a d d C l a s s ( " u i - s t a t e - d e f a u l t   u i - c o r n e r - a l l " )  
 	 	 	 . f i n d ( " . u i - i c o n " ) . r e m o v e C l a s s ( o . i c o n s . h e a d e r S e l e c t e d ) . a d d C l a s s ( o . i c o n s . h e a d e r ) ;  
 	 	 t h i s . a c t i v e . n e x t ( ) . a d d C l a s s ( ' u i - a c c o r d i o n - c o n t e n t - a c t i v e ' ) ;  
 	 	 i f   ( ! c l i c k e d I s A c t i v e )   {  
 	 	 	 c l i c k e d . r e m o v e C l a s s ( " u i - s t a t e - d e f a u l t   u i - c o r n e r - a l l " ) . a d d C l a s s ( " u i - s t a t e - a c t i v e   u i - c o r n e r - t o p " )  
 	 	 	 	 . f i n d ( " . u i - i c o n " ) . r e m o v e C l a s s ( o . i c o n s . h e a d e r ) . a d d C l a s s ( o . i c o n s . h e a d e r S e l e c t e d ) ;  
 	 	 	 c l i c k e d . n e x t ( ) . a d d C l a s s ( ' u i - a c c o r d i o n - c o n t e n t - a c t i v e ' ) ;  
 	 	 }  
  
 	 	 / /   f i n d   e l e m e n t s   t o   s h o w   a n d   h i d e  
 	 	 v a r   t o S h o w   =   c l i c k e d . n e x t ( ) ,  
 	 	 	 t o H i d e   =   t h i s . a c t i v e . n e x t ( ) ,  
 	 	 	 d a t a   =   {  
 	 	 	 	 o p t i o n s :   o ,  
 	 	 	 	 n e w H e a d e r :   c l i c k e d I s A c t i v e   & &   o . c o l l a p s i b l e   ?   $ ( [ ] )   :   c l i c k e d ,  
 	 	 	 	 o l d H e a d e r :   t h i s . a c t i v e ,  
 	 	 	 	 n e w C o n t e n t :   c l i c k e d I s A c t i v e   & &   o . c o l l a p s i b l e   ?   $ ( [ ] )   :   t o S h o w . f i n d ( ' >   * ' ) ,  
 	 	 	 	 o l d C o n t e n t :   t o H i d e . f i n d ( ' >   * ' )  
 	 	 	 } ,  
 	 	 	 d o w n   =   t h i s . h e a d e r s . i n d e x (   t h i s . a c t i v e [ 0 ]   )   >   t h i s . h e a d e r s . i n d e x (   c l i c k e d [ 0 ]   ) ;  
  
 	 	 t h i s . a c t i v e   =   c l i c k e d I s A c t i v e   ?   $ ( [ ] )   :   c l i c k e d ;  
 	 	 t h i s . _ t o g g l e ( t o S h o w ,   t o H i d e ,   d a t a ,   c l i c k e d I s A c t i v e ,   d o w n ) ;  
  
 	 	 r e t u r n   f a l s e ;  
  
 	 } ,  
  
 	 _ t o g g l e :   f u n c t i o n ( t o S h o w ,   t o H i d e ,   d a t a ,   c l i c k e d I s A c t i v e ,   d o w n )   {  
  
 	 	 v a r   o   =   t h i s . o p t i o n s ,   s e l f   =   t h i s ;  
  
 	 	 t h i s . t o S h o w   =   t o S h o w ;  
 	 	 t h i s . t o H i d e   =   t o H i d e ;  
 	 	 t h i s . d a t a   =   d a t a ;  
  
 	 	 v a r   c o m p l e t e   =   f u n c t i o n ( )   {   i f ( ! s e l f )   r e t u r n ;   r e t u r n   s e l f . _ c o m p l e t e d . a p p l y ( s e l f ,   a r g u m e n t s ) ;   } ;  
  
 	 	 / /   t r i g g e r   c h a n g e s t a r t   e v e n t  
 	 	 t h i s . _ t r i g g e r ( " c h a n g e s t a r t " ,   n u l l ,   t h i s . d a t a ) ;  
  
 	 	 / /   c o u n t   e l e m e n t s   t o   a n i m a t e  
 	 	 t h i s . r u n n i n g   =   t o H i d e . s i z e ( )   = = =   0   ?   t o S h o w . s i z e ( )   :   t o H i d e . s i z e ( ) ;  
  
 	 	 i f   ( o . a n i m a t e d )   {  
  
 	 	 	 v a r   a n i m O p t i o n s   =   { } ;  
  
 	 	 	 i f   (   o . c o l l a p s i b l e   & &   c l i c k e d I s A c t i v e   )   {  
 	 	 	 	 a n i m O p t i o n s   =   {  
 	 	 	 	 	 t o S h o w :   $ ( [ ] ) ,  
 	 	 	 	 	 t o H i d e :   t o H i d e ,  
 	 	 	 	 	 c o m p l e t e :   c o m p l e t e ,  
 	 	 	 	 	 d o w n :   d o w n ,  
 	 	 	 	 	 a u t o H e i g h t :   o . a u t o H e i g h t   | |   o . f i l l S p a c e  
 	 	 	 	 } ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 a n i m O p t i o n s   =   {  
 	 	 	 	 	 t o S h o w :   t o S h o w ,  
 	 	 	 	 	 t o H i d e :   t o H i d e ,  
 	 	 	 	 	 c o m p l e t e :   c o m p l e t e ,  
 	 	 	 	 	 d o w n :   d o w n ,  
 	 	 	 	 	 a u t o H e i g h t :   o . a u t o H e i g h t   | |   o . f i l l S p a c e  
 	 	 	 	 } ;  
 	 	 	 }  
  
 	 	 	 i f   ( ! o . p r o x i e d )   {  
 	 	 	 	 o . p r o x i e d   =   o . a n i m a t e d ;  
 	 	 	 }  
  
 	 	 	 i f   ( ! o . p r o x i e d D u r a t i o n )   {  
 	 	 	 	 o . p r o x i e d D u r a t i o n   =   o . d u r a t i o n ;  
 	 	 	 }  
  
 	 	 	 o . a n i m a t e d   =   $ . i s F u n c t i o n ( o . p r o x i e d )   ?  
 	 	 	 	 o . p r o x i e d ( a n i m O p t i o n s )   :   o . p r o x i e d ;  
  
 	 	 	 o . d u r a t i o n   =   $ . i s F u n c t i o n ( o . p r o x i e d D u r a t i o n )   ?  
 	 	 	 	 o . p r o x i e d D u r a t i o n ( a n i m O p t i o n s )   :   o . p r o x i e d D u r a t i o n ;  
  
 	 	 	 v a r   a n i m a t i o n s   =   $ . u i . a c c o r d i o n . a n i m a t i o n s ,  
 	 	 	 	 d u r a t i o n   =   o . d u r a t i o n ,  
 	 	 	 	 e a s i n g   =   o . a n i m a t e d ;  
  
 	 	 	 i f   ( ! a n i m a t i o n s [ e a s i n g ] )   {  
 	 	 	 	 a n i m a t i o n s [ e a s i n g ]   =   f u n c t i o n ( o p t i o n s )   {  
 	 	 	 	 	 t h i s . s l i d e ( o p t i o n s ,   {  
 	 	 	 	 	 	 e a s i n g :   e a s i n g ,  
 	 	 	 	 	 	 d u r a t i o n :   d u r a t i o n   | |   7 0 0  
 	 	 	 	 	 } ) ;  
 	 	 	 	 } ;  
 	 	 	 }  
  
 	 	 	 a n i m a t i o n s [ e a s i n g ] ( a n i m O p t i o n s ) ;  
  
 	 	 }   e l s e   {  
  
 	 	 	 i f   ( o . c o l l a p s i b l e   & &   c l i c k e d I s A c t i v e )   {  
 	 	 	 	 t o S h o w . t o g g l e ( ) ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 t o H i d e . h i d e ( ) ;  
 	 	 	 	 t o S h o w . s h o w ( ) ;  
 	 	 	 }  
  
 	 	 	 c o m p l e t e ( t r u e ) ;  
  
 	 	 }  
  
 	 	 t o H i d e . p r e v ( ) . a t t r ( ' a r i a - e x p a n d e d ' , ' f a l s e ' ) . a t t r ( " t a b I n d e x " ,   " - 1 " ) . b l u r ( ) ;  
 	 	 t o S h o w . p r e v ( ) . a t t r ( ' a r i a - e x p a n d e d ' , ' t r u e ' ) . a t t r ( " t a b I n d e x " ,   " 0 " ) . f o c u s ( ) ;  
  
 	 } ,  
  
 	 _ c o m p l e t e d :   f u n c t i o n ( c a n c e l )   {  
  
 	 	 v a r   o   =   t h i s . o p t i o n s ;  
  
 	 	 t h i s . r u n n i n g   =   c a n c e l   ?   0   :   - - t h i s . r u n n i n g ;  
 	 	 i f   ( t h i s . r u n n i n g )   r e t u r n ;  
  
 	 	 i f   ( o . c l e a r S t y l e )   {  
 	 	 	 t h i s . t o S h o w . a d d ( t h i s . t o H i d e ) . c s s ( {  
 	 	 	 	 h e i g h t :   " " ,  
 	 	 	 	 o v e r f l o w :   " "  
 	 	 	 } ) ;  
 	 	 }  
  
 	 	 t h i s . _ t r i g g e r ( ' c h a n g e ' ,   n u l l ,   t h i s . d a t a ) ;  
 	 }  
  
 } ) ;  
  
  
 $ . e x t e n d ( $ . u i . a c c o r d i o n ,   {  
 	 v e r s i o n :   " 1 . 7 . 1 " ,  
 	 d e f a u l t s :   {  
 	 	 a c t i v e :   n u l l ,  
 	 	 a l w a y s O p e n :   t r u e ,   / / d e p r e c a t e d ,   u s e   c o l l a p s i b l e  
 	 	 a n i m a t e d :   ' s l i d e ' ,  
 	 	 a u t o H e i g h t :   t r u e ,  
 	 	 c l e a r S t y l e :   f a l s e ,  
 	 	 c o l l a p s i b l e :   f a l s e ,  
 	 	 e v e n t :   " c l i c k " ,  
 	 	 f i l l S p a c e :   f a l s e ,  
 	 	 h e a d e r :   " >   l i   >   : f i r s t - c h i l d , >   : n o t ( l i ) : e v e n " ,  
 	 	 i c o n s :   {  
 	 	 	 h e a d e r :   " u i - i c o n - t r i a n g l e - 1 - e " ,  
 	 	 	 h e a d e r S e l e c t e d :   " u i - i c o n - t r i a n g l e - 1 - s "  
 	 	 } ,  
 	 	 n a v i g a t i o n :   f a l s e ,  
 	 	 n a v i g a t i o n F i l t e r :   f u n c t i o n ( )   {  
 	 	 	 r e t u r n   t h i s . h r e f . t o L o w e r C a s e ( )   = =   l o c a t i o n . h r e f . t o L o w e r C a s e ( ) ;  
 	 	 }  
 	 } ,  
 	 a n i m a t i o n s :   {  
 	 	 s l i d e :   f u n c t i o n ( o p t i o n s ,   a d d i t i o n s )   {  
 	 	 	 o p t i o n s   =   $ . e x t e n d ( {  
 	 	 	 	 e a s i n g :   " s w i n g " ,  
 	 	 	 	 d u r a t i o n :   3 0 0  
 	 	 	 } ,   o p t i o n s ,   a d d i t i o n s ) ;  
 	 	 	 i f   (   ! o p t i o n s . t o H i d e . s i z e ( )   )   {  
 	 	 	 	 o p t i o n s . t o S h o w . a n i m a t e ( { h e i g h t :   " s h o w " } ,   o p t i o n s ) ;  
 	 	 	 	 r e t u r n ;  
 	 	 	 }  
 	 	 	 i f   (   ! o p t i o n s . t o S h o w . s i z e ( )   )   {  
 	 	 	 	 o p t i o n s . t o H i d e . a n i m a t e ( { h e i g h t :   " h i d e " } ,   o p t i o n s ) ;  
 	 	 	 	 r e t u r n ;  
 	 	 	 }  
 	 	 	 v a r   o v e r f l o w   =   o p t i o n s . t o S h o w . c s s ( ' o v e r f l o w ' ) ,  
 	 	 	 	 p e r c e n t D o n e ,  
 	 	 	 	 s h o w P r o p s   =   { } ,  
 	 	 	 	 h i d e P r o p s   =   { } ,  
 	 	 	 	 f x A t t r s   =   [   " h e i g h t " ,   " p a d d i n g T o p " ,   " p a d d i n g B o t t o m "   ] ,  
 	 	 	 	 o r i g i n a l W i d t h ;  
 	 	 	 / /   f i x   w i d t h   b e f o r e   c a l c u l a t i n g   h e i g h t   o f   h i d d e n   e l e m e n t  
 	 	 	 v a r   s   =   o p t i o n s . t o S h o w ;  
 	 	 	 o r i g i n a l W i d t h   =   s [ 0 ] . s t y l e . w i d t h ;  
 	 	 	 s . w i d t h (   p a r s e I n t ( s . p a r e n t ( ) . w i d t h ( ) , 1 0 )   -   p a r s e I n t ( s . c s s ( " p a d d i n g L e f t " ) , 1 0 )   -   p a r s e I n t ( s . c s s ( " p a d d i n g R i g h t " ) , 1 0 )   -   ( p a r s e I n t ( s . c s s ( " b o r d e r L e f t W i d t h " ) , 1 0 )   | |   0 )   -   ( p a r s e I n t ( s . c s s ( " b o r d e r R i g h t W i d t h " ) , 1 0 )   | |   0 )   ) ;  
 	 	 	  
 	 	 	 $ . e a c h ( f x A t t r s ,   f u n c t i o n ( i ,   p r o p )   {  
 	 	 	 	 h i d e P r o p s [ p r o p ]   =   ' h i d e ' ;  
 	 	 	 	  
 	 	 	 	 v a r   p a r t s   =   ( ' '   +   $ . c s s ( o p t i o n s . t o S h o w [ 0 ] ,   p r o p ) ) . m a t c h ( / ^ ( [ \ d + - . ] + ) ( . * ) $ / ) ;  
 	 	 	 	 s h o w P r o p s [ p r o p ]   =   {  
 	 	 	 	 	 v a l u e :   p a r t s [ 1 ] ,  
 	 	 	 	 	 u n i t :   p a r t s [ 2 ]   | |   ' p x '  
 	 	 	 	 } ;  
 	 	 	 } ) ;  
 	 	 	 o p t i o n s . t o S h o w . c s s ( {   h e i g h t :   0 ,   o v e r f l o w :   ' h i d d e n '   } ) . s h o w ( ) ;  
 	 	 	 o p t i o n s . t o H i d e . f i l t e r ( " : h i d d e n " ) . e a c h ( o p t i o n s . c o m p l e t e ) . e n d ( ) . f i l t e r ( " : v i s i b l e " ) . a n i m a t e ( h i d e P r o p s , {  
 	 	 	 	 s t e p :   f u n c t i o n ( n o w ,   s e t t i n g s )   {  
 	 	 	 	 	 / /   o n l y   c a l c u l a t e   t h e   p e r c e n t   w h e n   a n i m a t i n g   h e i g h t  
 	 	 	 	 	 / /   I E   g e t s   v e r y   i n c o n s i s t e n t   r e s u l t s   w h e n   a n i m a t i n g   e l e m e n t s  
 	 	 	 	 	 / /   w i t h   s m a l l   v a l u e s ,   w h i c h   i s   c o m m o n   f o r   p a d d i n g  
 	 	 	 	 	 i f   ( s e t t i n g s . p r o p   = =   ' h e i g h t ' )   {  
 	 	 	 	 	 	 p e r c e n t D o n e   =   ( s e t t i n g s . n o w   -   s e t t i n g s . s t a r t )   /   ( s e t t i n g s . e n d   -   s e t t i n g s . s t a r t ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 	 o p t i o n s . t o S h o w [ 0 ] . s t y l e [ s e t t i n g s . p r o p ]   =  
 	 	 	 	 	 	 ( p e r c e n t D o n e   *   s h o w P r o p s [ s e t t i n g s . p r o p ] . v a l u e )   +   s h o w P r o p s [ s e t t i n g s . p r o p ] . u n i t ;  
 	 	 	 	 } ,  
 	 	 	 	 d u r a t i o n :   o p t i o n s . d u r a t i o n ,  
 	 	 	 	 e a s i n g :   o p t i o n s . e a s i n g ,  
 	 	 	 	 c o m p l e t e :   f u n c t i o n ( )   {  
 	 	 	 	 	 i f   (   ! o p t i o n s . a u t o H e i g h t   )   {  
 	 	 	 	 	 	 o p t i o n s . t o S h o w . c s s ( " h e i g h t " ,   " " ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 o p t i o n s . t o S h o w . c s s ( " w i d t h " ,   o r i g i n a l W i d t h ) ;  
 	 	 	 	 	 o p t i o n s . t o S h o w . c s s ( { o v e r f l o w :   o v e r f l o w } ) ;  
 	 	 	 	 	 o p t i o n s . c o m p l e t e ( ) ;  
 	 	 	 	 }  
 	 	 	 } ) ;  
 	 	 } ,  
 	 	 b o u n c e s l i d e :   f u n c t i o n ( o p t i o n s )   {  
 	 	 	 t h i s . s l i d e ( o p t i o n s ,   {  
 	 	 	 	 e a s i n g :   o p t i o n s . d o w n   ?   " e a s e O u t B o u n c e "   :   " s w i n g " ,  
 	 	 	 	 d u r a t i o n :   o p t i o n s . d o w n   ?   1 0 0 0   :   2 0 0  
 	 	 	 } ) ;  
 	 	 } ,  
 	 	 e a s e s l i d e :   f u n c t i o n ( o p t i o n s )   {  
 	 	 	 t h i s . s l i d e ( o p t i o n s ,   {  
 	 	 	 	 e a s i n g :   " e a s e i n o u t " ,  
 	 	 	 	 d u r a t i o n :   7 0 0  
 	 	 	 } ) ;  
 	 	 }  
 	 }  
 } ) ;  
  
 } ) ( j Q u e r y ) ; 
