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