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