ÿþ/ * !  
 *   j Q u e r y   U I   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   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 ( $ ,   u n d e f i n e d )   {  
  
         / /   p r e v e n t   d u p l i c a t e   l o a d i n g  
         / /   t h i s   i s   o n l y   a   p r o b l e m   b e c a u s e   w e   p r o x y   e x i s t i n g   f u n c t i o n s  
         / /   a n d   w e   d o n ' t   w a n t   t o   d o u b l e   p r o x y   t h e m  
         $ . u i   =   $ . u i   | |   { } ;  
         i f   ( $ . u i . v e r s i o n )   {  
                 r e t u r n ;  
         }  
  
         $ . e x t e n d ( $ . u i ,   {  
                 v e r s i o n :   " 1 . 8 . 1 0 " ,  
  
                 k e y C o d e :   {  
                         A L T :   1 8 ,  
                         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 M M A N D :   9 1 ,  
                         C O M M A N D _ L E F T :   9 1 ,   / /   C O M M A N D  
                         C O M M A N D _ R I G H T :   9 3 ,  
                         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 ,  
                         M E N U :   9 3 ,   / /   C O M M A N D _ R I G H T  
                         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 ,  
                         W I N D O W S :   9 1   / /   C O M M A N D  
                 }  
         } ) ;  
  
         / /   p l u g i n s  
         $ . f n . e x t e n d ( {  
                 _ f o c u s :   $ . f n . f o c u s ,  
                 f o c u s :   f u n c t i o n ( d e l a y ,   f n )   {  
                         r e t u r n   t y p e o f   d e l a y   = = =   " n u m b e r "   ?  
 	 	 	 t h i s . e a c h ( f u n c t i o n ( )   {  
 	 	 	         v a r   e l e m   =   t h i s ;  
 	 	 	         s e t T i m e o u t ( f u n c t i o n ( )   {  
 	 	 	                 $ ( e l e m ) . f o c u s ( ) ;  
 	 	 	                 i f   ( f n )   {  
 	 	 	                         f n . c a l l ( e l e m ) ;  
 	 	 	                 }  
 	 	 	         } ,   d e l a y ) ;  
 	 	 	 } )   :  
 	 	 	 t h i s . _ f o c u s . a p p l y ( t h i s ,   a r g u m e n t s ) ;  
                 } ,  
  
                 s c r o l l P a r e n t :   f u n c t i o n ( )   {  
                         v a r   s c r o l l P a r e n t ;  
                         i f   ( ( $ . b r o w s e r . m s i e   & &   ( / ( s t a t i c | r e l a t i v e ) / ) . t e s t ( t h i s . c s s ( ' p o s i t i o n ' ) ) )   | |   ( / a b s o l u t e / ) . t e s t ( t h i s . c s s ( ' p o s i t i o n ' ) ) )   {  
                                 s c r o l l P a r e n t   =   t h i s . p a r e n t s ( ) . f i l t e r ( f u n c t i o n ( )   {  
                                         r e t u r n   ( / ( r e l a t i v e | a b s o l u t e | f i x e d ) / ) . t e s t ( $ . c u r C S S ( t h i s ,   ' p o s i t i o n ' ,   1 ) )   & &   ( / ( a u t o | s c r o l l ) / ) . t e s t ( $ . c u r C S S ( t h i s ,   ' o v e r f l o w ' ,   1 )   +   $ . c u r C S S ( t h i s ,   ' o v e r f l o w - y ' ,   1 )   +   $ . c u r C S S ( t h i s ,   ' o v e r f l o w - x ' ,   1 ) ) ;  
                                 } ) . e q ( 0 ) ;  
                         }   e l s e   {  
                                 s c r o l l P a r e n t   =   t h i s . p a r e n t s ( ) . f i l t e r ( f u n c t i o n ( )   {  
                                         r e t u r n   ( / ( a u t o | s c r o l l ) / ) . t e s t ( $ . c u r C S S ( t h i s ,   ' o v e r f l o w ' ,   1 )   +   $ . c u r C S S ( t h i s ,   ' o v e r f l o w - y ' ,   1 )   +   $ . c u r C S S ( t h i s ,   ' o v e r f l o w - x ' ,   1 ) ) ;  
                                 } ) . e q ( 0 ) ;  
                         }  
  
                         r e t u r n   ( / f i x e d / ) . t e s t ( t h i s . c s s ( ' p o s i t i o n ' ) )   | |   ! s c r o l l P a r e n t . l e n g t h   ?   $ ( d o c u m e n t )   :   s c r o l l P a r e n t ;  
                 } ,  
  
                 z I n d e x :   f u n c t i o n ( z I n d e x )   {  
                         i f   ( z I n d e x   ! = =   u n d e f i n e d )   {  
                                 r e t u r n   t h i s . c s s ( " z I n d e x " ,   z I n d e x ) ;  
                         }  
  
                         i f   ( t h i s . l e n g t h )   {  
                                 v a r   e l e m   =   $ ( t h i s [ 0 ] ) ,   p o s i t i o n ,   v a l u e ;  
                                 w h i l e   ( e l e m . l e n g t h   & &   e l e m [ 0 ]   ! = =   d o c u m e n t )   {  
                                         / /   I g n o r e   z - i n d e x   i f   p o s i t i o n   i s   s e t   t o   a   v a l u e   w h e r e   z - i n d e x   i s   i g n o r e d   b y   t h e   b r o w s e r  
                                         / /   T h i s   m a k e s   b e h a v i o r   o f   t h i s   f u n c t i o n   c o n s i s t e n t   a c r o s s   b r o w s e r s  
                                         / /   W e b K i t   a l w a y s   r e t u r n s   a u t o   i f   t h e   e l e m e n t   i s   p o s i t i o n e d  
                                         p o s i t i o n   =   e l e m . c s s ( " p o s i t i o n " ) ;  
                                         i f   ( p o s i t i o n   = = =   " a b s o l u t e "   | |   p o s i t i o n   = = =   " r e l a t i v e "   | |   p o s i t i o n   = = =   " f i x e d " )   {  
                                                 / /   I E   r e t u r n s   0   w h e n   z I n d e x   i s   n o t   s p e c i f i e d  
                                                 / /   o t h e r   b r o w s e r s   r e t u r n   a   s t r i n g  
                                                 / /   w e   i g n o r e   t h e   c a s e   o f   n e s t e d   e l e m e n t s   w i t h   a n   e x p l i c i t   v a l u e   o f   0  
                                                 / /   < d i v   s t y l e = " z - i n d e x :   - 1 0 ; " > < d i v   s t y l e = " z - i n d e x :   0 ; " > < / d i v > < / d i v >  
                                                 v a l u e   =   p a r s e I n t ( e l e m . c s s ( " z I n d e x " ) ,   1 0 ) ;  
                                                 i f   ( ! i s N a N ( v a l u e )   & &   v a l u e   ! = =   0 )   {  
                                                         r e t u r n   v a l u e ;  
                                                 }  
                                         }  
                                         e l e m   =   e l e m . p a r e n t ( ) ;  
                                 }  
                         }  
  
                         r e t u r n   0 ;  
                 } ,  
  
                 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 . b i n d ( ( $ . s u p p o r t . s e l e c t s t a r t   ?   " s e l e c t s t a r t "   :   " m o u s e d o w n " )   +  
 	 	 	 " . 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 ( e v e n t )   {  
 	 	 	         e v e n t . p r e v e n t D e f a u l t ( ) ;  
 	 	 	 } ) ;  
                 } ,  
  
                 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 . u n b i n d ( " . u i - d i s a b l e S e l e c t i o n " ) ;  
                 }  
         } ) ;  
  
         $ . e a c h ( [ " W i d t h " ,   " H e i g h t " ] ,   f u n c t i o n ( i ,   n a m e )   {  
                 v a r   s i d e   =   n a m e   = = =   " W i d t h "   ?   [ " L e f t " ,   " R i g h t " ]   :   [ " T o p " ,   " B o t t o m " ] ,  
 	 	 t y p e   =   n a m e . t o L o w e r C a s e ( ) ,  
 	 	 o r i g   =   {  
 	 	         i n n e r W i d t h :   $ . f n . i n n e r W i d t h ,  
 	 	         i n n e r H e i g h t :   $ . f n . i n n e r H e i g h t ,  
 	 	         o u t e r W i d t h :   $ . f n . o u t e r W i d t h ,  
 	 	         o u t e r H e i g h t :   $ . f n . o u t e r H e i g h t  
 	 	 } ;  
  
                 f u n c t i o n   r e d u c e ( e l e m ,   s i z e ,   b o r d e r ,   m a r g i n )   {  
                         $ . e a c h ( s i d e ,   f u n c t i o n ( )   {  
                                 s i z e   - =   p a r s e F l o a t ( $ . c u r C S S ( e l e m ,   " p a d d i n g "   +   t h i s ,   t r u e ) )   | |   0 ;  
                                 i f   ( b o r d e r )   {  
                                         s i z e   - =   p a r s e F l o a t ( $ . c u r C S S ( e l e m ,   " b o r d e r "   +   t h i s   +   " W i d t h " ,   t r u e ) )   | |   0 ;  
                                 }  
                                 i f   ( m a r g i n )   {  
                                         s i z e   - =   p a r s e F l o a t ( $ . c u r C S S ( e l e m ,   " m a r g i n "   +   t h i s ,   t r u e ) )   | |   0 ;  
                                 }  
                         } ) ;  
                         r e t u r n   s i z e ;  
                 }  
  
                 $ . f n [ " i n n e r "   +   n a m e ]   =   f u n c t i o n ( s i z e )   {  
                         i f   ( s i z e   = = =   u n d e f i n e d )   {  
                                 r e t u r n   o r i g [ " i n n e r "   +   n a m e ] . c a l l ( t h i s ) ;  
                         }  
  
                         r e t u r n   t h i s . e a c h ( f u n c t i o n ( )   {  
                                 $ ( t h i s ) . c s s ( t y p e ,   r e d u c e ( t h i s ,   s i z e )   +   " p x " ) ;  
                         } ) ;  
                 } ;  
  
                 $ . f n [ " o u t e r "   +   n a m e ]   =   f u n c t i o n ( s i z e ,   m a r g i n )   {  
                         i f   ( t y p e o f   s i z e   ! = =   " n u m b e r " )   {  
                                 r e t u r n   o r i g [ " o u t e r "   +   n a m e ] . c a l l ( t h i s ,   s i z e ) ;  
                         }  
  
                         r e t u r n   t h i s . e a c h ( f u n c t i o n ( )   {  
                                 $ ( t h i s ) . c s s ( t y p e ,   r e d u c e ( t h i s ,   s i z e ,   t r u e ,   m a r g i n )   +   " p x " ) ;  
                         } ) ;  
                 } ;  
         } ) ;  
  
         / /   s e l e c t o r s  
         f u n c t i o n   v i s i b l e ( e l e m e n t )   {  
                 r e t u r n   ! $ ( e l e m e n t ) . p a r e n t s ( ) . a n d S e l f ( ) . f i l t e r ( f u n c t i o n ( )   {  
                         r e t u r n   $ . c u r C S S ( t h i s ,   " v i s i b i l i t y " )   = = =   " h i d d e n "   | |  
 	 	 	 $ . e x p r . f i l t e r s . h i d d e n ( t h i s ) ;  
                 } ) . l e n g t h ;  
         }  
  
         $ . e x t e n d ( $ . e x p r [ " : " ] ,   {  
                 d a t a :   f u n c t i o n ( e l e m ,   i ,   m a t c h )   {  
                         r e t u r n   ! ! $ . d a t a ( e l e m ,   m a t c h [ 3 ] ) ;  
                 } ,  
  
                 f o c u s a b l e :   f u n c t i o n ( e l e m e n t )   {  
                         v a r   n o d e N a m e   =   e l e m e n t . n o d e N a m e . t o L o w e r C a s e ( ) ,  
 	 	 	 t a b I n d e x   =   $ . a t t r ( e l e m e n t ,   " t a b i n d e x " ) ;  
                         i f   ( " a r e a "   = = =   n o d e N a m e )   {  
                                 v a r   m a p   =   e l e m e n t . p a r e n t N o d e ,  
 	 	 	 	 m a p N a m e   =   m a p . n a m e ,  
 	 	 	 	 i m g ;  
                                 i f   ( ! e l e m e n t . h r e f   | |   ! m a p N a m e   | |   m a p . n o d e N a m e . t o L o w e r C a s e ( )   ! = =   " m a p " )   {  
                                         r e t u r n   f a l s e ;  
                                 }  
                                 i m g   =   $ ( " i m g [ u s e m a p = # "   +   m a p N a m e   +   " ] " ) [ 0 ] ;  
                                 r e t u r n   ! ! i m g   & &   v i s i b l e ( i m g ) ;  
                         }  
                         r e t u r n   ( / 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 | o b j e c t / . t e s t ( n o d e N a m e )  
 	 	 	 ?   ! e l e m e n t . d i s a b l e d  
 	 	 	 :   " a "   = =   n o d e N a m e  
 	 	 	 	 ?   e l e m e n t . h r e f   | |   ! i s N a N ( t a b I n d e x )  
 	 	 	 	 :   ! i s N a N ( t a b I n d e x ) )  
                         / /   t h e   e l e m e n t   a n d   a l l   o f   i t s   a n c e s t o r s   m u s t   b e   v i s i b l e  
 	 	 	 & &   v i s i b l e ( e l e m e n t ) ;  
                 } ,  
  
                 t a b b a b l e :   f u n c t i o n ( e l e m e n t )   {  
                         v a r   t a b I n d e x   =   $ . a t t r ( e l e m e n t ,   " t a b i n d e x " ) ;  
                         r e t u r n   ( i s N a N ( t a b I n d e x )   | |   t a b I n d e x   > =   0 )   & &   $ ( e l e m e n t ) . i s ( " : f o c u s a b l e " ) ;  
                 }  
         } ) ;  
  
         / /   s u p p o r t  
         $ ( f u n c t i o n ( )   {  
                 v a r   b o d y   =   d o c u m e n t . b o d y ,  
 	 	 d i v   =   b o d y . a p p e n d C h i l d ( d i v   =   d o c u m e n t . c r e a t e E l e m e n t ( " d i v " ) ) ;  
  
                 $ . e x t e n d ( d i v . s t y l e ,   {  
                         m i n H e i g h t :   " 1 0 0 p x " ,  
                         h e i g h t :   " a u t o " ,  
                         p a d d i n g :   0 ,  
                         b o r d e r W i d t h :   0  
                 } ) ;  
  
                 $ . s u p p o r t . m i n H e i g h t   =   d i v . o f f s e t H e i g h t   = = =   1 0 0 ;  
                 $ . s u p p o r t . s e l e c t s t a r t   =   " o n s e l e c t s t a r t "   i n   d i v ;  
  
                 / /   s e t   d i s p l a y   t o   n o n e   t o   a v o i d   a   l a y o u t   b u g   i n   I E  
                 / /   h t t p : / / d e v . j q u e r y . c o m / t i c k e t / 4 0 1 4  
                 b o d y . r e m o v e C h i l d ( d i v ) . s t y l e . d i s p l a y   =   " n o n e " ;  
         } ) ;  
  
  
  
  
  
         / /   d e p r e c a t e d  
         $ . e x t e n d ( $ . u i ,   {  
                 / /   $ . 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   | |   ! i n s t a n c e . e l e m e n t [ 0 ] . p a r e n t N o d e )   {  
                                         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 ) ;  
                                         }  
                                 }  
                         }  
                 } ,  
  
                 / /   w i l l   b e   d e p r e c a t e d   w h e n   w e   s w i t c h   t o   j Q u e r y   1 . 4   -   u s e   j Q u e r y . c o n t a i n s ( )  
                 c o n t a i n s :   f u n c t i o n ( a ,   b )   {  
                         r e t u r n   d o c u m e n t . c o m p a r e D o c u m e n t P o s i t i o n   ?  
 	 	 	 a . c o m p a r e D o c u m e n t P o s i t i o n ( b )   &   1 6   :  
 	 	 	 a   ! = =   b   & &   a . c o n t a i n s ( b ) ;  
                 } ,  
  
                 / /   o n l y   u s e d   b y   r e s i z a b l e  
                 h a s S c r o l l :   f u n c t i o n ( e l ,   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 l ) . 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 l [ 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 l [ s c r o l l ]   =   1 ;  
                         h a s   =   ( e l [ s c r o l l ]   >   0 ) ;  
                         e l [ s c r o l l ]   =   0 ;  
                         r e t u r n   h a s ;  
                 } ,  
  
                 / /   t h e s e   a r e   o d d   f u n c t i o n s ,   f i x   t h e   A P I   o r   m o v e   i n t o   i n d i v i d u a l   p l u g i n s  
                 i s O v e r A x i s :   f u n c t i o n ( x ,   r e f e r e n c e ,   s i z e )   {  
                         / / D e t e r m i n e s   w h e n   x   c o o r d i n a t e   i s   o v e r   " b "   e l e m e n t   a x i s  
                         r e t u r n   ( x   >   r e f e r e n c e )   & &   ( x   <   ( r e f e r e n c e   +   s i z e ) ) ;  
                 } ,  
                 i s O v e r :   f u n c t i o n ( y ,   x ,   t o p ,   l e f t ,   h e i g h t ,   w i d t h )   {  
                         / / D e t e r m i n e s   w h e n   x ,   y   c o o r d i n a t e s   i s   o v e r   " b "   e l e m e n t  
                         r e t u r n   $ . u i . i s O v e r A x i s ( y ,   t o p ,   h e i g h t )   & &   $ . u i . i s O v e r A x i s ( x ,   l e f t ,   w i d t h ) ;  
                 }  
         } ) ;  
  
 } ) ( j Q u e r y ) ;  
 / * !  
 *   j Q u e r y   U I   W i d g e t   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / W i d g e t  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         / /   j Q u e r y   1 . 4 +  
         i f   ( $ . c l e a n D a t a )   {  
                 v a r   _ c l e a n D a t a   =   $ . c l e a n D a t a ;  
                 $ . c l e a n D a t a   =   f u n c t i o n ( e l e m s )   {  
                         f o r   ( v a r   i   =   0 ,   e l e m ;   ( e l e m   =   e l e m s [ i ] )   ! =   n u l l ;   i + + )   {  
                                 $ ( e l e m ) . t r i g g e r H a n d l e r ( " r e m o v e " ) ;  
                         }  
                         _ c l e a n D a t a ( e l e m s ) ;  
                 } ;  
         }   e l s e   {  
                 v a r   _ r e m o v e   =   $ . f n . r e m o v e ;  
                 $ . f n . r e m o v e   =   f u n c t i o n ( s e l e c t o r ,   k e e p D a t a )   {  
                         r e t u r n   t h i s . e a c h ( f u n c t i o n ( )   {  
                                 i f   ( ! k e e p D a t a )   {  
                                         i f   ( ! s e l e c t o r   | |   $ . f i l t e r ( s e l e c t o r ,   [ t h i s ] ) . l e n g t h )   {  
                                                 $ ( " * " ,   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 . c a l l ( $ ( t h i s ) ,   s e l e c t o r ,   k e e p D a t a ) ;  
                         } ) ;  
                 } ;  
         }  
  
         $ . w i d g e t   =   f u n c t i o n ( n a m e ,   b a s 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 ] ,  
 	 	 f u l l N a m e ;  
                 n a m e   =   n a m e . s p l i t ( " . " ) [ 1 ] ;  
                 f u l l N a m e   =   n a m e s p a c e   +   " - "   +   n a m e ;  
  
                 i f   ( ! p r o t o t y p e )   {  
                         p r o t o t y p e   =   b a s e ;  
                         b a s e   =   $ . W i d g e t ;  
                 }  
  
                 / /   c r e a t e   s e l e c t o r   f o r   p l u g i n  
                 $ . e x p r [ " : " ] [ f u l l N a m e ]   =   f u n c t i o n ( e l e m )   {  
                         r e t u r n   ! ! $ . d a t a ( e l e m ,   n a m e ) ;  
                 } ;  
  
                 $ [ 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 ( o p t i o n s ,   e l e m e n t )   {  
                         / /   a l l o w   i n s t a n t i a t i o n   w i t h o u t   i n i t i a l i z i n g   f o r   s i m p l e   i n h e r i t a n c e  
                         i f   ( a r g u m e n t s . l e n g t h )   {  
                                 t h i s . _ c r e a t e W i d g e t ( o p t i o n s ,   e l e m e n t ) ;  
                         }  
                 } ;  
  
                 v a r   b a s e P r o t o t y p e   =   n e w   b a s e ( ) ;  
                 / /   w e   n e e d   t o   m a k e   t h e   o p t i o n s   h a s h   a   p r o p e r t y   d i r e c t l y   o n   t h e   n e w   i n s t a n c e  
                 / /   o t h e r w i s e   w e ' l l   m o d i f y   t h e   o p t i o n s   h a s h   o n   t h e   p r o t o t y p e   t h a t   w e ' r e  
                 / /   i n h e r i t i n g   f r o m  
                 / / 	 $ . e a c h (   b a s e P r o t o t y p e ,   f u n c t i o n (   k e y ,   v a l   )   {  
                 / / 	 	 i f   (   $ . i s P l a i n O b j e c t ( v a l )   )   {  
                 / / 	 	 	 b a s e P r o t o t y p e [   k e y   ]   =   $ . e x t e n d (   { } ,   v a l   ) ;  
                 / / 	 	 }  
                 / / 	 } ) ;  
                 b a s e P r o t o t y p e . o p t i o n s   =   $ . e x t e n d ( t r u e ,   { } ,   b a s e P r o t o t y p e . o p t i o n s ) ;  
                 $ [ 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 ( t r u e ,   b a s e P r o t o t y p e ,   {  
                         n a m e s p a c e :   n a m e s p a c e ,  
                         w i d g e t N a m e :   n a m e ,  
                         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 ] . p r o t o t y p e . w i d g e t E v e n t P r e f i x   | |   n a m e ,  
                         w i d g e t B a s e C l a s s :   f u l l N a m e  
                 } ,   p r o t o t y p e ) ;  
  
                 $ . w i d g e t . b r i d g e ( n a m e ,   $ [ n a m e s p a c e ] [ n a m e ] ) ;  
         } ;  
  
         $ . w i d g e t . b r i d g e   =   f u n c t i o n ( n a m e ,   o b j e c t )   {  
                 $ . 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 ) ,  
 	 	 	 r e t u r n V a l u e   =   t h i s ;  
  
                         / /   a l l o w   m u l t i p l e   h a s h e s   t o   b e   p a s s e d   o n   i n i t  
                         o p t i o n s   =   ! i s M e t h o d C a l l   & &   a r g s . l e n g t h   ?  
 	 	 	 $ . e x t e n d . a p p l y ( n u l l ,   [ t r u e ,   o p t i o n s ] . c o n c a t ( a r g s ) )   :  
 	 	 	 o p t i o n s ;  
  
                         / /   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 . c h a r A t ( 0 )   = = =   " _ " )   {  
                                 r e t u r n   r e t u r n V a l u e ;  
                         }  
  
                         i f   ( i s M e t h o d C a l l )   {  
                                 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 ) ,  
 	 	 	 	 	 m e t h o d V a l u e   =   i n s t a n c e   & &   $ . 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 )   :  
 	 	 	 	 	 	 i n s t a n c e ;  
                                         / /   T O D O :   a d d   t h i s   b a c k   i n   1 . 9   a n d   u s e   $ . e r r o r ( )   ( s e e   # 5 9 7 2 )  
                                         / / 	 	 	 	 i f   (   ! i n s t a n c e   )   {  
                                         / / 	 	 	 	 	 t h r o w   " c a n n o t   c a l l   m e t h o d s   o n   "   +   n a m e   +   "   p r i o r   t o   i n i t i a l i z a t i o n ;   "   +  
                                         / / 	 	 	 	 	 	 " a t t e m p t e d   t o   c a l l   m e t h o d   ' "   +   o p t i o n s   +   " ' " ;  
                                         / / 	 	 	 	 }  
                                         / / 	 	 	 	 i f   (   ! $ . 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 ]   )   )   {  
                                         / / 	 	 	 	 	 t h r o w   " n o   s u c h   m e t h o d   ' "   +   o p t i o n s   +   " '   f o r   "   +   n a m e   +   "   w i d g e t   i n s t a n c e " ;  
                                         / / 	 	 	 	 }  
                                         / / 	 	 	 	 v a r   m e t h o d V a l u 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   ) ;  
                                         i f   ( m e t h o d V a l u e   ! = =   i n s t a n c e   & &   m e t h o d V a l u e   ! = =   u n d e f i n e d )   {  
                                                 r e t u r n V a l u e   =   m e t h o d V a l u e ;  
                                                 r e t u r n   f a l s e ;  
                                         }  
                                 } ) ;  
                         }   e l s e   {  
                                 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 ) ;  
                                         i f   ( i n s t a n c e )   {  
                                                 i n s t a n c e . o p t i o n ( o p t i o n s   | |   { } ) . _ i n i t ( ) ;  
                                         }   e l s e   {  
                                                 $ . d a t a ( t h i s ,   n a m e ,   n e w   o b j e c t ( o p t i o n s ,   t h i s ) ) ;  
                                         }  
                                 } ) ;  
                         }  
  
                         r e t u r n   r e t u r n V a l u e ;  
                 } ;  
         } ;  
  
         $ . W i d g e t   =   f u n c t i o n ( o p t i o n s ,   e l e m e n t )   {  
                 / /   a l l o w   i n s t a n t i a t i o n   w i t h o u t   i n i t i a l i z i n g   f o r   s i m p l e   i n h e r i t a n c e  
                 i f   ( a r g u m e n t s . l e n g t h )   {  
                         t h i s . _ c r e a t e W i d g e t ( o p t i o n s ,   e l e m e n t ) ;  
                 }  
         } ;  
  
         $ . W i d g e t . p r o t o t y p e   =   {  
                 w i d g e t N a m e :   " w i d g e t " ,  
                 w i d g e t E v e n t P r e f i x :   " " ,  
                 o p t i o n s :   {  
                         d i s a b l e d :   f a l s e  
                 } ,  
                 _ c r e a t e W i d g e t :   f u n c t i o n ( o p t i o n s ,   e l e m e n t )   {  
                         / /   $ . w i d g e t . b r i d g e   s t o r e s   t h e   p l u g i n   i n s t a n c e ,   b u t   w e   d o   i t   a n y w a y  
                         / /   s o   t h a t   i t ' s   s t o r e d   e v e n   b e f o r e   t h e   _ c r e a t e   f u n c t i o n   r u n s  
                         $ . d a t a ( e l e m e n t ,   t h i s . w i d g e t N a m e ,   t h i s ) ;  
                         t h i s . e l e m e n t   =   $ ( e l e m e n t ) ;  
                         t h i s . o p t i o n s   =   $ . e x t e n d ( t r u e ,   { } ,  
 	 	 	 t h i s . o p t i o n s ,  
 	 	 	 t h i s . _ g e t C r e a t e O p t i o n s ( ) ,  
 	 	 	 o p t i o n s ) ;  
  
                         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 ( " r e m o v e . "   +   t h i s . w i d g e t N a m e ,   f u n c t i o n ( )   {  
                                 s e l f . d e s t r o y ( ) ;  
                         } ) ;  
  
                         t h i s . _ c r e a t e ( ) ;  
                         t h i s . _ t r i g g e r ( " c r e a t e " ) ;  
                         t h i s . _ i n i t ( ) ;  
                 } ,  
                 _ g e t C r e a t e O p t i o n s :   f u n c t i o n ( )   {  
                         r e t u r n   $ . m e t a d a t a   & &   $ . m e t a d a t a . g e t ( t h i s . e l e m e n t [ 0 ] ) [ t h i s . w i d g e t N a m e ] ;  
                 } ,  
                 _ c r e a t e :   f u n c t i o n ( )   {   } ,  
                 _ 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  
 	 	 	 . u n b i n d ( " . "   +   t h i s . w i d g e t N a m e )  
 	 	 	 . r e m o v e D a t a ( t h i s . w i d g e t N a m e ) ;  
                         t h i s . w i d g e t ( )  
 	 	 	 . u n b i n d ( " . "   +   t h i s . w i d g e t N a m e )  
 	 	 	 . r e m o v e A t t r ( " a r i a - d i s a b l e d " )  
 	 	 	 . 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   "   +  
 	 	 	 	 " u i - s t a t e - d i s a b l e d " ) ;  
                 } ,  
  
                 w i d g e t :   f u n c t i o n ( )   {  
                         r e t u r n   t h i s . e l e m e n t ;  
                 } ,  
  
                 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 ;  
  
                         i f   ( a r g u m e n t s . l e n g t h   = = =   0 )   {  
                                 / /   d o n ' t   r e t u r n   a   r e f e r e n c e   t o   t h e   i n t e r n a l   h a s h  
                                 r e t u r n   $ . e x t e n d ( { } ,   t h i s . o p t i o n 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 . o p t i o n s [ 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 ;  
                         }  
  
                         t h i s . _ s e t O p t i o n s ( o p t i o n s ) ;  
  
                         r e t u r n   t h i s ;  
                 } ,  
                 _ s e t O p t i o n s :   f u n c t i o n ( o p t i o n s )   {  
                         v a r   s e l f   =   t h i s ;  
                         $ . 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 O p t i o n ( k e y ,   v a l u e ) ;  
                         } ) ;  
  
                         r e t u r n   t h i s ;  
                 } ,  
                 _ s e t O p t i o n :   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 . w i d g e 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 "   +   "   "   +  
 	 	 	 	 	 " u i - s t a t e - d i s a b l e d " )  
 	 	 	 	 . a t t r ( " a r i a - d i s a b l e d " ,   v a l u e ) ;  
                         }  
  
                         r e t u r n   t h i s ;  
                 } ,  
  
                 e n a b l e :   f u n c t i o n ( )   {  
                         r e t u r n   t h i s . _ s e t O p t i o n ( " 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 ( )   {  
                         r e t u r n   t h i s . _ s e t O p t i o n ( " 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 v e n t ,   d a t a )   {  
                         v a r   c a l l b a c k   =   t h i s . o p t i o n s [ t y p e ] ;  
  
                         e v e n t   =   $ . E v e n t ( e v e n t ) ;  
                         e v e n t . t y p 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 ) . t o L o w e r C a s e ( ) ;  
                         d a t a   =   d a t a   | |   { } ;  
  
                         / /   c o p y   o r i g i n a l   e v e n t   p r o p e r t i e s   o v e r   t o   t h e   n e w   e v e n t  
                         / /   t h i s   w o u l d   h a p p e n   i f   w e   c o u l d   c a l l   $ . e v e n t . f i x   i n s t e a d   o f   $ . E v e n t  
                         / /   b u t   w e   d o n ' t   h a v e   a   w a y   t o   f o r c e   a n   e v e n t   t o   b e   f i x e d   m u l t i p l e   t i m e s  
                         i f   ( e v e n t . o r i g i n a l E v e n t )   {  
                                 f o r   ( v a r   i   =   $ . e v e n t . p r o p s . l e n g t h ,   p r o p ;   i ;   )   {  
                                         p r o p   =   $ . e v e n t . p r o p s [ - - i ] ;  
                                         e v e n t [ p r o p ]   =   e v e n t . o r i g i n a l E v e n t [ p r o p ] ;  
                                 }  
                         }  
  
                         t h i s . e l e m e n t . t r i g g e r ( e v e n t ,   d a t a ) ;  
  
                         r e t u r n   ! ( $ . i s F u n c t i o n ( c a l l b a c k )   & &  
 	 	 	 c a l l b a c k . c a l l ( t h i s . e l e m e n t [ 0 ] ,   e v e n t ,   d a t a )   = = =   f a l s e   | |  
 	 	 	 e v e n t . i s D e f a u l t P r e v e n t e d ( ) ) ;  
                 }  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / * !  
 *   j Q u e r y   U I   M o u s e   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / M o u s e  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . u i . w i d g e t . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . w i d g e t ( " u i . m o u s e " ,   {  
                 o p t i o n s :   {  
                         c a n c e l :   ' : i n p u t , o p t i o n ' ,  
                         d i s t a n c e :   1 ,  
                         d e l a y :   0  
                 } ,  
                 _ 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 v e n t )   {  
 	 	 	         r e t u r n   s e l f . _ m o u s e D o w n ( e v e n t ) ;  
 	 	 	 } )  
 	 	 	 . 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 v e n t )   {  
 	 	 	         i f   ( t r u e   = = =   $ . d a t a ( e v e n t . t a r g e t ,   s e l f . w i d g e t N a m e   +   ' . p r e v e n t C l i c k E v e n t ' ) )   {  
 	 	 	                 $ . r e m o v e D a t a ( e v e n t . t a r g e t ,   s e l f . w i d g e t N a m e   +   ' . p r e v e n t C l i c k E v e n t ' ) ;  
 	 	 	                 e v e n t . s t o p I m m e d i a t e P r o p a g a t i o n ( ) ;  
 	 	 	                 r e t u r n   f a l s e ;  
 	 	 	         }  
 	 	 	 } ) ;  
  
                         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 ) ;  
                 } ,  
  
                 _ m o u s e D o w n :   f u n c t i o n ( e v e n t )   {  
                         / /   d o n ' t   l e t   m o r e   t h a n   o n e   w i d g e t   h a n d l e   m o u s e S t a r t  
                         / /   T O D O :   f i g u r e   o u t   w h y   w e   h a v e   t o   u s e   o r i g i n a l E v e n t  
                         e v e n t . o r i g i n a l E v e n t   =   e v e n t . o r i g i n a l E v e n t   | |   { } ;  
                         i f   ( e v e n t . o r i g i n a l E v e n t . m o u s e H a n d l e d )   {   r e t u r n ;   }  
  
                         / /   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 v e n t ) ) ;  
  
                         t h i s . _ m o u s e D o w n E v e n t   =   e v e n t ;  
  
                         v a r   s e l f   =   t h i s ,  
 	 	 	 b t n I s L e f t   =   ( e v e n t . 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 v e n t . t a r g e t ) . p a r e n t s ( ) . a d d ( e v e n t . 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 v e n t ) )   {  
                                 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 v e n t )   & &   t h i s . _ m o u s e D e l a y M e t ( e v e n t ) )   {  
                                 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 v e n t )   ! = =   f a l s e ) ;  
                                 i f   ( ! t h i s . _ m o u s e S t a r t e d )   {  
                                         e v e n t . 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 v e n t )   {  
                                 r e t u r n   s e l f . _ m o u s e M o v e ( e v e n t ) ;  
                         } ;  
                         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 v e n t )   {  
                                 r e t u r n   s e l f . _ m o u s e U p ( e v e n t ) ;  
                         } ;  
                         $ ( 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 ) ;  
  
                         e v e n t . p r e v e n t D e f a u l t ( ) ;  
                         e v e n t . o r i g i n a l E v e n t . m o u s e H a n d l e d   =   t r u e ;  
                         r e t u r n   t r u e ;  
                 } ,  
  
                 _ m o u s e M o v e :   f u n c t i o n ( e v e n t )   {  
                         / /   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   & &   ! ( d o c u m e n t . d o c u m e n t M o d e   > =   9 )   & &   ! e v e n t . b u t t o n )   {  
                                 r e t u r n   t h i s . _ m o u s e U p ( e v e n t ) ;  
                         }  
  
                         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 v e n t ) ;  
                                 r e t u r n   e v e n t . p r e v e n t D e f a u l t ( ) ;  
                         }  
  
                         i f   ( t h i s . _ m o u s e D i s t a n c e M e t ( e v e n t )   & &   t h i s . _ m o u s e D e l a y M e t ( e v e n t ) )   {  
                                 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 v e n t )   ! = =   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 v e n t )   :   t h i s . _ m o u s e U p ( e v e n t ) ) ;  
                         }  
  
                         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 v e n t )   {  
                         $ ( 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 ;  
  
                                 i f   ( e v e n t . t a r g e t   = =   t h i s . _ m o u s e D o w n E v e n t . t a r g e t )   {  
                                         $ . d a t a ( e v e n t . t a r g e t ,   t h i s . w i d g e t N a m e   +   ' . 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 v e n t ) ;  
                         }  
  
                         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 v e n t )   {  
                         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 v e n t . 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 v e n t . 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 v e n t )   {  
                         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 v e n t )   {   } ,  
                 _ m o u s e D r a g :   f u n c t i o n ( e v e n t )   {   } ,  
                 _ m o u s e S t o p :   f u n c t i o n ( e v e n t )   {   } ,  
                 _ m o u s e C a p t u r e :   f u n c t i o n ( e v e n t )   {   r e t u r n   t r u e ;   }  
         } ) ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   D r a g g a b l e   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / D r a g g a b l e s  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . u i . c o r e . j s  
 * 	 j q u e r y . u i . m o u s e . j s  
 * 	 j q u e r y . u i . w i d g e t . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . w i d g e t ( " u i . d r a g g a b l e " ,   $ . u i . m o u s e ,   {  
                 w i d g e t E v e n t P r e f i x :   " d r a g " ,  
                 o p t i o n s :   {  
                         a d d C l a s s e s :   t r u e ,  
                         a p p e n d T o :   " p a r e n t " ,  
                         a x i s :   f a l s e ,  
                         c o n n e c t T o S o r t a b l e :   f a l s e ,  
                         c o n t a i n m e n t :   f a l s e ,  
                         c u r s o r :   " a u t o " ,  
                         c u r s o r A t :   f a l s e ,  
                         g r i d :   f a l s e ,  
                         h a n d l e :   f a l s e ,  
                         h e l p e r :   " o r i g i n a l " ,  
                         i f r a m e F i x :   f a l s e ,  
                         o p a c i t y :   f a l s e ,  
                         r e f r e s h P o s i t i o n s :   f a l s e ,  
                         r e v e r t :   f a l s e ,  
                         r e v e r t D u r a t i o n :   5 0 0 ,  
                         s c o p e :   " d e f a u l t " ,  
                         s c r o l l :   t r u e ,  
                         s c r o l l S e n s i t i v i t y :   2 0 ,  
                         s c r o l l S p e e d :   2 0 ,  
                         s n a p :   f a l s e ,  
                         s n a p M o d e :   " b o t h " ,  
                         s n a p T o l e r a n c e :   2 0 ,  
                         s t a c k :   f a l s e ,  
                         z I n d e x :   f a l s e  
                 } ,  
                 _ c r e a t e :   f u n c t i o n ( )   {  
  
                         i f   ( t h i s . o p t i o n s . h e l p e r   = =   ' o r i g i n a l '   & &   ! ( / ^ ( ? : r | a | f ) / ) . t e s t ( t h i s . e l e m e n t . c s s ( " p o s i t i o n " ) ) )  
                                 t h i s . e l e m e n t [ 0 ] . s t y l e . p o s i t i o n   =   ' r e l a t i v e ' ;  
  
                         ( t h i s . o p t i o n s . a d d C l a s s e s   & &   t h i s . e l e m e n t . a d d C l a s s ( " u i - d r a g g a b l e " ) ) ;  
                         ( t h i s . o p t i o n s . d i s a b l e d   & &   t h i s . e l e m e n t . a d d C l a s s ( " u i - d r a g g a b l e - d i s a b l e d " ) ) ;  
  
                         t h i s . _ m o u s e I n i t ( ) ;  
  
                 } ,  
  
                 d e s t r o y :   f u n c t i o n ( )   {  
                         i f   ( ! t h i s . e l e m e n t . d a t a ( ' d r a g g a b l e ' ) )   r e t u r n ;  
                         t h i s . e l e m e n t  
 	 	 	 . r e m o v e D a t a ( " d r a g g a b l e " )  
 	 	 	 . u n b i n d ( " . d r a g g a b l e " )  
 	 	 	 . r e m o v e C l a s s ( " u i - d r a g g a b l e "  
 	 	 	 	 +   "   u i - d r a g g a b l e - d r a g g i n g "  
 	 	 	 	 +   "   u i - d r a g g a b l e - d i s a b l e d " ) ;  
                         t h i s . _ m o u s e D e s t r o y ( ) ;  
  
                         r e t u r n   t h i s ;  
                 } ,  
  
                 _ m o u s e C a p t u r e :   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 ;  
  
                         / /   a m o n g   o t h e r s ,   p r e v e n t   a   d r a g   o n   a   r e s i z a b l e - h a n d l e  
                         i f   ( t h i s . h e l p e r   | |   o . d i s a b l e d   | |   $ ( e v e n t . t a r g e t ) . i s ( ' . u i - r e s i z a b l e - h a n d l e ' ) )  
                                 r e t u r n   f a l s e ;  
  
                         / / Q u i t   i f   w e ' r e   n o t   o n   a   v a l i d   h a n d l e  
                         t h i s . h a n d l e   =   t h i s . _ g e t H a n d l e ( e v e n t ) ;  
                         i f   ( ! t h i s . h a n d l e )  
                                 r e t u r n   f a l s e ;  
  
                         r e t u r n   t r u e ;  
  
                 } ,  
  
                 _ m o u s e S t a r t :   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 ;  
  
                         / / C r e a t e   a n d   a p p e n d   t h e   v i s i b l e   h e l p e r  
                         t h i s . h e l p e r   =   t h i s . _ c r e a t e H e l p e r ( e v e n t ) ;  
  
                         / / C a c h e   t h e   h e l p e r   s i z e  
                         t h i s . _ c a c h e H e l p e r P r o p o r t i o n s ( ) ;  
  
                         / / I f   d d m a n a g e r   i s   u s e d   f o r   d r o p p a b l e s ,   s e t   t h e   g l o b a l   d r a g g a b l e  
                         i f   ( $ . u i . d d m a n a g e r )  
                                 $ . u i . d d m a n a g e r . c u r r e n t   =   t h i s ;  
  
                         / *  
                         *   -   P o s i t i o n   g e n e r a t i o n   -  
                         *   T h i s   b l o c k   g e n e r a t e s   e v e r y t h i n g   p o s i t i o n   r e l a t e d   -   i t ' s   t h e   c o r e   o f   d r a g g a b l e s .  
                         * /  
  
                         / / C a c h e   t h e   m a r g i n s   o f   t h e   o r i g i n a l   e l e m e n t  
                         t h i s . _ c a c h e M a r g i n s ( ) ;  
  
                         / / S t o r e   t h e   h e l p e r ' s   c s s   p o s i t i o n  
                         t h i s . c s s P o s i t i o n   =   t h i s . h e l p e r . c s s ( " p o s i t i o n " ) ;  
                         t h i s . s c r o l l P a r e n t   =   t h i s . h e l p e r . s c r o l l P a r e n t ( ) ;  
  
                         / / T h e   e l e m e n t ' s   a b s o l u t e   p o s i t i o n   o n   t h e   p a g e   m i n u s   m a r g i n s  
                         t h i s . o f f s e t   =   t h i s . p o s i t i o n A b s   =   t h i s . e l e m e n t . o f f s e t ( ) ;  
                         t h i s . o f f s e t   =   {  
                                 t o p :   t h i s . o f f s e t . t o p   -   t h i s . m a r g i n s . t o p ,  
                                 l e f t :   t h i s . o f f s e t . l e f t   -   t h i s . m a r g i n s . l e f t  
                         } ;  
  
                         $ . e x t e n d ( t h i s . o f f s e t ,   {  
                                 c l i c k :   {   / / W h e r e   t h e   c l i c k   h a p p e n e d ,   r e l a t i v e   t o   t h e   e l e m e n t  
                                         l e f t :   e v e n t . p a g e X   -   t h i s . o f f s e t . l e f t ,  
                                         t o p :   e v e n t . p a g e Y   -   t h i s . o f f s e t . t o p  
                                 } ,  
                                 p a r e n t :   t h i s . _ g e t P a r e n t O f f s e t ( ) ,  
                                 r e l a t i v e :   t h i s . _ g e t R e l a t i v e O f f s e t ( )   / / T h i s   i s   a   r e l a t i v e   t o   a b s o l u t e   p o s i t i o n   m i n u s   t h e   a c t u a l   p o s i t i o n   c a l c u l a t i o n   -   o n l y   u s e d   f o r   r e l a t i v e   p o s i t i o n e d   h e l p e r  
                         } ) ;  
  
                         / / G e n e r a t e   t h e   o r i g i n a l   p o s i t i o n  
                         t h i s . o r i g i n a l P o s i t i o n   =   t h i s . p o s i t i o n   =   t h i s . _ g e n e r a t e P o s i t i o n ( e v e n t ) ;  
                         t h i s . o r i g i n a l P a g e X   =   e v e n t . p a g e X ;  
                         t h i s . o r i g i n a l P a g e Y   =   e v e n t . p a g e Y ;  
  
                         / / A d j u s t   t h e   m o u s e   o f f s e t   r e l a t i v e   t o   t h e   h e l p e r   i f   ' c u r s o r A t '   i s   s u p p l i e d  
                         ( o . c u r s o r A t   & &   t h i s . _ a d j u s t O f f s e t F r o m H e l p e r ( o . c u r s o r A t ) ) ;  
  
                         / / S e t   a   c o n t a i n m e n t   i f   g i v e n   i n   t h e   o p t i o n s  
                         i f   ( o . c o n t a i n m e n t )  
                                 t h i s . _ s e t C o n t a i n m e n t ( ) ;  
  
                         / / T r i g g e r   e v e n t   +   c a l l b a c k s  
                         i f   ( t h i s . _ t r i g g e r ( " s t a r t " ,   e v e n t )   = = =   f a l s e )   {  
                                 t h i s . _ c l e a r ( ) ;  
                                 r e t u r n   f a l s e ;  
                         }  
  
                         / / R e c a c h e   t h e   h e l p e r   s i z e  
                         t h i s . _ c a c h e H e l p e r P r o p o r t i o n s ( ) ;  
  
                         / / P r e p a r e   t h e   d r o p p a b l e   o f f s e t s  
                         i f   ( $ . u i . d d m a n a g e r   & &   ! o . d r o p B e h a v i o u r )  
                                 $ . u i . d d m a n a g e r . p r e p a r e O f f s e t s ( t h i s ,   e v e n t ) ;  
  
                         t h i s . h e l p e r . a d d C l a s s ( " u i - d r a g g a b l e - d r a g g i n g " ) ;  
                         t h i s . _ m o u s e D r a g ( e v e n t ,   t r u e ) ;   / / E x e c u t e   t h e   d r a g   o n c e   -   t h i s   c a u s e s   t h e   h e l p e r   n o t   t o   b e   v i s i b l e   b e f o r e   g e t t i n g   i t s   c o r r e c t   p o s i t i o n  
                         r e t u r n   t r u e ;  
                 } ,  
  
                 _ m o u s e D r a g :   f u n c t i o n ( e v e n t ,   n o P r o p a g a t i o n )   {  
  
                         / / C o m p u t e   t h e   h e l p e r s   p o s i t i o n  
                         t h i s . p o s i t i o n   =   t h i s . _ g e n e r a t e P o s i t i o n ( e v e n t ) ;  
                         t h i s . p o s i t i o n A b s   =   t h i s . _ c o n v e r t P o s i t i o n T o ( " a b s o l u t e " ) ;  
  
                         / / C a l l   p l u g i n s   a n d   c a l l b a c k s   a n d   u s e   t h e   r e s u l t i n g   p o s i t i o n   i f   s o m e t h i n g   i s   r e t u r n e d  
                         i f   ( ! n o P r o p a g a t i o n )   {  
                                 v a r   u i   =   t h i s . _ u i H a s h ( ) ;  
                                 i f   ( t h i s . _ t r i g g e r ( ' d r a g ' ,   e v e n t ,   u i )   = = =   f a l s e )   {  
                                         t h i s . _ m o u s e U p ( { } ) ;  
                                         r e t u r n   f a l s e ;  
                                 }  
                                 t h i s . p o s i t i o n   =   u i . p o s i t i o n ;  
                         }  
  
                         i f   ( ! t h i s . o p t i o n s . a x i s   | |   t h i s . o p t i o n s . a x i s   ! =   " y " )   t h i s . h e l p e r [ 0 ] . s t y l e . l e f t   =   t h i s . p o s i t i o n . l e f t   +   ' p x ' ;  
                         i f   ( ! t h i s . o p t i o n s . a x i s   | |   t h i s . o p t i o n s . a x i s   ! =   " x " )   t h i s . h e l p e r [ 0 ] . s t y l e . t o p   =   t h i s . p o s i t i o n . t o p   +   ' p x ' ;  
                         i f   ( $ . u i . d d m a n a g e r )   $ . u i . d d m a n a g e r . d r a g ( t h i s ,   e v e n t ) ;  
  
                         r e t u r n   f a l s e ;  
                 } ,  
  
                 _ m o u s e S t o p :   f u n c t i o n ( e v e n t )   {  
  
                         / / I f   w e   a r e   u s i n g   d r o p p a b l e s ,   i n f o r m   t h e   m a n a g e r   a b o u t   t h e   d r o p  
                         v a r   d r o p p e d   =   f a l s e ;  
                         i f   ( $ . u i . d d m a n a g e r   & &   ! t h i s . o p t i o n s . d r o p B e h a v i o u r )  
                                 d r o p p e d   =   $ . u i . d d m a n a g e r . d r o p ( t h i s ,   e v e n t ) ;  
  
                         / / i f   a   d r o p   c o m e s   f r o m   o u t s i d e   ( a   s o r t a b l e )  
                         i f   ( t h i s . d r o p p e d )   {  
                                 d r o p p e d   =   t h i s . d r o p p e d ;  
                                 t h i s . d r o p p e d   =   f a l s e ;  
                         }  
  
                         / / i f   t h e   o r i g i n a l   e l e m e n t   i s   r e m o v e d ,   d o n ' t   b o t h e r   t o   c o n t i n u e   i f   h e l p e r   i s   s e t   t o   " o r i g i n a l "  
                         i f   ( ( ! t h i s . e l e m e n t [ 0 ]   | |   ! t h i s . e l e m e n t [ 0 ] . p a r e n t N o d e )   & &   t h i s . o p t i o n s . h e l p e r   = =   " o r i g i n a l " )  
                                 r e t u r n   f a l s e ;  
  
                         i f   ( ( t h i s . o p t i o n s . r e v e r t   = =   " i n v a l i d "   & &   ! d r o p p e d )   | |   ( t h i s . o p t i o n s . r e v e r t   = =   " v a l i d "   & &   d r o p p e d )   | |   t h i s . o p t i o n s . r e v e r t   = = =   t r u e   | |   ( $ . i s F u n c t i o n ( t h i s . o p t i o n s . r e v e r t )   & &   t h i s . o p t i o n s . r e v e r t . c a l l ( t h i s . e l e m e n t ,   d r o p p e d ) ) )   {  
                                 v a r   s e l f   =   t h i s ;  
                                 $ ( t h i s . h e l p e r ) . a n i m a t e ( t h i s . o r i g i n a l P o s i t i o n ,   p a r s e I n t ( t h i s . o p t i o n s . r e v e r t D u r a t i o n ,   1 0 ) ,   f u n c t i o n ( )   {  
                                         i f   ( s e l f . _ t r i g g e r ( " s t o p " ,   e v e n t )   ! = =   f a l s e )   {  
                                                 s e l f . _ c l e a r ( ) ;  
                                         }  
                                 } ) ;  
                         }   e l s e   {  
                                 i f   ( t h i s . _ t r i g g e r ( " s t o p " ,   e v e n t )   ! = =   f a l s e )   {  
                                         t h i s . _ c l e a r ( ) ;  
                                 }  
                         }  
  
                         r e t u r n   f a l s e ;  
                 } ,  
  
                 c a n c e l :   f u n c t i o n ( )   {  
  
                         i f   ( t h i s . h e l p e r . i s ( " . u i - d r a g g a b l e - d r a g g i n g " ) )   {  
                                 t h i s . _ m o u s e U p ( { } ) ;  
                         }   e l s e   {  
                                 t h i s . _ c l e a r ( ) ;  
                         }  
  
                         r e t u r n   t h i s ;  
  
                 } ,  
  
                 _ g e t H a n d l e :   f u n c t i o n ( e v e n t )   {  
  
                         v a r   h a n d l e   =   ! t h i s . o p t i o n s . h a n d l e   | |   ! $ ( t h i s . o p t i o n s . h a n d l e ,   t h i s . e l e m e n t ) . l e n g t h   ?   t r u e   :   f a l s e ;  
                         $ ( t h i s . o p t i o n s . h a n d l e ,   t h i s . e l e m e n t )  
 	 	 	 . f i n d ( " * " )  
 	 	 	 . a n d S e l f ( )  
 	 	 	 . e a c h ( f u n c t i o n ( )   {  
 	 	 	         i f   ( t h i s   = =   e v e n t . t a r g e t )   h a n d l e   =   t r u e ;  
 	 	 	 } ) ;  
  
                         r e t u r n   h a n d l e ;  
  
                 } ,  
  
                 _ c r e a t e H e l p e r :   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 ;  
                         v a r   h e l p e r   =   $ . i s F u n c t i o n ( o . h e l p e r )   ?   $ ( o . h e l p e r . a p p l y ( t h i s . e l e m e n t [ 0 ] ,   [ e v e n t ] ) )   :   ( o . h e l p e r   = =   ' c l o n e '   ?   t h i s . e l e m e n t . c l o n e ( )   :   t h i s . e l e m e n t ) ;  
  
                         i f   ( ! h e l p e r . p a r e n t s ( ' b o d y ' ) . l e n g t h )  
                                 h e l p e r . a p p e n d T o ( ( o . a p p e n d T o   = =   ' p a r e n t '   ?   t h i s . e l e m e n t [ 0 ] . p a r e n t N o d e   :   o . a p p e n d T o ) ) ;  
  
                         i f   ( h e l p e r [ 0 ]   ! =   t h i s . e l e m e n t [ 0 ]   & &   ! ( / ( f i x e d | a b s o l u t e ) / ) . t e s t ( h e l p e r . c s s ( " p o s i t i o n " ) ) )  
                                 h e l p e r . c s s ( " p o s i t i o n " ,   " a b s o l u t e " ) ;  
  
                         r e t u r n   h e l p e r ;  
  
                 } ,  
  
                 _ a d j u s t O f f s e t F r o m H e l p e r :   f u n c t i o n ( o b j )   {  
                         i f   ( t y p e o f   o b j   = =   ' s t r i n g ' )   {  
                                 o b j   =   o b j . s p l i t ( '   ' ) ;  
                         }  
                         i f   ( $ . i s A r r a y ( o b j ) )   {  
                                 o b j   =   {   l e f t :   + o b j [ 0 ] ,   t o p :   + o b j [ 1 ]   | |   0   } ;  
                         }  
                         i f   ( ' l e f t '   i n   o b j )   {  
                                 t h i s . o f f s e t . c l i c k . l e f t   =   o b j . l e f t   +   t h i s . m a r g i n s . l e f t ;  
                         }  
                         i f   ( ' r i g h t '   i n   o b j )   {  
                                 t h i s . o f f s e t . c l i c k . l e f t   =   t h i s . h e l p e r P r o p o r t i o n s . w i d t h   -   o b j . r i g h t   +   t h i s . m a r g i n s . l e f t ;  
                         }  
                         i f   ( ' t o p '   i n   o b j )   {  
                                 t h i s . o f f s e t . c l i c k . t o p   =   o b j . t o p   +   t h i s . m a r g i n s . t o p ;  
                         }  
                         i f   ( ' b o t t o m '   i n   o b j )   {  
                                 t h i s . o f f s e t . c l i c k . t o p   =   t h i s . h e l p e r P r o p o r t i o n s . h e i g h t   -   o b j . b o t t o m   +   t h i s . m a r g i n s . t o p ;  
                         }  
                 } ,  
  
                 _ g e t P a r e n t O f f s e t :   f u n c t i o n ( )   {  
  
                         / / G e t   t h e   o f f s e t P a r e n t   a n d   c a c h e   i t s   p o s i t i o n  
                         t h i s . o f f s e t P a r e n t   =   t h i s . h e l p e r . o f f s e t P a r e n t ( ) ;  
                         v a r   p o   =   t h i s . o f f s e t P a r e n t . o f f s e t ( ) ;  
  
                         / /   T h i s   i s   a   s p e c i a l   c a s e   w h e r e   w e   n e e d   t o   m o d i f y   a   o f f s e t   c a l c u l a t e d   o n   s t a r t ,   s i n c e   t h e   f o l l o w i n g   h a p p e n e d :  
                         / /   1 .   T h e   p o s i t i o n   o f   t h e   h e l p e r   i s   a b s o l u t e ,   s o   i t ' s   p o s i t i o n   i s   c a l c u l a t e d   b a s e d   o n   t h e   n e x t   p o s i t i o n e d   p a r e n t  
                         / /   2 .   T h e   a c t u a l   o f f s e t   p a r e n t   i s   a   c h i l d   o f   t h e   s c r o l l   p a r e n t ,   a n d   t h e   s c r o l l   p a r e n t   i s n ' t   t h e   d o c u m e n t ,   w h i c h   m e a n s   t h a t  
                         / /         t h e   s c r o l l   i s   i n c l u d e d   i n   t h e   i n i t i a l   c a l c u l a t i o n   o f   t h e   o f f s e t   o f   t h e   p a r e n t ,   a n d   n e v e r   r e c a l c u l a t e d   u p o n   d r a g  
                         i f   ( t h i s . c s s P o s i t i o n   = =   ' a b s o l u t e '   & &   t h i s . s c r o l l P a r e n t [ 0 ]   ! =   d o c u m e n t   & &   $ . u i . c o n t a i n s ( t h i s . s c r o l l P a r e n t [ 0 ] ,   t h i s . o f f s e t P a r e n t [ 0 ] ) )   {  
                                 p o . l e f t   + =   t h i s . s c r o l l P a r e n t . s c r o l l L e f t ( ) ;  
                                 p o . t o p   + =   t h i s . s c r o l l P a r e n t . s c r o l l T o p ( ) ;  
                         }  
  
                         i f   ( ( t h i s . o f f s e t P a r e n t [ 0 ]   = =   d o c u m e n t . b o d y )   / / T h i s   n e e d s   t o   b e   a c t u a l l y   d o n e   f o r   a l l   b r o w s e r s ,   s i n c e   p a g e X / p a g e Y   i n c l u d e s   t h i s   i n f o r m a t i o n  
 	 	 | |   ( t h i s . o f f s e t P a r e n t [ 0 ] . t a g N a m e   & &   t h i s . o f f s e t P a r e n t [ 0 ] . t a g N a m e . t o L o w e r C a s e ( )   = =   ' h t m l '   & &   $ . b r o w s e r . m s i e ) )   / / U g l y   I E   f i x  
                                 p o   =   {   t o p :   0 ,   l e f t :   0   } ;  
  
                         r e t u r n   {  
                                 t o p :   p o . t o p   +   ( p a r s e I n t ( t h i s . o f f s e t P a r e n t . c s s ( " b o r d e r T o p W i d t h " ) ,   1 0 )   | |   0 ) ,  
                                 l e f t :   p o . l e f t   +   ( p a r s e I n t ( t h i s . o f f s e t P a r e n t . c s s ( " b o r d e r L e f t W i d t h " ) ,   1 0 )   | |   0 )  
                         } ;  
  
                 } ,  
  
                 _ g e t R e l a t i v e O f f s e t :   f u n c t i o n ( )   {  
  
                         i f   ( t h i s . c s s P o s i t i o n   = =   " r e l a t i v e " )   {  
                                 v a r   p   =   t h i s . e l e m e n t . p o s i t i o n ( ) ;  
                                 r e t u r n   {  
                                         t o p :   p . t o p   -   ( p a r s e I n t ( t h i s . h e l p e r . c s s ( " t o p " ) ,   1 0 )   | |   0 )   +   t h i s . s c r o l l P a r e n t . s c r o l l T o p ( ) ,  
                                         l e f t :   p . l e f t   -   ( p a r s e I n t ( t h i s . h e l p e r . c s s ( " l e f t " ) ,   1 0 )   | |   0 )   +   t h i s . s c r o l l P a r e n t . s c r o l l L e f t ( )  
                                 } ;  
                         }   e l s e   {  
                                 r e t u r n   {   t o p :   0 ,   l e f t :   0   } ;  
                         }  
  
                 } ,  
  
                 _ c a c h e M a r g i n s :   f u n c t i o n ( )   {  
                         t h i s . m a r g i n s   =   {  
                                 l e f t :   ( p a r s e I n t ( t h i s . e l e m e n t . c s s ( " m a r g i n L e f t " ) ,   1 0 )   | |   0 ) ,  
                                 t o p :   ( p a r s e I n t ( t h i s . e l e m e n t . c s s ( " m a r g i n T o p " ) ,   1 0 )   | |   0 )  
                         } ;  
                 } ,  
  
                 _ c a c h e H e l p e r P r o p o r t i o n s :   f u n c t i o n ( )   {  
                         t h i s . h e l p e r P r o p o r t i o n s   =   {  
                                 w i d t h :   t h i s . h e l p e r . o u t e r W i d t h ( ) ,  
                                 h e i g h t :   t h i s . h e l p e r . o u t e r H e i g h t ( )  
                         } ;  
                 } ,  
  
                 _ s e t C o n t a i n m e n t :   f u n c t i o n ( )   {  
  
                         v a r   o   =   t h i s . o p t i o n s ;  
                         i f   ( o . c o n t a i n m e n t   = =   ' p a r e n t ' )   o . c o n t a i n m e n t   =   t h i s . h e l p e r [ 0 ] . p a r e n t N o d e ;  
                         i f   ( o . c o n t a i n m e n t   = =   ' d o c u m e n t '   | |   o . c o n t a i n m e n t   = =   ' w i n d o w ' )   t h i s . c o n t a i n m e n t   =   [  
 	 	 	 ( o . c o n t a i n m e n t   = =   ' d o c u m e n t '   ?   0   :   $ ( w i n d o w ) . s c r o l l L e f t ( ) )   -   t h i s . o f f s e t . r e l a t i v e . l e f t   -   t h i s . o f f s e t . p a r e n t . l e f t ,  
 	 	 	 ( o . c o n t a i n m e n t   = =   ' d o c u m e n t '   ?   0   :   $ ( w i n d o w ) . s c r o l l T o p ( ) )   -   t h i s . o f f s e t . r e l a t i v e . t o p   -   t h i s . o f f s e t . p a r e n t . t o p ,  
 	 	 	 ( o . c o n t a i n m e n t   = =   ' d o c u m e n t '   ?   0   :   $ ( w i n d o w ) . s c r o l l L e f t ( ) )   +   $ ( o . c o n t a i n m e n t   = =   ' d o c u m e n t '   ?   d o c u m e n t   :   w i n d o w ) . w i d t h ( )   -   t h i s . h e l p e r P r o p o r t i o n s . w i d t h   -   t h i s . m a r g i n s . l e f t ,  
 	 	 	 ( o . c o n t a i n m e n t   = =   ' d o c u m e n t '   ?   0   :   $ ( w i n d o w ) . s c r o l l T o p ( ) )   +   ( $ ( o . c o n t a i n m e n t   = =   ' d o c u m e n t '   ?   d o c u m e n t   :   w i n d o w ) . h e i g h t ( )   | |   d o c u m e n t . b o d y . p a r e n t N o d e . s c r o l l H e i g h t )   -   t h i s . h e l p e r P r o p o r t i o n s . h e i g h t   -   t h i s . m a r g i n s . t o p  
 	 	 ] ;  
  
                         i f   ( ! ( / ^ ( d o c u m e n t | w i n d o w | p a r e n t ) $ / ) . t e s t ( o . c o n t a i n m e n t )   & &   o . c o n t a i n m e n t . c o n s t r u c t o r   ! =   A r r a y )   {  
                                 v a r   c e   =   $ ( o . c o n t a i n m e n t ) [ 0 ] ;   i f   ( ! c e )   r e t u r n ;  
                                 v a r   c o   =   $ ( o . c o n t a i n m e n t ) . o f f s e t ( ) ;  
                                 v a r   o v e r   =   ( $ ( c e ) . c s s ( " o v e r f l o w " )   ! =   ' h i d d e n ' ) ;  
  
                                 t h i s . c o n t a i n m e n t   =   [  
 	 	 	 	 c o . l e f t   +   ( p a r s e I n t ( $ ( c e ) . 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 ( $ ( c e ) . c s s ( " p a d d i n g L e f t " ) ,   1 0 )   | |   0 )   -   t h i s . m a r g i n s . l e f t ,  
 	 	 	 	 c o . t o p   +   ( p a r s e I n t ( $ ( c e ) . c s s ( " b o r d e r T o p W i d t h " ) ,   1 0 )   | |   0 )   +   ( p a r s e I n t ( $ ( c e ) . c s s ( " p a d d i n g T o p " ) ,   1 0 )   | |   0 )   -   t h i s . m a r g i n s . t o p ,  
 	 	 	 	 c o . l e f t   +   ( o v e r   ?   M a t h . m a x ( c e . s c r o l l W i d t h ,   c e . o f f s e t W i d t h )   :   c e . o f f s e t W i d t h )   -   ( p a r s e I n t ( $ ( c e ) . 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 ( $ ( c e ) . c s s ( " p a d d i n g R i g h t " ) ,   1 0 )   | |   0 )   -   t h i s . h e l p e r P r o p o r t i o n s . w i d t h   -   t h i s . m a r g i n s . l e f t ,  
 	 	 	 	 c o . t o p   +   ( o v e r   ?   M a t h . m a x ( c e . s c r o l l H e i g h t ,   c e . o f f s e t H e i g h t )   :   c e . o f f s e t H e i g h t )   -   ( p a r s e I n t ( $ ( c e ) . c s s ( " b o r d e r T o p W i d t h " ) ,   1 0 )   | |   0 )   -   ( p a r s e I n t ( $ ( c e ) . c s s ( " p a d d i n g B o t t o m " ) ,   1 0 )   | |   0 )   -   t h i s . h e l p e r P r o p o r t i o n s . h e i g h t   -   t h i s . m a r g i n s . t o p  
 	 	 	 ] ;  
                         }   e l s e   i f   ( o . c o n t a i n m e n t . c o n s t r u c t o r   = =   A r r a y )   {  
                                 t h i s . c o n t a i n m e n t   =   o . c o n t a i n m e n t ;  
                         }  
  
                 } ,  
  
                 _ c o n v e r t P o s i t i o n T o :   f u n c t i o n ( d ,   p o s )   {  
  
                         i f   ( ! p o s )   p o s   =   t h i s . p o s i t i o n ;  
                         v a r   m o d   =   d   = =   " a b s o l u t e "   ?   1   :   - 1 ;  
                         v a r   o   =   t h i s . o p t i o n s ,   s c r o l l   =   t h i s . c s s P o s i t i o n   = =   ' a b s o l u t e '   & &   ! ( t h i s . s c r o l l P a r e n t [ 0 ]   ! =   d o c u m e n t   & &   $ . u i . c o n t a i n s ( t h i s . s c r o l l P a r e n t [ 0 ] ,   t h i s . o f f s e t P a r e n t [ 0 ] ) )   ?   t h i s . o f f s e t P a r e n t   :   t h i s . s c r o l l P a r e n t ,   s c r o l l I s R o o t N o d e   =   ( / ( h t m l | b o d y ) / i ) . t e s t ( s c r o l l [ 0 ] . t a g N a m e ) ;  
  
                         r e t u r n   {  
                                 t o p :   (  
 	 	 	 	 p o s . t o p 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   a b s o l u t e   m o u s e   p o s i t i o n  
 	 	 	 	 +   t h i s . o f f s e t . r e l a t i v e . t o p   *   m o d 	 	 	 	 	 	 	 	 	 	 / /   O n l y   f o r   r e l a t i v e   p o s i t i o n e d   n o d e s :   R e l a t i v e   o f f s e t   f r o m   e l e m e n t   t o   o f f s e t   p a r e n t  
 	 	 	 	 +   t h i s . o f f s e t . p a r e n t . t o p   *   m o d 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   o f f s e t P a r e n t ' s   o f f s e t   w i t h o u t   b o r d e r s   ( o f f s e t   +   b o r d e r )  
 	 	 	 	 -   ( $ . b r o w s e r . s a f a r i   & &   $ . b r o w s e r . v e r s i o n   <   5 2 6   & &   t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   0   :   ( t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   - t h i s . s c r o l l P a r e n t . s c r o l l T o p ( )   :   ( s c r o l l I s R o o t N o d e   ?   0   :   s c r o l l . s c r o l l T o p ( ) ) )   *   m o d )  
 	 	 	 ) ,  
                                 l e f t :   (  
 	 	 	 	 p o s . l e f t 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   a b s o l u t e   m o u s e   p o s i t i o n  
 	 	 	 	 +   t h i s . o f f s e t . r e l a t i v e . l e f t   *   m o d 	 	 	 	 	 	 	 	 	 	 / /   O n l y   f o r   r e l a t i v e   p o s i t i o n e d   n o d e s :   R e l a t i v e   o f f s e t   f r o m   e l e m e n t   t o   o f f s e t   p a r e n t  
 	 	 	 	 +   t h i s . o f f s e t . p a r e n t . l e f t   *   m o d 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   o f f s e t P a r e n t ' s   o f f s e t   w i t h o u t   b o r d e r s   ( o f f s e t   +   b o r d e r )  
 	 	 	 	 -   ( $ . b r o w s e r . s a f a r i   & &   $ . b r o w s e r . v e r s i o n   <   5 2 6   & &   t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   0   :   ( t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   - t h i s . s c r o l l P a r e n t . s c r o l l L e f t ( )   :   s c r o l l I s R o o t N o d e   ?   0   :   s c r o l l . s c r o l l L e f t ( ) )   *   m o d )  
 	 	 	 )  
                         } ;  
  
                 } ,  
  
                 _ g e n e r a t e P o s i t i o 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 ,   s c r o l l   =   t h i s . c s s P o s i t i o n   = =   ' a b s o l u t e '   & &   ! ( t h i s . s c r o l l P a r e n t [ 0 ]   ! =   d o c u m e n t   & &   $ . u i . c o n t a i n s ( t h i s . s c r o l l P a r e n t [ 0 ] ,   t h i s . o f f s e t P a r e n t [ 0 ] ) )   ?   t h i s . o f f s e t P a r e n t   :   t h i s . s c r o l l P a r e n t ,   s c r o l l I s R o o t N o d e   =   ( / ( h t m l | b o d y ) / i ) . t e s t ( s c r o l l [ 0 ] . t a g N a m e ) ;  
                         v a r   p a g e X   =   e v e n t . p a g e X ;  
                         v a r   p a g e Y   =   e v e n t . p a g e Y ;  
  
                         / *  
                         *   -   P o s i t i o n   c o n s t r a i n i n g   -  
                         *   C o n s t r a i n   t h e   p o s i t i o n   t o   a   m i x   o f   g r i d ,   c o n t a i n m e n t .  
                         * /  
  
                         i f   ( t h i s . o r i g i n a l P o s i t i o n )   {   / / I f   w e   a r e   n o t   d r a g g i n g   y e t ,   w e   w o n ' t   c h e c k   f o r   o p t i o n s  
  
                                 i f   ( t h i s . c o n t a i n m e n t )   {  
                                         i f   ( e v e n t . p a g e X   -   t h i s . o f f s e t . c l i c k . l e f t   <   t h i s . c o n t a i n m e n t [ 0 ] )   p a g e X   =   t h i s . c o n t a i n m e n t [ 0 ]   +   t h i s . o f f s e t . c l i c k . l e f t ;  
                                         i f   ( e v e n t . p a g e Y   -   t h i s . o f f s e t . c l i c k . t o p   <   t h i s . c o n t a i n m e n t [ 1 ] )   p a g e Y   =   t h i s . c o n t a i n m e n t [ 1 ]   +   t h i s . o f f s e t . c l i c k . t o p ;  
                                         i f   ( e v e n t . p a g e X   -   t h i s . o f f s e t . c l i c k . l e f t   >   t h i s . c o n t a i n m e n t [ 2 ] )   p a g e X   =   t h i s . c o n t a i n m e n t [ 2 ]   +   t h i s . o f f s e t . c l i c k . l e f t ;  
                                         i f   ( e v e n t . p a g e Y   -   t h i s . o f f s e t . c l i c k . t o p   >   t h i s . c o n t a i n m e n t [ 3 ] )   p a g e Y   =   t h i s . c o n t a i n m e n t [ 3 ]   +   t h i s . o f f s e t . c l i c k . t o p ;  
                                 }  
  
                                 i f   ( o . g r i d )   {  
                                         v a r   t o p   =   t h i s . o r i g i n a l P a g e Y   +   M a t h . r o u n d ( ( p a g e Y   -   t h i s . o r i g i n a l P a g e Y )   /   o . g r i d [ 1 ] )   *   o . g r i d [ 1 ] ;  
                                         p a g e Y   =   t h i s . c o n t a i n m e n t   ?   ( ! ( t o p   -   t h i s . o f f s e t . c l i c k . t o p   <   t h i s . c o n t a i n m e n t [ 1 ]   | |   t o p   -   t h i s . o f f s e t . c l i c k . t o p   >   t h i s . c o n t a i n m e n t [ 3 ] )   ?   t o p   :   ( ! ( t o p   -   t h i s . o f f s e t . c l i c k . t o p   <   t h i s . c o n t a i n m e n t [ 1 ] )   ?   t o p   -   o . g r i d [ 1 ]   :   t o p   +   o . g r i d [ 1 ] ) )   :   t o p ;  
  
                                         v a r   l e f t   =   t h i s . o r i g i n a l P a g e X   +   M a t h . r o u n d ( ( p a g e X   -   t h i s . o r i g i n a l P a g e X )   /   o . g r i d [ 0 ] )   *   o . g r i d [ 0 ] ;  
                                         p a g e X   =   t h i s . c o n t a i n m e n t   ?   ( ! ( l e f t   -   t h i s . o f f s e t . c l i c k . l e f t   <   t h i s . c o n t a i n m e n t [ 0 ]   | |   l e f t   -   t h i s . o f f s e t . c l i c k . l e f t   >   t h i s . c o n t a i n m e n t [ 2 ] )   ?   l e f t   :   ( ! ( l e f t   -   t h i s . o f f s e t . c l i c k . l e f t   <   t h i s . c o n t a i n m e n t [ 0 ] )   ?   l e f t   -   o . g r i d [ 0 ]   :   l e f t   +   o . g r i d [ 0 ] ) )   :   l e f t ;  
                                 }  
  
                         }  
  
                         r e t u r n   {  
                                 t o p :   (  
 	 	 	 	 p a g e Y 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   a b s o l u t e   m o u s e   p o s i t i o n  
 	 	 	 	 -   t h i s . o f f s e t . c l i c k . t o p 	 	 	 	 	 	 	 	 	 	 	 	 	 / /   C l i c k   o f f s e t   ( r e l a t i v e   t o   t h e   e l e m e n t )  
 	 	 	 	 -   t h i s . o f f s e t . r e l a t i v e . t o p 	 	 	 	 	 	 	 	 	 	 	 	 / /   O n l y   f o r   r e l a t i v e   p o s i t i o n e d   n o d e s :   R e l a t i v e   o f f s e t   f r o m   e l e m e n t   t o   o f f s e t   p a r e n t  
 	 	 	 	 -   t h i s . o f f s e t . p a r e n t . t o p 	 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   o f f s e t P a r e n t ' s   o f f s e t   w i t h o u t   b o r d e r s   ( o f f s e t   +   b o r d e r )  
 	 	 	 	 +   ( $ . b r o w s e r . s a f a r i   & &   $ . b r o w s e r . v e r s i o n   <   5 2 6   & &   t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   0   :   ( t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   - t h i s . s c r o l l P a r e n t . s c r o l l T o p ( )   :   ( s c r o l l I s R o o t N o d e   ?   0   :   s c r o l l . s c r o l l T o p ( ) ) ) )  
 	 	 	 ) ,  
                                 l e f t :   (  
 	 	 	 	 p a g e X 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   a b s o l u t e   m o u s e   p o s i t i o n  
 	 	 	 	 -   t h i s . o f f s e t . c l i c k . l e f t 	 	 	 	 	 	 	 	 	 	 	 	 / /   C l i c k   o f f s e t   ( r e l a t i v e   t o   t h e   e l e m e n t )  
 	 	 	 	 -   t h i s . o f f s e t . r e l a t i v e . l e f t 	 	 	 	 	 	 	 	 	 	 	 	 / /   O n l y   f o r   r e l a t i v e   p o s i t i o n e d   n o d e s :   R e l a t i v e   o f f s e t   f r o m   e l e m e n t   t o   o f f s e t   p a r e n t  
 	 	 	 	 -   t h i s . o f f s e t . p a r e n t . l e f t 	 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   o f f s e t P a r e n t ' s   o f f s e t   w i t h o u t   b o r d e r s   ( o f f s e t   +   b o r d e r )  
 	 	 	 	 +   ( $ . b r o w s e r . s a f a r i   & &   $ . b r o w s e r . v e r s i o n   <   5 2 6   & &   t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   0   :   ( t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   - t h i s . s c r o l l P a r e n t . s c r o l l L e f t ( )   :   s c r o l l I s R o o t N o d e   ?   0   :   s c r o l l . s c r o l l L e f t ( ) ) )  
 	 	 	 )  
                         } ;  
  
                 } ,  
  
                 _ c l e a r :   f u n c t i o n ( )   {  
                         t h i s . h e l p e r . r e m o v e C l a s s ( " u i - d r a g g a b l e - d r a g g i n g " ) ;  
                         i f   ( t h i s . h e l p e r [ 0 ]   ! =   t h i s . e l e m e n t [ 0 ]   & &   ! t h i s . c a n c e l H e l p e r R e m o v a l )   t h i s . h e l p e r . r e m o v e ( ) ;  
                         / / i f ( $ . u i . d d m a n a g e r )   $ . u i . d d m a n a g e r . c u r r e n t   =   n u l l ;  
                         t h i s . h e l p e r   =   n u l l ;  
                         t h i s . c a n c e l H e l p e r R e m o v a l   =   f a l s e ;  
                 } ,  
  
                 / /   F r o m   n o w   o n   b u l k   s t u f f   -   m a i n l y   h e l p e r s  
  
                 _ t r i g g e r :   f u n c t i o n ( t y p e ,   e v e n t ,   u i )   {  
                         u i   =   u i   | |   t h i s . _ u i H a s h ( ) ;  
                         $ . u i . p l u g i n . c a l l ( t h i s ,   t y p e ,   [ e v e n t ,   u i ] ) ;  
                         i f   ( t y p e   = =   " d r a g " )   t h i s . p o s i t i o n A b s   =   t h i s . _ c o n v e r t P o s i t i o n T o ( " a b s o l u t e " ) ;   / / T h e   a b s o l u t e   p o s i t i o n   h a s   t o   b e   r e c a l c u l a t e d   a f t e r   p l u g i n s  
                         r e t u r n   $ . W i d g e t . p r o t o t y p e . _ t r i g g e r . c a l l ( t h i s ,   t y p e ,   e v e n t ,   u i ) ;  
                 } ,  
  
                 p l u g i n s :   { } ,  
  
                 _ u i H a s h :   f u n c t i o n ( e v e n t )   {  
                         r e t u r n   {  
                                 h e l p e r :   t h i s . h e l p e r ,  
                                 p o s i t i o n :   t h i s . p o s i t i o n ,  
                                 o r i g i n a l P o s i t i o n :   t h i s . o r i g i n a l P o s i t i o n ,  
                                 o f f s e t :   t h i s . p o s i t i o n A b s  
                         } ;  
                 }  
  
         } ) ;  
  
         $ . e x t e n d ( $ . u i . d r a g g a b l e ,   {  
                 v e r s i o n :   " 1 . 8 . 1 0 "  
         } ) ;  
  
         $ . u i . p l u g i n . a d d ( " d r a g g a b l e " ,   " c o n n e c t T o S o r t a b l e " ,   {  
                 s t a r t :   f u n c t i o n ( e v e n t ,   u i )   {  
  
                         v a r   i n s t   =   $ ( t h i s ) . d a t a ( " d r a g g a b l e " ) ,   o   =   i n s t . o p t i o n s ,  
 	 	 	 u i S o r t a b l e   =   $ . e x t e n d ( { } ,   u i ,   {   i t e m :   i n s t . e l e m e n t   } ) ;  
                         i n s t . s o r t a b l e s   =   [ ] ;  
                         $ ( o . c o n n e c t T o S o r t a b l e ) . e a c h ( f u n c t i o n ( )   {  
                                 v a r   s o r t a b l e   =   $ . d a t a ( t h i s ,   ' s o r t a b l e ' ) ;  
                                 i f   ( s o r t a b l e   & &   ! s o r t a b l e . o p t i o n s . d i s a b l e d )   {  
                                         i n s t . s o r t a b l e s . p u s h ( {  
                                                 i n s t a n c e :   s o r t a b l e ,  
                                                 s h o u l d R e v e r t :   s o r t a b l e . o p t i o n s . r e v e r t  
                                         } ) ;  
                                         s o r t a b l e . _ r e f r e s h I t e m s ( ) ;   / / D o   a   o n e - t i m e   r e f r e s h   a t   s t a r t   t o   r e f r e s h   t h e   c o n t a i n e r C a c h e  
                                         s o r t a b l e . _ t r i g g e r ( " a c t i v a t e " ,   e v e n t ,   u i S o r t a b l e ) ;  
                                 }  
                         } ) ;  
  
                 } ,  
                 s t o p :   f u n c t i o n ( e v e n t ,   u i )   {  
  
                         / / I f   w e   a r e   s t i l l   o v e r   t h e   s o r t a b l e ,   w e   f a k e   t h e   s t o p   e v e n t   o f   t h e   s o r t a b l e ,   b u t   a l s o   r e m o v e   h e l p e r  
                         v a r   i n s t   =   $ ( t h i s ) . d a t a ( " d r a g g a b l e " ) ,  
 	 	 	 u i S o r t a b l e   =   $ . e x t e n d ( { } ,   u i ,   {   i t e m :   i n s t . e l e m e n t   } ) ;  
  
                         $ . e a c h ( i n s t . s o r t a b l e s ,   f u n c t i o n ( )   {  
                                 i f   ( t h i s . i n s t a n c e . i s O v e r )   {  
  
                                         t h i s . i n s t a n c e . i s O v e r   =   0 ;  
  
                                         i n s t . c a n c e l H e l p e r R e m o v a l   =   t r u e ;   / / D o n ' t   r e m o v e   t h e   h e l p e r   i n   t h e   d r a g g a b l e   i n s t a n c e  
                                         t h i s . i n s t a n c e . c a n c e l H e l p e r R e m o v a l   =   f a l s e ;   / / R e m o v e   i t   i n   t h e   s o r t a b l e   i n s t a n c e   ( s o   s o r t a b l e   p l u g i n s   l i k e   r e v e r t   s t i l l   w o r k )  
  
                                         / / T h e   s o r t a b l e   r e v e r t   i s   s u p p o r t e d ,   a n d   w e   h a v e   t o   s e t   a   t e m p o r a r y   d r o p p e d   v a r i a b l e   o n   t h e   d r a g g a b l e   t o   s u p p o r t   r e v e r t :   ' v a l i d / i n v a l i d '  
                                         i f   ( t h i s . s h o u l d R e v e r t )   t h i s . i n s t a n c e . o p t i o n s . r e v e r t   =   t r u e ;  
  
                                         / / T r i g g e r   t h e   s t o p   o f   t h e   s o r t a b l e  
                                         t h i s . i n s t a n c e . _ m o u s e S t o p ( e v e n t ) ;  
  
                                         t h i s . i n s t a n c e . o p t i o n s . h e l p e r   =   t h i s . i n s t a n c e . o p t i o n s . _ h e l p e r ;  
  
                                         / / I f   t h e   h e l p e r   h a s   b e e n   t h e   o r i g i n a l   i t e m ,   r e s t o r e   p r o p e r t i e s   i n   t h e   s o r t a b l e  
                                         i f   ( i n s t . o p t i o n s . h e l p e r   = =   ' o r i g i n a l ' )  
                                                 t h i s . i n s t a n c e . c u r r e n t I t e m . c s s ( {   t o p :   ' a u t o ' ,   l e f t :   ' a u t o '   } ) ;  
  
                                 }   e l s e   {  
                                         t h i s . i n s t a n c e . c a n c e l H e l p e r R e m o v a l   =   f a l s e ;   / / R e m o v e   t h e   h e l p e r   i n   t h e   s o r t a b l e   i n s t a n c e  
                                         t h i s . i n s t a n c e . _ t r i g g e r ( " d e a c t i v a t e " ,   e v e n t ,   u i S o r t a b l e ) ;  
                                 }  
  
                         } ) ;  
  
                 } ,  
                 d r a g :   f u n c t i o n ( e v e n t ,   u i )   {  
  
                         v a r   i n s t   =   $ ( t h i s ) . d a t a ( " d r a g g a b l e " ) ,   s e l f   =   t h i s ;  
  
                         v a r   c h e c k P o s   =   f u n c t i o n ( o )   {  
                                 v a r   d y C l i c k   =   t h i s . o f f s e t . c l i c k . t o p ,   d x C l i c k   =   t h i s . o f f s e t . c l i c k . l e f t ;  
                                 v a r   h e l p e r T o p   =   t h i s . p o s i t i o n A b s . t o p ,   h e l p e r L e f t   =   t h i s . p o s i t i o n A b s . l e f t ;  
                                 v a r   i t e m H e i g h t   =   o . h e i g h t ,   i t e m W i d t h   =   o . w i d t h ;  
                                 v a r   i t e m T o p   =   o . t o p ,   i t e m L e f t   =   o . l e f t ;  
  
                                 r e t u r n   $ . u i . i s O v e r ( h e l p e r T o p   +   d y C l i c k ,   h e l p e r L e f t   +   d x C l i c k ,   i t e m T o p ,   i t e m L e f t ,   i t e m H e i g h t ,   i t e m W i d t h ) ;  
                         } ;  
  
                         $ . e a c h ( i n s t . s o r t a b l e s ,   f u n c t i o n ( i )   {  
  
                                 / / C o p y   o v e r   s o m e   v a r i a b l e s   t o   a l l o w   c a l l i n g   t h e   s o r t a b l e ' s   n a t i v e   _ i n t e r s e c t s W i t h  
                                 t h i s . i n s t a n c e . p o s i t i o n A b s   =   i n s t . p o s i t i o n A b s ;  
                                 t h i s . i n s t a n c e . h e l p e r P r o p o r t i o n s   =   i n s t . h e l p e r P r o p o r t i o n s ;  
                                 t h i s . i n s t a n c e . o f f s e t . c l i c k   =   i n s t . o f f s e t . c l i c k ;  
  
                                 i f   ( t h i s . i n s t a n c e . _ i n t e r s e c t s W i t h ( t h i s . i n s t a n c e . c o n t a i n e r C a c h e ) )   {  
  
                                         / / I f   i t   i n t e r s e c t s ,   w e   u s e   a   l i t t l e   i s O v e r   v a r i a b l e   a n d   s e t   i t   o n c e ,   s o   o u r   m o v e - i n   s t u f f   g e t s   f i r e d   o n l y   o n c e  
                                         i f   ( ! t h i s . i n s t a n c e . i s O v e r )   {  
  
                                                 t h i s . i n s t a n c e . i s O v e r   =   1 ;  
                                                 / / N o w   w e   f a k e   t h e   s t a r t   o f   d r a g g i n g   f o r   t h e   s o r t a b l e   i n s t a n c e ,  
                                                 / / b y   c l o n i n g   t h e   l i s t   g r o u p   i t e m ,   a p p e n d i n g   i t   t o   t h e   s o r t a b l e   a n d   u s i n g   i t   a s   i n s t . c u r r e n t I t e m  
                                                 / / W e   c a n   t h e n   f i r e   t h e   s t a r t   e v e n t   o f   t h e   s o r t a b l e   w i t h   o u r   p a s s e d   b r o w s e r   e v e n t ,   a n d   o u r   o w n   h e l p e r   ( s o   i t   d o e s n ' t   c r e a t e   a   n e w   o n e )  
                                                 t h i s . i n s t a n c e . c u r r e n t I t e m   =   $ ( s e l f ) . c l o n e ( ) . a p p e n d T o ( t h i s . i n s t a n c e . e l e m e n t ) . d a t a ( " s o r t a b l e - i t e m " ,   t r u e ) ;  
                                                 t h i s . i n s t a n c e . o p t i o n s . _ h e l p e r   =   t h i s . i n s t a n c e . o p t i o n s . h e l p e r ;   / / S t o r e   h e l p e r   o p t i o n   t o   l a t e r   r e s t o r e   i t  
                                                 t h i s . i n s t a n c e . o p t i o n s . h e l p e r   =   f u n c t i o n ( )   {   r e t u r n   u i . h e l p e r [ 0 ] ;   } ;  
  
                                                 e v e n t . t a r g e t   =   t h i s . i n s t a n c e . c u r r e n t I t e m [ 0 ] ;  
                                                 t h i s . i n s t a n c e . _ m o u s e C a p t u r e ( e v e n t ,   t r u e ) ;  
                                                 t h i s . i n s t a n c e . _ m o u s e S t a r t ( e v e n t ,   t r u e ,   t r u e ) ;  
  
                                                 / / B e c a u s e   t h e   b r o w s e r   e v e n t   i s   w a y   o f f   t h e   n e w   a p p e n d e d   p o r t l e t ,   w e   m o d i f y   a   c o u p l e   o f   v a r i a b l e s   t o   r e f l e c t   t h e   c h a n g e s  
                                                 t h i s . i n s t a n c e . o f f s e t . c l i c k . t o p   =   i n s t . o f f s e t . c l i c k . t o p ;  
                                                 t h i s . i n s t a n c e . o f f s e t . c l i c k . l e f t   =   i n s t . o f f s e t . c l i c k . l e f t ;  
                                                 t h i s . i n s t a n c e . o f f s e t . p a r e n t . l e f t   - =   i n s t . o f f s e t . p a r e n t . l e f t   -   t h i s . i n s t a n c e . o f f s e t . p a r e n t . l e f t ;  
                                                 t h i s . i n s t a n c e . o f f s e t . p a r e n t . t o p   - =   i n s t . o f f s e t . p a r e n t . t o p   -   t h i s . i n s t a n c e . o f f s e t . p a r e n t . t o p ;  
  
                                                 i n s t . _ t r i g g e r ( " t o S o r t a b l e " ,   e v e n t ) ;  
                                                 i n s t . d r o p p e d   =   t h i s . i n s t a n c e . e l e m e n t ;   / / d r a g g a b l e   r e v e r t   n e e d s   t h a t  
                                                 / / h a c k   s o   r e c e i v e / u p d a t e   c a l l b a c k s   w o r k   ( m o s t l y )  
                                                 i n s t . c u r r e n t I t e m   =   i n s t . e l e m e n t ;  
                                                 t h i s . i n s t a n c e . f r o m O u t s i d e   =   i n s t ;  
  
                                         }  
  
                                         / / P r o v i d e d   w e   d i d   a l l   t h e   p r e v i o u s   s t e p s ,   w e   c a n   f i r e   t h e   d r a g   e v e n t   o f   t h e   s o r t a b l e   o n   e v e r y   d r a g g a b l e   d r a g ,   w h e n   i t   i n t e r s e c t s   w i t h   t h e   s o r t a b l e  
                                         i f   ( t h i s . i n s t a n c e . c u r r e n t I t e m )   t h i s . i n s t a n c e . _ m o u s e D r a g ( e v e n t ) ;  
  
                                 }   e l s e   {  
  
                                         / / I f   i t   d o e s n ' t   i n t e r s e c t   w i t h   t h e   s o r t a b l e ,   a n d   i t   i n t e r s e c t e d   b e f o r e ,  
                                         / / w e   f a k e   t h e   d r a g   s t o p   o f   t h e   s o r t a b l e ,   b u t   m a k e   s u r e   i t   d o e s n ' t   r e m o v e   t h e   h e l p e r   b y   u s i n g   c a n c e l H e l p e r R e m o v a l  
                                         i f   ( t h i s . i n s t a n c e . i s O v e r )   {  
  
                                                 t h i s . i n s t a n c e . i s O v e r   =   0 ;  
                                                 t h i s . i n s t a n c e . c a n c e l H e l p e r R e m o v a l   =   t r u e ;  
  
                                                 / / P r e v e n t   r e v e r t i n g   o n   t h i s   f o r c e d   s t o p  
                                                 t h i s . i n s t a n c e . o p t i o n s . r e v e r t   =   f a l s e ;  
  
                                                 / /   T h e   o u t   e v e n t   n e e d s   t o   b e   t r i g g e r e d   i n d e p e n d e n t l y  
                                                 t h i s . i n s t a n c e . _ t r i g g e r ( ' o u t ' ,   e v e n t ,   t h i s . i n s t a n c e . _ u i H a s h ( t h i s . i n s t a n c e ) ) ;  
  
                                                 t h i s . i n s t a n c e . _ m o u s e S t o p ( e v e n t ,   t r u e ) ;  
                                                 t h i s . i n s t a n c e . o p t i o n s . h e l p e r   =   t h i s . i n s t a n c e . o p t i o n s . _ h e l p e r ;  
  
                                                 / / N o w   w e   r e m o v e   o u r   c u r r e n t I t e m ,   t h e   l i s t   g r o u p   c l o n e   a g a i n ,   a n d   t h e   p l a c e h o l d e r ,   a n d   a n i m a t e   t h e   h e l p e r   b a c k   t o   i t ' s   o r i g i n a l   s i z e  
                                                 t h i s . i n s t a n c e . c u r r e n t I t e m . r e m o v e ( ) ;  
                                                 i f   ( t h i s . i n s t a n c e . p l a c e h o l d e r )   t h i s . i n s t a n c e . p l a c e h o l d e r . r e m o v e ( ) ;  
  
                                                 i n s t . _ t r i g g e r ( " f r o m S o r t a b l e " ,   e v e n t ) ;  
                                                 i n s t . d r o p p e d   =   f a l s e ;   / / d r a g g a b l e   r e v e r t   n e e d s   t h a t  
                                         }  
  
                                 } ;  
  
                         } ) ;  
  
                 }  
         } ) ;  
  
         $ . u i . p l u g i n . a d d ( " d r a g g a b l e " ,   " c u r s o r " ,   {  
                 s t a r t :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   t   =   $ ( ' b o d y ' ) ,   o   =   $ ( t h i s ) . d a t a ( ' d r a g g a b l e ' ) . o p t i o n s ;  
                         i f   ( t . c s s ( " c u r s o r " ) )   o . _ c u r s o r   =   t . c s s ( " c u r s o r " ) ;  
                         t . c s s ( " c u r s o r " ,   o . c u r s o r ) ;  
                 } ,  
                 s t o p :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   o   =   $ ( t h i s ) . d a t a ( ' d r a g g a b l e ' ) . o p t i o n s ;  
                         i f   ( o . _ c u r s o r )   $ ( ' b o d y ' ) . c s s ( " c u r s o r " ,   o . _ c u r s o r ) ;  
                 }  
         } ) ;  
  
         $ . u i . p l u g i n . a d d ( " d r a g g a b l e " ,   " i f r a m e F i x " ,   {  
                 s t a r t :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   o   =   $ ( t h i s ) . d a t a ( ' d r a g g a b l e ' ) . o p t i o n s ;  
                         $ ( o . i f r a m e F i x   = = =   t r u e   ?   " i f r a m e "   :   o . i f r a m e F i x ) . e a c h ( f u n c t i o n ( )   {  
                                 $ ( ' < d i v   c l a s s = " u i - d r a g g a b l e - i f r a m e F i x "   s t y l e = " b a c k g r o u n d :   # f f f ; " > < / d i v > ' )  
 	 	 	 . c s s ( {  
 	 	 	         w i d t h :   t h i s . o f f s e t W i d t h   +   " p x " ,   h e i g h t :   t h i s . o f f s e t H e i g h t   +   " p x " ,  
 	 	 	         p o s i t i o n :   " a b s o l u t e " ,   o p a c i t y :   " 0 . 0 0 1 " ,   z I n d e x :   1 0 0 0  
 	 	 	 } )  
 	 	 	 . c s s ( $ ( t h i s ) . o f f s e t ( ) )  
 	 	 	 . a p p e n d T o ( " b o d y " ) ;  
                         } ) ;  
                 } ,  
                 s t o p :   f u n c t i o n ( e v e n t ,   u i )   {  
                         $ ( " d i v . u i - d r a g g a b l e - i f r a m e F i x " ) . e a c h ( f u n c t i o n ( )   {   t h i s . p a r e n t N o d e . r e m o v e C h i l d ( t h i s ) ;   } ) ;   / / R e m o v e   f r a m e   h e l p e r s  
                 }  
         } ) ;  
  
         $ . u i . p l u g i n . a d d ( " d r a g g a b l e " ,   " o p a c i t y " ,   {  
                 s t a r t :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   t   =   $ ( u i . h e l p e r ) ,   o   =   $ ( t h i s ) . d a t a ( ' d r a g g a b l e ' ) . o p t i o n s ;  
                         i f   ( t . c s s ( " o p a c i t y " ) )   o . _ o p a c i t y   =   t . c s s ( " o p a c i t y " ) ;  
                         t . c s s ( ' o p a c i t y ' ,   o . o p a c i t y ) ;  
                 } ,  
                 s t o p :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   o   =   $ ( t h i s ) . d a t a ( ' d r a g g a b l e ' ) . o p t i o n s ;  
                         i f   ( o . _ o p a c i t y )   $ ( u i . h e l p e r ) . c s s ( ' o p a c i t y ' ,   o . _ o p a c i t y ) ;  
                 }  
         } ) ;  
  
         $ . u i . p l u g i n . a d d ( " d r a g g a b l e " ,   " s c r o l l " ,   {  
                 s t a r t :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   i   =   $ ( t h i s ) . d a t a ( " d r a g g a b l e " ) ;  
                         i f   ( i . s c r o l l P a r e n t [ 0 ]   ! =   d o c u m e n t   & &   i . s c r o l l P a r e n t [ 0 ] . t a g N a m e   ! =   ' H T M L ' )   i . o v e r f l o w O f f s e t   =   i . s c r o l l P a r e n t . o f f s e t ( ) ;  
                 } ,  
                 d r a g :   f u n c t i o n ( e v e n t ,   u i )   {  
  
                         v a r   i   =   $ ( t h i s ) . d a t a ( " d r a g g a b l e " ) ,   o   =   i . o p t i o n s ,   s c r o l l e d   =   f a l s e ;  
  
                         i f   ( i . s c r o l l P a r e n t [ 0 ]   ! =   d o c u m e n t   & &   i . s c r o l l P a r e n t [ 0 ] . t a g N a m e   ! =   ' H T M L ' )   {  
  
                                 i f   ( ! o . a x i s   | |   o . a x i s   ! =   ' x ' )   {  
                                         i f   ( ( i . o v e r f l o w O f f s e t . t o p   +   i . s c r o l l P a r e n t [ 0 ] . o f f s e t H e i g h t )   -   e v e n t . p a g e Y   <   o . s c r o l l S e n s i t i v i t y )  
                                                 i . s c r o l l P a r e n t [ 0 ] . s c r o l l T o p   =   s c r o l l e d   =   i . s c r o l l P a r e n t [ 0 ] . s c r o l l T o p   +   o . s c r o l l S p e e d ;  
                                         e l s e   i f   ( e v e n t . p a g e Y   -   i . o v e r f l o w O f f s e t . t o p   <   o . s c r o l l S e n s i t i v i t y )  
                                                 i . s c r o l l P a r e n t [ 0 ] . s c r o l l T o p   =   s c r o l l e d   =   i . s c r o l l P a r e n t [ 0 ] . s c r o l l T o p   -   o . s c r o l l S p e e d ;  
                                 }  
  
                                 i f   ( ! o . a x i s   | |   o . a x i s   ! =   ' y ' )   {  
                                         i f   ( ( i . o v e r f l o w O f f s e t . l e f t   +   i . s c r o l l P a r e n t [ 0 ] . o f f s e t W i d t h )   -   e v e n t . p a g e X   <   o . s c r o l l S e n s i t i v i t y )  
                                                 i . s c r o l l P a r e n t [ 0 ] . s c r o l l L e f t   =   s c r o l l e d   =   i . s c r o l l P a r e n t [ 0 ] . s c r o l l L e f t   +   o . s c r o l l S p e e d ;  
                                         e l s e   i f   ( e v e n t . p a g e X   -   i . o v e r f l o w O f f s e t . l e f t   <   o . s c r o l l S e n s i t i v i t y )  
                                                 i . s c r o l l P a r e n t [ 0 ] . s c r o l l L e f t   =   s c r o l l e d   =   i . s c r o l l P a r e n t [ 0 ] . s c r o l l L e f t   -   o . s c r o l l S p e e d ;  
                                 }  
  
                         }   e l s e   {  
  
                                 i f   ( ! o . a x i s   | |   o . a x i s   ! =   ' x ' )   {  
                                         i f   ( e v e n t . p a g e Y   -   $ ( d o c u m e n t ) . s c r o l l T o p ( )   <   o . s c r o l l S e n s i t i v i t y )  
                                                 s c r o l l e d   =   $ ( d o c u m e n t ) . s c r o l l T o p ( $ ( d o c u m e n t ) . s c r o l l T o p ( )   -   o . s c r o l l S p e e d ) ;  
                                         e l s e   i f   ( $ ( w i n d o w ) . h e i g h t ( )   -   ( e v e n t . p a g e Y   -   $ ( d o c u m e n t ) . s c r o l l T o p ( ) )   <   o . s c r o l l S e n s i t i v i t y )  
                                                 s c r o l l e d   =   $ ( d o c u m e n t ) . s c r o l l T o p ( $ ( d o c u m e n t ) . s c r o l l T o p ( )   +   o . s c r o l l S p e e d ) ;  
                                 }  
  
                                 i f   ( ! o . a x i s   | |   o . a x i s   ! =   ' y ' )   {  
                                         i f   ( e v e n t . p a g e X   -   $ ( d o c u m e n t ) . s c r o l l L e f t ( )   <   o . s c r o l l S e n s i t i v i t y )  
                                                 s c r o l l e d   =   $ ( d o c u m e n t ) . s c r o l l L e f t ( $ ( d o c u m e n t ) . s c r o l l L e f t ( )   -   o . s c r o l l S p e e d ) ;  
                                         e l s e   i f   ( $ ( w i n d o w ) . w i d t h ( )   -   ( e v e n t . p a g e X   -   $ ( d o c u m e n t ) . s c r o l l L e f t ( ) )   <   o . s c r o l l S e n s i t i v i t y )  
                                                 s c r o l l e d   =   $ ( d o c u m e n t ) . s c r o l l L e f t ( $ ( d o c u m e n t ) . s c r o l l L e f t ( )   +   o . s c r o l l S p e e d ) ;  
                                 }  
  
                         }  
  
                         i f   ( s c r o l l e d   ! = =   f a l s e   & &   $ . u i . d d m a n a g e r   & &   ! o . d r o p B e h a v i o u r )  
                                 $ . u i . d d m a n a g e r . p r e p a r e O f f s e t s ( i ,   e v e n t ) ;  
  
                 }  
         } ) ;  
  
         $ . u i . p l u g i n . a d d ( " d r a g g a b l e " ,   " s n a p " ,   {  
                 s t a r t :   f u n c t i o n ( e v e n t ,   u i )   {  
  
                         v a r   i   =   $ ( t h i s ) . d a t a ( " d r a g g a b l e " ) ,   o   =   i . o p t i o n s ;  
                         i . s n a p E l e m e n t s   =   [ ] ;  
  
                         $ ( o . s n a p . c o n s t r u c t o r   ! =   S t r i n g   ?   ( o . s n a p . i t e m s   | |   ' : d a t a ( d r a g g a b l e ) ' )   :   o . s n a p ) . e a c h ( f u n c t i o n ( )   {  
                                 v a r   $ t   =   $ ( t h i s ) ;   v a r   $ o   =   $ t . o f f s e t ( ) ;  
                                 i f   ( t h i s   ! =   i . e l e m e n t [ 0 ] )   i . s n a p E l e m e n t s . p u s h ( {  
                                         i t e m :   t h i s ,  
                                         w i d t h :   $ t . o u t e r W i d t h ( ) ,   h e i g h t :   $ t . o u t e r H e i g h t ( ) ,  
                                         t o p :   $ o . t o p ,   l e f t :   $ o . l e f t  
                                 } ) ;  
                         } ) ;  
  
                 } ,  
                 d r a g :   f u n c t i o n ( e v e n t ,   u i )   {  
  
                         v a r   i n s t   =   $ ( t h i s ) . d a t a ( " d r a g g a b l e " ) ,   o   =   i n s t . o p t i o n s ;  
                         v a r   d   =   o . s n a p T o l e r a n c e ;  
  
                         v a r   x 1   =   u i . o f f s e t . l e f t ,   x 2   =   x 1   +   i n s t . h e l p e r P r o p o r t i o n s . w i d t h ,  
 	 	 	 y 1   =   u i . o f f s e t . t o p ,   y 2   =   y 1   +   i n s t . h e l p e r P r o p o r t i o n s . h e i g h t ;  
  
                         f o r   ( v a r   i   =   i n s t . s n a p E l e m e n t s . l e n g t h   -   1 ;   i   > =   0 ;   i - - )   {  
  
                                 v a r   l   =   i n s t . s n a p E l e m e n t s [ i ] . l e f t ,   r   =   l   +   i n s t . s n a p E l e m e n t s [ i ] . w i d t h ,  
 	 	 	 	 t   =   i n s t . s n a p E l e m e n t s [ i ] . t o p ,   b   =   t   +   i n s t . s n a p E l e m e n t s [ i ] . h e i g h t ;  
  
                                 / / Y e s ,   I   k n o w ,   t h i s   i s   i n s a n e   ; )  
                                 i f   ( ! ( ( l   -   d   <   x 1   & &   x 1   <   r   +   d   & &   t   -   d   <   y 1   & &   y 1   <   b   +   d )   | |   ( l   -   d   <   x 1   & &   x 1   <   r   +   d   & &   t   -   d   <   y 2   & &   y 2   <   b   +   d )   | |   ( l   -   d   <   x 2   & &   x 2   <   r   +   d   & &   t   -   d   <   y 1   & &   y 1   <   b   +   d )   | |   ( l   -   d   <   x 2   & &   x 2   <   r   +   d   & &   t   -   d   <   y 2   & &   y 2   <   b   +   d ) ) )   {  
                                         i f   ( i n s t . s n a p E l e m e n t s [ i ] . s n a p p i n g )   ( i n s t . o p t i o n s . s n a p . r e l e a s e   & &   i n s t . o p t i o n s . s n a p . r e l e a s e . c a l l ( i n s t . e l e m e n t ,   e v e n t ,   $ . e x t e n d ( i n s t . _ u i H a s h ( ) ,   {   s n a p I t e m :   i n s t . s n a p E l e m e n t s [ i ] . i t e m   } ) ) ) ;  
                                         i n s t . s n a p E l e m e n t s [ i ] . s n a p p i n g   =   f a l s e ;  
                                         c o n t i n u e ;  
                                 }  
  
                                 i f   ( o . s n a p M o d e   ! =   ' i n n e r ' )   {  
                                         v a r   t s   =   M a t h . a b s ( t   -   y 2 )   < =   d ;  
                                         v a r   b s   =   M a t h . a b s ( b   -   y 1 )   < =   d ;  
                                         v a r   l s   =   M a t h . a b s ( l   -   x 2 )   < =   d ;  
                                         v a r   r s   =   M a t h . a b s ( r   -   x 1 )   < =   d ;  
                                         i f   ( t s )   u i . p o s i t i o n . t o p   =   i n s t . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " ,   {   t o p :   t   -   i n s t . h e l p e r P r o p o r t i o n s . h e i g h t ,   l e f t :   0   } ) . t o p   -   i n s t . m a r g i n s . t o p ;  
                                         i f   ( b s )   u i . p o s i t i o n . t o p   =   i n s t . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " ,   {   t o p :   b ,   l e f t :   0   } ) . t o p   -   i n s t . m a r g i n s . t o p ;  
                                         i f   ( l s )   u i . p o s i t i o n . l e f t   =   i n s t . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " ,   {   t o p :   0 ,   l e f t :   l   -   i n s t . h e l p e r P r o p o r t i o n s . w i d t h   } ) . l e f t   -   i n s t . m a r g i n s . l e f t ;  
                                         i f   ( r s )   u i . p o s i t i o n . l e f t   =   i n s t . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " ,   {   t o p :   0 ,   l e f t :   r   } ) . l e f t   -   i n s t . m a r g i n s . l e f t ;  
                                 }  
  
                                 v a r   f i r s t   =   ( t s   | |   b s   | |   l s   | |   r s ) ;  
  
                                 i f   ( o . s n a p M o d e   ! =   ' o u t e r ' )   {  
                                         v a r   t s   =   M a t h . a b s ( t   -   y 1 )   < =   d ;  
                                         v a r   b s   =   M a t h . a b s ( b   -   y 2 )   < =   d ;  
                                         v a r   l s   =   M a t h . a b s ( l   -   x 1 )   < =   d ;  
                                         v a r   r s   =   M a t h . a b s ( r   -   x 2 )   < =   d ;  
                                         i f   ( t s )   u i . p o s i t i o n . t o p   =   i n s t . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " ,   {   t o p :   t ,   l e f t :   0   } ) . t o p   -   i n s t . m a r g i n s . t o p ;  
                                         i f   ( b s )   u i . p o s i t i o n . t o p   =   i n s t . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " ,   {   t o p :   b   -   i n s t . h e l p e r P r o p o r t i o n s . h e i g h t ,   l e f t :   0   } ) . t o p   -   i n s t . m a r g i n s . t o p ;  
                                         i f   ( l s )   u i . p o s i t i o n . l e f t   =   i n s t . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " ,   {   t o p :   0 ,   l e f t :   l   } ) . l e f t   -   i n s t . m a r g i n s . l e f t ;  
                                         i f   ( r s )   u i . p o s i t i o n . l e f t   =   i n s t . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " ,   {   t o p :   0 ,   l e f t :   r   -   i n s t . h e l p e r P r o p o r t i o n s . w i d t h   } ) . l e f t   -   i n s t . m a r g i n s . l e f t ;  
                                 }  
  
                                 i f   ( ! i n s t . s n a p E l e m e n t s [ i ] . s n a p p i n g   & &   ( t s   | |   b s   | |   l s   | |   r s   | |   f i r s t ) )  
                                         ( i n s t . o p t i o n s . s n a p . s n a p   & &   i n s t . o p t i o n s . s n a p . s n a p . c a l l ( i n s t . e l e m e n t ,   e v e n t ,   $ . e x t e n d ( i n s t . _ u i H a s h ( ) ,   {   s n a p I t e m :   i n s t . s n a p E l e m e n t s [ i ] . i t e m   } ) ) ) ;  
                                 i n s t . s n a p E l e m e n t s [ i ] . s n a p p i n g   =   ( t s   | |   b s   | |   l s   | |   r s   | |   f i r s t ) ;  
  
                         } ;  
  
                 }  
         } ) ;  
  
         $ . u i . p l u g i n . a d d ( " d r a g g a b l e " ,   " s t a c k " ,   {  
                 s t a r t :   f u n c t i o n ( e v e n t ,   u i )   {  
  
                         v a r   o   =   $ ( t h i s ) . d a t a ( " d r a g g a b l e " ) . o p t i o n s ;  
  
                         v a r   g r o u p   =   $ . m a k e A r r a y ( $ ( o . s t a c k ) ) . s o r t ( f u n c t i o n ( a ,   b )   {  
                                 r e t u r n   ( p a r s e I n t ( $ ( a ) . c s s ( " z I n d e x " ) ,   1 0 )   | |   0 )   -   ( p a r s e I n t ( $ ( b ) . c s s ( " z I n d e x " ) ,   1 0 )   | |   0 ) ;  
                         } ) ;  
                         i f   ( ! g r o u p . l e n g t h )   {   r e t u r n ;   }  
  
                         v a r   m i n   =   p a r s e I n t ( g r o u p [ 0 ] . s t y l e . z I n d e x )   | |   0 ;  
                         $ ( g r o u p ) . e a c h ( f u n c t i o n ( i )   {  
                                 t h i s . s t y l e . z I n d e x   =   m i n   +   i ;  
                         } ) ;  
  
                         t h i s [ 0 ] . s t y l e . z I n d e x   =   m i n   +   g r o u p . l e n g t h ;  
  
                 }  
         } ) ;  
  
         $ . u i . p l u g i n . a d d ( " d r a g g a b l e " ,   " z I n d e x " ,   {  
                 s t a r t :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   t   =   $ ( u i . h e l p e r ) ,   o   =   $ ( t h i s ) . d a t a ( " d r a g g a b l e " ) . o p t i o n s ;  
                         i f   ( t . c s s ( " z I n d e x " ) )   o . _ z I n d e x   =   t . c s s ( " z I n d e x " ) ;  
                         t . c s s ( ' z I n d e x ' ,   o . z I n d e x ) ;  
                 } ,  
                 s t o p :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   o   =   $ ( t h i s ) . d a t a ( " d r a g g a b l e " ) . o p t i o n s ;  
                         i f   ( o . _ z I n d e x )   $ ( u i . h e l p e r ) . c s s ( ' z I n d e x ' ,   o . _ z I n d e x ) ;  
                 }  
         } ) ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   D r o p p a b l e   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / D r o p p a b l e s  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . u i . c o r e . j s  
 * 	 j q u e r y . u i . w i d g e t . j s  
 * 	 j q u e r y . u i . m o u s e . j s  
 * 	 j q u e r y . u i . d r a g g a b l e . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . w i d g e t ( " u i . d r o p p a b l e " ,   {  
                 w i d g e t E v e n t P r e f i x :   " d r o p " ,  
                 o p t i o n s :   {  
                         a c c e p t :   ' * ' ,  
                         a c t i v e C l a s s :   f a l s e ,  
                         a d d C l a s s e s :   t r u e ,  
                         g r e e d y :   f a l s e ,  
                         h o v e r C l a s s :   f a l s e ,  
                         s c o p e :   ' d e f a u l t ' ,  
                         t o l e r a n c e :   ' i n t e r s e c t '  
                 } ,  
                 _ c r e a t e :   f u n c t i o n ( )   {  
  
                         v a r   o   =   t h i s . o p t i o n s ,   a c c e p t   =   o . a c c e p t ;  
                         t h i s . i s o v e r   =   0 ;   t h i s . i s o u t   =   1 ;  
  
                         t h i s . a c c e p t   =   $ . i s F u n c t i o n ( a c c e p t )   ?   a c c e p t   :   f u n c t i o n ( d )   {  
                                 r e t u r n   d . i s ( a c c e p t ) ;  
                         } ;  
  
                         / / S t o r e   t h e   d r o p p a b l e ' s   p r o p o r t i o n s  
                         t h i s . p r o p o r t i o n s   =   {   w i d t h :   t h i s . e l e m e n t [ 0 ] . o f f s e t W i d t h ,   h e i g h t :   t h i s . e l e m e n t [ 0 ] . o f f s e t H e i g h t   } ;  
  
                         / /   A d d   t h e   r e f e r e n c e   a n d   p o s i t i o n s   t o   t h e   m a n a g e r  
                         $ . u i . d d m a n a g e r . d r o p p a b l e s [ o . s c o p e ]   =   $ . u i . d d m a n a g e r . d r o p p a b l e s [ o . s c o p e ]   | |   [ ] ;  
                         $ . u i . d d m a n a g e r . d r o p p a b l e s [ o . s c o p e ] . p u s h ( t h i s ) ;  
  
                         ( o . a d d C l a s s e s   & &   t h i s . e l e m e n t . a d d C l a s s ( " u i - d r o p p a b l e " ) ) ;  
  
                 } ,  
  
                 d e s t r o y :   f u n c t i o n ( )   {  
                         v a r   d r o p   =   $ . u i . d d m a n a g e r . d r o p p a b l e s [ t h i s . o p t i o n s . s c o p e ] ;  
                         f o r   ( v a r   i   =   0 ;   i   <   d r o p . l e n g t h ;   i + + )  
                                 i f   ( d r o p [ i ]   = =   t h i s )  
                                 d r o p . s p l i c e ( i ,   1 ) ;  
  
                         t h i s . e l e m e n t  
 	 	 	 . r e m o v e C l a s s ( " u i - d r o p p a b l e   u i - d r o p p a b l e - d i s a b l e d " )  
 	 	 	 . r e m o v e D a t a ( " d r o p p a b l e " )  
 	 	 	 . u n b i n d ( " . d r o p p a b l e " ) ;  
  
                         r e t u r n   t h i s ;  
                 } ,  
  
                 _ s e t O p t i o n :   f u n c t i o n ( k e y ,   v a l u e )   {  
  
                         i f   ( k e y   = =   ' a c c e p t ' )   {  
                                 t h i s . a c c e p t   =   $ . i s F u n c t i o n ( v a l u e )   ?   v a l u e   :   f u n c t i o n ( d )   {  
                                         r e t u r n   d . i s ( v a l u e ) ;  
                                 } ;  
                         }  
                         $ . W i d g e t . p r o t o t y p e . _ s e t O p t i o n . a p p l y ( t h i s ,   a r g u m e n t s ) ;  
                 } ,  
  
                 _ a c t i v a t e :   f u n c t i o n ( e v e n t )   {  
                         v a r   d r a g g a b l e   =   $ . u i . d d m a n a g e r . c u r r e n t ;  
                         i f   ( t h i s . o p t i o n s . a c t i v e C l a s s )   t h i s . e l e m e n t . a d d C l a s s ( t h i s . o p t i o n s . a c t i v e C l a s s ) ;  
                         ( d r a g g a b l e   & &   t h i s . _ t r i g g e r ( ' a c t i v a t e ' ,   e v e n t ,   t h i s . u i ( d r a g g a b l e ) ) ) ;  
                 } ,  
  
                 _ d e a c t i v a t e :   f u n c t i o n ( e v e n t )   {  
                         v a r   d r a g g a b l e   =   $ . u i . d d m a n a g e r . c u r r e n t ;  
                         i f   ( t h i s . o p t i o n s . a c t i v e C l a s s )   t h i s . e l e m e n t . r e m o v e C l a s s ( t h i s . o p t i o n s . a c t i v e C l a s s ) ;  
                         ( d r a g g a b l e   & &   t h i s . _ t r i g g e r ( ' d e a c t i v a t e ' ,   e v e n t ,   t h i s . u i ( d r a g g a b l e ) ) ) ;  
                 } ,  
  
                 _ o v e r :   f u n c t i o n ( e v e n t )   {  
  
                         v a r   d r a g g a b l e   =   $ . u i . d d m a n a g e r . c u r r e n t ;  
                         i f   ( ! d r a g g a b l e   | |   ( d r a g g a b l e . c u r r e n t I t e m   | |   d r a g g a b l e . e l e m e n t ) [ 0 ]   = =   t h i s . e l e m e n t [ 0 ] )   r e t u r n ;   / /   B a i l   i f   d r a g g a b l e   a n d   d r o p p a b l e   a r e   s a m e   e l e m e n t  
  
                         i f   ( t h i s . a c c e p t . c a l l ( t h i s . e l e m e n t [ 0 ] ,   ( d r a g g a b l e . c u r r e n t I t e m   | |   d r a g g a b l e . e l e m e n t ) ) )   {  
                                 i f   ( t h i s . o p t i o n s . h o v e r C l a s s )   t h i s . e l e m e n t . a d d C l a s s ( t h i s . o p t i o n s . h o v e r C l a s s ) ;  
                                 t h i s . _ t r i g g e r ( ' o v e r ' ,   e v e n t ,   t h i s . u i ( d r a g g a b l e ) ) ;  
                         }  
  
                 } ,  
  
                 _ o u t :   f u n c t i o n ( e v e n t )   {  
  
                         v a r   d r a g g a b l e   =   $ . u i . d d m a n a g e r . c u r r e n t ;  
                         i f   ( ! d r a g g a b l e   | |   ( d r a g g a b l e . c u r r e n t I t e m   | |   d r a g g a b l e . e l e m e n t ) [ 0 ]   = =   t h i s . e l e m e n t [ 0 ] )   r e t u r n ;   / /   B a i l   i f   d r a g g a b l e   a n d   d r o p p a b l e   a r e   s a m e   e l e m e n t  
  
                         i f   ( t h i s . a c c e p t . c a l l ( t h i s . e l e m e n t [ 0 ] ,   ( d r a g g a b l e . c u r r e n t I t e m   | |   d r a g g a b l e . e l e m e n t ) ) )   {  
                                 i f   ( t h i s . o p t i o n s . h o v e r C l a s s )   t h i s . e l e m e n t . r e m o v e C l a s s ( t h i s . o p t i o n s . h o v e r C l a s s ) ;  
                                 t h i s . _ t r i g g e r ( ' o u t ' ,   e v e n t ,   t h i s . u i ( d r a g g a b l e ) ) ;  
                         }  
  
                 } ,  
  
                 _ d r o p :   f u n c t i o n ( e v e n t ,   c u s t o m )   {  
  
                         v a r   d r a g g a b l e   =   c u s t o m   | |   $ . u i . d d m a n a g e r . c u r r e n t ;  
                         i f   ( ! d r a g g a b l e   | |   ( d r a g g a b l e . c u r r e n t I t e m   | |   d r a g g a b l e . e l e m e n t ) [ 0 ]   = =   t h i s . e l e m e n t [ 0 ] )   r e t u r n   f a l s e ;   / /   B a i l   i f   d r a g g a b l e   a n d   d r o p p a b l e   a r e   s a m e   e l e m e n t  
  
                         v a r   c h i l d r e n I n t e r s e c t i o n   =   f a l s e ;  
                         t h i s . e l e m e n t . f i n d ( " : d a t a ( d r o p p a b l e ) " ) . n o t ( " . u i - d r a g g a b l e - d r a g g i n g " ) . e a c h ( f u n c t i o n ( )   {  
                                 v a r   i n s t   =   $ . d a t a ( t h i s ,   ' d r o p p a b l e ' ) ;  
                                 i f   (  
 	 	 	 	 i n s t . o p t i o n s . g r e e d y  
 	 	 	 	 & &   ! i n s t . o p t i o n s . d i s a b l e d  
 	 	 	 	 & &   i n s t . o p t i o n s . s c o p e   = =   d r a g g a b l e . o p t i o n s . s c o p e  
 	 	 	 	 & &   i n s t . a c c e p t . c a l l ( i n s t . e l e m e n t [ 0 ] ,   ( d r a g g a b l e . c u r r e n t I t e m   | |   d r a g g a b l e . e l e m e n t ) )  
 	 	 	 	 & &   $ . u i . i n t e r s e c t ( d r a g g a b l e ,   $ . e x t e n d ( i n s t ,   {   o f f s e t :   i n s t . e l e m e n t . o f f s e t ( )   } ) ,   i n s t . o p t i o n s . t o l e r a n c e )  
 	 	 	 )   {   c h i l d r e n I n t e r s e c t i o n   =   t r u e ;   r e t u r n   f a l s e ;   }  
                         } ) ;  
                         i f   ( c h i l d r e n I n t e r s e c t i o n )   r e t u r n   f a l s e ;  
  
                         i f   ( t h i s . a c c e p t . c a l l ( t h i s . e l e m e n t [ 0 ] ,   ( d r a g g a b l e . c u r r e n t I t e m   | |   d r a g g a b l e . e l e m e n t ) ) )   {  
                                 i f   ( t h i s . o p t i o n s . a c t i v e C l a s s )   t h i s . e l e m e n t . r e m o v e C l a s s ( t h i s . o p t i o n s . a c t i v e C l a s s ) ;  
                                 i f   ( t h i s . o p t i o n s . h o v e r C l a s s )   t h i s . e l e m e n t . r e m o v e C l a s s ( t h i s . o p t i o n s . h o v e r C l a s s ) ;  
                                 t h i s . _ t r i g g e r ( ' d r o p ' ,   e v e n t ,   t h i s . u i ( d r a g g a b l e ) ) ;  
                                 r e t u r n   t h i s . e l e m e n t ;  
                         }  
  
                         r e t u r n   f a l s e ;  
  
                 } ,  
  
                 u i :   f u n c t i o n ( c )   {  
                         r e t u r n   {  
                                 d r a g g a b l e :   ( c . c u r r e n t I t e m   | |   c . e l e m e n t ) ,  
                                 h e l p e r :   c . h e l p e r ,  
                                 p o s i t i o n :   c . p o s i t i o n ,  
                                 o f f s e t :   c . p o s i t i o n A b s  
                         } ;  
                 }  
  
         } ) ;  
  
         $ . e x t e n d ( $ . u i . d r o p p a b l e ,   {  
                 v e r s i o n :   " 1 . 8 . 1 0 "  
         } ) ;  
  
         $ . u i . i n t e r s e c t   =   f u n c t i o n ( d r a g g a b l e ,   d r o p p a b l e ,   t o l e r a n c e M o d e )   {  
  
                 i f   ( ! d r o p p a b l e . o f f s e t )   r e t u r n   f a l s e ;  
  
                 v a r   x 1   =   ( d r a g g a b l e . p o s i t i o n A b s   | |   d r a g g a b l e . p o s i t i o n . a b s o l u t e ) . l e f t ,   x 2   =   x 1   +   d r a g g a b l e . h e l p e r P r o p o r t i o n s . w i d t h ,  
 	 	 y 1   =   ( d r a g g a b l e . p o s i t i o n A b s   | |   d r a g g a b l e . p o s i t i o n . a b s o l u t e ) . t o p ,   y 2   =   y 1   +   d r a g g a b l e . h e l p e r P r o p o r t i o n s . h e i g h t ;  
                 v a r   l   =   d r o p p a b l e . o f f s e t . l e f t ,   r   =   l   +   d r o p p a b l e . p r o p o r t i o n s . w i d t h ,  
 	 	 t   =   d r o p p a b l e . o f f s e t . t o p ,   b   =   t   +   d r o p p a b l e . p r o p o r t i o n s . h e i g h t ;  
  
                 s w i t c h   ( t o l e r a n c e M o d e )   {  
                         c a s e   ' f i t ' :  
                                 r e t u r n   ( l   < =   x 1   & &   x 2   < =   r  
 	 	 	 	 & &   t   < =   y 1   & &   y 2   < =   b ) ;  
                                 b r e a k ;  
                         c a s e   ' i n t e r s e c t ' :  
                                 r e t u r n   ( l   <   x 1   +   ( d r a g g a b l e . h e l p e r P r o p o r t i o n s . w i d t h   /   2 )   / /   R i g h t   H a l f  
 	 	 	 	 & &   x 2   -   ( d r a g g a b l e . h e l p e r P r o p o r t i o n s . w i d t h   /   2 )   <   r   / /   L e f t   H a l f  
 	 	 	 	 & &   t   <   y 1   +   ( d r a g g a b l e . h e l p e r P r o p o r t i o n s . h e i g h t   /   2 )   / /   B o t t o m   H a l f  
 	 	 	 	 & &   y 2   -   ( d r a g g a b l e . h e l p e r P r o p o r t i o n s . h e i g h t   /   2 )   <   b ) ;   / /   T o p   H a l f  
                                 b r e a k ;  
                         c a s e   ' p o i n t e r ' :  
                                 v a r   d r a g g a b l e L e f t   =   ( ( d r a g g a b l e . p o s i t i o n A b s   | |   d r a g g a b l e . p o s i t i o n . a b s o l u t e ) . l e f t   +   ( d r a g g a b l e . c l i c k O f f s e t   | |   d r a g g a b l e . o f f s e t . c l i c k ) . l e f t ) ,  
 	 	 	 	 d r a g g a b l e T o p   =   ( ( d r a g g a b l e . p o s i t i o n A b s   | |   d r a g g a b l e . p o s i t i o n . a b s o l u t e ) . t o p   +   ( d r a g g a b l e . c l i c k O f f s e t   | |   d r a g g a b l e . o f f s e t . c l i c k ) . t o p ) ,  
 	 	 	 	 i s O v e r   =   $ . u i . i s O v e r ( d r a g g a b l e T o p ,   d r a g g a b l e L e f t ,   t ,   l ,   d r o p p a b l e . p r o p o r t i o n s . h e i g h t ,   d r o p p a b l e . p r o p o r t i o n s . w i d t h ) ;  
                                 r e t u r n   i s O v e r ;  
                                 b r e a k ;  
                         c a s e   ' t o u c h ' :  
                                 r e t u r n   (  
 	 	 	 	 	 ( y 1   > =   t   & &   y 1   < =   b )   | |   / /   T o p   e d g e   t o u c h i n g  
 	 	 	 	 	 ( y 2   > =   t   & &   y 2   < =   b )   | |   / /   B o t t o m   e d g e   t o u c h i n g  
 	 	 	 	 	 ( y 1   <   t   & &   y 2   >   b ) 	 	 / /   S u r r o u n d e d   v e r t i c a l l y  
 	 	 	 	 )   & &   (  
 	 	 	 	 	 ( x 1   > =   l   & &   x 1   < =   r )   | |   / /   L e f t   e d g e   t o u c h i n g  
 	 	 	 	 	 ( x 2   > =   l   & &   x 2   < =   r )   | |   / /   R i g h t   e d g e   t o u c h i n g  
 	 	 	 	 	 ( x 1   <   l   & &   x 2   >   r ) 	 	 / /   S u r r o u n d e d   h o r i z o n t a l l y  
 	 	 	 	 ) ;  
                                 b r e a k ;  
                         d e f a u l t :  
                                 r e t u r n   f a l s e ;  
                                 b r e a k ;  
                 }  
  
         } ;  
  
         / *  
         T h i s   m a n a g e r   t r a c k s   o f f s e t s   o f   d r a g g a b l e s   a n d   d r o p p a b l e s  
         * /  
         $ . u i . d d m a n a g e r   =   {  
                 c u r r e n t :   n u l l ,  
                 d r o p p a b l e s :   {   ' d e f a u l t ' :   [ ]   } ,  
                 p r e p a r e O f f s e t s :   f u n c t i o n ( t ,   e v e n t )   {  
  
                         v a r   m   =   $ . u i . d d m a n a g e r . d r o p p a b l e s [ t . o p t i o n s . s c o p e ]   | |   [ ] ;  
                         v a r   t y p e   =   e v e n t   ?   e v e n t . t y p e   :   n u l l ;   / /   w o r k a r o u n d   f o r   # 2 3 1 7  
                         v a r   l i s t   =   ( t . c u r r e n t I t e m   | |   t . e l e m e n t ) . f i n d ( " : d a t a ( d r o p p a b l e ) " ) . a n d S e l f ( ) ;  
  
                         d r o p p a b l e s L o o p :   f o r   ( v a r   i   =   0 ;   i   <   m . l e n g t h ;   i + + )   {  
  
                                 i f   ( m [ i ] . o p t i o n s . d i s a b l e d   | |   ( t   & &   ! m [ i ] . a c c e p t . c a l l ( m [ i ] . e l e m e n t [ 0 ] ,   ( t . c u r r e n t I t e m   | |   t . e l e m e n t ) ) ) )   c o n t i n u e ;   / / N o   d i s a b l e d   a n d   n o n - a c c e p t e d  
                                 f o r   ( v a r   j   =   0 ;   j   <   l i s t . l e n g t h ;   j + + )   {   i f   ( l i s t [ j ]   = =   m [ i ] . e l e m e n t [ 0 ] )   {   m [ i ] . p r o p o r t i o n s . h e i g h t   =   0 ;   c o n t i n u e   d r o p p a b l e s L o o p ;   }   } ;   / / F i l t e r   o u t   e l e m e n t s   i n   t h e   c u r r e n t   d r a g g e d   i t e m  
                                 m [ i ] . v i s i b l e   =   m [ i ] . e l e m e n t . c s s ( " d i s p l a y " )   ! =   " n o n e " ;   i f   ( ! m [ i ] . v i s i b l e )   c o n t i n u e ;   	 	 	 	 	 	 	 	 	 / / I f   t h e   e l e m e n t   i s   n o t   v i s i b l e ,   c o n t i n u e  
  
                                 m [ i ] . o f f s e t   =   m [ i ] . e l e m e n t . o f f s e t ( ) ;  
                                 m [ i ] . p r o p o r t i o n s   =   {   w i d t h :   m [ i ] . e l e m e n t [ 0 ] . o f f s e t W i d t h ,   h e i g h t :   m [ i ] . e l e m e n t [ 0 ] . o f f s e t H e i g h t   } ;  
  
                                 i f   ( t y p e   = =   " m o u s e d o w n " )   m [ i ] . _ a c t i v a t e . c a l l ( m [ i ] ,   e v e n t ) ;   / / A c t i v a t e   t h e   d r o p p a b l e   i f   u s e d   d i r e c t l y   f r o m   d r a g g a b l e s  
  
                         }  
  
                 } ,  
                 d r o p :   f u n c t i o n ( d r a g g a b l e ,   e v e n t )   {  
  
                         v a r   d r o p p e d   =   f a l s e ;  
                         $ . e a c h ( $ . u i . d d m a n a g e r . d r o p p a b l e s [ d r a g g a b l e . o p t i o n s . s c o p e ]   | |   [ ] ,   f u n c t i o n ( )   {  
  
                                 i f   ( ! t h i s . o p t i o n s )   r e t u r n ;  
                                 i f   ( ! t h i s . o p t i o n s . d i s a b l e d   & &   t h i s . v i s i b l e   & &   $ . u i . i n t e r s e c t ( d r a g g a b l e ,   t h i s ,   t h i s . o p t i o n s . t o l e r a n c e ) )  
                                         d r o p p e d   =   d r o p p e d   | |   t h i s . _ d r o p . c a l l ( t h i s ,   e v e n t ) ;  
  
                                 i f   ( ! t h i s . o p t i o n s . d i s a b l e d   & &   t h i s . v i s i b l e   & &   t h i s . a c c e p t . c a l l ( t h i s . e l e m e n t [ 0 ] ,   ( d r a g g a b l e . c u r r e n t I t e m   | |   d r a g g a b l e . e l e m e n t ) ) )   {  
                                         t h i s . i s o u t   =   1 ;   t h i s . i s o v e r   =   0 ;  
                                         t h i s . _ d e a c t i v a t e . c a l l ( t h i s ,   e v e n t ) ;  
                                 }  
  
                         } ) ;  
                         r e t u r n   d r o p p e d ;  
  
                 } ,  
                 d r a g :   f u n c t i o n ( d r a g g a b l e ,   e v e n t )   {  
  
                         / / I f   y o u   h a v e   a   h i g h l y   d y n a m i c   p a g e ,   y o u   m i g h t   t r y   t h i s   o p t i o n .   I t   r e n d e r s   p o s i t i o n s   e v e r y   t i m e   y o u   m o v e   t h e   m o u s e .  
                         i f   ( d r a g g a b l e . o p t i o n s . r e f r e s h P o s i t i o n s )   $ . u i . d d m a n a g e r . p r e p a r e O f f s e t s ( d r a g g a b l e ,   e v e n t ) ;  
  
                         / / R u n   t h r o u g h   a l l   d r o p p a b l e s   a n d   c h e c k   t h e i r   p o s i t i o n s   b a s e d   o n   s p e c i f i c   t o l e r a n c e   o p t i o n s  
                         $ . e a c h ( $ . u i . d d m a n a g e r . d r o p p a b l e s [ d r a g g a b l e . o p t i o n s . s c o p e ]   | |   [ ] ,   f u n c t i o n ( )   {  
  
                                 i f   ( t h i s . o p t i o n s . d i s a b l e d   | |   t h i s . g r e e d y C h i l d   | |   ! t h i s . v i s i b l e )   r e t u r n ;  
                                 v a r   i n t e r s e c t s   =   $ . u i . i n t e r s e c t ( d r a g g a b l e ,   t h i s ,   t h i s . o p t i o n s . t o l e r a n c e ) ;  
  
                                 v a r   c   =   ! i n t e r s e c t s   & &   t h i s . i s o v e r   = =   1   ?   ' i s o u t '   :   ( i n t e r s e c t s   & &   t h i s . i s o v e r   = =   0   ?   ' i s o v e r '   :   n u l l ) ;  
                                 i f   ( ! c )   r e t u r n ;  
  
                                 v a r   p a r e n t I n s t a n c e ;  
                                 i f   ( t h i s . o p t i o n s . g r e e d y )   {  
                                         v a r   p a r e n t   =   t h i s . e l e m e n t . p a r e n t s ( ' : d a t a ( d r o p p a b l e ) : e q ( 0 ) ' ) ;  
                                         i f   ( p a r e n t . l e n g t h )   {  
                                                 p a r e n t I n s t a n c e   =   $ . d a t a ( p a r e n t [ 0 ] ,   ' d r o p p a b l e ' ) ;  
                                                 p a r e n t I n s t a n c e . g r e e d y C h i l d   =   ( c   = =   ' i s o v e r '   ?   1   :   0 ) ;  
                                         }  
                                 }  
  
                                 / /   w e   j u s t   m o v e d   i n t o   a   g r e e d y   c h i l d  
                                 i f   ( p a r e n t I n s t a n c e   & &   c   = =   ' i s o v e r ' )   {  
                                         p a r e n t I n s t a n c e [ ' i s o v e r ' ]   =   0 ;  
                                         p a r e n t I n s t a n c e [ ' i s o u t ' ]   =   1 ;  
                                         p a r e n t I n s t a n c e . _ o u t . c a l l ( p a r e n t I n s t a n c e ,   e v e n t ) ;  
                                 }  
  
                                 t h i s [ c ]   =   1 ;   t h i s [ c   = =   ' i s o u t '   ?   ' i s o v e r '   :   ' i s o u t ' ]   =   0 ;  
                                 t h i s [ c   = =   " i s o v e r "   ?   " _ o v e r "   :   " _ o u t " ] . c a l l ( t h i s ,   e v e n t ) ;  
  
                                 / /   w e   j u s t   m o v e d   o u t   o f   a   g r e e d y   c h i l d  
                                 i f   ( p a r e n t I n s t a n c e   & &   c   = =   ' i s o u t ' )   {  
                                         p a r e n t I n s t a n c e [ ' i s o u t ' ]   =   0 ;  
                                         p a r e n t I n s t a n c e [ ' i s o v e r ' ]   =   1 ;  
                                         p a r e n t I n s t a n c e . _ o v e r . c a l l ( p a r e n t I n s t a n c e ,   e v e n t ) ;  
                                 }  
                         } ) ;  
  
                 }  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   R e s i z a b l e   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / R e s i z a b l e s  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . u i . c o r e . j s  
 * 	 j q u e r y . u i . m o u s e . j s  
 * 	 j q u e r y . u i . w i d g e t . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . w i d g e t ( " u i . r e s i z a b l e " ,   $ . u i . m o u s e ,   {  
                 w i d g e t E v e n t P r e f i x :   " r e s i z e " ,  
                 o p t i o n s :   {  
                         a l s o R e s i z e :   f a l s e ,  
                         a n i m a t e :   f a l s e ,  
                         a n i m a t e D u r a t i o n :   " s l o w " ,  
                         a n i m a t e E a s i n g :   " s w i n g " ,  
                         a s p e c t R a t i o :   f a l s e ,  
                         a u t o H i d e :   f a l s e ,  
                         c o n t a i n m e n t :   f a l s e ,  
                         g h o s t :   f a l s e ,  
                         g r i d :   f a l s e ,  
                         h a n d l e s :   " e , s , s e " ,  
                         h e l p e r :   f a l s e ,  
                         m a x H e i g h t :   n u l l ,  
                         m a x W i d t h :   n u l l ,  
                         m i n H e i g h t :   1 0 ,  
                         m i n W i d t h :   1 0 ,  
                         z I n d e x :   1 0 0 0  
                 } ,  
                 _ c r e a t e :   f u n c t i o n ( )   {  
  
                         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 . e l e m e n t . a d d C l a s s ( " u i - r e s i z a b l e " ) ;  
  
                         $ . e x t e n d ( t h i s ,   {  
                                 _ a s p e c t R a t i o :   ! ! ( o . a s p e c t R a t i o ) ,  
                                 a s p e c t R a t i o :   o . a s p e c t R a t i o ,  
                                 o r i g i n a l E l e m e n t :   t h i s . e l e m e n t ,  
                                 _ p r o p o r t i o n a l l y R e s i z e E l e m e n t s :   [ ] ,  
                                 _ h e l p e r :   o . h e l p e r   | |   o . g h o s t   | |   o . a n i m a t e   ?   o . h e l p e r   | |   ' u i - r e s i z a b l e - h e l p e r '   :   n u l l  
                         } ) ;  
  
                         / / W r a p   t h e   e l e m e n t   i f   i t   c a n n o t   h o l d   c h i l d   n o d e s  
                         i f   ( t h i s . e l e m e n t [ 0 ] . n o d e N a m e . m a t c h ( / c a n v a s | t e x t a r e a | i n p u t | s e l e c t | b u t t o n | i m g / i ) )   {  
  
                                 / / O p e r a   f i x   f o r   r e l a t i v e   p o s i t i o n i n g  
                                 i f   ( / r e l a t i v e / . t e s t ( t h i s . e l e m e n t . c s s ( ' p o s i t i o n ' ) )   & &   $ . b r o w s e r . o p e r a )  
                                         t h i s . e l e m e n t . c s s ( {   p o s i t i o n :   ' r e l a t i v e ' ,   t o p :   ' a u t o ' ,   l e f t :   ' a u t o '   } ) ;  
  
                                 / / C r e a t e   a   w r a p p e r   e l e m e n t   a n d   s e t   t h e   w r a p p e r   t o   t h e   n e w   c u r r e n t   i n t e r n a l   e l e m e n t  
                                 t h i s . e l e m e n t . w r a p (  
 	 	 	 	 $ ( ' < d i v   c l a s s = " u i - w r a p p e r "   s t y l e = " o v e r f l o w :   h i d d e n ; " > < / d i v > ' ) . c s s ( {  
 	 	 	 	         p o s i t i o n :   t h i s . e l e m e n t . c s s ( ' p o s i t i o n ' ) ,  
 	 	 	 	         w i d t h :   t h i s . e l e m e n t . o u t e r W i d t h ( ) ,  
 	 	 	 	         h e i g h t :   t h i s . e l e m e n t . o u t e r H e i g h t ( ) ,  
 	 	 	 	         t o p :   t h i s . e l e m e n t . c s s ( ' t o p ' ) ,  
 	 	 	 	         l e f t :   t h i s . e l e m e n t . c s s ( ' l e f t ' )  
 	 	 	 	 } )  
 	 	 	 ) ;  
  
                                 / / O v e r w r i t e   t h e   o r i g i n a l   t h i s . e l e m e n t  
                                 t h i s . e l e m e n t   =   t h i s . e l e m e n t . p a r e n t ( ) . d a t a (  
 	 	 	 	 " r e s i z a b l e " ,   t h i s . e l e m e n t . d a t a ( ' r e s i z a b l e ' )  
 	 	 	 ) ;  
  
                                 t h i s . e l e m e n t I s W r a p p e r   =   t r u e ;  
  
                                 / / M o v e   m a r g i n s   t o   t h e   w r a p p e r  
                                 t h i s . e l e m e n t . c s s ( {   m a r g i n L e f t :   t h i s . o r i g i n a l E l e m e n t . c s s ( " m a r g i n L e f t " ) ,   m a r g i n T o p :   t h i s . o r i g i n a l E l e m e n t . c s s ( " m a r g i n T o p " ) ,   m a r g i n R i g h t :   t h i s . o r i g i n a l E l e m e n t . c s s ( " m a r g i n R i g h t " ) ,   m a r g i n B o t t o m :   t h i s . o r i g i n a l E l e m e n t . c s s ( " m a r g i n B o t t o m " )   } ) ;  
                                 t h i s . o r i g i n a l E l e m e n t . c s s ( {   m a r g i n L e f t :   0 ,   m a r g i n T o p :   0 ,   m a r g i n R i g h t :   0 ,   m a r g i n B o t t o m :   0   } ) ;  
  
                                 / / P r e v e n t   S a f a r i   t e x t a r e a   r e s i z e  
                                 t h i s . o r i g i n a l R e s i z e S t y l e   =   t h i s . o r i g i n a l E l e m e n t . c s s ( ' r e s i z e ' ) ;  
                                 t h i s . o r i g i n a l E l e m e n t . c s s ( ' r e s i z e ' ,   ' n o n e ' ) ;  
  
                                 / / P u s h   t h e   a c t u a l   e l e m e n t   t o   o u r   p r o p o r t i o n a l l y R e s i z e   i n t e r n a l   a r r a y  
                                 t h i s . _ p r o p o r t i o n a l l y R e s i z e E l e m e n t s . p u s h ( t h i s . o r i g i n a l E l e m e n t . c s s ( {   p o s i t i o n :   ' s t a t i c ' ,   z o o m :   1 ,   d i s p l a y :   ' b l o c k '   } ) ) ;  
  
                                 / /   a v o i d   I E   j u m p   ( h a r d   s e t   t h e   m a r g i n )  
                                 t h i s . o r i g i n a l E l e m e n t . c s s ( {   m a r g i n :   t h i s . o r i g i n a l E l e m e n t . c s s ( ' m a r g i n ' )   } ) ;  
  
                                 / /   f i x   h a n d l e r s   o f f s e t  
                                 t h i s . _ p r o p o r t i o n a l l y R e s i z e ( ) ;  
  
                         }  
  
                         t h i s . h a n d l e s   =   o . h a n d l e s   | |   ( ! $ ( ' . u i - r e s i z a b l e - h a n d l e ' ,   t h i s . e l e m e n t ) . l e n g t h   ?   " e , s , s e "   :   {   n :   ' . u i - r e s i z a b l e - n ' ,   e :   ' . u i - r e s i z a b l e - e ' ,   s :   ' . u i - r e s i z a b l e - s ' ,   w :   ' . u i - r e s i z a b l e - w ' ,   s e :   ' . u i - r e s i z a b l e - s e ' ,   s w :   ' . u i - r e s i z a b l e - s w ' ,   n e :   ' . u i - r e s i z a b l e - n e ' ,   n w :   ' . u i - r e s i z a b l e - n w '   } ) ;  
                         i f   ( t h i s . h a n d l e s . c o n s t r u c t o r   = =   S t r i n g )   {  
  
                                 i f   ( t h i s . h a n d l e s   = =   ' a l l ' )   t h i s . h a n d l e s   =   ' n , e , s , w , s e , s w , n e , n w ' ;  
                                 v a r   n   =   t h i s . h a n d l e s . s p l i t ( " , " ) ;   t h i s . h a n d l e s   =   { } ;  
  
                                 f o r   ( v a r   i   =   0 ;   i   <   n . l e n g t h ;   i + + )   {  
  
                                         v a r   h a n d l e   =   $ . t r i m ( n [ i ] ) ,   h n a m e   =   ' u i - r e s i z a b l e - '   +   h a n d l e ;  
                                         v a r   a x i s   =   $ ( ' < d i v   c l a s s = " u i - r e s i z a b l e - h a n d l e   '   +   h n a m e   +   ' " > < / d i v > ' ) ;  
  
                                         / /   i n c r e a s e   z I n d e x   o f   s w ,   s e ,   n e ,   n w   a x i s  
                                         / / T O D O   :   t h i s   m o d i f i e s   o r i g i n a l   o p t i o n  
                                         i f   ( / s w | s e | n e | n w / . t e s t ( h a n d l e ) )   a x i s . c s s ( {   z I n d e x :   + + o . z I n d e x   } ) ;  
  
                                         / / T O D O   :   W h a t ' s   g o i n g   o n   h e r e ?  
                                         i f   ( ' s e '   = =   h a n d l e )   {  
                                                 a x i s . a d d C l a s s ( ' u i - i c o n   u i - i c o n - g r i p s m a l l - d i a g o n a l - s e ' ) ;  
                                         } ;  
  
                                         / / I n s e r t   i n t o   i n t e r n a l   h a n d l e s   o b j e c t   a n d   a p p e n d   t o   e l e m e n t  
                                         t h i s . h a n d l e s [ h a n d l e ]   =   ' . u i - r e s i z a b l e - '   +   h a n d l e ;  
                                         t h i s . e l e m e n t . a p p e n d ( a x i s ) ;  
                                 }  
  
                         }  
  
                         t h i s . _ r e n d e r A x i s   =   f u n c t i o n ( t a r g e t )   {  
  
                                 t a r g e t   =   t a r g e t   | |   t h i s . e l e m e n t ;  
  
                                 f o r   ( v a r   i   i n   t h i s . h a n d l e s )   {  
  
                                         i f   ( t h i s . h a n d l e s [ i ] . c o n s t r u c t o r   = =   S t r i n g )  
                                                 t h i s . h a n d l e s [ i ]   =   $ ( t h i s . h a n d l e s [ i ] ,   t h i s . e l e m e n t ) . s h o w ( ) ;  
  
                                         / / A p p l y   p a d   t o   w r a p p e r   e l e m e n t ,   n e e d e d   t o   f i x   a x i s   p o s i t i o n   ( t e x t a r e a ,   i n p u t s ,   s c r o l l s )  
                                         i f   ( t h i s . e l e m e n t I s W r a p p e r   & &   t h i s . o r i g i n a l E l e m e n t [ 0 ] . n o d e N a m e . m a t c h ( / t e x t a r e a | i n p u t | s e l e c t | b u t t o n / i ) )   {  
  
                                                 v a r   a x i s   =   $ ( t h i s . h a n d l e s [ i ] ,   t h i s . e l e m e n t ) ,   p a d W r a p p e r   =   0 ;  
  
                                                 / / C h e c k i n g   t h e   c o r r e c t   p a d   a n d   b o r d e r  
                                                 p a d W r a p p e r   =   / s w | n e | n w | s e | n | s / . t e s t ( i )   ?   a x i s . o u t e r H e i g h t ( )   :   a x i s . o u t e r W i d t h ( ) ;  
  
                                                 / / T h e   p a d d i n g   t y p e   i   h a v e   t o   a p p l y . . .  
                                                 v a r   p a d P o s   =   [ ' p a d d i n g ' ,  
 	 	 	 	 	 	 / n e | n w | n / . t e s t ( i )   ?   ' T o p '   :  
 	 	 	 	 	 	 / s e | s w | s / . t e s t ( i )   ?   ' B o t t o m '   :  
 	 	 	 	 	 	 / ^ e $ / . t e s t ( i )   ?   ' R i g h t '   :   ' L e f t ' ] . j o i n ( " " ) ;  
  
                                                 t a r g e t . c s s ( p a d P o s ,   p a d W r a p p e r ) ;  
  
                                                 t h i s . _ p r o p o r t i o n a l l y R e s i z e ( ) ;  
  
                                         }  
  
                                         / / T O D O :   W h a t ' s   t h a t   g o o d   f o r ?   T h e r e ' s   n o t   a n y t h i n g   t o   b e   e x e c u t e d   l e f t  
                                         i f   ( ! $ ( t h i s . h a n d l e s [ i ] ) . l e n g t h )  
                                                 c o n t i n u e ;  
  
                                 }  
                         } ;  
  
                         / / T O D O :   m a k e   r e n d e r A x i s   a   p r o t o t y p e   f u n c t i o n  
                         t h i s . _ r e n d e r A x i s ( t h i s . e l e m e n t ) ;  
  
                         t h i s . _ h a n d l e s   =   $ ( ' . u i - r e s i z a b l e - h a n d l e ' ,   t h i s . e l e m e n t )  
 	 	 	 . d i s a b l e S e l e c t i o n ( ) ;  
  
                         / / M a t c h i n g   a x i s   n a m e  
                         t h i s . _ h a n d l e s . m o u s e o v e r ( f u n c t i o n ( )   {  
                                 i f   ( ! s e l f . r e s i z i n g )   {  
                                         i f   ( t h i s . c l a s s N a m e )  
                                                 v a r   a x i s   =   t h i s . c l a s s N a m e . m a t c h ( / u i - r e s i z a b l e - ( s e | s w | n e | n w | n | e | s | w ) / i ) ;  
                                         / / A x i s ,   d e f a u l t   =   s e  
                                         s e l f . a x i s   =   a x i s   & &   a x i s [ 1 ]   ?   a x i s [ 1 ]   :   ' s e ' ;  
                                 }  
                         } ) ;  
  
                         / / I f   w e   w a n t   t o   a u t o   h i d e   t h e   e l e m e n t s  
                         i f   ( o . a u t o H i d e )   {  
                                 t h i s . _ h a n d l e s . h i d e ( ) ;  
                                 $ ( t h i s . e l e m e n t )  
 	 	 	 	 . a d d C l a s s ( " u i - r e s i z a b l e - a u t o h i d e " )  
 	 	 	 	 . h o v e r ( 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 - r e s i z a b l e - a u t o h i d e " ) ;  
 	 	 	 	         s e l f . _ h a n d l e s . s h o w ( ) ;  
 	 	 	 	 } ,  
 	 	 	 	 f u n c t i o n ( )   {  
 	 	 	 	         i f   ( ! s e l f . r e s i z i n g )   {  
 	 	 	 	                 $ ( t h i s ) . a d d C l a s s ( " u i - r e s i z a b l e - a u t o h i d e " ) ;  
 	 	 	 	                 s e l f . _ h a n d l e s . h i d e ( ) ;  
 	 	 	 	         }  
 	 	 	 	 } ) ;  
                         }  
  
                         / / I n i t i a l i z e   t h e   m o u s e   i n t e r a c t i o n  
                         t h i s . _ m o u s e I n i t ( ) ;  
  
                 } ,  
  
                 d e s t r o y :   f u n c t i o n ( )   {  
  
                         t h i s . _ m o u s e D e s t r o y ( ) ;  
  
                         v a r   _ d e s t r o y   =   f u n c t i o n ( e x p )   {  
                                 $ ( e x p ) . r e m o v e C l a s s ( " u i - r e s i z a b l e   u i - r e s i z a b l e - d i s a b l e d   u i - r e s i z a b l e - r e s i z i n g " )  
 	 	 	 	 . r e m o v e D a t a ( " r e s i z a b l e " ) . u n b i n d ( " . r e s i z a b l e " ) . f i n d ( ' . u i - r e s i z a b l e - h a n d l e ' ) . r e m o v e ( ) ;  
                         } ;  
  
                         / / T O D O :   U n w r a p   a t   s a m e   D O M   p o s i t i o n  
                         i f   ( t h i s . e l e m e n t I s W r a p p e r )   {  
                                 _ d e s t r o y ( t h i s . e l e m e n t ) ;  
                                 v a r   w r a p p e r   =   t h i s . e l e m e n t ;  
                                 w r a p p e r . a f t e r (  
 	 	 	 	 t h i s . o r i g i n a l E l e m e n t . c s s ( {  
 	 	 	 	         p o s i t i o n :   w r a p p e r . c s s ( ' p o s i t i o n ' ) ,  
 	 	 	 	         w i d t h :   w r a p p e r . o u t e r W i d t h ( ) ,  
 	 	 	 	         h e i g h t :   w r a p p e r . o u t e r H e i g h t ( ) ,  
 	 	 	 	         t o p :   w r a p p e r . c s s ( ' t o p ' ) ,  
 	 	 	 	         l e f t :   w r a p p e r . c s s ( ' l e f t ' )  
 	 	 	 	 } )  
 	 	 	 ) . r e m o v e ( ) ;  
                         }  
  
                         t h i s . o r i g i n a l E l e m e n t . c s s ( ' r e s i z e ' ,   t h i s . o r i g i n a l R e s i z e S t y l e ) ;  
                         _ d e s t r o y ( t h i s . o r i g i n a l E l e m e n t ) ;  
  
                         r e t u r n   t h i s ;  
                 } ,  
  
                 _ m o u s e C a p t u r e :   f u n c t i o n ( e v e n t )   {  
                         v a r   h a n d l e   =   f a l s e ;  
                         f o r   ( v a r   i   i n   t h i s . h a n d l e s )   {  
                                 i f   ( $ ( t h i s . h a n d l e s [ i ] ) [ 0 ]   = =   e v e n t . t a r g e t )   {  
                                         h a n d l e   =   t r u e ;  
                                 }  
                         }  
  
                         r e t u r n   ! t h i s . o p t i o n s . d i s a b l e d   & &   h a n d l e ;  
                 } ,  
  
                 _ m o u s e S t a r t :   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 ,   i n i P o s   =   t h i s . e l e m e n t . p o s i t i o n ( ) ,   e l   =   t h i s . e l e m e n t ;  
  
                         t h i s . r e s i z i n g   =   t r u e ;  
                         t h i s . d o c u m e n t S c r o l l   =   {   t o p :   $ ( d o c u m e n t ) . s c r o l l T o p ( ) ,   l e f t :   $ ( d o c u m e n t ) . s c r o l l L e f t ( )   } ;  
  
                         / /   b u g f i x   f o r   h t t p : / / d e v . j q u e r y . c o m / t i c k e t / 1 7 4 9  
                         i f   ( e l . i s ( ' . u i - d r a g g a b l e ' )   | |   ( / a b s o l u t e / ) . t e s t ( e l . c s s ( ' p o s i t i o n ' ) ) )   {  
                                 e l . c s s ( {   p o s i t i o n :   ' a b s o l u t e ' ,   t o p :   i n i P o s . t o p ,   l e f t :   i n i P o s . l e f t   } ) ;  
                         }  
  
                         / / O p e r a   f i x i n g   r e l a t i v e   p o s i t i o n  
                         i f   ( $ . b r o w s e r . o p e r a   & &   ( / r e l a t i v e / ) . t e s t ( e l . c s s ( ' p o s i t i o n ' ) ) )  
                                 e l . c s s ( {   p o s i t i o n :   ' r e l a t i v e ' ,   t o p :   ' a u t o ' ,   l e f t :   ' a u t o '   } ) ;  
  
                         t h i s . _ r e n d e r P r o x y ( ) ;  
  
                         v a r   c u r l e f t   =   n u m ( t h i s . h e l p e r . c s s ( ' l e f t ' ) ) ,   c u r t o p   =   n u m ( t h i s . h e l p e r . c s s ( ' t o p ' ) ) ;  
  
                         i f   ( o . c o n t a i n m e n t )   {  
                                 c u r l e f t   + =   $ ( o . c o n t a i n m e n t ) . s c r o l l L e f t ( )   | |   0 ;  
                                 c u r t o p   + =   $ ( o . c o n t a i n m e n t ) . s c r o l l T o p ( )   | |   0 ;  
                         }  
  
                         / / S t o r e   n e e d e d   v a r i a b l e s  
                         t h i s . o f f s e t   =   t h i s . h e l p e r . o f f s e t ( ) ;  
                         t h i s . p o s i t i o n   =   {   l e f t :   c u r l e f t ,   t o p :   c u r t o p   } ;  
                         t h i s . s i z e   =   t h i s . _ h e l p e r   ?   {   w i d t h :   e l . o u t e r W i d t h ( ) ,   h e i g h t :   e l . o u t e r H e i g h t ( ) }   :   {   w i d t h :   e l . w i d t h ( ) ,   h e i g h t :   e l . h e i g h t ( )   } ;  
                         t h i s . o r i g i n a l S i z e   =   t h i s . _ h e l p e r   ?   {   w i d t h :   e l . o u t e r W i d t h ( ) ,   h e i g h t :   e l . o u t e r H e i g h t ( ) }   :   {   w i d t h :   e l . w i d t h ( ) ,   h e i g h t :   e l . h e i g h t ( )   } ;  
                         t h i s . o r i g i n a l P o s i t i o n   =   {   l e f t :   c u r l e f t ,   t o p :   c u r t o p   } ;  
                         t h i s . s i z e D i f f   =   {   w i d t h :   e l . o u t e r W i d t h ( )   -   e l . w i d t h ( ) ,   h e i g h t :   e l . o u t e r H e i g h t ( )   -   e l . h e i g h t ( )   } ;  
                         t h i s . o r i g i n a l M o u s e P o s i t i o n   =   {   l e f t :   e v e n t . p a g e X ,   t o p :   e v e n t . p a g e Y   } ;  
  
                         / / A s p e c t   R a t i o  
                         t h i s . a s p e c t R a t i o   =   ( t y p e o f   o . a s p e c t R a t i o   = =   ' n u m b e r ' )   ?   o . a s p e c t R a t i o   :   ( ( t h i s . o r i g i n a l S i z e . w i d t h   /   t h i s . o r i g i n a l S i z e . h e i g h t )   | |   1 ) ;  
  
                         v a r   c u r s o r   =   $ ( ' . u i - r e s i z a b l e - '   +   t h i s . a x i s ) . c s s ( ' c u r s o r ' ) ;  
                         $ ( ' b o d y ' ) . c s s ( ' c u r s o r ' ,   c u r s o r   = =   ' a u t o '   ?   t h i s . a x i s   +   ' - r e s i z e '   :   c u r s o r ) ;  
  
                         e l . a d d C l a s s ( " u i - r e s i z a b l e - r e s i z i n g " ) ;  
                         t h i s . _ p r o p a g a t e ( " s t a r t " ,   e v e n t ) ;  
                         r e t u r n   t r u e ;  
                 } ,  
  
                 _ m o u s e D r a g :   f u n c t i o n ( e v e n t )   {  
  
                         / / I n c r e a s e   p e r f o r m a n c e ,   a v o i d   r e g e x  
                         v a r   e l   =   t h i s . h e l p e r ,   o   =   t h i s . o p t i o n s ,   p r o p s   =   { } ,  
 	 	 	 s e l f   =   t h i s ,   s m p   =   t h i s . o r i g i n a l M o u s e P o s i t i o n ,   a   =   t h i s . a x i s ;  
  
                         v a r   d x   =   ( e v e n t . p a g e X   -   s m p . l e f t )   | |   0 ,   d y   =   ( e v e n t . p a g e Y   -   s m p . t o p )   | |   0 ;  
                         v a r   t r i g g e r   =   t h i s . _ c h a n g e [ a ] ;  
                         i f   ( ! t r i g g e r )   r e t u r n   f a l s e ;  
  
                         / /   C a l c u l a t e   t h e   a t t r s   t h a t   w i l l   b e   c h a n g e  
                         v a r   d a t a   =   t r i g g e r . a p p l y ( t h i s ,   [ e v e n t ,   d x ,   d y ] ) ,   i e 6   =   $ . b r o w s e r . m s i e   & &   $ . b r o w s e r . v e r s i o n   <   7 ,   c s d i f   =   t h i s . s i z e D i f f ;  
  
                         i f   ( t h i s . _ a s p e c t R a t i o   | |   e v e n t . s h i f t K e y )  
                                 d a t a   =   t h i s . _ u p d a t e R a t i o ( d a t a ,   e v e n t ) ;  
  
                         d a t a   =   t h i s . _ r e s p e c t S i z e ( d a t a ,   e v e n t ) ;  
  
                         / /   p l u g i n s   c a l l b a c k s   n e e d   t o   b e   c a l l e d   f i r s t  
                         t h i s . _ p r o p a g a t e ( " r e s i z e " ,   e v e n t ) ;  
  
                         e l . c s s ( {  
                                 t o p :   t h i s . p o s i t i o n . t o p   +   " p x " ,   l e f t :   t h i s . p o s i t i o n . l e f t   +   " p x " ,  
                                 w i d t h :   t h i s . s i z e . w i d t h   +   " p x " ,   h e i g h t :   t h i s . s i z e . h e i g h t   +   " p x "  
                         } ) ;  
  
                         i f   ( ! t h i s . _ h e l p e r   & &   t h i s . _ p r o p o r t i o n a l l y R e s i z e E l e m e n t s . l e n g t h )  
                                 t h i s . _ p r o p o r t i o n a l l y R e s i z e ( ) ;  
  
                         t h i s . _ u p d a t e C a c h e ( d a t a ) ;  
  
                         / /   c a l l i n g   t h e   u s e r   c a l l b a c k   a t   t h e   e n d  
                         t h i s . _ t r i g g e r ( ' r e s i z e ' ,   e v e n t ,   t h i s . u i ( ) ) ;  
  
                         r e t u r n   f a l s e ;  
                 } ,  
  
                 _ m o u s e S t o p :   f u n c t i o n ( e v e n t )   {  
  
                         t h i s . r e s i z i n g   =   f a l s e ;  
                         v a r   o   =   t h i s . o p t i o n s ,   s e l f   =   t h i s ;  
  
                         i f   ( t h i s . _ h e l p e r )   {  
                                 v a r   p r   =   t h i s . _ p r o p o r t i o n a l l y R e s i z e E l e m e n t s ,   i s t a   =   p r . l e n g t h   & &   ( / t e x t a r e a / i ) . t e s t ( p r [ 0 ] . n o d e N a m e ) ,  
 	 	 	 	 s o f f s e t h   =   i s t a   & &   $ . u i . h a s S c r o l l ( p r [ 0 ] ,   ' l e f t ' )   / *   T O D O   -   j u m p   h e i g h t   * /   ?   0   :   s e l f . s i z e D i f f . h e i g h t ,  
 	 	 	 	 s o f f s e t w   =   i s t a   ?   0   :   s e l f . s i z e D i f f . w i d t h ;  
  
                                 v a r   s   =   {   w i d t h :   ( s e l f . h e l p e r . w i d t h ( )   -   s o f f s e t w ) ,   h e i g h t :   ( s e l f . h e l p e r . h e i g h t ( )   -   s o f f s e t h )   } ,  
 	 	 	 	 l e f t   =   ( p a r s e I n t ( s e l f . e l e m e n t . c s s ( ' l e f t ' ) ,   1 0 )   +   ( s e l f . p o s i t i o n . l e f t   -   s e l f . o r i g i n a l P o s i t i o n . l e f t ) )   | |   n u l l ,  
 	 	 	 	 t o p   =   ( p a r s e I n t ( s e l f . e l e m e n t . c s s ( ' t o p ' ) ,   1 0 )   +   ( s e l f . p o s i t i o n . t o p   -   s e l f . o r i g i n a l P o s i t i o n . t o p ) )   | |   n u l l ;  
  
                                 i f   ( ! o . a n i m a t e )  
                                         t h i s . e l e m e n t . c s s ( $ . e x t e n d ( s ,   {   t o p :   t o p ,   l e f t :   l e f t   } ) ) ;  
  
                                 s e l f . h e l p e r . h e i g h t ( s e l f . s i z e . h e i g h t ) ;  
                                 s e l f . h e l p e r . w i d t h ( s e l f . s i z e . w i d t h ) ;  
  
                                 i f   ( t h i s . _ h e l p e r   & &   ! o . a n i m a t e )   t h i s . _ p r o p o r t i o n a l l y R e s i z e ( ) ;  
                         }  
  
                         $ ( ' b o d y ' ) . c s s ( ' c u r s o r ' ,   ' a u t o ' ) ;  
  
                         t h i s . e l e m e n t . r e m o v e C l a s s ( " u i - r e s i z a b l e - r e s i z i n g " ) ;  
  
                         t h i s . _ p r o p a g a t e ( " s t o p " ,   e v e n t ) ;  
  
                         i f   ( t h i s . _ h e l p e r )   t h i s . h e l p e r . r e m o v e ( ) ;  
                         r e t u r n   f a l s e ;  
  
                 } ,  
  
                 _ u p d a t e C a c h e :   f u n c t i o n ( d a t a )   {  
                         v a r   o   =   t h i s . o p t i o n s ;  
                         t h i s . o f f s e t   =   t h i s . h e l p e r . o f f s e t ( ) ;  
                         i f   ( i s N u m b e r ( d a t a . l e f t ) )   t h i s . p o s i t i o n . l e f t   =   d a t a . l e f t ;  
                         i f   ( i s N u m b e r ( d a t a . t o p ) )   t h i s . p o s i t i o n . t o p   =   d a t a . t o p ;  
                         i f   ( i s N u m b e r ( d a t a . h e i g h t ) )   t h i s . s i z e . h e i g h t   =   d a t a . h e i g h t ;  
                         i f   ( i s N u m b e r ( d a t a . w i d t h ) )   t h i s . s i z e . w i d t h   =   d a t a . w i d t h ;  
                 } ,  
  
                 _ u p d a t e R a t i o :   f u n c t i o n ( d a t a ,   e v e n t )   {  
  
                         v a r   o   =   t h i s . o p t i o n s ,   c p o s   =   t h i s . p o s i t i o n ,   c s i z e   =   t h i s . s i z e ,   a   =   t h i s . a x i s ;  
  
                         i f   ( d a t a . h e i g h t )   d a t a . w i d t h   =   ( c s i z e . h e i g h t   *   t h i s . a s p e c t R a t i o ) ;  
                         e l s e   i f   ( d a t a . w i d t h )   d a t a . h e i g h t   =   ( c s i z e . w i d t h   /   t h i s . a s p e c t R a t i o ) ;  
  
                         i f   ( a   = =   ' s w ' )   {  
                                 d a t a . l e f t   =   c p o s . l e f t   +   ( c s i z e . w i d t h   -   d a t a . w i d t h ) ;  
                                 d a t a . t o p   =   n u l l ;  
                         }  
                         i f   ( a   = =   ' n w ' )   {  
                                 d a t a . t o p   =   c p o s . t o p   +   ( c s i z e . h e i g h t   -   d a t a . h e i g h t ) ;  
                                 d a t a . l e f t   =   c p o s . l e f t   +   ( c s i z e . w i d t h   -   d a t a . w i d t h ) ;  
                         }  
  
                         r e t u r n   d a t a ;  
                 } ,  
  
                 _ r e s p e c t S i z e :   f u n c t i o n ( d a t a ,   e v e n t )   {  
  
                         v a r   e l   =   t h i s . h e l p e r ,   o   =   t h i s . o p t i o n s ,   p R a t i o   =   t h i s . _ a s p e c t R a t i o   | |   e v e n t . s h i f t K e y ,   a   =   t h i s . a x i s ,  
 	 	 	 	 i s m a x w   =   i s N u m b e r ( d a t a . w i d t h )   & &   o . m a x W i d t h   & &   ( o . m a x W i d t h   <   d a t a . w i d t h ) ,   i s m a x h   =   i s N u m b e r ( d a t a . h e i g h t )   & &   o . m a x H e i g h t   & &   ( o . m a x H e i g h t   <   d a t a . h e i g h t ) ,  
 	 	 	 	 	 i s m i n w   =   i s N u m b e r ( d a t a . w i d t h )   & &   o . m i n W i d t h   & &   ( o . m i n W i d t h   >   d a t a . w i d t h ) ,   i s m i n h   =   i s N u m b e r ( d a t a . h e i g h t )   & &   o . m i n H e i g h t   & &   ( o . m i n H e i g h t   >   d a t a . h e i g h t ) ;  
  
                         i f   ( i s m i n w )   d a t a . w i d t h   =   o . m i n W i d t h ;  
                         i f   ( i s m i n h )   d a t a . h e i g h t   =   o . m i n H e i g h t ;  
                         i f   ( i s m a x w )   d a t a . w i d t h   =   o . m a x W i d t h ;  
                         i f   ( i s m a x h )   d a t a . h e i g h t   =   o . m a x H e i g h t ;  
  
                         v a r   d w   =   t h i s . o r i g i n a l P o s i t i o n . l e f t   +   t h i s . o r i g i n a l S i z e . w i d t h ,   d h   =   t h i s . p o s i t i o n . t o p   +   t h i s . s i z e . h e i g h t ;  
                         v a r   c w   =   / s w | n w | w / . t e s t ( a ) ,   c h   =   / n w | n e | n / . t e s t ( a ) ;  
  
                         i f   ( i s m i n w   & &   c w )   d a t a . l e f t   =   d w   -   o . m i n W i d t h ;  
                         i f   ( i s m a x w   & &   c w )   d a t a . l e f t   =   d w   -   o . m a x W i d t h ;  
                         i f   ( i s m i n h   & &   c h )   d a t a . t o p   =   d h   -   o . m i n H e i g h t ;  
                         i f   ( i s m a x h   & &   c h )   d a t a . t o p   =   d h   -   o . m a x H e i g h t ;  
  
                         / /   f i x i n g   j u m p   e r r o r   o n   t o p / l e f t   -   b u g   # 2 3 3 0  
                         v a r   i s N o t w h   =   ! d a t a . w i d t h   & &   ! d a t a . h e i g h t ;  
                         i f   ( i s N o t w h   & &   ! d a t a . l e f t   & &   d a t a . t o p )   d a t a . t o p   =   n u l l ;  
                         e l s e   i f   ( i s N o t w h   & &   ! d a t a . t o p   & &   d a t a . l e f t )   d a t a . l e f t   =   n u l l ;  
  
                         r e t u r n   d a t a ;  
                 } ,  
  
                 _ p r o p o r t i o n a l l y 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 ;  
                         i f   ( ! t h i s . _ p r o p o r t i o n a l l y R e s i z e E l e m e n t s . l e n g t h )   r e t u r n ;  
                         v a r   e l e m e n t   =   t h i s . h e l p e r   | |   t h i s . e l e m e n t ;  
  
                         f o r   ( v a r   i   =   0 ;   i   <   t h i s . _ p r o p o r t i o n a l l y R e s i z e E l e m e n t s . l e n g t h ;   i + + )   {  
  
                                 v a r   p r e l   =   t h i s . _ p r o p o r t i o n a l l y R e s i z e E l e m e n t s [ i ] ;  
  
                                 i f   ( ! t h i s . b o r d e r D i f )   {  
                                         v a r   b   =   [ p r e l . c s s ( ' b o r d e r T o p W i d t h ' ) ,   p r e l . c s s ( ' b o r d e r R i g h t W i d t h ' ) ,   p r e l . c s s ( ' b o r d e r B o t t o m W i d t h ' ) ,   p r e l . c s s ( ' b o r d e r L e f t W i d t h ' ) ] ,  
 	 	 	 	 	 p   =   [ p r e l . c s s ( ' p a d d i n g T o p ' ) ,   p r e l . c s s ( ' p a d d i n g R i g h t ' ) ,   p r e l . c s s ( ' p a d d i n g B o t t o m ' ) ,   p r e l . c s s ( ' p a d d i n g L e f t ' ) ] ;  
  
                                         t h i s . b o r d e r D i f   =   $ . m a p ( b ,   f u n c t i o n ( v ,   i )   {  
                                                 v a r   b o r d e r   =   p a r s e I n t ( v ,   1 0 )   | |   0 ,   p a d d i n g   =   p a r s e I n t ( p [ i ] ,   1 0 )   | |   0 ;  
                                                 r e t u r n   b o r d e r   +   p a d d i n g ;  
                                         } ) ;  
                                 }  
  
                                 i f   ( $ . b r o w s e r . m s i e   & &   ! ( ! ( $ ( e l e m e n t ) . i s ( ' : h i d d e n ' )   | |   $ ( e l e m e n t ) . p a r e n t s ( ' : h i d d e n ' ) . l e n g t h ) ) )  
                                         c o n t i n u e ;  
  
                                 p r e l . c s s ( {  
                                         h e i g h t :   ( e l e m e n t . h e i g h t ( )   -   t h i s . b o r d e r D i f [ 0 ]   -   t h i s . b o r d e r D i f [ 2 ] )   | |   0 ,  
                                         w i d t h :   ( e l e m e n t . w i d t h ( )   -   t h i s . b o r d e r D i f [ 1 ]   -   t h i s . b o r d e r D i f [ 3 ] )   | |   0  
                                 } ) ;  
  
                         } ;  
  
                 } ,  
  
                 _ r e n d e r P r o x y :   f u n c t i o n ( )   {  
  
                         v a r   e l   =   t h i s . e l e m e n t ,   o   =   t h i s . o p t i o n s ;  
                         t h i s . e l e m e n t O f f s e t   =   e l . o f f s e t ( ) ;  
  
                         i f   ( t h i s . _ h e l p e r )   {  
  
                                 t h i s . h e l p e r   =   t h i s . h e l p e r   | |   $ ( ' < d i v   s t y l e = " o v e r f l o w : h i d d e n ; " > < / d i v > ' ) ;  
  
                                 / /   f i x   i e 6   o f f s e t   T O D O :   T h i s   s e e m s   b r o k e n  
                                 v a r   i e 6   =   $ . b r o w s e r . m s i e   & &   $ . b r o w s e r . v e r s i o n   <   7 ,   i e 6 o f f s e t   =   ( i e 6   ?   1   :   0 ) ,  
 	 	 	 p x y o f f s e t   =   ( i e 6   ?   2   :   - 1 ) ;  
  
                                 t h i s . h e l p e r . a d d C l a s s ( t h i s . _ h e l p e r ) . c s s ( {  
                                         w i d t h :   t h i s . e l e m e n t . o u t e r W i d t h ( )   +   p x y o f f s e t ,  
                                         h e i g h t :   t h i s . e l e m e n t . o u t e r H e i g h t ( )   +   p x y o f f s e t ,  
                                         p o s i t i o n :   ' a b s o l u t e ' ,  
                                         l e f t :   t h i s . e l e m e n t O f f s e t . l e f t   -   i e 6 o f f s e t   +   ' p x ' ,  
                                         t o p :   t h i s . e l e m e n t O f f s e t . t o p   -   i e 6 o f f s e t   +   ' p x ' ,  
                                         z I n d e x :   + + o . z I n d e x   / / T O D O :   D o n ' t   m o d i f y   o p t i o n  
                                 } ) ;  
  
                                 t h i s . h e l p e r  
 	 	 	 	 . a p p e n d T o ( " b o d y " )  
 	 	 	 	 . d i s a b l e S e l e c t i o n ( ) ;  
  
                         }   e l s e   {  
                                 t h i s . h e l p e r   =   t h i s . e l e m e n t ;  
                         }  
  
                 } ,  
  
                 _ c h a n g e :   {  
                         e :   f u n c t i o n ( e v e n t ,   d x ,   d y )   {  
                                 r e t u r n   {   w i d t h :   t h i s . o r i g i n a l S i z e . w i d t h   +   d x   } ;  
                         } ,  
                         w :   f u n c t i o n ( e v e n t ,   d x ,   d y )   {  
                                 v a r   o   =   t h i s . o p t i o n s ,   c s   =   t h i s . o r i g i n a l S i z e ,   s p   =   t h i s . o r i g i n a l P o s i t i o n ;  
                                 r e t u r n   {   l e f t :   s p . l e f t   +   d x ,   w i d t h :   c s . w i d t h   -   d x   } ;  
                         } ,  
                         n :   f u n c t i o n ( e v e n t ,   d x ,   d y )   {  
                                 v a r   o   =   t h i s . o p t i o n s ,   c s   =   t h i s . o r i g i n a l S i z e ,   s p   =   t h i s . o r i g i n a l P o s i t i o n ;  
                                 r e t u r n   {   t o p :   s p . t o p   +   d y ,   h e i g h t :   c s . h e i g h t   -   d y   } ;  
                         } ,  
                         s :   f u n c t i o n ( e v e n t ,   d x ,   d y )   {  
                                 r e t u r n   {   h e i g h t :   t h i s . o r i g i n a l S i z e . h e i g h t   +   d y   } ;  
                         } ,  
                         s e :   f u n c t i o n ( e v e n t ,   d x ,   d y )   {  
                                 r e t u r n   $ . e x t e n d ( t h i s . _ c h a n g e . s . a p p l y ( t h i s ,   a r g u m e n t s ) ,   t h i s . _ c h a n g e . e . a p p l y ( t h i s ,   [ e v e n t ,   d x ,   d y ] ) ) ;  
                         } ,  
                         s w :   f u n c t i o n ( e v e n t ,   d x ,   d y )   {  
                                 r e t u r n   $ . e x t e n d ( t h i s . _ c h a n g e . s . a p p l y ( t h i s ,   a r g u m e n t s ) ,   t h i s . _ c h a n g e . w . a p p l y ( t h i s ,   [ e v e n t ,   d x ,   d y ] ) ) ;  
                         } ,  
                         n e :   f u n c t i o n ( e v e n t ,   d x ,   d y )   {  
                                 r e t u r n   $ . e x t e n d ( t h i s . _ c h a n g e . n . a p p l y ( t h i s ,   a r g u m e n t s ) ,   t h i s . _ c h a n g e . e . a p p l y ( t h i s ,   [ e v e n t ,   d x ,   d y ] ) ) ;  
                         } ,  
                         n w :   f u n c t i o n ( e v e n t ,   d x ,   d y )   {  
                                 r e t u r n   $ . e x t e n d ( t h i s . _ c h a n g e . n . a p p l y ( t h i s ,   a r g u m e n t s ) ,   t h i s . _ c h a n g e . w . a p p l y ( t h i s ,   [ e v e n t ,   d x ,   d y ] ) ) ;  
                         }  
                 } ,  
  
                 _ p r o p a g a t e :   f u n c t i o n ( n ,   e v e n t )   {  
                         $ . u i . p l u g i n . c a l l ( t h i s ,   n ,   [ e v e n t ,   t h i s . u i ( ) ] ) ;  
                         ( n   ! =   " r e s i z e "   & &   t h i s . _ t r i g g e r ( n ,   e v e n t ,   t h i s . u i ( ) ) ) ;  
                 } ,  
  
                 p l u g i n s :   { } ,  
  
                 u i :   f u n c t i o n ( )   {  
                         r e t u r n   {  
                                 o r i g i n a l E l e m e n t :   t h i s . o r i g i n a l E l e m e n t ,  
                                 e l e m e n t :   t h i s . e l e m e n t ,  
                                 h e l p e r :   t h i s . h e l p e r ,  
                                 p o s i t i o n :   t h i s . p o s i t i o n ,  
                                 s i z e :   t h i s . s i z e ,  
                                 o r i g i n a l S i z e :   t h i s . o r i g i n a l S i z e ,  
                                 o r i g i n a l P o s i t i o n :   t h i s . o r i g i n a l P o s i t i o n  
                         } ;  
                 }  
  
         } ) ;  
  
         $ . e x t e n d ( $ . u i . r e s i z a b l e ,   {  
                 v e r s i o n :   " 1 . 8 . 1 0 "  
         } ) ;  
  
         / *  
         *   R e s i z a b l e   E x t e n s i o n s  
         * /  
  
         $ . u i . p l u g i n . a d d ( " r e s i z a b l e " ,   " a l s o R e s i z e " ,   {  
  
                 s t a r t :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   s e l f   =   $ ( t h i s ) . d a t a ( " r e s i z a b l e " ) ,   o   =   s e l f . o p t i o n s ;  
  
                         v a r   _ s t o r e   =   f u n c t i o n ( e x p )   {  
                                 $ ( e x p ) . e a c h ( f u n c t i o n ( )   {  
                                         v a r   e l   =   $ ( t h i s ) ;  
                                         e l . d a t a ( " r e s i z a b l e - a l s o r e s i z e " ,   {  
                                                 w i d t h :   p a r s e I n t ( e l . w i d t h ( ) ,   1 0 ) ,   h e i g h t :   p a r s e I n t ( e l . h e i g h t ( ) ,   1 0 ) ,  
                                                 l e f t :   p a r s e I n t ( e l . c s s ( ' l e f t ' ) ,   1 0 ) ,   t o p :   p a r s e I n t ( e l . c s s ( ' t o p ' ) ,   1 0 ) ,  
                                                 p o s i t i o n :   e l . c s s ( ' p o s i t i o n ' )   / /   t o   r e s e t   O p e r a   o n   s t o p ( )  
                                         } ) ;  
                                 } ) ;  
                         } ;  
  
                         i f   ( t y p e o f   ( o . a l s o R e s i z e )   = =   ' o b j e c t '   & &   ! o . a l s o R e s i z e . p a r e n t N o d e )   {  
                                 i f   ( o . a l s o R e s i z e . l e n g t h )   {   o . a l s o R e s i z e   =   o . a l s o R e s i z e [ 0 ] ;   _ s t o r e ( o . a l s o R e s i z e ) ;   }  
                                 e l s e   {   $ . e a c h ( o . a l s o R e s i z e ,   f u n c t i o n ( e x p )   {   _ s t o r e ( e x p ) ;   } ) ;   }  
                         }   e l s e   {  
                                 _ s t o r e ( o . a l s o R e s i z e ) ;  
                         }  
                 } ,  
  
                 r e s i z e :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   s e l f   =   $ ( t h i s ) . d a t a ( " r e s i z a b l e " ) ,   o   =   s e l f . o p t i o n s ,   o s   =   s e l f . o r i g i n a l S i z e ,   o p   =   s e l f . o r i g i n a l P o s i t i o n ;  
  
                         v a r   d e l t a   =   {  
                                 h e i g h t :   ( s e l f . s i z e . h e i g h t   -   o s . h e i g h t )   | |   0 ,   w i d t h :   ( s e l f . s i z e . w i d t h   -   o s . w i d t h )   | |   0 ,  
                                 t o p :   ( s e l f . p o s i t i o n . t o p   -   o p . t o p )   | |   0 ,   l e f t :   ( s e l f . p o s i t i o n . l e f t   -   o p . l e f t )   | |   0  
                         } ,  
  
 	 	 _ a l s o R e s i z e   =   f u n c t i o n ( e x p ,   c )   {  
 	 	         $ ( e x p ) . e a c h ( f u n c t i o n ( )   {  
 	 	                 v a r   e l   =   $ ( t h i s ) ,   s t a r t   =   $ ( t h i s ) . d a t a ( " r e s i z a b l e - a l s o r e s i z e " ) ,   s t y l e   =   { } ,  
 	 	 	 	 	 c s s   =   c   & &   c . l e n g t h   ?   c   :   e l . p a r e n t s ( u i . o r i g i n a l E l e m e n t [ 0 ] ) . l e n g t h   ?   [ ' w i d t h ' ,   ' h e i g h t ' ]   :   [ ' w i d t h ' ,   ' h e i g h t ' ,   ' t o p ' ,   ' l e f t ' ] ;  
  
 	 	                 $ . e a c h ( c s s ,   f u n c t i o n ( i ,   p r o p )   {  
 	 	                         v a r   s u m   =   ( s t a r t [ p r o p ]   | |   0 )   +   ( d e l t a [ p r o p ]   | |   0 ) ;  
 	 	                         i f   ( s u m   & &   s u m   > =   0 )  
 	 	                                 s t y l e [ p r o p ]   =   s u m   | |   n u l l ;  
 	 	                 } ) ;  
  
 	 	                 / /   O p e r a   f i x i n g   r e l a t i v e   p o s i t i o n  
 	 	                 i f   ( $ . b r o w s e r . o p e r a   & &   / r e l a t i v e / . t e s t ( e l . c s s ( ' p o s i t i o n ' ) ) )   {  
 	 	                         s e l f . _ r e v e r t T o R e l a t i v e P o s i t i o n   =   t r u e ;  
 	 	                         e l . c s s ( {   p o s i t i o n :   ' a b s o l u t e ' ,   t o p :   ' a u t o ' ,   l e f t :   ' a u t o '   } ) ;  
 	 	                 }  
  
 	 	                 e l . c s s ( s t y l e ) ;  
 	 	         } ) ;  
 	 	 } ;  
  
                         i f   ( t y p e o f   ( o . a l s o R e s i z e )   = =   ' o b j e c t '   & &   ! o . a l s o R e s i z e . n o d e T y p e )   {  
                                 $ . e a c h ( o . a l s o R e s i z e ,   f u n c t i o n ( e x p ,   c )   {   _ a l s o R e s i z e ( e x p ,   c ) ;   } ) ;  
                         }   e l s e   {  
                                 _ a l s o R e s i z e ( o . a l s o R e s i z e ) ;  
                         }  
                 } ,  
  
                 s t o p :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   s e l f   =   $ ( t h i s ) . d a t a ( " r e s i z a b l e " ) ,   o   =   s e l f . o p t i o n s ;  
  
                         v a r   _ r e s e t   =   f u n c t i o n ( e x p )   {  
                                 $ ( e x p ) . e a c h ( f u n c t i o n ( )   {  
                                         v a r   e l   =   $ ( t h i s ) ;  
                                         / /   r e s e t   p o s i t i o n   f o r   O p e r a   -   n o   n e e d   t o   v e r i f y   i t   w a s   c h a n g e d  
                                         e l . c s s ( {   p o s i t i o n :   e l . d a t a ( " r e s i z a b l e - a l s o r e s i z e " ) . p o s i t i o n   } ) ;  
                                 } ) ;  
                         } ;  
  
                         i f   ( s e l f . _ r e v e r t T o R e l a t i v e P o s i t i o n )   {  
                                 s e l f . _ r e v e r t T o R e l a t i v e P o s i t i o n   =   f a l s e ;  
                                 i f   ( t y p e o f   ( o . a l s o R e s i z e )   = =   ' o b j e c t '   & &   ! o . a l s o R e s i z e . n o d e T y p e )   {  
                                         $ . e a c h ( o . a l s o R e s i z e ,   f u n c t i o n ( e x p )   {   _ r e s e t ( e x p ) ;   } ) ;  
                                 }   e l s e   {  
                                         _ r e s e t ( o . a l s o R e s i z e ) ;  
                                 }  
                         }  
  
                         $ ( t h i s ) . r e m o v e D a t a ( " r e s i z a b l e - a l s o r e s i z e " ) ;  
                 }  
         } ) ;  
  
         $ . u i . p l u g i n . a d d ( " r e s i z a b l e " ,   " a n i m a t e " ,   {  
  
                 s t o p :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   s e l f   =   $ ( t h i s ) . d a t a ( " r e s i z a b l e " ) ,   o   =   s e l f . o p t i o n s ;  
  
                         v a r   p r   =   s e l f . _ p r o p o r t i o n a l l y R e s i z e E l e m e n t s ,   i s t a   =   p r . l e n g t h   & &   ( / t e x t a r e a / i ) . t e s t ( p r [ 0 ] . n o d e N a m e ) ,  
 	 	 	 	 	 s o f f s e t h   =   i s t a   & &   $ . u i . h a s S c r o l l ( p r [ 0 ] ,   ' l e f t ' )   / *   T O D O   -   j u m p   h e i g h t   * /   ?   0   :   s e l f . s i z e D i f f . h e i g h t ,  
 	 	 	 	 	 	 s o f f s e t w   =   i s t a   ?   0   :   s e l f . s i z e D i f f . w i d t h ;  
  
                         v a r   s t y l e   =   {   w i d t h :   ( s e l f . s i z e . w i d t h   -   s o f f s e t w ) ,   h e i g h t :   ( s e l f . s i z e . h e i g h t   -   s o f f s e t h )   } ,  
 	 	 	 	 	 l e f t   =   ( p a r s e I n t ( s e l f . e l e m e n t . c s s ( ' l e f t ' ) ,   1 0 )   +   ( s e l f . p o s i t i o n . l e f t   -   s e l f . o r i g i n a l P o s i t i o n . l e f t ) )   | |   n u l l ,  
 	 	 	 	 	 	 t o p   =   ( p a r s e I n t ( s e l f . e l e m e n t . c s s ( ' t o p ' ) ,   1 0 )   +   ( s e l f . p o s i t i o n . t o p   -   s e l f . o r i g i n a l P o s i t i o n . t o p ) )   | |   n u l l ;  
  
                         s e l f . e l e m e n t . a n i m a t e (  
 	 	 	 $ . e x t e n d ( s t y l e ,   t o p   & &   l e f t   ?   {   t o p :   t o p ,   l e f t :   l e f t }   :   { } ) ,   {  
 	 	 	         d u r a t i o n :   o . a n i m a t e D u r a t i o n ,  
 	 	 	         e a s i n g :   o . a n i m a t e E a s i n g ,  
 	 	 	         s t e p :   f u n c t i o n ( )   {  
  
 	 	 	                 v a r   d a t a   =   {  
 	 	 	                         w i d t h :   p a r s e I n t ( s e l f . e l e m e n t . c s s ( ' w i d t h ' ) ,   1 0 ) ,  
 	 	 	                         h e i g h t :   p a r s e I n t ( s e l f . e l e m e n t . c s s ( ' h e i g h t ' ) ,   1 0 ) ,  
 	 	 	                         t o p :   p a r s e I n t ( s e l f . e l e m e n t . c s s ( ' t o p ' ) ,   1 0 ) ,  
 	 	 	                         l e f t :   p a r s e I n t ( s e l f . e l e m e n t . c s s ( ' l e f t ' ) ,   1 0 )  
 	 	 	                 } ;  
  
 	 	 	                 i f   ( p r   & &   p r . l e n g t h )   $ ( p r [ 0 ] ) . c s s ( {   w i d t h :   d a t a . w i d t h ,   h e i g h t :   d a t a . h e i g h t   } ) ;  
  
 	 	 	                 / /   p r o p a g a t i n g   r e s i z e ,   a n d   u p d a t i n g   v a l u e s   f o r   e a c h   a n i m a t i o n   s t e p  
 	 	 	                 s e l f . _ u p d a t e C a c h e ( d a t a ) ;  
 	 	 	                 s e l f . _ p r o p a g a t e ( " r e s i z e " ,   e v e n t ) ;  
  
 	 	 	         }  
 	 	 	 }  
 	 	 ) ;  
                 }  
  
         } ) ;  
  
         $ . u i . p l u g i n . a d d ( " r e s i z a b l e " ,   " c o n t a i n m e n t " ,   {  
  
                 s t a r t :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   s e l f   =   $ ( t h i s ) . d a t a ( " r e s i z a b l e " ) ,   o   =   s e l f . o p t i o n s ,   e l   =   s e l f . e l e m e n t ;  
                         v a r   o c   =   o . c o n t a i n m e n t ,   c e   =   ( o c   i n s t a n c e o f   $ )   ?   o c . g e t ( 0 )   :   ( / p a r e n t / . t e s t ( o c ) )   ?   e l . p a r e n t ( ) . g e t ( 0 )   :   o c ;  
                         i f   ( ! c e )   r e t u r n ;  
  
                         s e l f . c o n t a i n e r E l e m e n t   =   $ ( c e ) ;  
  
                         i f   ( / d o c u m e n t / . t e s t ( o c )   | |   o c   = =   d o c u m e n t )   {  
                                 s e l f . c o n t a i n e r O f f s e t   =   {   l e f t :   0 ,   t o p :   0   } ;  
                                 s e l f . c o n t a i n e r P o s i t i o n   =   {   l e f t :   0 ,   t o p :   0   } ;  
  
                                 s e l f . p a r e n t D a t a   =   {  
                                         e l e m e n t :   $ ( d o c u m e n t ) ,   l e f t :   0 ,   t o p :   0 ,  
                                         w i d t h :   $ ( d o c u m e n t ) . w i d t h ( ) ,   h e i g h t :   $ ( d o c u m e n t ) . h e i g h t ( )   | |   d o c u m e n t . b o d y . p a r e n t N o d e . s c r o l l H e i g h t  
                                 } ;  
                         }  
  
                         / /   i ' m   a   n o d e ,   s o   c o m p u t e   t o p ,   l e f t ,   r i g h t ,   b o t t o m  
                         e l s e   {  
                                 v a r   e l e m e n t   =   $ ( c e ) ,   p   =   [ ] ;  
                                 $ ( [ " T o p " ,   " R i g h t " ,   " L e f t " ,   " B o t t o m " ] ) . e a c h ( f u n c t i o n ( i ,   n a m e )   {   p [ i ]   =   n u m ( e l e m e n t . c s s ( " p a d d i n g "   +   n a m e ) ) ;   } ) ;  
  
                                 s e l f . c o n t a i n e r O f f s e t   =   e l e m e n t . o f f s e t ( ) ;  
                                 s e l f . c o n t a i n e r P o s i t i o n   =   e l e m e n t . p o s i t i o n ( ) ;  
                                 s e l f . c o n t a i n e r S i z e   =   {   h e i g h t :   ( e l e m e n t . i n n e r H e i g h t ( )   -   p [ 3 ] ) ,   w i d t h :   ( e l e m e n t . i n n e r W i d t h ( )   -   p [ 1 ] )   } ;  
  
                                 v a r   c o   =   s e l f . c o n t a i n e r O f f s e t ,   c h   =   s e l f . c o n t a i n e r S i z e . h e i g h t ,   c w   =   s e l f . c o n t a i n e r S i z e . w i d t h ,  
 	 	 	 	 	 	 w i d t h   =   ( $ . u i . h a s S c r o l l ( c e ,   " l e f t " )   ?   c e . s c r o l l W i d t h   :   c w ) ,   h e i g h t   =   ( $ . u i . h a s S c r o l l ( c e )   ?   c e . s c r o l l H e i g h t   :   c h ) ;  
  
                                 s e l f . p a r e n t D a t a   =   {  
                                         e l e m e n t :   c e ,   l e f t :   c o . l e f t ,   t o p :   c o . t o p ,   w i d t h :   w i d t h ,   h e i g h t :   h e i g h t  
                                 } ;  
                         }  
                 } ,  
  
                 r e s i z e :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   s e l f   =   $ ( t h i s ) . d a t a ( " r e s i z a b l e " ) ,   o   =   s e l f . o p t i o n s ,  
 	 	 	 	 p s   =   s e l f . c o n t a i n e r S i z e ,   c o   =   s e l f . c o n t a i n e r O f f s e t ,   c s   =   s e l f . s i z e ,   c p   =   s e l f . p o s i t i o n ,  
 	 	 	 	 p R a t i o   =   s e l f . _ a s p e c t R a t i o   | |   e v e n t . s h i f t K e y ,   c o p   =   {   t o p :   0 ,   l e f t :   0   } ,   c e   =   s e l f . c o n t a i n e r E l e m e n t ;  
  
                         i f   ( c e [ 0 ]   ! =   d o c u m e n t   & &   ( / s t a t i c / ) . t e s t ( c e . c s s ( ' p o s i t i o n ' ) ) )   c o p   =   c o ;  
  
                         i f   ( c p . l e f t   <   ( s e l f . _ h e l p e r   ?   c o . l e f t   :   0 ) )   {  
                                 s e l f . s i z e . w i d t h   =   s e l f . s i z e . w i d t h   +   ( s e l f . _ h e l p e r   ?   ( s e l f . p o s i t i o n . l e f t   -   c o . l e f t )   :   ( s e l f . p o s i t i o n . l e f t   -   c o p . l e f t ) ) ;  
                                 i f   ( p R a t i o )   s e l f . s i z e . h e i g h t   =   s e l f . s i z e . w i d t h   /   o . a s p e c t R a t i o ;  
                                 s e l f . p o s i t i o n . l e f t   =   o . h e l p e r   ?   c o . l e f t   :   0 ;  
                         }  
  
                         i f   ( c p . t o p   <   ( s e l f . _ h e l p e r   ?   c o . t o p   :   0 ) )   {  
                                 s e l f . s i z e . h e i g h t   =   s e l f . s i z e . h e i g h t   +   ( s e l f . _ h e l p e r   ?   ( s e l f . p o s i t i o n . t o p   -   c o . t o p )   :   s e l f . p o s i t i o n . t o p ) ;  
                                 i f   ( p R a t i o )   s e l f . s i z e . w i d t h   =   s e l f . s i z e . h e i g h t   *   o . a s p e c t R a t i o ;  
                                 s e l f . p o s i t i o n . t o p   =   s e l f . _ h e l p e r   ?   c o . t o p   :   0 ;  
                         }  
  
                         s e l f . o f f s e t . l e f t   =   s e l f . p a r e n t D a t a . l e f t   +   s e l f . p o s i t i o n . l e f t ;  
                         s e l f . o f f s e t . t o p   =   s e l f . p a r e n t D a t a . t o p   +   s e l f . p o s i t i o n . t o p ;  
  
                         v a r   w o s e t   =   M a t h . a b s ( ( s e l f . _ h e l p e r   ?   s e l f . o f f s e t . l e f t   -   c o p . l e f t   :   ( s e l f . o f f s e t . l e f t   -   c o p . l e f t ) )   +   s e l f . s i z e D i f f . w i d t h ) ,  
 	 	 	 	 	 h o s e t   =   M a t h . a b s ( ( s e l f . _ h e l p e r   ?   s e l f . o f f s e t . t o p   -   c o p . t o p   :   ( s e l f . o f f s e t . t o p   -   c o . t o p ) )   +   s e l f . s i z e D i f f . h e i g h t ) ;  
  
                         v a r   i s P a r e n t   =   s e l f . c o n t a i n e r E l e m e n t . g e t ( 0 )   = =   s e l f . e l e m e n t . p a r e n t ( ) . g e t ( 0 ) ,  
 	 	         i s O f f s e t R e l a t i v e   =   / r e l a t i v e | a b s o l u t e / . t e s t ( s e l f . c o n t a i n e r E l e m e n t . c s s ( ' p o s i t i o n ' ) ) ;  
  
                         i f   ( i s P a r e n t   & &   i s O f f s e t R e l a t i v e )   w o s e t   - =   s e l f . p a r e n t D a t a . l e f t ;  
  
                         i f   ( w o s e t   +   s e l f . s i z e . w i d t h   > =   s e l f . p a r e n t D a t a . w i d t h )   {  
                                 s e l f . s i z e . w i d t h   =   s e l f . p a r e n t D a t a . w i d t h   -   w o s e t ;  
                                 i f   ( p R a t i o )   s e l f . s i z e . h e i g h t   =   s e l f . s i z e . w i d t h   /   s e l f . a s p e c t R a t i o ;  
                         }  
  
                         i f   ( h o s e t   +   s e l f . s i z e . h e i g h t   > =   s e l f . p a r e n t D a t a . h e i g h t )   {  
                                 s e l f . s i z e . h e i g h t   =   s e l f . p a r e n t D a t a . h e i g h t   -   h o s e t ;  
                                 i f   ( p R a t i o )   s e l f . s i z e . w i d t h   =   s e l f . s i z e . h e i g h t   *   s e l f . a s p e c t R a t i o ;  
                         }  
                 } ,  
  
                 s t o p :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   s e l f   =   $ ( t h i s ) . d a t a ( " r e s i z a b l e " ) ,   o   =   s e l f . o p t i o n s ,   c p   =   s e l f . p o s i t i o n ,  
 	 	 	 	 c o   =   s e l f . c o n t a i n e r O f f s e t ,   c o p   =   s e l f . c o n t a i n e r P o s i t i o n ,   c e   =   s e l f . c o n t a i n e r E l e m e n t ;  
  
                         v a r   h e l p e r   =   $ ( s e l f . h e l p e r ) ,   h o   =   h e l p e r . o f f s e t ( ) ,   w   =   h e l p e r . o u t e r W i d t h ( )   -   s e l f . s i z e D i f f . w i d t h ,   h   =   h e l p e r . o u t e r H e i g h t ( )   -   s e l f . s i z e D i f f . h e i g h t ;  
  
                         i f   ( s e l f . _ h e l p e r   & &   ! o . a n i m a t e   & &   ( / r e l a t i v e / ) . t e s t ( c e . c s s ( ' p o s i t i o n ' ) ) )  
                                 $ ( t h i s ) . c s s ( {   l e f t :   h o . l e f t   -   c o p . l e f t   -   c o . l e f t ,   w i d t h :   w ,   h e i g h t :   h   } ) ;  
  
                         i f   ( s e l f . _ h e l p e r   & &   ! o . a n i m a t e   & &   ( / s t a t i c / ) . t e s t ( c e . c s s ( ' p o s i t i o n ' ) ) )  
                                 $ ( t h i s ) . c s s ( {   l e f t :   h o . l e f t   -   c o p . l e f t   -   c o . l e f t ,   w i d t h :   w ,   h e i g h t :   h   } ) ;  
  
                 }  
         } ) ;  
  
         $ . u i . p l u g i n . a d d ( " r e s i z a b l e " ,   " g h o s t " ,   {  
  
                 s t a r t :   f u n c t i o n ( e v e n t ,   u i )   {  
  
                         v a r   s e l f   =   $ ( t h i s ) . d a t a ( " r e s i z a b l e " ) ,   o   =   s e l f . o p t i o n s ,   c s   =   s e l f . s i z e ;  
  
                         s e l f . g h o s t   =   s e l f . o r i g i n a l E l e m e n t . c l o n e ( ) ;  
                         s e l f . g h o s t  
 	 	 	 . c s s ( {   o p a c i t y :   . 2 5 ,   d i s p l a y :   ' b l o c k ' ,   p o s i t i o n :   ' r e l a t i v e ' ,   h e i g h t :   c s . h e i g h t ,   w i d t h :   c s . w i d t h ,   m a r g i n :   0 ,   l e f t :   0 ,   t o p :   0   } )  
 	 	 	 . a d d C l a s s ( ' u i - r e s i z a b l e - g h o s t ' )  
 	 	 	 . a d d C l a s s ( t y p e o f   o . g h o s t   = =   ' s t r i n g '   ?   o . g h o s t   :   ' ' ) ;  
  
                         s e l f . g h o s t . a p p e n d T o ( s e l f . h e l p e r ) ;  
  
                 } ,  
  
                 r e s i z e :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   s e l f   =   $ ( t h i s ) . d a t a ( " r e s i z a b l e " ) ,   o   =   s e l f . o p t i o n s ;  
                         i f   ( s e l f . g h o s t )   s e l f . g h o s t . c s s ( {   p o s i t i o n :   ' r e l a t i v e ' ,   h e i g h t :   s e l f . s i z e . h e i g h t ,   w i d t h :   s e l f . s i z e . w i d t h   } ) ;  
                 } ,  
  
                 s t o p :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   s e l f   =   $ ( t h i s ) . d a t a ( " r e s i z a b l e " ) ,   o   =   s e l f . o p t i o n s ;  
                         i f   ( s e l f . g h o s t   & &   s e l f . h e l p e r )   s e l f . h e l p e r . g e t ( 0 ) . r e m o v e C h i l d ( s e l f . g h o s t . g e t ( 0 ) ) ;  
                 }  
  
         } ) ;  
  
         $ . u i . p l u g i n . a d d ( " r e s i z a b l e " ,   " g r i d " ,   {  
  
                 r e s i z e :   f u n c t i o n ( e v e n t ,   u i )   {  
                         v a r   s e l f   =   $ ( t h i s ) . d a t a ( " r e s i z a b l e " ) ,   o   =   s e l f . o p t i o n s ,   c s   =   s e l f . s i z e ,   o s   =   s e l f . o r i g i n a l S i z e ,   o p   =   s e l f . o r i g i n a l P o s i t i o n ,   a   =   s e l f . a x i s ,   r a t i o   =   o . _ a s p e c t R a t i o   | |   e v e n t . s h i f t K e y ;  
                         o . g r i d   =   t y p e o f   o . g r i d   = =   " n u m b e r "   ?   [ o . g r i d ,   o . g r i d ]   :   o . g r i d ;  
                         v a r   o x   =   M a t h . r o u n d ( ( c s . w i d t h   -   o s . w i d t h )   /   ( o . g r i d [ 0 ]   | |   1 ) )   *   ( o . g r i d [ 0 ]   | |   1 ) ,   o y   =   M a t h . r o u n d ( ( c s . h e i g h t   -   o s . h e i g h t )   /   ( o . g r i d [ 1 ]   | |   1 ) )   *   ( o . g r i d [ 1 ]   | |   1 ) ;  
  
                         i f   ( / ^ ( s e | s | e ) $ / . t e s t ( a ) )   {  
                                 s e l f . s i z e . w i d t h   =   o s . w i d t h   +   o x ;  
                                 s e l f . s i z e . h e i g h t   =   o s . h e i g h t   +   o y ;  
                         }  
                         e l s e   i f   ( / ^ ( n e ) $ / . t e s t ( a ) )   {  
                                 s e l f . s i z e . w i d t h   =   o s . w i d t h   +   o x ;  
                                 s e l f . s i z e . h e i g h t   =   o s . h e i g h t   +   o y ;  
                                 s e l f . p o s i t i o n . t o p   =   o p . t o p   -   o y ;  
                         }  
                         e l s e   i f   ( / ^ ( s w ) $ / . t e s t ( a ) )   {  
                                 s e l f . s i z e . w i d t h   =   o s . w i d t h   +   o x ;  
                                 s e l f . s i z e . h e i g h t   =   o s . h e i g h t   +   o y ;  
                                 s e l f . p o s i t i o n . l e f t   =   o p . l e f t   -   o x ;  
                         }  
                         e l s e   {  
                                 s e l f . s i z e . w i d t h   =   o s . w i d t h   +   o x ;  
                                 s e l f . s i z e . h e i g h t   =   o s . h e i g h t   +   o y ;  
                                 s e l f . p o s i t i o n . t o p   =   o p . t o p   -   o y ;  
                                 s e l f . p o s i t i o n . l e f t   =   o p . l e f t   -   o x ;  
                         }  
                 }  
  
         } ) ;  
  
         v a r   n u m   =   f u n c t i o n ( v )   {  
                 r e t u r n   p a r s e I n t ( v ,   1 0 )   | |   0 ;  
         } ;  
  
         v a r   i s N u m b e r   =   f u n c t i o n ( v a l u e )   {  
                 r e t u r n   ! i s N a N ( p a r s e I n t ( v a l u e ,   1 0 ) ) ;  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   S e l e c t a b l e   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / S e l e c t a b l e s  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . u i . c o r e . j s  
 * 	 j q u e r y . u i . m o u s e . j s  
 * 	 j q u e r y . u i . w i d g e t . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . w i d g e t ( " u i . s e l e c t a b l e " ,   $ . u i . m o u s e ,   {  
                 o p t i o n s :   {  
                         a p p e n d T o :   ' b o d y ' ,  
                         a u t o R e f r e s h :   t r u e ,  
                         d i s t a n c e :   0 ,  
                         f i l t e r :   ' * ' ,  
                         t o l e r a n c e :   ' t o u c h '  
                 } ,  
                 _ c r e a t e :   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 . a d d C l a s s ( " u i - s e l e c t a b l e " ) ;  
  
                         t h i s . d r a g g e d   =   f a l s e ;  
  
                         / /   c a c h e   s e l e c t e e   c h i l d r e n   b a s e d   o n   f i l t e r  
                         v a r   s e l e c t e e s ;  
                         t h i s . r e f r e s h   =   f u n c t i o n ( )   {  
                                 s e l e c t e e s   =   $ ( s e l f . o p t i o n s . f i l t e r ,   s e l f . e l e m e n t [ 0 ] ) ;  
                                 s e l e c t e e s . e a c h ( f u n c t i o n ( )   {  
                                         v a r   $ t h i s   =   $ ( t h i s ) ;  
                                         v a r   p o s   =   $ t h i s . o f f s e t ( ) ;  
                                         $ . d a t a ( t h i s ,   " s e l e c t a b l e - i t e m " ,   {  
                                                 e l e m e n t :   t h i s ,  
                                                 $ e l e m e n t :   $ t h i s ,  
                                                 l e f t :   p o s . l e f t ,  
                                                 t o p :   p o s . t o p ,  
                                                 r i g h t :   p o s . l e f t   +   $ t h i s . o u t e r W i d t h ( ) ,  
                                                 b o t t o m :   p o s . t o p   +   $ t h i s . o u t e r H e i g h t ( ) ,  
                                                 s t a r t s e l e c t e d :   f a l s e ,  
                                                 s e l e c t e d :   $ t h i s . h a s C l a s s ( ' u i - s e l e c t e d ' ) ,  
                                                 s e l e c t i n g :   $ t h i s . h a s C l a s s ( ' u i - s e l e c t i n g ' ) ,  
                                                 u n s e l e c t i n g :   $ t h i s . h a s C l a s s ( ' u i - u n s e l e c t i n g ' )  
                                         } ) ;  
                                 } ) ;  
                         } ;  
                         t h i s . r e f r e s h ( ) ;  
  
                         t h i s . s e l e c t e e s   =   s e l e c t e e s . a d d C l a s s ( " u i - s e l e c t e e " ) ;  
  
                         t h i s . _ m o u s e I n i t ( ) ;  
  
                         t h i s . h e l p e r   =   $ ( " < d i v   c l a s s = ' u i - s e l e c t a b l e - h e l p e r ' > < / d i v > " ) ;  
                 } ,  
  
                 d e s t r o y :   f u n c t i o n ( )   {  
                         t h i s . s e l e c t e e s  
 	 	 	 . r e m o v e C l a s s ( " u i - s e l e c t e e " )  
 	 	 	 . r e m o v e D a t a ( " s e l e c t a b l e - i t e m " ) ;  
                         t h i s . e l e m e n t  
 	 	 	 . r e m o v e C l a s s ( " u i - s e l e c t a b l e   u i - s e l e c t a b l e - d i s a b l e d " )  
 	 	 	 . r e m o v e D a t a ( " s e l e c t a b l e " )  
 	 	 	 . u n b i n d ( " . s e l e c t a b l e " ) ;  
                         t h i s . _ m o u s e D e s t r o y ( ) ;  
  
                         r e t u r n   t h i s ;  
                 } ,  
  
                 _ m o u s e S t a r t :   f u n c t i o n ( e v e n t )   {  
                         v a r   s e l f   =   t h i s ;  
  
                         t h i s . o p o s   =   [ e v e n t . p a g e X ,   e v e n t . p a g e Y ] ;  
  
                         i f   ( t h i s . o p t i o n s . d i s a b l e d )  
                                 r e t u r n ;  
  
                         v a r   o p t i o n s   =   t h i s . o p t i o n s ;  
  
                         t h i s . s e l e c t e e s   =   $ ( o p t i o n s . f i l t e r ,   t h i s . e l e m e n t [ 0 ] ) ;  
  
                         t h i s . _ t r i g g e r ( " s t a r t " ,   e v e n t ) ;  
  
                         $ ( o p t i o n s . a p p e n d T o ) . a p p e n d ( t h i s . h e l p e r ) ;  
                         / /   p o s i t i o n   h e l p e r   ( l a s s o )  
                         t h i s . h e l p e r . c s s ( {  
                                 " l e f t " :   e v e n t . c l i e n t X ,  
                                 " t o p " :   e v e n t . c l i e n t Y ,  
                                 " w i d t h " :   0 ,  
                                 " h e i g h t " :   0  
                         } ) ;  
  
                         i f   ( o p t i o n s . a u t o R e f r e s h )   {  
                                 t h i s . r e f r e s h ( ) ;  
                         }  
  
                         t h i s . s e l e c t e e s . f i l t e r ( ' . u i - s e l e c t e d ' ) . e a c h ( f u n c t i o n ( )   {  
                                 v a r   s e l e c t e e   =   $ . d a t a ( t h i s ,   " s e l e c t a b l e - i t e m " ) ;  
                                 s e l e c t e e . s t a r t s e l e c t e d   =   t r u e ;  
                                 i f   ( ! e v e n t . m e t a K e y )   {  
                                         s e l e c t e e . $ e l e m e n t . r e m o v e C l a s s ( ' u i - s e l e c t e d ' ) ;  
                                         s e l e c t e e . s e l e c t e d   =   f a l s e ;  
                                         s e l e c t e e . $ e l e m e n t . a d d C l a s s ( ' u i - u n s e l e c t i n g ' ) ;  
                                         s e l e c t e e . u n s e l e c t i n g   =   t r u e ;  
                                         / /   s e l e c t a b l e   U N S E L E C T I N G   c a l l b a c k  
                                         s e l f . _ t r i g g e r ( " u n s e l e c t i n g " ,   e v e n t ,   {  
                                                 u n s e l e c t i n g :   s e l e c t e e . e l e m e n t  
                                         } ) ;  
                                 }  
                         } ) ;  
  
                         $ ( e v e n t . t a r g e t ) . p a r e n t s ( ) . a n d S e l f ( ) . e a c h ( f u n c t i o n ( )   {  
                                 v a r   s e l e c t e e   =   $ . d a t a ( t h i s ,   " s e l e c t a b l e - i t e m " ) ;  
                                 i f   ( s e l e c t e e )   {  
                                         v a r   d o S e l e c t   =   ! e v e n t . m e t a K e y   | |   ! s e l e c t e e . $ e l e m e n t . h a s C l a s s ( ' u i - s e l e c t e d ' ) ;  
                                         s e l e c t e e . $ e l e m e n t  
 	 	 	 	 	 . r e m o v e C l a s s ( d o S e l e c t   ?   " u i - u n s e l e c t i n g "   :   " u i - s e l e c t e d " )  
 	 	 	 	 	 . a d d C l a s s ( d o S e l e c t   ?   " u i - s e l e c t i n g "   :   " u i - u n s e l e c t i n g " ) ;  
                                         s e l e c t e e . u n s e l e c t i n g   =   ! d o S e l e c t ;  
                                         s e l e c t e e . s e l e c t i n g   =   d o S e l e c t ;  
                                         s e l e c t e e . s e l e c t e d   =   d o S e l e c t ;  
                                         / /   s e l e c t a b l e   ( U N ) S E L E C T I N G   c a l l b a c k  
                                         i f   ( d o S e l e c t )   {  
                                                 s e l f . _ t r i g g e r ( " s e l e c t i n g " ,   e v e n t ,   {  
                                                         s e l e c t i n g :   s e l e c t e e . e l e m e n t  
                                                 } ) ;  
                                         }   e l s e   {  
                                                 s e l f . _ t r i g g e r ( " u n s e l e c t i n g " ,   e v e n t ,   {  
                                                         u n s e l e c t i n g :   s e l e c t e e . e l e m e n t  
                                                 } ) ;  
                                         }  
                                         r e t u r n   f a l s e ;  
                                 }  
                         } ) ;  
  
                 } ,  
  
                 _ m o u s e D r a g :   f u n c t i o n ( e v e n t )   {  
                         v a r   s e l f   =   t h i s ;  
                         t h i s . d r a g g e d   =   t r u e ;  
  
                         i f   ( t h i s . o p t i o n s . d i s a b l e d )  
                                 r e t u r n ;  
  
                         v a r   o p t i o n s   =   t h i s . o p t i o n s ;  
  
                         v a r   x 1   =   t h i s . o p o s [ 0 ] ,   y 1   =   t h i s . o p o s [ 1 ] ,   x 2   =   e v e n t . p a g e X ,   y 2   =   e v e n t . p a g e Y ;  
                         i f   ( x 1   >   x 2 )   {   v a r   t m p   =   x 2 ;   x 2   =   x 1 ;   x 1   =   t m p ;   }  
                         i f   ( y 1   >   y 2 )   {   v a r   t m p   =   y 2 ;   y 2   =   y 1 ;   y 1   =   t m p ;   }  
                         t h i s . h e l p e r . c s s ( {   l e f t :   x 1 ,   t o p :   y 1 ,   w i d t h :   x 2   -   x 1 ,   h e i g h t :   y 2   -   y 1   } ) ;  
  
                         t h i s . s e l e c t e e s . e a c h ( f u n c t i o n ( )   {  
                                 v a r   s e l e c t e e   =   $ . d a t a ( t h i s ,   " s e l e c t a b l e - i t e m " ) ;  
                                 / / p r e v e n t   h e l p e r   f r o m   b e i n g   s e l e c t e d   i f   a p p e n d T o :   s e l e c t a b l e  
                                 i f   ( ! s e l e c t e e   | |   s e l e c t e e . e l e m e n t   = =   s e l f . e l e m e n t [ 0 ] )  
                                         r e t u r n ;  
                                 v a r   h i t   =   f a l s e ;  
                                 i f   ( o p t i o n s . t o l e r a n c e   = =   ' t o u c h ' )   {  
                                         h i t   =   ( ! ( s e l e c t e e . l e f t   >   x 2   | |   s e l e c t e e . r i g h t   <   x 1   | |   s e l e c t e e . t o p   >   y 2   | |   s e l e c t e e . b o t t o m   <   y 1 ) ) ;  
                                 }   e l s e   i f   ( o p t i o n s . t o l e r a n c e   = =   ' f i t ' )   {  
                                         h i t   =   ( s e l e c t e e . l e f t   >   x 1   & &   s e l e c t e e . r i g h t   <   x 2   & &   s e l e c t e e . t o p   >   y 1   & &   s e l e c t e e . b o t t o m   <   y 2 ) ;  
                                 }  
  
                                 i f   ( h i t )   {  
                                         / /   S E L E C T  
                                         i f   ( s e l e c t e e . s e l e c t e d )   {  
                                                 s e l e c t e e . $ e l e m e n t . r e m o v e C l a s s ( ' u i - s e l e c t e d ' ) ;  
                                                 s e l e c t e e . s e l e c t e d   =   f a l s e ;  
                                         }  
                                         i f   ( s e l e c t e e . u n s e l e c t i n g )   {  
                                                 s e l e c t e e . $ e l e m e n t . r e m o v e C l a s s ( ' u i - u n s e l e c t i n g ' ) ;  
                                                 s e l e c t e e . u n s e l e c t i n g   =   f a l s e ;  
                                         }  
                                         i f   ( ! s e l e c t e e . s e l e c t i n g )   {  
                                                 s e l e c t e e . $ e l e m e n t . a d d C l a s s ( ' u i - s e l e c t i n g ' ) ;  
                                                 s e l e c t e e . s e l e c t i n g   =   t r u e ;  
                                                 / /   s e l e c t a b l e   S E L E C T I N G   c a l l b a c k  
                                                 s e l f . _ t r i g g e r ( " s e l e c t i n g " ,   e v e n t ,   {  
                                                         s e l e c t i n g :   s e l e c t e e . e l e m e n t  
                                                 } ) ;  
                                         }  
                                 }   e l s e   {  
                                         / /   U N S E L E C T  
                                         i f   ( s e l e c t e e . s e l e c t i n g )   {  
                                                 i f   ( e v e n t . m e t a K e y   & &   s e l e c t e e . s t a r t s e l e c t e d )   {  
                                                         s e l e c t e e . $ e l e m e n t . r e m o v e C l a s s ( ' u i - s e l e c t i n g ' ) ;  
                                                         s e l e c t e e . s e l e c t i n g   =   f a l s e ;  
                                                         s e l e c t e e . $ e l e m e n t . a d d C l a s s ( ' u i - s e l e c t e d ' ) ;  
                                                         s e l e c t e e . s e l e c t e d   =   t r u e ;  
                                                 }   e l s e   {  
                                                         s e l e c t e e . $ e l e m e n t . r e m o v e C l a s s ( ' u i - s e l e c t i n g ' ) ;  
                                                         s e l e c t e e . s e l e c t i n g   =   f a l s e ;  
                                                         i f   ( s e l e c t e e . s t a r t s e l e c t e d )   {  
                                                                 s e l e c t e e . $ e l e m e n t . a d d C l a s s ( ' u i - u n s e l e c t i n g ' ) ;  
                                                                 s e l e c t e e . u n s e l e c t i n g   =   t r u e ;  
                                                         }  
                                                         / /   s e l e c t a b l e   U N S E L E C T I N G   c a l l b a c k  
                                                         s e l f . _ t r i g g e r ( " u n s e l e c t i n g " ,   e v e n t ,   {  
                                                                 u n s e l e c t i n g :   s e l e c t e e . e l e m e n t  
                                                         } ) ;  
                                                 }  
                                         }  
                                         i f   ( s e l e c t e e . s e l e c t e d )   {  
                                                 i f   ( ! e v e n t . m e t a K e y   & &   ! s e l e c t e e . s t a r t s e l e c t e d )   {  
                                                         s e l e c t e e . $ e l e m e n t . r e m o v e C l a s s ( ' u i - s e l e c t e d ' ) ;  
                                                         s e l e c t e e . s e l e c t e d   =   f a l s e ;  
  
                                                         s e l e c t e e . $ e l e m e n t . a d d C l a s s ( ' u i - u n s e l e c t i n g ' ) ;  
                                                         s e l e c t e e . u n s e l e c t i n g   =   t r u e ;  
                                                         / /   s e l e c t a b l e   U N S E L E C T I N G   c a l l b a c k  
                                                         s e l f . _ t r i g g e r ( " u n s e l e c t i n g " ,   e v e n t ,   {  
                                                                 u n s e l e c t i n g :   s e l e c t e e . e l e m e n t  
                                                         } ) ;  
                                                 }  
                                         }  
                                 }  
                         } ) ;  
  
                         r e t u r n   f a l s e ;  
                 } ,  
  
                 _ m o u s e S t o p :   f u n c t i o n ( e v e n t )   {  
                         v a r   s e l f   =   t h i s ;  
  
                         t h i s . d r a g g e d   =   f a l s e ;  
  
                         v a r   o p t i o n s   =   t h i s . o p t i o n s ;  
  
                         $ ( ' . u i - u n s e l e c t i n g ' ,   t h i s . e l e m e n t [ 0 ] ) . e a c h ( f u n c t i o n ( )   {  
                                 v a r   s e l e c t e e   =   $ . d a t a ( t h i s ,   " s e l e c t a b l e - i t e m " ) ;  
                                 s e l e c t e e . $ e l e m e n t . r e m o v e C l a s s ( ' u i - u n s e l e c t i n g ' ) ;  
                                 s e l e c t e e . u n s e l e c t i n g   =   f a l s e ;  
                                 s e l e c t e e . s t a r t s e l e c t e d   =   f a l s e ;  
                                 s e l f . _ t r i g g e r ( " u n s e l e c t e d " ,   e v e n t ,   {  
                                         u n s e l e c t e d :   s e l e c t e e . e l e m e n t  
                                 } ) ;  
                         } ) ;  
                         $ ( ' . u i - s e l e c t i n g ' ,   t h i s . e l e m e n t [ 0 ] ) . e a c h ( f u n c t i o n ( )   {  
                                 v a r   s e l e c t e e   =   $ . d a t a ( t h i s ,   " s e l e c t a b l e - i t e m " ) ;  
                                 s e l e c t e e . $ e l e m e n t . r e m o v e C l a s s ( ' u i - s e l e c t i n g ' ) . a d d C l a s s ( ' u i - s e l e c t e d ' ) ;  
                                 s e l e c t e e . s e l e c t i n g   =   f a l s e ;  
                                 s e l e c t e e . s e l e c t e d   =   t r u e ;  
                                 s e l e c t e e . s t a r t s e l e c t e d   =   t r u e ;  
                                 s e l f . _ t r i g g e r ( " s e l e c t e d " ,   e v e n t ,   {  
                                         s e l e c t e d :   s e l e c t e e . e l e m e n t  
                                 } ) ;  
                         } ) ;  
                         t h i s . _ t r i g g e r ( " s t o p " ,   e v e n t ) ;  
  
                         t h i s . h e l p e r . r e m o v e ( ) ;  
  
                         r e t u r n   f a l s e ;  
                 }  
  
         } ) ;  
  
         $ . e x t e n d ( $ . u i . s e l e c t a b l e ,   {  
                 v e r s i o n :   " 1 . 8 . 1 0 "  
         } ) ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   S o r t a b l e   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / S o r t a b l e s  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . u i . c o r e . j s  
 * 	 j q u e r y . u i . m o u s e . j s  
 * 	 j q u e r y . u i . w i d g e t . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . w i d g e t ( " u i . s o r t a b l e " ,   $ . u i . m o u s e ,   {  
                 w i d g e t E v e n t P r e f i x :   " s o r t " ,  
                 o p t i o n s :   {  
                         a p p e n d T o :   " p a r e n t " ,  
                         a x i s :   f a l s e ,  
                         c o n n e c t W i t h :   f a l s e ,  
                         c o n t a i n m e n t :   f a l s e ,  
                         c u r s o r :   ' a u t o ' ,  
                         c u r s o r A t :   f a l s e ,  
                         d r o p O n E m p t y :   t r u e ,  
                         f o r c e P l a c e h o l d e r S i z e :   f a l s e ,  
                         f o r c e H e l p e r S i z e :   f a l s e ,  
                         g r i d :   f a l s e ,  
                         h a n d l e :   f a l s e ,  
                         h e l p e r :   " o r i g i n a l " ,  
                         i t e m s :   ' >   * ' ,  
                         o p a c i t y :   f a l s e ,  
                         p l a c e h o l d e r :   f a l s e ,  
                         r e v e r t :   f a l s e ,  
                         s c r o l l :   t r u e ,  
                         s c r o l l S e n s i t i v i t y :   2 0 ,  
                         s c r o l l S p e e d :   2 0 ,  
                         s c o p e :   " d e f a u l t " ,  
                         t o l e r a n c e :   " i n t e r s e c t " ,  
                         z I n d e x :   1 0 0 0  
                 } ,  
                 _ c r e a t e :   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 . c o n t a i n e r C a c h e   =   { } ;  
                         t h i s . e l e m e n t . a d d C l a s s ( " u i - s o r t a b l e " ) ;  
  
                         / / G e t   t h e   i t e m s  
                         t h i s . r e f r e s h ( ) ;  
  
                         / / L e t ' s   d e t e r m i n e   i f   t h e   i t e m s   a r e   f l o a t i n g  
                         t h i s . f l o a t i n g   =   t h i s . i t e m s . l e n g t h   ?   ( / l e f t | r i g h t / ) . t e s t ( t h i s . i t e m s [ 0 ] . i t e m . c s s ( ' f l o a t ' ) )   :   f a l s e ;  
  
                         / / L e t ' s   d e t e r m i n e   t h e   p a r e n t ' s   o f f s e t  
                         t h i s . o f f s e t   =   t h i s . e l e m e n t . o f f s e t ( ) ;  
  
                         / / I n i t i a l i z e   m o u s e   e v e n t s   f o r   i n t e r a c t i o n  
                         t h i s . _ m o u s e I n i t ( ) ;  
  
                 } ,  
  
                 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 C l a s s ( " u i - s o r t a b l e   u i - s o r t a b l e - d i s a b l e d " )  
 	 	 	 . r e m o v e D a t a ( " s o r t a b l e " )  
 	 	 	 . u n b i n d ( " . s o r t a b l e " ) ;  
                         t h i s . _ m o u s e D e s t r o y ( ) ;  
  
                         f o r   ( v a r   i   =   t h i s . i t e m s . l e n g t h   -   1 ;   i   > =   0 ;   i - - )  
                                 t h i s . i t e m s [ i ] . i t e m . r e m o v e D a t a ( " s o r t a b l e - i t e m " ) ;  
  
                         r e t u r n   t h i s ;  
                 } ,  
  
                 _ s e t O p t i o n :   f u n c t i o n ( 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 . o p t i o n s [ k e y ]   =   v a l u e ;  
  
                                 t h i s . w i d g e 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 " ] ( " u i - s o r t a b l e - d i s a b l e d " ) ;  
                         }   e l s e   {  
                                 / /   D o n ' t   c a l l   w i d g e t   b a s e   _ s e t O p t i o n   f o r   d i s a b l e   a s   i t   a d d s   u i - s t a t e - d i s a b l e d   c l a s s  
                                 $ . W i d g e t . p r o t o t y p e . _ s e t O p t i o n . a p p l y ( t h i s ,   a r g u m e n t s ) ;  
                         }  
                 } ,  
  
                 _ m o u s e C a p t u r e :   f u n c t i o n ( e v e n t ,   o v e r r i d e H a n d l e )   {  
  
                         i f   ( t h i s . r e v e r t i n g )   {  
                                 r e t u r n   f a l s e ;  
                         }  
  
                         i f   ( t h i s . o p t i o n s . d i s a b l e d   | |   t h i s . o p t i o n s . t y p e   = =   ' s t a t i c ' )   r e t u r n   f a l s e ;  
  
                         / / W e   h a v e   t o   r e f r e s h   t h e   i t e m s   d a t a   o n c e   f i r s t  
                         t h i s . _ r e f r e s h I t e m s ( e v e n t ) ;  
  
                         / / F i n d   o u t   i f   t h e   c l i c k e d   n o d e   ( o r   o n e   o f   i t s   p a r e n t s )   i s   a   a c t u a l   i t e m   i n   t h i s . i t e m s  
                         v a r   c u r r e n t I t e m   =   n u l l ,   s e l f   =   t h i s ,   n o d e s   =   $ ( e v e n t . t a r g e t ) . p a r e n t s ( ) . e a c h ( f u n c t i o n ( )   {  
                                 i f   ( $ . d a t a ( t h i s ,   ' s o r t a b l e - i t e m ' )   = =   s e l f )   {  
                                         c u r r e n t I t e m   =   $ ( t h i s ) ;  
                                         r e t u r n   f a l s e ;  
                                 }  
                         } ) ;  
                         i f   ( $ . d a t a ( e v e n t . t a r g e t ,   ' s o r t a b l e - i t e m ' )   = =   s e l f )   c u r r e n t I t e m   =   $ ( e v e n t . t a r g e t ) ;  
  
                         i f   ( ! c u r r e n t I t e m )   r e t u r n   f a l s e ;  
                         i f   ( t h i s . o p t i o n s . h a n d l e   & &   ! o v e r r i d e H a n d l e )   {  
                                 v a r   v a l i d H a n d l e   =   f a l s e ;  
  
                                 $ ( t h i s . o p t i o n s . h a n d l e ,   c u r r e n t I t e m ) . f i n d ( " * " ) . a n d S e l f ( ) . e a c h ( f u n c t i o n ( )   {   i f   ( t h i s   = =   e v e n t . t a r g e t )   v a l i d H a n d l e   =   t r u e ;   } ) ;  
                                 i f   ( ! v a l i d H a n d l e )   r e t u r n   f a l s e ;  
                         }  
  
                         t h i s . c u r r e n t I t e m   =   c u r r e n t I t e m ;  
                         t h i s . _ r e m o v e C u r r e n t s F r o m I t e m s ( ) ;  
                         r e t u r n   t r u e ;  
  
                 } ,  
  
                 _ m o u s e S t a r t :   f u n c t i o n ( e v e n t ,   o v e r r i d e H a n d l e ,   n o A c t i v a 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 . c u r r e n t C o n t a i n e r   =   t h i s ;  
  
                         / / W e   o n l y   n e e d   t o   c a l l   r e f r e s h P o s i t i o n s ,   b e c a u s e   t h e   r e f r e s h I t e m s   c a l l   h a s   b e e n   m o v e d   t o   m o u s e C a p t u r e  
                         t h i s . r e f r e s h P o s i t i o n s ( ) ;  
  
                         / / C r e a t e   a n d   a p p e n d   t h e   v i s i b l e   h e l p e r  
                         t h i s . h e l p e r   =   t h i s . _ c r e a t e H e l p e r ( e v e n t ) ;  
  
                         / / C a c h e   t h e   h e l p e r   s i z e  
                         t h i s . _ c a c h e H e l p e r P r o p o r t i o n s ( ) ;  
  
                         / *  
                         *   -   P o s i t i o n   g e n e r a t i o n   -  
                         *   T h i s   b l o c k   g e n e r a t e s   e v e r y t h i n g   p o s i t i o n   r e l a t e d   -   i t ' s   t h e   c o r e   o f   d r a g g a b l e s .  
                         * /  
  
                         / / C a c h e   t h e   m a r g i n s   o f   t h e   o r i g i n a l   e l e m e n t  
                         t h i s . _ c a c h e M a r g i n s ( ) ;  
  
                         / / G e t   t h e   n e x t   s c r o l l i n g   p a r e n t  
                         t h i s . s c r o l l P a r e n t   =   t h i s . h e l p e r . s c r o l l P a r e n t ( ) ;  
  
                         / / T h e   e l e m e n t ' s   a b s o l u t e   p o s i t i o n   o n   t h e   p a g e   m i n u s   m a r g i n s  
                         t h i s . o f f s e t   =   t h i s . c u r r e n t I t e m . o f f s e t ( ) ;  
                         t h i s . o f f s e t   =   {  
                                 t o p :   t h i s . o f f s e t . t o p   -   t h i s . m a r g i n s . t o p ,  
                                 l e f t :   t h i s . o f f s e t . l e f t   -   t h i s . m a r g i n s . l e f t  
                         } ;  
  
                         / /   O n l y   a f t e r   w e   g o t   t h e   o f f s e t ,   w e   c a n   c h a n g e   t h e   h e l p e r ' s   p o s i t i o n   t o   a b s o l u t e  
                         / /   T O D O :   S t i l l   n e e d   t o   f i g u r e   o u t   a   w a y   t o   m a k e   r e l a t i v e   s o r t i n g   p o s s i b l e  
                         t h i s . h e l p e r . c s s ( " p o s i t i o n " ,   " a b s o l u t e " ) ;  
                         t h i s . c s s P o s i t i o n   =   t h i s . h e l p e r . c s s ( " p o s i t i o n " ) ;  
  
                         $ . e x t e n d ( t h i s . o f f s e t ,   {  
                                 c l i c k :   {   / / W h e r e   t h e   c l i c k   h a p p e n e d ,   r e l a t i v e   t o   t h e   e l e m e n t  
                                         l e f t :   e v e n t . p a g e X   -   t h i s . o f f s e t . l e f t ,  
                                         t o p :   e v e n t . p a g e Y   -   t h i s . o f f s e t . t o p  
                                 } ,  
                                 p a r e n t :   t h i s . _ g e t P a r e n t O f f s e t ( ) ,  
                                 r e l a t i v e :   t h i s . _ g e t R e l a t i v e O f f s e t ( )   / / T h i s   i s   a   r e l a t i v e   t o   a b s o l u t e   p o s i t i o n   m i n u s   t h e   a c t u a l   p o s i t i o n   c a l c u l a t i o n   -   o n l y   u s e d   f o r   r e l a t i v e   p o s i t i o n e d   h e l p e r  
                         } ) ;  
  
                         / / G e n e r a t e   t h e   o r i g i n a l   p o s i t i o n  
                         t h i s . o r i g i n a l P o s i t i o n   =   t h i s . _ g e n e r a t e P o s i t i o n ( e v e n t ) ;  
                         t h i s . o r i g i n a l P a g e X   =   e v e n t . p a g e X ;  
                         t h i s . o r i g i n a l P a g e Y   =   e v e n t . p a g e Y ;  
  
                         / / A d j u s t   t h e   m o u s e   o f f s e t   r e l a t i v e   t o   t h e   h e l p e r   i f   ' c u r s o r A t '   i s   s u p p l i e d  
                         ( o . c u r s o r A t   & &   t h i s . _ a d j u s t O f f s e t F r o m H e l p e r ( o . c u r s o r A t ) ) ;  
  
                         / / C a c h e   t h e   f o r m e r   D O M   p o s i t i o n  
                         t h i s . d o m P o s i t i o n   =   {   p r e v :   t h i s . c u r r e n t I t e m . p r e v ( ) [ 0 ] ,   p a r e n t :   t h i s . c u r r e n t I t e m . p a r e n t ( ) [ 0 ]   } ;  
  
                         / / I f   t h e   h e l p e r   i s   n o t   t h e   o r i g i n a l ,   h i d e   t h e   o r i g i n a l   s o   i t ' s   n o t   p l a y i n g   a n y   r o l e   d u r i n g   t h e   d r a g ,   w o n ' t   c a u s e   a n y t h i n g   b a d   t h i s   w a y  
                         i f   ( t h i s . h e l p e r [ 0 ]   ! =   t h i s . c u r r e n t I t e m [ 0 ] )   {  
                                 t h i s . c u r r e n t I t e m . h i d e ( ) ;  
                         }  
  
                         / / C r e a t e   t h e   p l a c e h o l d e r  
                         t h i s . _ c r e a t e P l a c e h o l d e r ( ) ;  
  
                         / / S e t   a   c o n t a i n m e n t   i f   g i v e n   i n   t h e   o p t i o n s  
                         i f   ( o . c o n t a i n m e n t )  
                                 t h i s . _ s e t C o n t a i n m e n t ( ) ;  
  
                         i f   ( o . c u r s o r )   {   / /   c u r s o r   o p t i o n  
                                 i f   ( $ ( ' b o d y ' ) . c s s ( " c u r s o r " ) )   t h i s . _ s t o r e d C u r s o r   =   $ ( ' b o d y ' ) . c s s ( " c u r s o r " ) ;  
                                 $ ( ' b o d y ' ) . c s s ( " c u r s o r " ,   o . c u r s o r ) ;  
                         }  
  
                         i f   ( o . o p a c i t y )   {   / /   o p a c i t y   o p t i o n  
                                 i f   ( t h i s . h e l p e r . c s s ( " o p a c i t y " ) )   t h i s . _ s t o r e d O p a c i t y   =   t h i s . h e l p e r . c s s ( " o p a c i t y " ) ;  
                                 t h i s . h e l p e r . c s s ( " o p a c i t y " ,   o . o p a c i t y ) ;  
                         }  
  
                         i f   ( o . z I n d e x )   {   / /   z I n d e x   o p t i o n  
                                 i f   ( t h i s . h e l p e r . c s s ( " z I n d e x " ) )   t h i s . _ s t o r e d Z I n d e x   =   t h i s . h e l p e r . c s s ( " z I n d e x " ) ;  
                                 t h i s . h e l p e r . c s s ( " z I n d e x " ,   o . z I n d e x ) ;  
                         }  
  
                         / / P r e p a r e   s c r o l l i n g  
                         i f   ( t h i s . s c r o l l P a r e n t [ 0 ]   ! =   d o c u m e n t   & &   t h i s . s c r o l l P a r e n t [ 0 ] . t a g N a m e   ! =   ' H T M L ' )  
                                 t h i s . o v e r f l o w O f f s e t   =   t h i s . s c r o l l P a r e n t . o f f s e t ( ) ;  
  
                         / / C a l l   c a l l b a c k s  
                         t h i s . _ t r i g g e r ( " s t a r t " ,   e v e n t ,   t h i s . _ u i H a s h ( ) ) ;  
  
                         / / R e c a c h e   t h e   h e l p e r   s i z e  
                         i f   ( ! t h i s . _ p r e s e r v e H e l p e r P r o p o r t i o n s )  
                                 t h i s . _ c a c h e H e l p e r P r o p o r t i o n s ( ) ;  
  
  
                         / / P o s t   ' a c t i v a t e '   e v e n t s   t o   p o s s i b l e   c o n t a i n e r s  
                         i f   ( ! n o A c t i v a t i o n )   {  
                                 f o r   ( v a r   i   =   t h i s . c o n t a i n e r s . l e n g t h   -   1 ;   i   > =   0 ;   i - - )   {   t h i s . c o n t a i n e r s [ i ] . _ t r i g g e r ( " a c t i v a t e " ,   e v e n t ,   s e l f . _ u i H a s h ( t h i s ) ) ;   }  
                         }  
  
                         / / P r e p a r e   p o s s i b l e   d r o p p a b l e s  
                         i f   ( $ . u i . d d m a n a g e r )  
                                 $ . u i . d d m a n a g e r . c u r r e n t   =   t h i s ;  
  
                         i f   ( $ . u i . d d m a n a g e r   & &   ! o . d r o p B e h a v i o u r )  
                                 $ . u i . d d m a n a g e r . p r e p a r e O f f s e t s ( t h i s ,   e v e n t ) ;  
  
                         t h i s . d r a g g i n g   =   t r u e ;  
  
                         t h i s . h e l p e r . a d d C l a s s ( " u i - s o r t a b l e - h e l p e r " ) ;  
                         t h i s . _ m o u s e D r a g ( e v e n t ) ;   / / E x e c u t e   t h e   d r a g   o n c e   -   t h i s   c a u s e s   t h e   h e l p e r   n o t   t o   b e   v i s i b l e   b e f o r e   g e t t i n g   i t s   c o r r e c t   p o s i t i o n  
                         r e t u r n   t r u e ;  
  
                 } ,  
  
                 _ m o u s e D r a g :   f u n c t i o n ( e v e n t )   {  
  
                         / / C o m p u t e   t h e   h e l p e r s   p o s i t i o n  
                         t h i s . p o s i t i o n   =   t h i s . _ g e n e r a t e P o s i t i o n ( e v e n t ) ;  
                         t h i s . p o s i t i o n A b s   =   t h i s . _ c o n v e r t P o s i t i o n T o ( " a b s o l u t e " ) ;  
  
                         i f   ( ! t h i s . l a s t P o s i t i o n A b s )   {  
                                 t h i s . l a s t P o s i t i o n A b s   =   t h i s . p o s i t i o n A b s ;  
                         }  
  
                         / / D o   s c r o l l i n g  
                         i f   ( t h i s . o p t i o n s . s c r o l l )   {  
                                 v a r   o   =   t h i s . o p t i o n s ,   s c r o l l e d   =   f a l s e ;  
                                 i f   ( t h i s . s c r o l l P a r e n t [ 0 ]   ! =   d o c u m e n t   & &   t h i s . s c r o l l P a r e n t [ 0 ] . t a g N a m e   ! =   ' H T M L ' )   {  
  
                                         i f   ( ( t h i s . o v e r f l o w O f f s e t . t o p   +   t h i s . s c r o l l P a r e n t [ 0 ] . o f f s e t H e i g h t )   -   e v e n t . p a g e Y   <   o . s c r o l l S e n s i t i v i t y )  
                                                 t h i s . s c r o l l P a r e n t [ 0 ] . s c r o l l T o p   =   s c r o l l e d   =   t h i s . s c r o l l P a r e n t [ 0 ] . s c r o l l T o p   +   o . s c r o l l S p e e d ;  
                                         e l s e   i f   ( e v e n t . p a g e Y   -   t h i s . o v e r f l o w O f f s e t . t o p   <   o . s c r o l l S e n s i t i v i t y )  
                                                 t h i s . s c r o l l P a r e n t [ 0 ] . s c r o l l T o p   =   s c r o l l e d   =   t h i s . s c r o l l P a r e n t [ 0 ] . s c r o l l T o p   -   o . s c r o l l S p e e d ;  
  
                                         i f   ( ( t h i s . o v e r f l o w O f f s e t . l e f t   +   t h i s . s c r o l l P a r e n t [ 0 ] . o f f s e t W i d t h )   -   e v e n t . p a g e X   <   o . s c r o l l S e n s i t i v i t y )  
                                                 t h i s . s c r o l l P a r e n t [ 0 ] . s c r o l l L e f t   =   s c r o l l e d   =   t h i s . s c r o l l P a r e n t [ 0 ] . s c r o l l L e f t   +   o . s c r o l l S p e e d ;  
                                         e l s e   i f   ( e v e n t . p a g e X   -   t h i s . o v e r f l o w O f f s e t . l e f t   <   o . s c r o l l S e n s i t i v i t y )  
                                                 t h i s . s c r o l l P a r e n t [ 0 ] . s c r o l l L e f t   =   s c r o l l e d   =   t h i s . s c r o l l P a r e n t [ 0 ] . s c r o l l L e f t   -   o . s c r o l l S p e e d ;  
  
                                 }   e l s e   {  
  
                                         i f   ( e v e n t . p a g e Y   -   $ ( d o c u m e n t ) . s c r o l l T o p ( )   <   o . s c r o l l S e n s i t i v i t y )  
                                                 s c r o l l e d   =   $ ( d o c u m e n t ) . s c r o l l T o p ( $ ( d o c u m e n t ) . s c r o l l T o p ( )   -   o . s c r o l l S p e e d ) ;  
                                         e l s e   i f   ( $ ( w i n d o w ) . h e i g h t ( )   -   ( e v e n t . p a g e Y   -   $ ( d o c u m e n t ) . s c r o l l T o p ( ) )   <   o . s c r o l l S e n s i t i v i t y )  
                                                 s c r o l l e d   =   $ ( d o c u m e n t ) . s c r o l l T o p ( $ ( d o c u m e n t ) . s c r o l l T o p ( )   +   o . s c r o l l S p e e d ) ;  
  
                                         i f   ( e v e n t . p a g e X   -   $ ( d o c u m e n t ) . s c r o l l L e f t ( )   <   o . s c r o l l S e n s i t i v i t y )  
                                                 s c r o l l e d   =   $ ( d o c u m e n t ) . s c r o l l L e f t ( $ ( d o c u m e n t ) . s c r o l l L e f t ( )   -   o . s c r o l l S p e e d ) ;  
                                         e l s e   i f   ( $ ( w i n d o w ) . w i d t h ( )   -   ( e v e n t . p a g e X   -   $ ( d o c u m e n t ) . s c r o l l L e f t ( ) )   <   o . s c r o l l S e n s i t i v i t y )  
                                                 s c r o l l e d   =   $ ( d o c u m e n t ) . s c r o l l L e f t ( $ ( d o c u m e n t ) . s c r o l l L e f t ( )   +   o . s c r o l l S p e e d ) ;  
  
                                 }  
  
                                 i f   ( s c r o l l e d   ! = =   f a l s e   & &   $ . u i . d d m a n a g e r   & &   ! o . d r o p B e h a v i o u r )  
                                         $ . u i . d d m a n a g e r . p r e p a r e O f f s e t s ( t h i s ,   e v e n t ) ;  
                         }  
  
                         / / R e g e n e r a t e   t h e   a b s o l u t e   p o s i t i o n   u s e d   f o r   p o s i t i o n   c h e c k s  
                         t h i s . p o s i t i o n A b s   =   t h i s . _ c o n v e r t P o s i t i o n T o ( " a b s o l u t e " ) ;  
  
                         / / S e t   t h e   h e l p e r   p o s i t i o n  
                         i f   ( ! t h i s . o p t i o n s . a x i s   | |   t h i s . o p t i o n s . a x i s   ! =   " y " )   t h i s . h e l p e r [ 0 ] . s t y l e . l e f t   =   t h i s . p o s i t i o n . l e f t   +   ' p x ' ;  
                         i f   ( ! t h i s . o p t i o n s . a x i s   | |   t h i s . o p t i o n s . a x i s   ! =   " x " )   t h i s . h e l p e r [ 0 ] . s t y l e . t o p   =   t h i s . p o s i t i o n . t o p   +   ' p x ' ;  
  
                         / / R e a r r a n g e  
                         f o r   ( v a r   i   =   t h i s . i t e m s . l e n g t h   -   1 ;   i   > =   0 ;   i - - )   {  
  
                                 / / C a c h e   v a r i a b l e s   a n d   i n t e r s e c t i o n ,   c o n t i n u e   i f   n o   i n t e r s e c t i o n  
                                 v a r   i t e m   =   t h i s . i t e m s [ i ] ,   i t e m E l e m e n t   =   i t e m . i t e m [ 0 ] ,   i n t e r s e c t i o n   =   t h i s . _ i n t e r s e c t s W i t h P o i n t e r ( i t e m ) ;  
                                 i f   ( ! i n t e r s e c t i o n )   c o n t i n u e ;  
  
                                 i f   ( i t e m E l e m e n t   ! =   t h i s . c u r r e n t I t e m [ 0 ]   / / c a n n o t   i n t e r s e c t   w i t h   i t s e l f  
 	 	 	 	 & &   t h i s . p l a c e h o l d e r [ i n t e r s e c t i o n   = =   1   ?   " n e x t "   :   " p r e v " ] ( ) [ 0 ]   ! =   i t e m E l e m e n t   / / n o   u s e l e s s   a c t i o n s   t h a t   h a v e   b e e n   d o n e   b e f o r e  
 	 	 	 	 & &   ! $ . u i . c o n t a i n s ( t h i s . p l a c e h o l d e r [ 0 ] ,   i t e m E l e m e n t )   / / n o   a c t i o n   i f   t h e   i t e m   m o v e d   i s   t h e   p a r e n t   o f   t h e   i t e m   c h e c k e d  
 	 	 	 	 & &   ( t h i s . o p t i o n s . t y p e   = =   ' s e m i - d y n a m i c '   ?   ! $ . u i . c o n t a i n s ( t h i s . e l e m e n t [ 0 ] ,   i t e m E l e m e n t )   :   t r u e )  
                                 / / & &   i t e m E l e m e n t . p a r e n t N o d e   = =   t h i s . p l a c e h o l d e r [ 0 ] . p a r e n t N o d e   / /   o n l y   r e a r r a n g e   i t e m s   w i t h i n   t h e   s a m e   c o n t a i n e r  
 	 	 	 )   {  
  
                                         t h i s . d i r e c t i o n   =   i n t e r s e c t i o n   = =   1   ?   " d o w n "   :   " u p " ;  
  
                                         i f   ( t h i s . o p t i o n s . t o l e r a n c e   = =   " p o i n t e r "   | |   t h i s . _ i n t e r s e c t s W i t h S i d e s ( i t e m ) )   {  
                                                 t h i s . _ r e a r r a n g e ( e v e n t ,   i t e m ) ;  
                                         }   e l s e   {  
                                                 b r e a k ;  
                                         }  
  
                                         t h i s . _ t r i g g e r ( " c h a n g e " ,   e v e n t ,   t h i s . _ u i H a s h ( ) ) ;  
                                         b r e a k ;  
                                 }  
                         }  
  
                         / / P o s t   e v e n t s   t o   c o n t a i n e r s  
                         t h i s . _ c o n t a c t C o n t a i n e r s ( e v e n t ) ;  
  
                         / / I n t e r c o n n e c t   w i t h   d r o p p a b l e s  
                         i f   ( $ . u i . d d m a n a g e r )   $ . u i . d d m a n a g e r . d r a g ( t h i s ,   e v e n t ) ;  
  
                         / / C a l l   c a l l b a c k s  
                         t h i s . _ t r i g g e r ( ' s o r t ' ,   e v e n t ,   t h i s . _ u i H a s h ( ) ) ;  
  
                         t h i s . l a s t P o s i t i o n A b s   =   t h i s . p o s i t i o n A b s ;  
                         r e t u r n   f a l s e ;  
  
                 } ,  
  
                 _ m o u s e S t o p :   f u n c t i o n ( e v e n t ,   n o P r o p a g a t i o n )   {  
  
                         i f   ( ! e v e n t )   r e t u r n ;  
  
                         / / I f   w e   a r e   u s i n g   d r o p p a b l e s ,   i n f o r m   t h e   m a n a g e r   a b o u t   t h e   d r o p  
                         i f   ( $ . u i . d d m a n a g e r   & &   ! t h i s . o p t i o n s . d r o p B e h a v i o u r )  
                                 $ . u i . d d m a n a g e r . d r o p ( t h i s ,   e v e n t ) ;  
  
                         i f   ( t h i s . o p t i o n s . r e v e r t )   {  
                                 v a r   s e l f   =   t h i s ;  
                                 v a r   c u r   =   s e l f . p l a c e h o l d e r . o f f s e t ( ) ;  
  
                                 s e l f . r e v e r t i n g   =   t r u e ;  
  
                                 $ ( t h i s . h e l p e r ) . a n i m a t e ( {  
                                         l e f t :   c u r . l e f t   -   t h i s . o f f s e t . p a r e n t . l e f t   -   s e l f . m a r g i n s . l e f t   +   ( t h i s . o f f s e t P a r e n t [ 0 ]   = =   d o c u m e n t . b o d y   ?   0   :   t h i s . o f f s e t P a r e n t [ 0 ] . s c r o l l L e f t ) ,  
                                         t o p :   c u r . t o p   -   t h i s . o f f s e t . p a r e n t . t o p   -   s e l f . m a r g i n s . t o p   +   ( t h i s . o f f s e t P a r e n t [ 0 ]   = =   d o c u m e n t . b o d y   ?   0   :   t h i s . o f f s e t P a r e n t [ 0 ] . s c r o l l T o p )  
                                 } ,   p a r s e I n t ( t h i s . o p t i o n s . r e v e r t ,   1 0 )   | |   5 0 0 ,   f u n c t i o n ( )   {  
                                         s e l f . _ c l e a r ( e v e n t ) ;  
                                 } ) ;  
                         }   e l s e   {  
                                 t h i s . _ c l e a r ( e v e n t ,   n o P r o p a g a t i o n ) ;  
                         }  
  
                         r e t u r n   f a l s e ;  
  
                 } ,  
  
                 c a n c e l :   f u n c t i o n ( )   {  
  
                         v a r   s e l f   =   t h i s ;  
  
                         i f   ( t h i s . d r a g g i n g )   {  
  
                                 t h i s . _ m o u s e U p ( {   t a r g e t :   n u l l   } ) ;  
  
                                 i f   ( t h i s . o p t i o n s . h e l p e r   = =   " o r i g i n a l " )  
                                         t h i s . c u r r e n t I t e m . c s s ( t h i s . _ s t o r e d C S S ) . r e m o v e C l a s s ( " u i - s o r t a b l e - h e l p e r " ) ;  
                                 e l s e  
                                         t h i s . c u r r e n t I t e m . s h o w ( ) ;  
  
                                 / / P o s t   d e a c t i v a t i n g   e v e n t s   t o   c o n t a i n e r s  
                                 f o r   ( v a r   i   =   t h i s . c o n t a i n e r s . l e n g t h   -   1 ;   i   > =   0 ;   i - - )   {  
                                         t h i s . c o n t a i n e r s [ i ] . _ t r i g g e r ( " d e a c t i v a t e " ,   n u l l ,   s e l f . _ u i H a s h ( t h i s ) ) ;  
                                         i f   ( t h i s . c o n t a i n e r s [ i ] . c o n t a i n e r C a c h e . o v e r )   {  
                                                 t h i s . c o n t a i n e r s [ i ] . _ t r i g g e r ( " o u t " ,   n u l l ,   s e l f . _ u i H a s h ( t h i s ) ) ;  
                                                 t h i s . c o n t a i n e r s [ i ] . c o n t a i n e r C a c h e . o v e r   =   0 ;  
                                         }  
                                 }  
  
                         }  
  
                         i f   ( t h i s . p l a c e h o l d e r )   {  
                                 / / $ ( t h i s . p l a c e h o l d e r [ 0 ] ) . r e m o v e ( ) ;   w o u l d   h a v e   b e e n   t h e   j Q u e r y   w a y   -   u n f o r t u n a t e l y ,   i t   u n b i n d s   A L L   e v e n t s   f r o m   t h e   o r i g i n a l   n o d e !  
                                 i f   ( t h i s . p l a c e h o l d e r [ 0 ] . p a r e n t N o d e )   t h i s . p l a c e h o l d e r [ 0 ] . p a r e n t N o d e . r e m o v e C h i l d ( t h i s . p l a c e h o l d e r [ 0 ] ) ;  
                                 i f   ( t h i s . o p t i o n s . h e l p e r   ! =   " o r i g i n a l "   & &   t h i s . h e l p e r   & &   t h i s . h e l p e r [ 0 ] . p a r e n t N o d e )   t h i s . h e l p e r . r e m o v e ( ) ;  
  
                                 $ . e x t e n d ( t h i s ,   {  
                                         h e l p e r :   n u l l ,  
                                         d r a g g i n g :   f a l s e ,  
                                         r e v e r t i n g :   f a l s e ,  
                                         _ n o F i n a l S o r t :   n u l l  
                                 } ) ;  
  
                                 i f   ( t h i s . d o m P o s i t i o n . p r e v )   {  
                                         $ ( t h i s . d o m P o s i t i o n . p r e v ) . a f t e r ( t h i s . c u r r e n t I t e m ) ;  
                                 }   e l s e   {  
                                         $ ( t h i s . d o m P o s i t i o n . p a r e n t ) . p r e p e n d ( t h i s . c u r r e n t I t e m ) ;  
                                 }  
                         }  
  
                         r e t u r n   t h i s ;  
  
                 } ,  
  
                 s e r i a l i z e :   f u n c t i o n ( o )   {  
  
                         v a r   i t e m s   =   t h i s . _ g e t I t e m s A s j Q u e r y ( o   & &   o . c o n n e c t e d ) ;  
                         v a r   s t r   =   [ ] ;   o   =   o   | |   { } ;  
  
                         $ ( i t e m s ) . e a c h ( f u n c t i o n ( )   {  
                                 v a r   r e s   =   ( $ ( o . i t e m   | |   t h i s ) . a t t r ( o . a t t r i b u t e   | |   ' i d ' )   | |   ' ' ) . m a t c h ( o . e x p r e s s i o n   | |   ( / ( . + ) [ - = _ ] ( . + ) / ) ) ;  
                                 i f   ( r e s )   s t r . p u s h ( ( o . k e y   | |   r e s [ 1 ]   +   ' [ ] ' )   +   ' = '   +   ( o . k e y   & &   o . e x p r e s s i o n   ?   r e s [ 1 ]   :   r e s [ 2 ] ) ) ;  
                         } ) ;  
  
                         i f   ( ! s t r . l e n g t h   & &   o . k e y )   {  
                                 s t r . p u s h ( o . k e y   +   ' = ' ) ;  
                         }  
  
                         r e t u r n   s t r . j o i n ( ' & ' ) ;  
  
                 } ,  
  
                 t o A r r a y :   f u n c t i o n ( o )   {  
  
                         v a r   i t e m s   =   t h i s . _ g e t I t e m s A s j Q u e r y ( o   & &   o . c o n n e c t e d ) ;  
                         v a r   r e t   =   [ ] ;   o   =   o   | |   { } ;  
  
                         i t e m s . e a c h ( f u n c t i o n ( )   {   r e t . p u s h ( $ ( o . i t e m   | |   t h i s ) . a t t r ( o . a t t r i b u t e   | |   ' i d ' )   | |   ' ' ) ;   } ) ;  
                         r e t u r n   r e t ;  
  
                 } ,  
  
                 / *   B e   c a r e f u l   w i t h   t h e   f o l l o w i n g   c o r e   f u n c t i o n s   * /  
                 _ i n t e r s e c t s W i t h :   f u n c t i o n ( i t e m )   {  
  
                         v a r   x 1   =   t h i s . p o s i t i o n A b s . l e f t ,  
 	 	 	 x 2   =   x 1   +   t h i s . h e l p e r P r o p o r t i o n s . w i d t h ,  
 	 	 	 y 1   =   t h i s . p o s i t i o n A b s . t o p ,  
 	 	 	 y 2   =   y 1   +   t h i s . h e l p e r P r o p o r t i o n s . h e i g h t ;  
  
                         v a r   l   =   i t e m . l e f t ,  
 	 	 	 r   =   l   +   i t e m . w i d t h ,  
 	 	 	 t   =   i t e m . t o p ,  
 	 	 	 b   =   t   +   i t e m . h e i g h t ;  
  
                         v a r   d y C l i c k   =   t h i s . o f f s e t . c l i c k . t o p ,  
 	 	 	 d x C l i c k   =   t h i s . o f f s e t . c l i c k . l e f t ;  
  
                         v a r   i s O v e r E l e m e n t   =   ( y 1   +   d y C l i c k )   >   t   & &   ( y 1   +   d y C l i c k )   <   b   & &   ( x 1   +   d x C l i c k )   >   l   & &   ( x 1   +   d x C l i c k )   <   r ;  
  
                         i f   ( t h i s . o p t i o n s . t o l e r a n c e   = =   " p o i n t e r "  
 	 	 	 | |   t h i s . o p t i o n s . f o r c e P o i n t e r F o r C o n t a i n e r s  
 	 	 	 | |   ( t h i s . o p t i o n s . t o l e r a n c e   ! =   " p o i n t e r "   & &   t h i s . h e l p e r P r o p o r t i o n s [ t h i s . f l o a t i n g   ?   ' w i d t h '   :   ' h e i g h t ' ]   >   i t e m [ t h i s . f l o a t i n g   ?   ' w i d t h '   :   ' h e i g h t ' ] )  
 	 	 )   {  
                                 r e t u r n   i s O v e r E l e m e n t ;  
                         }   e l s e   {  
  
                                 r e t u r n   ( l   <   x 1   +   ( t h i s . h e l p e r P r o p o r t i o n s . w i d t h   /   2 )   / /   R i g h t   H a l f  
 	 	 	 	 & &   x 2   -   ( t h i s . h e l p e r P r o p o r t i o n s . w i d t h   /   2 )   <   r   / /   L e f t   H a l f  
 	 	 	 	 & &   t   <   y 1   +   ( t h i s . h e l p e r P r o p o r t i o n s . h e i g h t   /   2 )   / /   B o t t o m   H a l f  
 	 	 	 	 & &   y 2   -   ( t h i s . h e l p e r P r o p o r t i o n s . h e i g h t   /   2 )   <   b ) ;   / /   T o p   H a l f  
  
                         }  
                 } ,  
  
                 _ i n t e r s e c t s W i t h P o i n t e r :   f u n c t i o n ( i t e m )   {  
  
                         v a r   i s O v e r E l e m e n t H e i g h t   =   $ . u i . i s O v e r A x i s ( t h i s . p o s i t i o n A b s . t o p   +   t h i s . o f f s e t . c l i c k . t o p ,   i t e m . t o p ,   i t e m . h e i g h t ) ,  
 	 	 	 i s O v e r E l e m e n t W i d t h   =   $ . u i . i s O v e r A x i s ( t h i s . p o s i t i o n A b s . l e f t   +   t h i s . o f f s e t . c l i c k . l e f t ,   i t e m . l e f t ,   i t e m . w i d t h ) ,  
 	 	 	 i s O v e r E l e m e n t   =   i s O v e r E l e m e n t H e i g h t   & &   i s O v e r E l e m e n t W i d t h ,  
 	 	 	 v e r t i c a l D i r e c t i o n   =   t h i s . _ g e t D r a g V e r t i c a l D i r e c t i o n ( ) ,  
 	 	 	 h o r i z o n t a l D i r e c t i o n   =   t h i s . _ g e t D r a g H o r i z o n t a l D i r e c t i o n ( ) ;  
  
                         i f   ( ! i s O v e r E l e m e n t )  
                                 r e t u r n   f a l s e ;  
  
                         r e t u r n   t h i s . f l o a t i n g   ?  
 	 	 	 ( ( ( h o r i z o n t a l D i r e c t i o n   & &   h o r i z o n t a l D i r e c t i o n   = =   " r i g h t " )   | |   v e r t i c a l D i r e c t i o n   = =   " d o w n " )   ?   2   :   1 )  
 	 	 	 :   ( v e r t i c a l D i r e c t i o n   & &   ( v e r t i c a l D i r e c t i o n   = =   " d o w n "   ?   2   :   1 ) ) ;  
  
                 } ,  
  
                 _ i n t e r s e c t s W i t h S i d e s :   f u n c t i o n ( i t e m )   {  
  
                         v a r   i s O v e r B o t t o m H a l f   =   $ . u i . i s O v e r A x i s ( t h i s . p o s i t i o n A b s . t o p   +   t h i s . o f f s e t . c l i c k . t o p ,   i t e m . t o p   +   ( i t e m . h e i g h t   /   2 ) ,   i t e m . h e i g h t ) ,  
 	 	 	 i s O v e r R i g h t H a l f   =   $ . u i . i s O v e r A x i s ( t h i s . p o s i t i o n A b s . l e f t   +   t h i s . o f f s e t . c l i c k . l e f t ,   i t e m . l e f t   +   ( i t e m . w i d t h   /   2 ) ,   i t e m . w i d t h ) ,  
 	 	 	 v e r t i c a l D i r e c t i o n   =   t h i s . _ g e t D r a g V e r t i c a l D i r e c t i o n ( ) ,  
 	 	 	 h o r i z o n t a l D i r e c t i o n   =   t h i s . _ g e t D r a g H o r i z o n t a l D i r e c t i o n ( ) ;  
  
                         i f   ( t h i s . f l o a t i n g   & &   h o r i z o n t a l D i r e c t i o n )   {  
                                 r e t u r n   ( ( h o r i z o n t a l D i r e c t i o n   = =   " r i g h t "   & &   i s O v e r R i g h t H a l f )   | |   ( h o r i z o n t a l D i r e c t i o n   = =   " l e f t "   & &   ! i s O v e r R i g h t H a l f ) ) ;  
                         }   e l s e   {  
                                 r e t u r n   v e r t i c a l D i r e c t i o n   & &   ( ( v e r t i c a l D i r e c t i o n   = =   " d o w n "   & &   i s O v e r B o t t o m H a l f )   | |   ( v e r t i c a l D i r e c t i o n   = =   " u p "   & &   ! i s O v e r B o t t o m H a l f ) ) ;  
                         }  
  
                 } ,  
  
                 _ g e t D r a g V e r t i c a l D i r e c t i o n :   f u n c t i o n ( )   {  
                         v a r   d e l t a   =   t h i s . p o s i t i o n A b s . t o p   -   t h i s . l a s t P o s i t i o n A b s . t o p ;  
                         r e t u r n   d e l t a   ! =   0   & &   ( d e l t a   >   0   ?   " d o w n "   :   " u p " ) ;  
                 } ,  
  
                 _ g e t D r a g H o r i z o n t a l D i r e c t i o n :   f u n c t i o n ( )   {  
                         v a r   d e l t a   =   t h i s . p o s i t i o n A b s . l e f t   -   t h i s . l a s t P o s i t i o n A b s . l e f t ;  
                         r e t u r n   d e l t a   ! =   0   & &   ( d e l t a   >   0   ?   " r i g h t "   :   " l e f t " ) ;  
                 } ,  
  
                 r e f r e s h :   f u n c t i o n ( e v e n t )   {  
                         t h i s . _ r e f r e s h I t e m s ( e v e n t ) ;  
                         t h i s . r e f r e s h P o s i t i o n s ( ) ;  
                         r e t u r n   t h i s ;  
                 } ,  
  
                 _ c o n n e c t W i t h :   f u n c t i o n ( )   {  
                         v a r   o p t i o n s   =   t h i s . o p t i o n s ;  
                         r e t u r n   o p t i o n s . c o n n e c t W i t h . c o n s t r u c t o r   = =   S t r i n g  
 	 	 	 ?   [ o p t i o n s . c o n n e c t W i t h ]  
 	 	 	 :   o p t i o n s . c o n n e c t W i t h ;  
                 } ,  
  
                 _ g e t I t e m s A s j Q u e r y :   f u n c t i o n ( c o n n e c t e d )   {  
  
                         v a r   s e l f   =   t h i s ;  
                         v a r   i t e m s   =   [ ] ;  
                         v a r   q u e r i e s   =   [ ] ;  
                         v a r   c o n n e c t W i t h   =   t h i s . _ c o n n e c t W i t h ( ) ;  
  
                         i f   ( c o n n e c t W i t h   & &   c o n n e c t e d )   {  
                                 f o r   ( v a r   i   =   c o n n e c t W i t h . l e n g t h   -   1 ;   i   > =   0 ;   i - - )   {  
                                         v a r   c u r   =   $ ( c o n n e c t W i t h [ i ] ) ;  
                                         f o r   ( v a r   j   =   c u r . l e n g t h   -   1 ;   j   > =   0 ;   j - - )   {  
                                                 v a r   i n s t   =   $ . d a t a ( c u r [ j ] ,   ' s o r t a b l e ' ) ;  
                                                 i f   ( i n s t   & &   i n s t   ! =   t h i s   & &   ! i n s t . o p t i o n s . d i s a b l e d )   {  
                                                         q u e r i e s . p u s h ( [ $ . i s F u n c t i o n ( i n s t . o p t i o n s . i t e m s )   ?   i n s t . o p t i o n s . i t e m s . c a l l ( i n s t . e l e m e n t )   :   $ ( i n s t . o p t i o n s . i t e m s ,   i n s t . e l e m e n t ) . n o t ( " . u i - s o r t a b l e - h e l p e r " ) . n o t ( ' . u i - s o r t a b l e - p l a c e h o l d e r ' ) ,   i n s t ] ) ;  
                                                 }  
                                         } ;  
                                 } ;  
                         }  
  
                         q u e r i e s . p u s h ( [ $ . i s F u n c t i o n ( t h i s . o p t i o n s . i t e m s )   ?   t h i s . o p t i o n s . i t e m s . c a l l ( t h i s . e l e m e n t ,   n u l l ,   {   o p t i o n s :   t h i s . o p t i o n s ,   i t e m :   t h i s . c u r r e n t I t e m   } )   :   $ ( t h i s . o p t i o n s . i t e m s ,   t h i s . e l e m e n t ) . n o t ( " . u i - s o r t a b l e - h e l p e r " ) . n o t ( ' . u i - s o r t a b l e - p l a c e h o l d e r ' ) ,   t h i s ] ) ;  
  
                         f o r   ( v a r   i   =   q u e r i e s . l e n g t h   -   1 ;   i   > =   0 ;   i - - )   {  
                                 q u e r i e s [ i ] [ 0 ] . e a c h ( f u n c t i o n ( )   {  
                                         i t e m s . p u s h ( t h i s ) ;  
                                 } ) ;  
                         } ;  
  
                         r e t u r n   $ ( i t e m s ) ;  
  
                 } ,  
  
                 _ r e m o v e C u r r e n t s F r o m I t e m s :   f u n c t i o n ( )   {  
  
                         v a r   l i s t   =   t h i s . c u r r e n t I t e m . f i n d ( " : d a t a ( s o r t a b l e - i t e m ) " ) ;  
  
                         f o r   ( v a r   i   =   0 ;   i   <   t h i s . i t e m s . l e n g t h ;   i + + )   {  
  
                                 f o r   ( v a r   j   =   0 ;   j   <   l i s t . l e n g t h ;   j + + )   {  
                                         i f   ( l i s t [ j ]   = =   t h i s . i t e m s [ i ] . i t e m [ 0 ] )  
                                                 t h i s . i t e m s . s p l i c e ( i ,   1 ) ;  
                                 } ;  
  
                         } ;  
  
                 } ,  
  
                 _ r e f r e s h I t e m s :   f u n c t i o n ( e v e n t )   {  
  
                         t h i s . i t e m s   =   [ ] ;  
                         t h i s . c o n t a i n e r s   =   [ t h i s ] ;  
                         v a r   i t e m s   =   t h i s . i t e m s ;  
                         v a r   s e l f   =   t h i s ;  
                         v a r   q u e r i e s   =   [ [ $ . i s F u n c t i o n ( t h i s . o p t i o n s . i t e m s )   ?   t h i s . o p t i o n s . i t e m s . c a l l ( t h i s . e l e m e n t [ 0 ] ,   e v e n t ,   {   i t e m :   t h i s . c u r r e n t I t e m   } )   :   $ ( t h i s . o p t i o n s . i t e m s ,   t h i s . e l e m e n t ) ,   t h i s ] ] ;  
                         v a r   c o n n e c t W i t h   =   t h i s . _ c o n n e c t W i t h ( ) ;  
  
                         i f   ( c o n n e c t W i t h )   {  
                                 f o r   ( v a r   i   =   c o n n e c t W i t h . l e n g t h   -   1 ;   i   > =   0 ;   i - - )   {  
                                         v a r   c u r   =   $ ( c o n n e c t W i t h [ i ] ) ;  
                                         f o r   ( v a r   j   =   c u r . l e n g t h   -   1 ;   j   > =   0 ;   j - - )   {  
                                                 v a r   i n s t   =   $ . d a t a ( c u r [ j ] ,   ' s o r t a b l e ' ) ;  
                                                 i f   ( i n s t   & &   i n s t   ! =   t h i s   & &   ! i n s t . o p t i o n s . d i s a b l e d )   {  
                                                         q u e r i e s . p u s h ( [ $ . i s F u n c t i o n ( i n s t . o p t i o n s . i t e m s )   ?   i n s t . o p t i o n s . i t e m s . c a l l ( i n s t . e l e m e n t [ 0 ] ,   e v e n t ,   {   i t e m :   t h i s . c u r r e n t I t e m   } )   :   $ ( i n s t . o p t i o n s . i t e m s ,   i n s t . e l e m e n t ) ,   i n s t ] ) ;  
                                                         t h i s . c o n t a i n e r s . p u s h ( i n s t ) ;  
                                                 }  
                                         } ;  
                                 } ;  
                         }  
  
                         f o r   ( v a r   i   =   q u e r i e s . l e n g t h   -   1 ;   i   > =   0 ;   i - - )   {  
                                 v a r   t a r g e t D a t a   =   q u e r i e s [ i ] [ 1 ] ;  
                                 v a r   _ q u e r i e s   =   q u e r i e s [ i ] [ 0 ] ;  
  
                                 f o r   ( v a r   j   =   0 ,   q u e r i e s L e n g t h   =   _ q u e r i e s . l e n g t h ;   j   <   q u e r i e s L e n g t h ;   j + + )   {  
                                         v a r   i t e m   =   $ ( _ q u e r i e s [ j ] ) ;  
  
                                         i t e m . d a t a ( ' s o r t a b l e - i t e m ' ,   t a r g e t D a t a ) ;   / /   D a t a   f o r   t a r g e t   c h e c k i n g   ( m o u s e   m a n a g e r )  
  
                                         i t e m s . p u s h ( {  
                                                 i t e m :   i t e m ,  
                                                 i n s t a n c e :   t a r g e t D a t a ,  
                                                 w i d t h :   0 ,   h e i g h t :   0 ,  
                                                 l e f t :   0 ,   t o p :   0  
                                         } ) ;  
                                 } ;  
                         } ;  
  
                 } ,  
  
                 r e f r e s h P o s i t i o n s :   f u n c t i o n ( f a s t )   {  
  
                         / / T h i s   h a s   t o   b e   r e d o n e   b e c a u s e   d u e   t o   t h e   i t e m   b e i n g   m o v e d   o u t / i n t o   t h e   o f f s e t P a r e n t ,   t h e   o f f s e t P a r e n t ' s   p o s i t i o n   w i l l   c h a n g e  
                         i f   ( t h i s . o f f s e t P a r e n t   & &   t h i s . h e l p e r )   {  
                                 t h i s . o f f s e t . p a r e n t   =   t h i s . _ g e t P a r e n t O f f s e t ( ) ;  
                         }  
  
                         f o r   ( v a r   i   =   t h i s . i t e m s . l e n g t h   -   1 ;   i   > =   0 ;   i - - )   {  
                                 v a r   i t e m   =   t h i s . i t e m s [ i ] ;  
  
                                 v a r   t   =   t h i s . o p t i o n s . t o l e r a n c e E l e m e n t   ?   $ ( t h i s . o p t i o n s . t o l e r a n c e E l e m e n t ,   i t e m . i t e m )   :   i t e m . i t e m ;  
  
                                 i f   ( ! f a s t )   {  
                                         i t e m . w i d t h   =   t . o u t e r W i d t h ( ) ;  
                                         i t e m . h e i g h t   =   t . o u t e r H e i g h t ( ) ;  
                                 }  
  
                                 v a r   p   =   t . o f f s e t ( ) ;  
                                 i t e m . l e f t   =   p . l e f t ;  
                                 i t e m . t o p   =   p . t o p ;  
                         } ;  
  
                         i f   ( t h i s . o p t i o n s . c u s t o m   & &   t h i s . o p t i o n s . c u s t o m . r e f r e s h C o n t a i n e r s )   {  
                                 t h i s . o p t i o n s . c u s t o m . r e f r e s h C o n t a i n e r s . c a l l ( t h i s ) ;  
                         }   e l s e   {  
                                 f o r   ( v a r   i   =   t h i s . c o n t a i n e r s . l e n g t h   -   1 ;   i   > =   0 ;   i - - )   {  
                                         v a r   p   =   t h i s . c o n t a i n e r s [ i ] . e l e m e n t . o f f s e t ( ) ;  
                                         t h i s . c o n t a i n e r s [ i ] . c o n t a i n e r C a c h e . l e f t   =   p . l e f t ;  
                                         t h i s . c o n t a i n e r s [ i ] . c o n t a i n e r C a c h e . t o p   =   p . t o p ;  
                                         t h i s . c o n t a i n e r s [ i ] . c o n t a i n e r C a c h e . w i d t h   =   t h i s . c o n t a i n e r s [ i ] . e l e m e n t . o u t e r W i d t h ( ) ;  
                                         t h i s . c o n t a i n e r s [ i ] . c o n t a i n e r C a c h e . h e i g h t   =   t h i s . c o n t a i n e r s [ i ] . e l e m e n t . o u t e r H e i g h t ( ) ;  
                                 } ;  
                         }  
  
                         r e t u r n   t h i s ;  
                 } ,  
  
                 _ c r e a t e P l a c e h o l d e r :   f u n c t i o n ( t h a t )   {  
  
                         v a r   s e l f   =   t h a t   | |   t h i s ,   o   =   s e l f . o p t i o n s ;  
  
                         i f   ( ! o . p l a c e h o l d e r   | |   o . p l a c e h o l d e r . c o n s t r u c t o r   = =   S t r i n g )   {  
                                 v a r   c l a s s N a m e   =   o . p l a c e h o l d e r ;  
                                 o . p l a c e h o l d e r   =   {  
                                         e l e m e n t :   f u n c t i o n ( )   {  
  
                                                 v a r   e l   =   $ ( d o c u m e n t . c r e a t e E l e m e n t ( s e l f . c u r r e n t I t e m [ 0 ] . n o d e N a m e ) )  
 	 	 	 	 	 	 . a d d C l a s s ( c l a s s N a m e   | |   s e l f . c u r r e n t I t e m [ 0 ] . c l a s s N a m e   +   "   u i - s o r t a b l e - p l a c e h o l d e r " )  
 	 	 	 	 	 	 . r e m o v e C l a s s ( " u i - s o r t a b l e - h e l p e r " ) [ 0 ] ;  
  
                                                 i f   ( ! c l a s s N a m e )  
                                                         e l . s t y l e . v i s i b i l i t y   =   " h i d d e n " ;  
  
                                                 r e t u r n   e l ;  
                                         } ,  
                                         u p d a t e :   f u n c t i o n ( c o n t a i n e r ,   p )   {  
  
                                                 / /   1 .   I f   a   c l a s s N a m e   i s   s e t   a s   ' p l a c e h o l d e r   o p t i o n ,   w e   d o n ' t   f o r c e   s i z e s   -   t h e   c l a s s   i s   r e s p o n s i b l e   f o r   t h a t  
                                                 / /   2 .   T h e   o p t i o n   ' f o r c e P l a c e h o l d e r S i z e   c a n   b e   e n a b l e d   t o   f o r c e   i t   e v e n   i f   a   c l a s s   n a m e   i s   s p e c i f i e d  
                                                 i f   ( c l a s s N a m e   & &   ! o . f o r c e P l a c e h o l d e r S i z e )   r e t u r n ;  
  
                                                 / / I f   t h e   e l e m e n t   d o e s n ' t   h a v e   a   a c t u a l   h e i g h t   b y   i t s e l f   ( w i t h o u t   s t y l e s   c o m i n g   f r o m   a   s t y l e s h e e t ) ,   i t   r e c e i v e s   t h e   i n l i n e   h e i g h t   f r o m   t h e   d r a g g e d   i t e m  
                                                 i f   ( ! p . h e i g h t ( ) )   {   p . h e i g h t ( s e l f . c u r r e n t I t e m . i n n e r H e i g h t ( )   -   p a r s e I n t ( s e l f . c u r r e n t I t e m . c s s ( ' p a d d i n g T o p ' )   | |   0 ,   1 0 )   -   p a r s e I n t ( s e l f . c u r r e n t I t e m . c s s ( ' p a d d i n g B o t t o m ' )   | |   0 ,   1 0 ) ) ;   } ;  
                                                 i f   ( ! p . w i d t h ( ) )   {   p . w i d t h ( s e l f . c u r r e n t I t e m . i n n e r W i d t h ( )   -   p a r s e I n t ( s e l f . c u r r e n t I t e m . c s s ( ' p a d d i n g L e f t ' )   | |   0 ,   1 0 )   -   p a r s e I n t ( s e l f . c u r r e n t I t e m . c s s ( ' p a d d i n g R i g h t ' )   | |   0 ,   1 0 ) ) ;   } ;  
                                         }  
                                 } ;  
                         }  
  
                         / / C r e a t e   t h e   p l a c e h o l d e r  
                         s e l f . p l a c e h o l d e r   =   $ ( o . p l a c e h o l d e r . e l e m e n t . c a l l ( s e l f . e l e m e n t ,   s e l f . c u r r e n t I t e m ) ) ;  
  
                         / / A p p e n d   i t   a f t e r   t h e   a c t u a l   c u r r e n t   i t e m  
                         s e l f . c u r r e n t I t e m . a f t e r ( s e l f . p l a c e h o l d e r ) ;  
  
                         / / U p d a t e   t h e   s i z e   o f   t h e   p l a c e h o l d e r   ( T O D O :   L o g i c   t o   f u z z y ,   s e e   l i n e   3 1 6 / 3 1 7 )  
                         o . p l a c e h o l d e r . u p d a t e ( s e l f ,   s e l f . p l a c e h o l d e r ) ;  
  
                 } ,  
  
                 _ c o n t a c t C o n t a i n e r s :   f u n c t i o n ( e v e n t )   {  
  
                         / /   g e t   i n n e r m o s t   c o n t a i n e r   t h a t   i n t e r s e c t s   w i t h   i t e m    
                         v a r   i n n e r m o s t C o n t a i n e r   =   n u l l ,   i n n e r m o s t I n d e x   =   n u l l ;  
  
  
                         f o r   ( v a r   i   =   t h i s . c o n t a i n e r s . l e n g t h   -   1 ;   i   > =   0 ;   i - - )   {  
  
                                 / /   n e v e r   c o n s i d e r   a   c o n t a i n e r   t h a t ' s   l o c a t e d   w i t h i n   t h e   i t e m   i t s e l f    
                                 i f   ( $ . u i . c o n t a i n s ( t h i s . c u r r e n t I t e m [ 0 ] ,   t h i s . c o n t a i n e r s [ i ] . e l e m e n t [ 0 ] ) )  
                                         c o n t i n u e ;  
  
                                 i f   ( t h i s . _ i n t e r s e c t s W i t h ( t h i s . c o n t a i n e r s [ i ] . c o n t a i n e r C a c h e ) )   {  
  
                                         / /   i f   w e ' v e   a l r e a d y   f o u n d   a   c o n t a i n e r   a n d   i t ' s   m o r e   " i n n e r "   t h a n   t h i s ,   t h e n   c o n t i n u e    
                                         i f   ( i n n e r m o s t C o n t a i n e r   & &   $ . u i . c o n t a i n s ( t h i s . c o n t a i n e r s [ i ] . e l e m e n t [ 0 ] ,   i n n e r m o s t C o n t a i n e r . e l e m e n t [ 0 ] ) )  
                                                 c o n t i n u e ;  
  
                                         i n n e r m o s t C o n t a i n e r   =   t h i s . c o n t a i n e r s [ i ] ;  
                                         i n n e r m o s t I n d e x   =   i ;  
  
                                 }   e l s e   {  
                                         / /   c o n t a i n e r   d o e s n ' t   i n t e r s e c t .   t r i g g e r   " o u t "   e v e n t   i f   n e c e s s a r y    
                                         i f   ( t h i s . c o n t a i n e r s [ i ] . c o n t a i n e r C a c h e . o v e r )   {  
                                                 t h i s . c o n t a i n e r s [ i ] . _ t r i g g e r ( " o u t " ,   e v e n t ,   t h i s . _ u i H a s h ( t h i s ) ) ;  
                                                 t h i s . c o n t a i n e r s [ i ] . c o n t a i n e r C a c h e . o v e r   =   0 ;  
                                         }  
                                 }  
  
                         }  
  
                         / /   i f   n o   i n t e r s e c t i n g   c o n t a i n e r s   f o u n d ,   r e t u r n    
                         i f   ( ! i n n e r m o s t C o n t a i n e r )   r e t u r n ;  
  
                         / /   m o v e   t h e   i t e m   i n t o   t h e   c o n t a i n e r   i f   i t ' s   n o t   t h e r e   a l r e a d y  
                         i f   ( t h i s . c o n t a i n e r s . l e n g t h   = = =   1 )   {  
                                 t h i s . c o n t a i n e r s [ i n n e r m o s t I n d e x ] . _ t r i g g e r ( " o v e r " ,   e v e n t ,   t h i s . _ u i H a s h ( t h i s ) ) ;  
                                 t h i s . c o n t a i n e r s [ i n n e r m o s t I n d e x ] . c o n t a i n e r C a c h e . o v e r   =   1 ;  
                         }   e l s e   i f   ( t h i s . c u r r e n t C o n t a i n e r   ! =   t h i s . c o n t a i n e r s [ i n n e r m o s t I n d e x ] )   {  
  
                                 / / W h e n   e n t e r i n g   a   n e w   c o n t a i n e r ,   w e   w i l l   f i n d   t h e   i t e m   w i t h   t h e   l e a s t   d i s t a n c e   a n d   a p p e n d   o u r   i t e m   n e a r   i t    
                                 v a r   d i s t   =   1 0 0 0 0 ;   v a r   i t e m W i t h L e a s t D i s t a n c e   =   n u l l ;   v a r   b a s e   =   t h i s . p o s i t i o n A b s [ t h i s . c o n t a i n e r s [ i n n e r m o s t I n d e x ] . f l o a t i n g   ?   ' l e f t '   :   ' t o p ' ] ;  
                                 f o r   ( v a r   j   =   t h i s . i t e m s . l e n g t h   -   1 ;   j   > =   0 ;   j - - )   {  
                                         i f   ( ! $ . u i . c o n t a i n s ( t h i s . c o n t a i n e r s [ i n n e r m o s t I n d e x ] . e l e m e n t [ 0 ] ,   t h i s . i t e m s [ j ] . i t e m [ 0 ] ) )   c o n t i n u e ;  
                                         v a r   c u r   =   t h i s . i t e m s [ j ] [ t h i s . c o n t a i n e r s [ i n n e r m o s t I n d e x ] . f l o a t i n g   ?   ' l e f t '   :   ' t o p ' ] ;  
                                         i f   ( M a t h . a b s ( c u r   -   b a s e )   <   d i s t )   {  
                                                 d i s t   =   M a t h . a b s ( c u r   -   b a s e ) ;   i t e m W i t h L e a s t D i s t a n c e   =   t h i s . i t e m s [ j ] ;  
                                         }  
                                 }  
  
                                 i f   ( ! i t e m W i t h L e a s t D i s t a n c e   & &   ! t h i s . o p t i o n s . d r o p O n E m p t y )   / / C h e c k   i f   d r o p O n E m p t y   i s   e n a b l e d    
                                         r e t u r n ;  
  
                                 t h i s . c u r r e n t C o n t a i n e r   =   t h i s . c o n t a i n e r s [ i n n e r m o s t I n d e x ] ;  
                                 i t e m W i t h L e a s t D i s t a n c e   ?   t h i s . _ r e a r r a n g e ( e v e n t ,   i t e m W i t h L e a s t D i s t a n c e ,   n u l l ,   t r u e )   :   t h i s . _ r e a r r a n g e ( e v e n t ,   n u l l ,   t h i s . c o n t a i n e r s [ i n n e r m o s t I n d e x ] . e l e m e n t ,   t r u e ) ;  
                                 t h i s . _ t r i g g e r ( " c h a n g e " ,   e v e n t ,   t h i s . _ u i H a s h ( ) ) ;  
                                 t h i s . c o n t a i n e r s [ i n n e r m o s t I n d e x ] . _ t r i g g e r ( " c h a n g e " ,   e v e n t ,   t h i s . _ u i H a s h ( t h i s ) ) ;  
  
                                 / / U p d a t e   t h e   p l a c e h o l d e r    
                                 t h i s . o p t i o n s . p l a c e h o l d e r . u p d a t e ( t h i s . c u r r e n t C o n t a i n e r ,   t h i s . p l a c e h o l d e r ) ;  
  
                                 t h i s . c o n t a i n e r s [ i n n e r m o s t I n d e x ] . _ t r i g g e r ( " o v e r " ,   e v e n t ,   t h i s . _ u i H a s h ( t h i s ) ) ;  
                                 t h i s . c o n t a i n e r s [ i n n e r m o s t I n d e x ] . c o n t a i n e r C a c h e . o v e r   =   1 ;  
                         }  
  
  
                 } ,  
  
                 _ c r e a t e H e l p e r :   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 ;  
                         v a r   h e l p e r   =   $ . i s F u n c t i o n ( o . h e l p e r )   ?   $ ( o . h e l p e r . a p p l y ( t h i s . e l e m e n t [ 0 ] ,   [ e v e n t ,   t h i s . c u r r e n t I t e m ] ) )   :   ( o . h e l p e r   = =   ' c l o n e '   ?   t h i s . c u r r e n t I t e m . c l o n e ( )   :   t h i s . c u r r e n t I t e m ) ;  
  
                         i f   ( ! h e l p e r . p a r e n t s ( ' b o d y ' ) . l e n g t h )   / / A d d   t h e   h e l p e r   t o   t h e   D O M   i f   t h a t   d i d n ' t   h a p p e n   a l r e a d y  
                                 $ ( o . a p p e n d T o   ! =   ' p a r e n t '   ?   o . a p p e n d T o   :   t h i s . c u r r e n t I t e m [ 0 ] . p a r e n t N o d e ) [ 0 ] . a p p e n d C h i l d ( h e l p e r [ 0 ] ) ;  
  
                         i f   ( h e l p e r [ 0 ]   = =   t h i s . c u r r e n t I t e m [ 0 ] )  
                                 t h i s . _ s t o r e d C S S   =   {   w i d t h :   t h i s . c u r r e n t I t e m [ 0 ] . s t y l e . w i d t h ,   h e i g h t :   t h i s . c u r r e n t I t e m [ 0 ] . s t y l e . h e i g h t ,   p o s i t i o n :   t h i s . c u r r e n t I t e m . c s s ( " p o s i t i o n " ) ,   t o p :   t h i s . c u r r e n t I t e m . c s s ( " t o p " ) ,   l e f t :   t h i s . c u r r e n t I t e m . c s s ( " l e f t " )   } ;  
  
                         i f   ( h e l p e r [ 0 ] . s t y l e . w i d t h   = =   ' '   | |   o . f o r c e H e l p e r S i z e )   h e l p e r . w i d t h ( t h i s . c u r r e n t I t e m . w i d t h ( ) ) ;  
                         i f   ( h e l p e r [ 0 ] . s t y l e . h e i g h t   = =   ' '   | |   o . f o r c e H e l p e r S i z e )   h e l p e r . h e i g h t ( t h i s . c u r r e n t I t e m . h e i g h t ( ) ) ;  
  
                         r e t u r n   h e l p e r ;  
  
                 } ,  
  
                 _ a d j u s t O f f s e t F r o m H e l p e r :   f u n c t i o n ( o b j )   {  
                         i f   ( t y p e o f   o b j   = =   ' s t r i n g ' )   {  
                                 o b j   =   o b j . s p l i t ( '   ' ) ;  
                         }  
                         i f   ( $ . i s A r r a y ( o b j ) )   {  
                                 o b j   =   {   l e f t :   + o b j [ 0 ] ,   t o p :   + o b j [ 1 ]   | |   0   } ;  
                         }  
                         i f   ( ' l e f t '   i n   o b j )   {  
                                 t h i s . o f f s e t . c l i c k . l e f t   =   o b j . l e f t   +   t h i s . m a r g i n s . l e f t ;  
                         }  
                         i f   ( ' r i g h t '   i n   o b j )   {  
                                 t h i s . o f f s e t . c l i c k . l e f t   =   t h i s . h e l p e r P r o p o r t i o n s . w i d t h   -   o b j . r i g h t   +   t h i s . m a r g i n s . l e f t ;  
                         }  
                         i f   ( ' t o p '   i n   o b j )   {  
                                 t h i s . o f f s e t . c l i c k . t o p   =   o b j . t o p   +   t h i s . m a r g i n s . t o p ;  
                         }  
                         i f   ( ' b o t t o m '   i n   o b j )   {  
                                 t h i s . o f f s e t . c l i c k . t o p   =   t h i s . h e l p e r P r o p o r t i o n s . h e i g h t   -   o b j . b o t t o m   +   t h i s . m a r g i n s . t o p ;  
                         }  
                 } ,  
  
                 _ g e t P a r e n t O f f s e t :   f u n c t i o n ( )   {  
  
  
                         / / G e t   t h e   o f f s e t P a r e n t   a n d   c a c h e   i t s   p o s i t i o n  
                         t h i s . o f f s e t P a r e n t   =   t h i s . h e l p e r . o f f s e t P a r e n t ( ) ;  
                         v a r   p o   =   t h i s . o f f s e t P a r e n t . o f f s e t ( ) ;  
  
                         / /   T h i s   i s   a   s p e c i a l   c a s e   w h e r e   w e   n e e d   t o   m o d i f y   a   o f f s e t   c a l c u l a t e d   o n   s t a r t ,   s i n c e   t h e   f o l l o w i n g   h a p p e n e d :  
                         / /   1 .   T h e   p o s i t i o n   o f   t h e   h e l p e r   i s   a b s o l u t e ,   s o   i t ' s   p o s i t i o n   i s   c a l c u l a t e d   b a s e d   o n   t h e   n e x t   p o s i t i o n e d   p a r e n t  
                         / /   2 .   T h e   a c t u a l   o f f s e t   p a r e n t   i s   a   c h i l d   o f   t h e   s c r o l l   p a r e n t ,   a n d   t h e   s c r o l l   p a r e n t   i s n ' t   t h e   d o c u m e n t ,   w h i c h   m e a n s   t h a t  
                         / /         t h e   s c r o l l   i s   i n c l u d e d   i n   t h e   i n i t i a l   c a l c u l a t i o n   o f   t h e   o f f s e t   o f   t h e   p a r e n t ,   a n d   n e v e r   r e c a l c u l a t e d   u p o n   d r a g  
                         i f   ( t h i s . c s s P o s i t i o n   = =   ' a b s o l u t e '   & &   t h i s . s c r o l l P a r e n t [ 0 ]   ! =   d o c u m e n t   & &   $ . u i . c o n t a i n s ( t h i s . s c r o l l P a r e n t [ 0 ] ,   t h i s . o f f s e t P a r e n t [ 0 ] ) )   {  
                                 p o . l e f t   + =   t h i s . s c r o l l P a r e n t . s c r o l l L e f t ( ) ;  
                                 p o . t o p   + =   t h i s . s c r o l l P a r e n t . s c r o l l T o p ( ) ;  
                         }  
  
                         i f   ( ( t h i s . o f f s e t P a r e n t [ 0 ]   = =   d o c u m e n t . b o d y )   / / T h i s   n e e d s   t o   b e   a c t u a l l y   d o n e   f o r   a l l   b r o w s e r s ,   s i n c e   p a g e X / p a g e Y   i n c l u d e s   t h i s   i n f o r m a t i o n  
 	 	 | |   ( t h i s . o f f s e t P a r e n t [ 0 ] . t a g N a m e   & &   t h i s . o f f s e t P a r e n t [ 0 ] . t a g N a m e . t o L o w e r C a s e ( )   = =   ' h t m l '   & &   $ . b r o w s e r . m s i e ) )   / / U g l y   I E   f i x  
                                 p o   =   {   t o p :   0 ,   l e f t :   0   } ;  
  
                         r e t u r n   {  
                                 t o p :   p o . t o p   +   ( p a r s e I n t ( t h i s . o f f s e t P a r e n t . c s s ( " b o r d e r T o p W i d t h " ) ,   1 0 )   | |   0 ) ,  
                                 l e f t :   p o . l e f t   +   ( p a r s e I n t ( t h i s . o f f s e t P a r e n t . c s s ( " b o r d e r L e f t W i d t h " ) ,   1 0 )   | |   0 )  
                         } ;  
  
                 } ,  
  
                 _ g e t R e l a t i v e O f f s e t :   f u n c t i o n ( )   {  
  
                         i f   ( t h i s . c s s P o s i t i o n   = =   " r e l a t i v e " )   {  
                                 v a r   p   =   t h i s . c u r r e n t I t e m . p o s i t i o n ( ) ;  
                                 r e t u r n   {  
                                         t o p :   p . t o p   -   ( p a r s e I n t ( t h i s . h e l p e r . c s s ( " t o p " ) ,   1 0 )   | |   0 )   +   t h i s . s c r o l l P a r e n t . s c r o l l T o p ( ) ,  
                                         l e f t :   p . l e f t   -   ( p a r s e I n t ( t h i s . h e l p e r . c s s ( " l e f t " ) ,   1 0 )   | |   0 )   +   t h i s . s c r o l l P a r e n t . s c r o l l L e f t ( )  
                                 } ;  
                         }   e l s e   {  
                                 r e t u r n   {   t o p :   0 ,   l e f t :   0   } ;  
                         }  
  
                 } ,  
  
                 _ c a c h e M a r g i n s :   f u n c t i o n ( )   {  
                         t h i s . m a r g i n s   =   {  
                                 l e f t :   ( p a r s e I n t ( t h i s . c u r r e n t I t e m . c s s ( " m a r g i n L e f t " ) ,   1 0 )   | |   0 ) ,  
                                 t o p :   ( p a r s e I n t ( t h i s . c u r r e n t I t e m . c s s ( " m a r g i n T o p " ) ,   1 0 )   | |   0 )  
                         } ;  
                 } ,  
  
                 _ c a c h e H e l p e r P r o p o r t i o n s :   f u n c t i o n ( )   {  
                         t h i s . h e l p e r P r o p o r t i o n s   =   {  
                                 w i d t h :   t h i s . h e l p e r . o u t e r W i d t h ( ) ,  
                                 h e i g h t :   t h i s . h e l p e r . o u t e r H e i g h t ( )  
                         } ;  
                 } ,  
  
                 _ s e t C o n t a i n m e n t :   f u n c t i o n ( )   {  
  
                         v a r   o   =   t h i s . o p t i o n s ;  
                         i f   ( o . c o n t a i n m e n t   = =   ' p a r e n t ' )   o . c o n t a i n m e n t   =   t h i s . h e l p e r [ 0 ] . p a r e n t N o d e ;  
                         i f   ( o . c o n t a i n m e n t   = =   ' d o c u m e n t '   | |   o . c o n t a i n m e n t   = =   ' w i n d o w ' )   t h i s . c o n t a i n m e n t   =   [  
 	 	 	 0   -   t h i s . o f f s e t . r e l a t i v e . l e f t   -   t h i s . o f f s e t . p a r e n t . l e f t ,  
 	 	 	 0   -   t h i s . o f f s e t . r e l a t i v e . t o p   -   t h i s . o f f s e t . p a r e n t . t o p ,  
 	 	 	 $ ( o . c o n t a i n m e n t   = =   ' d o c u m e n t '   ?   d o c u m e n t   :   w i n d o w ) . w i d t h ( )   -   t h i s . h e l p e r P r o p o r t i o n s . w i d t h   -   t h i s . m a r g i n s . l e f t ,  
 	 	 	 ( $ ( o . c o n t a i n m e n t   = =   ' d o c u m e n t '   ?   d o c u m e n t   :   w i n d o w ) . h e i g h t ( )   | |   d o c u m e n t . b o d y . p a r e n t N o d e . s c r o l l H e i g h t )   -   t h i s . h e l p e r P r o p o r t i o n s . h e i g h t   -   t h i s . m a r g i n s . t o p  
 	 	 ] ;  
  
                         i f   ( ! ( / ^ ( d o c u m e n t | w i n d o w | p a r e n t ) $ / ) . t e s t ( o . c o n t a i n m e n t ) )   {  
                                 v a r   c e   =   $ ( o . c o n t a i n m e n t ) [ 0 ] ;  
                                 v a r   c o   =   $ ( o . c o n t a i n m e n t ) . o f f s e t ( ) ;  
                                 v a r   o v e r   =   ( $ ( c e ) . c s s ( " o v e r f l o w " )   ! =   ' h i d d e n ' ) ;  
  
                                 t h i s . c o n t a i n m e n t   =   [  
 	 	 	 	 c o . l e f t   +   ( p a r s e I n t ( $ ( c e ) . 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 ( $ ( c e ) . c s s ( " p a d d i n g L e f t " ) ,   1 0 )   | |   0 )   -   t h i s . m a r g i n s . l e f t ,  
 	 	 	 	 c o . t o p   +   ( p a r s e I n t ( $ ( c e ) . c s s ( " b o r d e r T o p W i d t h " ) ,   1 0 )   | |   0 )   +   ( p a r s e I n t ( $ ( c e ) . c s s ( " p a d d i n g T o p " ) ,   1 0 )   | |   0 )   -   t h i s . m a r g i n s . t o p ,  
 	 	 	 	 c o . l e f t   +   ( o v e r   ?   M a t h . m a x ( c e . s c r o l l W i d t h ,   c e . o f f s e t W i d t h )   :   c e . o f f s e t W i d t h )   -   ( p a r s e I n t ( $ ( c e ) . 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 ( $ ( c e ) . c s s ( " p a d d i n g R i g h t " ) ,   1 0 )   | |   0 )   -   t h i s . h e l p e r P r o p o r t i o n s . w i d t h   -   t h i s . m a r g i n s . l e f t ,  
 	 	 	 	 c o . t o p   +   ( o v e r   ?   M a t h . m a x ( c e . s c r o l l H e i g h t ,   c e . o f f s e t H e i g h t )   :   c e . o f f s e t H e i g h t )   -   ( p a r s e I n t ( $ ( c e ) . c s s ( " b o r d e r T o p W i d t h " ) ,   1 0 )   | |   0 )   -   ( p a r s e I n t ( $ ( c e ) . c s s ( " p a d d i n g B o t t o m " ) ,   1 0 )   | |   0 )   -   t h i s . h e l p e r P r o p o r t i o n s . h e i g h t   -   t h i s . m a r g i n s . t o p  
 	 	 	 ] ;  
                         }  
  
                 } ,  
  
                 _ c o n v e r t P o s i t i o n T o :   f u n c t i o n ( d ,   p o s )   {  
  
                         i f   ( ! p o s )   p o s   =   t h i s . p o s i t i o n ;  
                         v a r   m o d   =   d   = =   " a b s o l u t e "   ?   1   :   - 1 ;  
                         v a r   o   =   t h i s . o p t i o n s ,   s c r o l l   =   t h i s . c s s P o s i t i o n   = =   ' a b s o l u t e '   & &   ! ( t h i s . s c r o l l P a r e n t [ 0 ]   ! =   d o c u m e n t   & &   $ . u i . c o n t a i n s ( t h i s . s c r o l l P a r e n t [ 0 ] ,   t h i s . o f f s e t P a r e n t [ 0 ] ) )   ?   t h i s . o f f s e t P a r e n t   :   t h i s . s c r o l l P a r e n t ,   s c r o l l I s R o o t N o d e   =   ( / ( h t m l | b o d y ) / i ) . t e s t ( s c r o l l [ 0 ] . t a g N a m e ) ;  
  
                         r e t u r n   {  
                                 t o p :   (  
 	 	 	 	 p o s . t o p 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   a b s o l u t e   m o u s e   p o s i t i o n  
 	 	 	 	 +   t h i s . o f f s e t . r e l a t i v e . t o p   *   m o d 	 	 	 	 	 	 	 	 	 	 / /   O n l y   f o r   r e l a t i v e   p o s i t i o n e d   n o d e s :   R e l a t i v e   o f f s e t   f r o m   e l e m e n t   t o   o f f s e t   p a r e n t  
 	 	 	 	 +   t h i s . o f f s e t . p a r e n t . t o p   *   m o d 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   o f f s e t P a r e n t ' s   o f f s e t   w i t h o u t   b o r d e r s   ( o f f s e t   +   b o r d e r )  
 	 	 	 	 -   ( $ . b r o w s e r . s a f a r i   & &   t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   0   :   ( t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   - t h i s . s c r o l l P a r e n t . s c r o l l T o p ( )   :   ( s c r o l l I s R o o t N o d e   ?   0   :   s c r o l l . s c r o l l T o p ( ) ) )   *   m o d )  
 	 	 	 ) ,  
                                 l e f t :   (  
 	 	 	 	 p o s . l e f t 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   a b s o l u t e   m o u s e   p o s i t i o n  
 	 	 	 	 +   t h i s . o f f s e t . r e l a t i v e . l e f t   *   m o d 	 	 	 	 	 	 	 	 	 	 / /   O n l y   f o r   r e l a t i v e   p o s i t i o n e d   n o d e s :   R e l a t i v e   o f f s e t   f r o m   e l e m e n t   t o   o f f s e t   p a r e n t  
 	 	 	 	 +   t h i s . o f f s e t . p a r e n t . l e f t   *   m o d 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   o f f s e t P a r e n t ' s   o f f s e t   w i t h o u t   b o r d e r s   ( o f f s e t   +   b o r d e r )  
 	 	 	 	 -   ( $ . b r o w s e r . s a f a r i   & &   t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   0   :   ( t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   - t h i s . s c r o l l P a r e n t . s c r o l l L e f t ( )   :   s c r o l l I s R o o t N o d e   ?   0   :   s c r o l l . s c r o l l L e f t ( ) )   *   m o d )  
 	 	 	 )  
                         } ;  
  
                 } ,  
  
                 _ g e n e r a t e P o s i t i o 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 ,   s c r o l l   =   t h i s . c s s P o s i t i o n   = =   ' a b s o l u t e '   & &   ! ( t h i s . s c r o l l P a r e n t [ 0 ]   ! =   d o c u m e n t   & &   $ . u i . c o n t a i n s ( t h i s . s c r o l l P a r e n t [ 0 ] ,   t h i s . o f f s e t P a r e n t [ 0 ] ) )   ?   t h i s . o f f s e t P a r e n t   :   t h i s . s c r o l l P a r e n t ,   s c r o l l I s R o o t N o d e   =   ( / ( h t m l | b o d y ) / i ) . t e s t ( s c r o l l [ 0 ] . t a g N a m e ) ;  
  
                         / /   T h i s   i s   a n o t h e r   v e r y   w e i r d   s p e c i a l   c a s e   t h a t   o n l y   h a p p e n s   f o r   r e l a t i v e   e l e m e n t s :  
                         / /   1 .   I f   t h e   c s s   p o s i t i o n   i s   r e l a t i v e  
                         / /   2 .   a n d   t h e   s c r o l l   p a r e n t   i s   t h e   d o c u m e n t   o r   s i m i l a r   t o   t h e   o f f s e t   p a r e n t  
                         / /   w e   h a v e   t o   r e f r e s h   t h e   r e l a t i v e   o f f s e t   d u r i n g   t h e   s c r o l l   s o   t h e r e   a r e   n o   j u m p s  
                         i f   ( t h i s . c s s P o s i t i o n   = =   ' r e l a t i v e '   & &   ! ( t h i s . s c r o l l P a r e n t [ 0 ]   ! =   d o c u m e n t   & &   t h i s . s c r o l l P a r e n t [ 0 ]   ! =   t h i s . o f f s e t P a r e n t [ 0 ] ) )   {  
                                 t h i s . o f f s e t . r e l a t i v e   =   t h i s . _ g e t R e l a t i v e O f f s e t ( ) ;  
                         }  
  
                         v a r   p a g e X   =   e v e n t . p a g e X ;  
                         v a r   p a g e Y   =   e v e n t . p a g e Y ;  
  
                         / *  
                         *   -   P o s i t i o n   c o n s t r a i n i n g   -  
                         *   C o n s t r a i n   t h e   p o s i t i o n   t o   a   m i x   o f   g r i d ,   c o n t a i n m e n t .  
                         * /  
  
                         i f   ( t h i s . o r i g i n a l P o s i t i o n )   {   / / I f   w e   a r e   n o t   d r a g g i n g   y e t ,   w e   w o n ' t   c h e c k   f o r   o p t i o n s  
  
                                 i f   ( t h i s . c o n t a i n m e n t )   {  
                                         i f   ( e v e n t . p a g e X   -   t h i s . o f f s e t . c l i c k . l e f t   <   t h i s . c o n t a i n m e n t [ 0 ] )   p a g e X   =   t h i s . c o n t a i n m e n t [ 0 ]   +   t h i s . o f f s e t . c l i c k . l e f t ;  
                                         i f   ( e v e n t . p a g e Y   -   t h i s . o f f s e t . c l i c k . t o p   <   t h i s . c o n t a i n m e n t [ 1 ] )   p a g e Y   =   t h i s . c o n t a i n m e n t [ 1 ]   +   t h i s . o f f s e t . c l i c k . t o p ;  
                                         i f   ( e v e n t . p a g e X   -   t h i s . o f f s e t . c l i c k . l e f t   >   t h i s . c o n t a i n m e n t [ 2 ] )   p a g e X   =   t h i s . c o n t a i n m e n t [ 2 ]   +   t h i s . o f f s e t . c l i c k . l e f t ;  
                                         i f   ( e v e n t . p a g e Y   -   t h i s . o f f s e t . c l i c k . t o p   >   t h i s . c o n t a i n m e n t [ 3 ] )   p a g e Y   =   t h i s . c o n t a i n m e n t [ 3 ]   +   t h i s . o f f s e t . c l i c k . t o p ;  
                                 }  
  
                                 i f   ( o . g r i d )   {  
                                         v a r   t o p   =   t h i s . o r i g i n a l P a g e Y   +   M a t h . r o u n d ( ( p a g e Y   -   t h i s . o r i g i n a l P a g e Y )   /   o . g r i d [ 1 ] )   *   o . g r i d [ 1 ] ;  
                                         p a g e Y   =   t h i s . c o n t a i n m e n t   ?   ( ! ( t o p   -   t h i s . o f f s e t . c l i c k . t o p   <   t h i s . c o n t a i n m e n t [ 1 ]   | |   t o p   -   t h i s . o f f s e t . c l i c k . t o p   >   t h i s . c o n t a i n m e n t [ 3 ] )   ?   t o p   :   ( ! ( t o p   -   t h i s . o f f s e t . c l i c k . t o p   <   t h i s . c o n t a i n m e n t [ 1 ] )   ?   t o p   -   o . g r i d [ 1 ]   :   t o p   +   o . g r i d [ 1 ] ) )   :   t o p ;  
  
                                         v a r   l e f t   =   t h i s . o r i g i n a l P a g e X   +   M a t h . r o u n d ( ( p a g e X   -   t h i s . o r i g i n a l P a g e X )   /   o . g r i d [ 0 ] )   *   o . g r i d [ 0 ] ;  
                                         p a g e X   =   t h i s . c o n t a i n m e n t   ?   ( ! ( l e f t   -   t h i s . o f f s e t . c l i c k . l e f t   <   t h i s . c o n t a i n m e n t [ 0 ]   | |   l e f t   -   t h i s . o f f s e t . c l i c k . l e f t   >   t h i s . c o n t a i n m e n t [ 2 ] )   ?   l e f t   :   ( ! ( l e f t   -   t h i s . o f f s e t . c l i c k . l e f t   <   t h i s . c o n t a i n m e n t [ 0 ] )   ?   l e f t   -   o . g r i d [ 0 ]   :   l e f t   +   o . g r i d [ 0 ] ) )   :   l e f t ;  
                                 }  
  
                         }  
  
                         r e t u r n   {  
                                 t o p :   (  
 	 	 	 	 p a g e Y 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   a b s o l u t e   m o u s e   p o s i t i o n  
 	 	 	 	 -   t h i s . o f f s e t . c l i c k . t o p 	 	 	 	 	 	 	 	 	 	 	 	 	 / /   C l i c k   o f f s e t   ( r e l a t i v e   t o   t h e   e l e m e n t )  
 	 	 	 	 -   t h i s . o f f s e t . r e l a t i v e . t o p 	 	 	 	 	 	 	 	 	 	 	 	 / /   O n l y   f o r   r e l a t i v e   p o s i t i o n e d   n o d e s :   R e l a t i v e   o f f s e t   f r o m   e l e m e n t   t o   o f f s e t   p a r e n t  
 	 	 	 	 -   t h i s . o f f s e t . p a r e n t . t o p 	 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   o f f s e t P a r e n t ' s   o f f s e t   w i t h o u t   b o r d e r s   ( o f f s e t   +   b o r d e r )  
 	 	 	 	 +   ( $ . b r o w s e r . s a f a r i   & &   t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   0   :   ( t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   - t h i s . s c r o l l P a r e n t . s c r o l l T o p ( )   :   ( s c r o l l I s R o o t N o d e   ?   0   :   s c r o l l . s c r o l l T o p ( ) ) ) )  
 	 	 	 ) ,  
                                 l e f t :   (  
 	 	 	 	 p a g e X 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   a b s o l u t e   m o u s e   p o s i t i o n  
 	 	 	 	 -   t h i s . o f f s e t . c l i c k . l e f t 	 	 	 	 	 	 	 	 	 	 	 	 / /   C l i c k   o f f s e t   ( r e l a t i v e   t o   t h e   e l e m e n t )  
 	 	 	 	 -   t h i s . o f f s e t . r e l a t i v e . l e f t 	 	 	 	 	 	 	 	 	 	 	 	 / /   O n l y   f o r   r e l a t i v e   p o s i t i o n e d   n o d e s :   R e l a t i v e   o f f s e t   f r o m   e l e m e n t   t o   o f f s e t   p a r e n t  
 	 	 	 	 -   t h i s . o f f s e t . p a r e n t . l e f t 	 	 	 	 	 	 	 	 	 	 	 	 / /   T h e   o f f s e t P a r e n t ' s   o f f s e t   w i t h o u t   b o r d e r s   ( o f f s e t   +   b o r d e r )  
 	 	 	 	 +   ( $ . b r o w s e r . s a f a r i   & &   t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   0   :   ( t h i s . c s s P o s i t i o n   = =   ' f i x e d '   ?   - t h i s . s c r o l l P a r e n t . s c r o l l L e f t ( )   :   s c r o l l I s R o o t N o d e   ?   0   :   s c r o l l . s c r o l l L e f t ( ) ) )  
 	 	 	 )  
                         } ;  
  
                 } ,  
  
                 _ r e a r r a n g e :   f u n c t i o n ( e v e n t ,   i ,   a ,   h a r d R e f r e s h )   {  
  
                         a   ?   a [ 0 ] . a p p e n d C h i l d ( t h i s . p l a c e h o l d e r [ 0 ] )   :   i . i t e m [ 0 ] . p a r e n t N o d e . i n s e r t B e f o r e ( t h i s . p l a c e h o l d e r [ 0 ] ,   ( t h i s . d i r e c t i o n   = =   ' d o w n '   ?   i . i t e m [ 0 ]   :   i . i t e m [ 0 ] . n e x t S i b l i n g ) ) ;  
  
                         / / V a r i o u s   t h i n g s   d o n e   h e r e   t o   i m p r o v e   t h e   p e r f o r m a n c e :  
                         / /   1 .   w e   c r e a t e   a   s e t T i m e o u t ,   t h a t   c a l l s   r e f r e s h P o s i t i o n s  
                         / /   2 .   o n   t h e   i n s t a n c e ,   w e   h a v e   a   c o u n t e r   v a r i a b l e ,   t h a t   g e t ' s   h i g h e r   a f t e r   e v e r y   a p p e n d  
                         / /   3 .   o n   t h e   l o c a l   s c o p e ,   w e   c o p y   t h e   c o u n t e r   v a r i a b l e ,   a n d   c h e c k   i n   t h e   t i m e o u t ,   i f   i t ' s   s t i l l   t h e   s a m e  
                         / /   4 .   t h i s   l e t s   o n l y   t h e   l a s t   a d d i t i o n   t o   t h e   t i m e o u t   s t a c k   t h r o u g h  
                         t h i s . c o u n t e r   =   t h i s . c o u n t e r   ?   + + t h i s . c o u n t e r   :   1 ;  
                         v a r   s e l f   =   t h i s ,   c o u n t e r   =   t h i s . c o u n t e r ;  
  
                         w i n d o w . s e t T i m e o u t ( f u n c t i o n ( )   {  
                                 i f   ( c o u n t e r   = =   s e l f . c o u n t e r )   s e l f . r e f r e s h P o s i t i o n s ( ! h a r d R e f r e s h ) ;   / / P r e c o m p u t e   a f t e r   e a c h   D O M   i n s e r t i o n ,   N O T   o n   m o u s e m o v e  
                         } ,   0 ) ;  
  
                 } ,  
  
                 _ c l e a r :   f u n c t i o n ( e v e n t ,   n o P r o p a g a t i o n )   {  
  
                         t h i s . r e v e r t i n g   =   f a l s e ;  
                         / /   W e   d e l a y   a l l   e v e n t s   t h a t   h a v e   t o   b e   t r i g g e r e d   t o   a f t e r   t h e   p o i n t   w h e r e   t h e   p l a c e h o l d e r   h a s   b e e n   r e m o v e d   a n d  
                         / /   e v e r y t h i n g   e l s e   n o r m a l i z e d   a g a i n  
                         v a r   d e l a y e d T r i g g e r s   =   [ ] ,   s e l f   =   t h i s ;  
  
                         / /   W e   f i r s t   h a v e   t o   u p d a t e   t h e   d o m   p o s i t i o n   o f   t h e   a c t u a l   c u r r e n t I t e m  
                         / /   N o t e :   d o n ' t   d o   i t   i f   t h e   c u r r e n t   i t e m   i s   a l r e a d y   r e m o v e d   ( b y   a   u s e r ) ,   o r   i t   g e t s   r e a p p e n d e d   ( s e e   # 4 0 8 8 )  
                         i f   ( ! t h i s . _ n o F i n a l S o r t   & &   t h i s . c u r r e n t I t e m [ 0 ] . p a r e n t N o d e )   t h i s . p l a c e h o l d e r . b e f o r e ( t h i s . c u r r e n t I t e m ) ;  
                         t h i s . _ n o F i n a l S o r t   =   n u l l ;  
  
                         i f   ( t h i s . h e l p e r [ 0 ]   = =   t h i s . c u r r e n t I t e m [ 0 ] )   {  
                                 f o r   ( v a r   i   i n   t h i s . _ s t o r e d C S S )   {  
                                         i f   ( t h i s . _ s t o r e d C S S [ i ]   = =   ' a u t o '   | |   t h i s . _ s t o r e d C S S [ i ]   = =   ' s t a t i c ' )   t h i s . _ s t o r e d C S S [ i ]   =   ' ' ;  
                                 }  
                                 t h i s . c u r r e n t I t e m . c s s ( t h i s . _ s t o r e d C S S ) . r e m o v e C l a s s ( " u i - s o r t a b l e - h e l p e r " ) ;  
                         }   e l s e   {  
                                 t h i s . c u r r e n t I t e m . s h o w ( ) ;  
                         }  
  
                         i f   ( t h i s . f r o m O u t s i d e   & &   ! n o P r o p a g a t i o n )   d e l a y e d T r i g g e r s . p u s h ( f u n c t i o n ( e v e n t )   {   t h i s . _ t r i g g e r ( " r e c e i v e " ,   e v e n t ,   t h i s . _ u i H a s h ( t h i s . f r o m O u t s i d e ) ) ;   } ) ;  
                         i f   ( ( t h i s . f r o m O u t s i d e   | |   t h i s . d o m P o s i t i o n . p r e v   ! =   t h i s . c u r r e n t I t e m . p r e v ( ) . n o t ( " . u i - s o r t a b l e - h e l p e r " ) [ 0 ]   | |   t h i s . d o m P o s i t i o n . p a r e n t   ! =   t h i s . c u r r e n t I t e m . p a r e n t ( ) [ 0 ] )   & &   ! n o P r o p a g a t i o n )   d e l a y e d T r i g g e r s . p u s h ( f u n c t i o n ( e v e n t )   {   t h i s . _ t r i g g e r ( " u p d a t e " ,   e v e n t ,   t h i s . _ u i H a s h ( ) ) ;   } ) ;   / / T r i g g e r   u p d a t e   c a l l b a c k   i f   t h e   D O M   p o s i t i o n   h a s   c h a n g e d  
                         i f   ( ! $ . u i . c o n t a i n s ( t h i s . e l e m e n t [ 0 ] ,   t h i s . c u r r e n t I t e m [ 0 ] ) )   {   / / N o d e   w a s   m o v e d   o u t   o f   t h e   c u r r e n t   e l e m e n t  
                                 i f   ( ! n o P r o p a g a t i o n )   d e l a y e d T r i g g e r s . p u s h ( f u n c t i o n ( e v e n t )   {   t h i s . _ t r i g g e r ( " r e m o v e " ,   e v e n t ,   t h i s . _ u i H a s h ( ) ) ;   } ) ;  
                                 f o r   ( v a r   i   =   t h i s . c o n t a i n e r s . l e n g t h   -   1 ;   i   > =   0 ;   i - - )   {  
                                         i f   ( $ . u i . c o n t a i n s ( t h i s . c o n t a i n e r s [ i ] . e l e m e n t [ 0 ] ,   t h i s . c u r r e n t I t e m [ 0 ] )   & &   ! n o P r o p a g a t i o n )   {  
                                                 d e l a y e d T r i g g e r s . p u s h ( ( f u n c t i o n ( c )   {   r e t u r n   f u n c t i o n ( e v e n t )   {   c . _ t r i g g e r ( " r e c e i v e " ,   e v e n t ,   t h i s . _ u i H a s h ( t h i s ) ) ;   } ;   } ) . c a l l ( t h i s ,   t h i s . c o n t a i n e r s [ i ] ) ) ;  
                                                 d e l a y e d T r i g g e r s . p u s h ( ( f u n c t i o n ( c )   {   r e t u r n   f u n c t i o n ( e v e n t )   {   c . _ t r i g g e r ( " u p d a t e " ,   e v e n t ,   t h i s . _ u i H a s h ( t h i s ) ) ;   } ;   } ) . c a l l ( t h i s ,   t h i s . c o n t a i n e r s [ i ] ) ) ;  
                                         }  
                                 } ;  
                         } ;  
  
                         / / P o s t   e v e n t s   t o   c o n t a i n e r s  
                         f o r   ( v a r   i   =   t h i s . c o n t a i n e r s . l e n g t h   -   1 ;   i   > =   0 ;   i - - )   {  
                                 i f   ( ! n o P r o p a g a t i o n )   d e l a y e d T r i g g e r s . p u s h ( ( f u n c t i o n ( c )   {   r e t u r n   f u n c t i o n ( e v e n t )   {   c . _ t r i g g e r ( " d e a c t i v a t e " ,   e v e n t ,   t h i s . _ u i H a s h ( t h i s ) ) ;   } ;   } ) . c a l l ( t h i s ,   t h i s . c o n t a i n e r s [ i ] ) ) ;  
                                 i f   ( t h i s . c o n t a i n e r s [ i ] . c o n t a i n e r C a c h e . o v e r )   {  
                                         d e l a y e d T r i g g e r s . p u s h ( ( f u n c t i o n ( c )   {   r e t u r n   f u n c t i o n ( e v e n t )   {   c . _ t r i g g e r ( " o u t " ,   e v e n t ,   t h i s . _ u i H a s h ( t h i s ) ) ;   } ;   } ) . c a l l ( t h i s ,   t h i s . c o n t a i n e r s [ i ] ) ) ;  
                                         t h i s . c o n t a i n e r s [ i ] . c o n t a i n e r C a c h e . o v e r   =   0 ;  
                                 }  
                         }  
  
                         / / D o   w h a t   w a s   o r i g i n a l l y   i n   p l u g i n s  
                         i f   ( t h i s . _ s t o r e d C u r s o r )   $ ( ' b o d y ' ) . c s s ( " c u r s o r " ,   t h i s . _ s t o r e d C u r s o r ) ;   / / R e s e t   c u r s o r  
                         i f   ( t h i s . _ s t o r e d O p a c i t y )   t h i s . h e l p e r . c s s ( " o p a c i t y " ,   t h i s . _ s t o r e d O p a c i t y ) ;   / / R e s e t   o p a c i t y  
                         i f   ( t h i s . _ s t o r e d Z I n d e x )   t h i s . h e l p e r . c s s ( " z I n d e x " ,   t h i s . _ s t o r e d Z I n d e x   = =   ' a u t o '   ?   ' '   :   t h i s . _ s t o r e d Z I n d e x ) ;   / / R e s e t   z - i n d e x  
  
                         t h i s . d r a g g i n g   =   f a l s e ;  
                         i f   ( t h i s . c a n c e l H e l p e r R e m o v a l )   {  
                                 i f   ( ! n o P r o p a g a t i o n )   {  
                                         t h i s . _ t r i g g e r ( " b e f o r e S t o p " ,   e v e n t ,   t h i s . _ u i H a s h ( ) ) ;  
                                         f o r   ( v a r   i   =   0 ;   i   <   d e l a y e d T r i g g e r s . l e n g t h ;   i + + )   {   d e l a y e d T r i g g e r s [ i ] . c a l l ( t h i s ,   e v e n t ) ;   } ;   / / T r i g g e r   a l l   d e l a y e d   e v e n t s  
                                         t h i s . _ t r i g g e r ( " s t o p " ,   e v e n t ,   t h i s . _ u i H a s h ( ) ) ;  
                                 }  
                                 r e t u r n   f a l s e ;  
                         }  
  
                         i f   ( ! n o P r o p a g a t i o n )   t h i s . _ t r i g g e r ( " b e f o r e S t o p " ,   e v e n t ,   t h i s . _ u i H a s h ( ) ) ;  
  
                         / / $ ( t h i s . p l a c e h o l d e r [ 0 ] ) . r e m o v e ( ) ;   w o u l d   h a v e   b e e n   t h e   j Q u e r y   w a y   -   u n f o r t u n a t e l y ,   i t   u n b i n d s   A L L   e v e n t s   f r o m   t h e   o r i g i n a l   n o d e !  
                         t h i s . p l a c e h o l d e r [ 0 ] . p a r e n t N o d e . r e m o v e C h i l d ( t h i s . p l a c e h o l d e r [ 0 ] ) ;  
  
                         i f   ( t h i s . h e l p e r [ 0 ]   ! =   t h i s . c u r r e n t I t e m [ 0 ] )   t h i s . h e l p e r . r e m o v e ( ) ;   t h i s . h e l p e r   =   n u l l ;  
  
                         i f   ( ! n o P r o p a g a t i o n )   {  
                                 f o r   ( v a r   i   =   0 ;   i   <   d e l a y e d T r i g g e r s . l e n g t h ;   i + + )   {   d e l a y e d T r i g g e r s [ i ] . c a l l ( t h i s ,   e v e n t ) ;   } ;   / / T r i g g e r   a l l   d e l a y e d   e v e n t s  
                                 t h i s . _ t r i g g e r ( " s t o p " ,   e v e n t ,   t h i s . _ u i H a s h ( ) ) ;  
                         }  
  
                         t h i s . f r o m O u t s i d e   =   f a l s e ;  
                         r e t u r n   t r u e ;  
  
                 } ,  
  
                 _ t r i g g e r :   f u n c t i o n ( )   {  
                         i f   ( $ . W i d g e t . p r o t o t y p e . _ t r i g g e r . a p p l y ( t h i s ,   a r g u m e n t s )   = = =   f a l s e )   {  
                                 t h i s . c a n c e l ( ) ;  
                         }  
                 } ,  
  
                 _ u i H a s h :   f u n c t i o n ( i n s t )   {  
                         v a r   s e l f   =   i n s t   | |   t h i s ;  
                         r e t u r n   {  
                                 h e l p e r :   s e l f . h e l p e r ,  
                                 p l a c e h o l d e r :   s e l f . p l a c e h o l d e r   | |   $ ( [ ] ) ,  
                                 p o s i t i o n :   s e l f . p o s i t i o n ,  
                                 o r i g i n a l P o s i t i o n :   s e l f . o r i g i n a l P o s i t i o n ,  
                                 o f f s e t :   s e l f . p o s i t i o n A b s ,  
                                 i t e m :   s e l f . c u r r e n t I t e m ,  
                                 s e n d e r :   i n s t   ?   i n s t . e l e m e n t   :   n u l l  
                         } ;  
                 }  
  
         } ) ;  
  
         $ . e x t e n d ( $ . u i . s o r t a b l e ,   {  
                 v e r s i o n :   " 1 . 8 . 1 0 "  
         } ) ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   E f f e c t s   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / E f f e c t s /  
 * /  
 ;   j Q u e r y . e f f e c t s   | |   ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . e f f e c t s   =   { } ;  
  
  
  
         / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
         / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *   C O L O R   A N I M A T I O N S   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
         / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
  
         / /   o v e r r i d e   t h e   a n i m a t i o n   f o r   c o l o r   s t y l e s  
         $ . e a c h ( [ ' b a c k g r o u n d C o l o r ' ,   ' b o r d e r B o t t o m C o l o r ' ,   ' b o r d e r L e f t C o l o r ' ,  
 	 ' b o r d e r R i g h t C o l o r ' ,   ' b o r d e r T o p C o l o r ' ,   ' b o r d e r C o l o r ' ,   ' c o l o r ' ,   ' o u t l i n e C o l o r ' ] ,  
 f u n c t i o n ( i ,   a t t r )   {  
         $ . f x . s t e p [ a t t r ]   =   f u n c t i o n ( f x )   {  
                 i f   ( ! f x . c o l o r I n i t )   {  
                         f x . s t a r t   =   g e t C o l o r ( f x . e l e m ,   a t t r ) ;  
                         f x . e n d   =   g e t R G B ( f x . e n d ) ;  
                         f x . c o l o r I n i t   =   t r u e ;  
                 }  
  
                 f x . e l e m . s t y l e [ a t t r ]   =   ' r g b ( '   +  
 	 	 	 M a t h . m a x ( M a t h . m i n ( p a r s e I n t ( ( f x . p o s   *   ( f x . e n d [ 0 ]   -   f x . s t a r t [ 0 ] ) )   +   f x . s t a r t [ 0 ] ,   1 0 ) ,   2 5 5 ) ,   0 )   +   ' , '   +  
 	 	 	 M a t h . m a x ( M a t h . m i n ( p a r s e I n t ( ( f x . p o s   *   ( f x . e n d [ 1 ]   -   f x . s t a r t [ 1 ] ) )   +   f x . s t a r t [ 1 ] ,   1 0 ) ,   2 5 5 ) ,   0 )   +   ' , '   +  
 	 	 	 M a t h . m a x ( M a t h . m i n ( p a r s e I n t ( ( f x . p o s   *   ( f x . e n d [ 2 ]   -   f x . s t a r t [ 2 ] ) )   +   f x . s t a r t [ 2 ] ,   1 0 ) ,   2 5 5 ) ,   0 )   +   ' ) ' ;  
         } ;  
 } ) ;  
  
         / /   C o l o r   C o n v e r s i o n   f u n c t i o n s   f r o m   h i g h l i g h t F a d e  
         / /   B y   B l a i r   M i t c h e l m o r e  
         / /   h t t p : / / j q u e r y . o f f p u t . c a / h i g h l i g h t F a d e /  
  
         / /   P a r s e   s t r i n g s   l o o k i n g   f o r   c o l o r   t u p l e s   [ 2 5 5 , 2 5 5 , 2 5 5 ]  
         f u n c t i o n   g e t R G B ( c o l o r )   {  
                 v a r   r e s u l t ;  
  
                 / /   C h e c k   i f   w e ' r e   a l r e a d y   d e a l i n g   w i t h   a n   a r r a y   o f   c o l o r s  
                 i f   ( c o l o r   & &   c o l o r . c o n s t r u c t o r   = =   A r r a y   & &   c o l o r . l e n g t h   = =   3 )  
                         r e t u r n   c o l o r ;  
  
                 / /   L o o k   f o r   r g b ( n u m , n u m , n u m )  
                 i f   ( r e s u l t   =   / r g b \ ( \ s * ( [ 0 - 9 ] { 1 , 3 } ) \ s * , \ s * ( [ 0 - 9 ] { 1 , 3 } ) \ s * , \ s * ( [ 0 - 9 ] { 1 , 3 } ) \ s * \ ) / . e x e c ( c o l o r ) )  
                         r e t u r n   [ p a r s e I n t ( r e s u l t [ 1 ] ,   1 0 ) ,   p a r s e I n t ( r e s u l t [ 2 ] ,   1 0 ) ,   p a r s e I n t ( r e s u l t [ 3 ] ,   1 0 ) ] ;  
  
                 / /   L o o k   f o r   r g b ( n u m % , n u m % , n u m % )  
                 i f   ( r e s u l t   =   / r g b \ ( \ s * ( [ 0 - 9 ] + ( ? : \ . [ 0 - 9 ] + ) ? ) \ % \ s * , \ s * ( [ 0 - 9 ] + ( ? : \ . [ 0 - 9 ] + ) ? ) \ % \ s * , \ s * ( [ 0 - 9 ] + ( ? : \ . [ 0 - 9 ] + ) ? ) \ % \ s * \ ) / . e x e c ( c o l o r ) )  
                         r e t u r n   [ p a r s e F l o a t ( r e s u l t [ 1 ] )   *   2 . 5 5 ,   p a r s e F l o a t ( r e s u l t [ 2 ] )   *   2 . 5 5 ,   p a r s e F l o a t ( r e s u l t [ 3 ] )   *   2 . 5 5 ] ;  
  
                 / /   L o o k   f o r   # a 0 b 1 c 2  
                 i f   ( r e s u l t   =   / # ( [ a - f A - F 0 - 9 ] { 2 } ) ( [ a - f A - F 0 - 9 ] { 2 } ) ( [ a - f A - F 0 - 9 ] { 2 } ) / . e x e c ( c o l o r ) )  
                         r e t u r n   [ p a r s e I n t ( r e s u l t [ 1 ] ,   1 6 ) ,   p a r s e I n t ( r e s u l t [ 2 ] ,   1 6 ) ,   p a r s e I n t ( r e s u l t [ 3 ] ,   1 6 ) ] ;  
  
                 / /   L o o k   f o r   # f f f  
                 i f   ( r e s u l t   =   / # ( [ a - f A - F 0 - 9 ] ) ( [ a - f A - F 0 - 9 ] ) ( [ a - f A - F 0 - 9 ] ) / . e x e c ( c o l o r ) )  
                         r e t u r n   [ p a r s e I n t ( r e s u l t [ 1 ]   +   r e s u l t [ 1 ] ,   1 6 ) ,   p a r s e I n t ( r e s u l t [ 2 ]   +   r e s u l t [ 2 ] ,   1 6 ) ,   p a r s e I n t ( r e s u l t [ 3 ]   +   r e s u l t [ 3 ] ,   1 6 ) ] ;  
  
                 / /   L o o k   f o r   r g b a ( 0 ,   0 ,   0 ,   0 )   = =   t r a n s p a r e n t   i n   S a f a r i   3  
                 i f   ( r e s u l t   =   / r g b a \ ( 0 ,   0 ,   0 ,   0 \ ) / . e x e c ( c o l o r ) )  
                         r e t u r n   c o l o r s [ ' t r a n s p a r e n t ' ] ;  
  
                 / /   O t h e r w i s e ,   w e ' r e   m o s t   l i k e l y   d e a l i n g   w i t h   a   n a m e d   c o l o r  
                 r e t u r n   c o l o r s [ $ . t r i m ( c o l o r ) . t o L o w e r C a s e ( ) ] ;  
         }  
  
         f u n c t i o n   g e t C o l o r ( e l e m ,   a t t r )   {  
                 v a r   c o l o r ;  
  
                 d o   {  
                         c o l o r   =   $ . c u r C S S ( e l e m ,   a t t r ) ;  
  
                         / /   K e e p   g o i n g   u n t i l   w e   f i n d   a n   e l e m e n t   t h a t   h a s   c o l o r ,   o r   w e   h i t   t h e   b o d y  
                         i f   ( c o l o r   ! =   ' '   & &   c o l o r   ! =   ' t r a n s p a r e n t '   | |   $ . n o d e N a m e ( e l e m ,   " b o d y " ) )  
                                 b r e a k ;  
  
                         a t t r   =   " b a c k g r o u n d C o l o r " ;  
                 }   w h i l e   ( e l e m   =   e l e m . p a r e n t N o d e ) ;  
  
                 r e t u r n   g e t R G B ( c o l o r ) ;  
         } ;  
  
         / /   S o m e   n a m e d   c o l o r s   t o   w o r k   w i t h  
         / /   F r o m   I n t e r f a c e   b y   S t e f a n   P e t r e  
         / /   h t t p : / / i n t e r f a c e . e y e c o n . r o /  
  
         v a r   c o l o r s   =   {  
                 a q u a :   [ 0 ,   2 5 5 ,   2 5 5 ] ,  
                 a z u r e :   [ 2 4 0 ,   2 5 5 ,   2 5 5 ] ,  
                 b e i g e :   [ 2 4 5 ,   2 4 5 ,   2 2 0 ] ,  
                 b l a c k :   [ 0 ,   0 ,   0 ] ,  
                 b l u e :   [ 0 ,   0 ,   2 5 5 ] ,  
                 b r o w n :   [ 1 6 5 ,   4 2 ,   4 2 ] ,  
                 c y a n :   [ 0 ,   2 5 5 ,   2 5 5 ] ,  
                 d a r k b l u e :   [ 0 ,   0 ,   1 3 9 ] ,  
                 d a r k c y a n :   [ 0 ,   1 3 9 ,   1 3 9 ] ,  
                 d a r k g r e y :   [ 1 6 9 ,   1 6 9 ,   1 6 9 ] ,  
                 d a r k g r e e n :   [ 0 ,   1 0 0 ,   0 ] ,  
                 d a r k k h a k i :   [ 1 8 9 ,   1 8 3 ,   1 0 7 ] ,  
                 d a r k m a g e n t a :   [ 1 3 9 ,   0 ,   1 3 9 ] ,  
                 d a r k o l i v e g r e e n :   [ 8 5 ,   1 0 7 ,   4 7 ] ,  
                 d a r k o r a n g e :   [ 2 5 5 ,   1 4 0 ,   0 ] ,  
                 d a r k o r c h i d :   [ 1 5 3 ,   5 0 ,   2 0 4 ] ,  
                 d a r k r e d :   [ 1 3 9 ,   0 ,   0 ] ,  
                 d a r k s a l m o n :   [ 2 3 3 ,   1 5 0 ,   1 2 2 ] ,  
                 d a r k v i o l e t :   [ 1 4 8 ,   0 ,   2 1 1 ] ,  
                 f u c h s i a :   [ 2 5 5 ,   0 ,   2 5 5 ] ,  
                 g o l d :   [ 2 5 5 ,   2 1 5 ,   0 ] ,  
                 g r e e n :   [ 0 ,   1 2 8 ,   0 ] ,  
                 i n d i g o :   [ 7 5 ,   0 ,   1 3 0 ] ,  
                 k h a k i :   [ 2 4 0 ,   2 3 0 ,   1 4 0 ] ,  
                 l i g h t b l u e :   [ 1 7 3 ,   2 1 6 ,   2 3 0 ] ,  
                 l i g h t c y a n :   [ 2 2 4 ,   2 5 5 ,   2 5 5 ] ,  
                 l i g h t g r e e n :   [ 1 4 4 ,   2 3 8 ,   1 4 4 ] ,  
                 l i g h t g r e y :   [ 2 1 1 ,   2 1 1 ,   2 1 1 ] ,  
                 l i g h t p i n k :   [ 2 5 5 ,   1 8 2 ,   1 9 3 ] ,  
                 l i g h t y e l l o w :   [ 2 5 5 ,   2 5 5 ,   2 2 4 ] ,  
                 l i m e :   [ 0 ,   2 5 5 ,   0 ] ,  
                 m a g e n t a :   [ 2 5 5 ,   0 ,   2 5 5 ] ,  
                 m a r o o n :   [ 1 2 8 ,   0 ,   0 ] ,  
                 n a v y :   [ 0 ,   0 ,   1 2 8 ] ,  
                 o l i v e :   [ 1 2 8 ,   1 2 8 ,   0 ] ,  
                 o r a n g e :   [ 2 5 5 ,   1 6 5 ,   0 ] ,  
                 p i n k :   [ 2 5 5 ,   1 9 2 ,   2 0 3 ] ,  
                 p u r p l e :   [ 1 2 8 ,   0 ,   1 2 8 ] ,  
                 v i o l e t :   [ 1 2 8 ,   0 ,   1 2 8 ] ,  
                 r e d :   [ 2 5 5 ,   0 ,   0 ] ,  
                 s i l v e r :   [ 1 9 2 ,   1 9 2 ,   1 9 2 ] ,  
                 w h i t e :   [ 2 5 5 ,   2 5 5 ,   2 5 5 ] ,  
                 y e l l o w :   [ 2 5 5 ,   2 5 5 ,   0 ] ,  
                 t r a n s p a r e n t :   [ 2 5 5 ,   2 5 5 ,   2 5 5 ]  
         } ;  
  
  
  
         / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
         / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *   C L A S S   A N I M A T I O N S   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
         / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
  
         v a r   c l a s s A n i m a t i o n A c t i o n s   =   [ ' a d d ' ,   ' r e m o v e ' ,   ' t o g g l e ' ] ,  
 	 s h o r t h a n d S t y l e s   =   {  
 	         b o r d e r :   1 ,  
 	         b o r d e r B o t t o m :   1 ,  
 	         b o r d e r C o l o r :   1 ,  
 	         b o r d e r L e f t :   1 ,  
 	         b o r d e r R i g h t :   1 ,  
 	         b o r d e r T o p :   1 ,  
 	         b o r d e r W i d t h :   1 ,  
 	         m a r g i n :   1 ,  
 	         p a d d i n g :   1  
 	 } ;  
  
         f u n c t i o n   g e t E l e m e n t S t y l e s ( )   {  
                 v a r   s t y l e   =   d o c u m e n t . d e f a u l t V i e w  
 	 	 	 ?   d o c u m e n t . d e f a u l t V i e w . g e t C o m p u t e d S t y l e ( t h i s ,   n u l l )  
 	 	 	 :   t h i s . c u r r e n t S t y l e ,  
 	 	 n e w S t y l e   =   { } ,  
 	 	 k e y ,  
 	 	 c a m e l C a s e ;  
  
                 / /   w e b k i t   e n u m e r a t e s   s t y l e   p o r p e r t i e s  
                 i f   ( s t y l e   & &   s t y l e . l e n g t h   & &   s t y l e [ 0 ]   & &   s t y l e [ s t y l e [ 0 ] ] )   {  
                         v a r   l e n   =   s t y l e . l e n g t h ;  
                         w h i l e   ( l e n - - )   {  
                                 k e y   =   s t y l e [ l e n ] ;  
                                 i f   ( t y p e o f   s t y l e [ k e y ]   = =   ' s t r i n g ' )   {  
                                         c a m e l C a s e   =   k e y . r e p l a c e ( / \ - ( \ w ) / g ,   f u n c t i o n ( a l l ,   l e t t e r )   {  
                                                 r e t u r n   l e t t e r . t o U p p e r C a s e ( ) ;  
                                         } ) ;  
                                         n e w S t y l e [ c a m e l C a s e ]   =   s t y l e [ k e y ] ;  
                                 }  
                         }  
                 }   e l s e   {  
                         f o r   ( k e y   i n   s t y l e )   {  
                                 i f   ( t y p e o f   s t y l e [ k e y ]   = = =   ' s t r i n g ' )   {  
                                         n e w S t y l e [ k e y ]   =   s t y l e [ k e y ] ;  
                                 }  
                         }  
                 }  
  
                 r e t u r n   n e w S t y l e ;  
         }  
  
         f u n c t i o n   f i l t e r S t y l e s ( s t y l e s )   {  
                 v a r   n a m e ,   v a l u e ;  
                 f o r   ( n a m e   i n   s t y l e s )   {  
                         v a l u e   =   s t y l e s [ n a m e ] ;  
                         i f   (  
                         / /   i g n o r e   n u l l   a n d   u n d e f i n e d   v a l u e s  
 	 	 	 v a l u e   = =   n u l l   | |  
                         / /   i g n o r e   f u n c t i o n s   ( w h e n   d o e s   t h i s   o c c u r ? )  
 	 	 	 $ . i s F u n c t i o n ( v a l u e )   | |  
                         / /   s h o r t h a n d   s t y l e s   t h a t   n e e d   t o   b e   e x p a n d e d  
 	 	 	 n a m e   i n   s h o r t h a n d S t y l e s   | |  
                         / /   i g n o r e   s c r o l l b a r s   ( b r e a k   i n   I E )  
 	 	 	 ( / s c r o l l b a r / ) . t e s t ( n a m e )   | |  
  
                         / /   o n l y   c o l o r s   o r   v a l u e s   t h a t   c a n   b e   c o n v e r t e d   t o   n u m b e r s  
 	 	 	 ( ! ( / c o l o r / i ) . t e s t ( n a m e )   & &   i s N a N ( p a r s e F l o a t ( v a l u e ) ) )  
 	 	 )   {  
                                 d e l e t e   s t y l e s [ n a m e ] ;  
                         }  
                 }  
  
                 r e t u r n   s t y l e s ;  
         }  
  
         f u n c t i o n   s t y l e D i f f e r e n c e ( o l d S t y l e ,   n e w S t y l e )   {  
                 v a r   d i f f   =   {   _ :   0   } ,   / /   h t t p : / / d e v . j q u e r y . c o m / t i c k e t / 5 4 5 9  
 	 	 n a m e ;  
  
                 f o r   ( n a m e   i n   n e w S t y l e )   {  
                         i f   ( o l d S t y l e [ n a m e ]   ! =   n e w S t y l e [ n a m e ] )   {  
                                 d i f f [ n a m e ]   =   n e w S t y l e [ n a m e ] ;  
                         }  
                 }  
  
                 r e t u r n   d i f f ;  
         }  
  
         $ . e f f e c t s . a n i m a t e C l a s s   =   f u n c t i o n ( v a l u e ,   d u r a t i o n ,   e a s i n g ,   c a l l b a c k )   {  
                 i f   ( $ . i s F u n c t i o n ( e a s i n g ) )   {  
                         c a l l b a c k   =   e a s i n g ;  
                         e a s i n g   =   n u l l ;  
                 }  
  
                 r e t u r n   t h i s . q u e u e ( ' f x ' ,   f u n c t i o n ( )   {  
                         v a r   t h a t   =   $ ( t h i s ) ,  
 	 	 	 o r i g i n a l S t y l e A t t r   =   t h a t . a t t r ( ' s t y l e ' )   | |   '   ' ,  
 	 	 	 o r i g i n a l S t y l e   =   f i l t e r S t y l e s ( g e t E l e m e n t S t y l e s . c a l l ( t h i s ) ) ,  
 	 	 	 n e w S t y l e ,  
 	 	 	 c l a s s N a m e   =   t h a t . a t t r ( ' c l a s s N a m e ' ) ;  
  
                         $ . e a c h ( c l a s s A n i m a t i o n A c t i o n s ,   f u n c t i o n ( i ,   a c t i o n )   {  
                                 i f   ( v a l u e [ a c t i o n ] )   {  
                                         t h a t [ a c t i o n   +   ' C l a s s ' ] ( v a l u e [ a c t i o n ] ) ;  
                                 }  
                         } ) ;  
                         n e w S t y l e   =   f i l t e r S t y l e s ( g e t E l e m e n t S t y l e s . c a l l ( t h i s ) ) ;  
                         t h a t . a t t r ( ' c l a s s N a m e ' ,   c l a s s N a m e ) ;  
  
                         t h a t . a n i m a t e ( s t y l e D i f f e r e n c e ( o r i g i n a l S t y l e ,   n e w S t y l e ) ,   d u r a t i o n ,   e a s i n g ,   f u n c t i o n ( )   {  
                                 $ . e a c h ( c l a s s A n i m a t i o n A c t i o n s ,   f u n c t i o n ( i ,   a c t i o n )   {  
                                         i f   ( v a l u e [ a c t i o n ] )   {   t h a t [ a c t i o n   +   ' C l a s s ' ] ( v a l u e [ a c t i o n ] ) ;   }  
                                 } ) ;  
                                 / /   w o r k   a r o u n d   b u g   i n   I E   b y   c l e a r i n g   t h e   c s s T e x t   b e f o r e   s e t t i n g   i t  
                                 i f   ( t y p e o f   t h a t . a t t r ( ' s t y l e ' )   = =   ' o b j e c t ' )   {  
                                         t h a t . a t t r ( ' s t y l e ' ) . c s s T e x t   =   ' ' ;  
                                         t h a t . a t t r ( ' s t y l e ' ) . c s s T e x t   =   o r i g i n a l S t y l e A t t r ;  
                                 }   e l s e   {  
                                         t h a t . a t t r ( ' s t y l e ' ,   o r i g i n a l S t y l e A t t r ) ;  
                                 }  
                                 i f   ( c a l l b a c k )   {   c a l l b a c k . a p p l y ( t h i s ,   a r g u m e n t s ) ;   }  
                         } ) ;  
  
                         / /   $ . a n i m a t e   a d d s   a   f u n c t i o n   t o   t h e   e n d   o f   t h e   q u e u e  
                         / /   b u t   w e   w a n t   i t   a t   t h e   f r o n t  
                         v a r   q u e u e   =   $ . q u e u e ( t h i s ) ,  
 	 	 	 a n i m   =   q u e u e . s p l i c e ( q u e u e . l e n g t h   -   1 ,   1 ) [ 0 ] ;  
                         q u e u e . s p l i c e ( 1 ,   0 ,   a n i m ) ;  
                         $ . d e q u e u e ( t h i s ) ;  
                 } ) ;  
         } ;  
  
         $ . f n . e x t e n d ( {  
                 _ a d d C l a s s :   $ . f n . a d d C l a s s ,  
                 a d d C l a s s :   f u n c t i o n ( c l a s s N a m e s ,   s p e e d ,   e a s i n g ,   c a l l b a c k )   {  
                         r e t u r n   s p e e d   ?   $ . e f f e c t s . a n i m a t e C l a s s . a p p l y ( t h i s ,   [ {   a d d :   c l a s s N a m e s   } ,   s p e e d ,   e a s i n g ,   c a l l b a c k ] )   :   t h i s . _ a d d C l a s s ( c l a s s N a m e s ) ;  
                 } ,  
  
                 _ r e m o v e C l a s s :   $ . f n . r e m o v e C l a s s ,  
                 r e m o v e C l a s s :   f u n c t i o n ( c l a s s N a m e s ,   s p e e d ,   e a s i n g ,   c a l l b a c k )   {  
                         r e t u r n   s p e e d   ?   $ . e f f e c t s . a n i m a t e C l a s s . a p p l y ( t h i s ,   [ {   r e m o v e :   c l a s s N a m e s   } ,   s p e e d ,   e a s i n g ,   c a l l b a c k ] )   :   t h i s . _ r e m o v e C l a s s ( c l a s s N a m e s ) ;  
                 } ,  
  
                 _ t o g g l e C l a s s :   $ . f n . t o g g l e C l a s s ,  
                 t o g g l e C l a s s :   f u n c t i o n ( c l a s s N a m e s ,   f o r c e ,   s p e e d ,   e a s i n g ,   c a l l b a c k )   {  
                         i f   ( t y p e o f   f o r c e   = =   " b o o l e a n "   | |   f o r c e   = = =   u n d e f i n e d )   {  
                                 i f   ( ! s p e e d )   {  
                                         / /   w i t h o u t   s p e e d   p a r a m e t e r ;  
                                         r e t u r n   t h i s . _ t o g g l e C l a s s ( c l a s s N a m e s ,   f o r c e ) ;  
                                 }   e l s e   {  
                                         r e t u r n   $ . e f f e c t s . a n i m a t e C l a s s . a p p l y ( t h i s ,   [ ( f o r c e   ?   {   a d d :   c l a s s N a m e s }   :   {   r e m o v e :   c l a s s N a m e s   } ) ,   s p e e d ,   e a s i n g ,   c a l l b a c k ] ) ;  
                                 }  
                         }   e l s e   {  
                                 / /   w i t h o u t   s w i t c h   p a r a m e t e r ;  
                                 r e t u r n   $ . e f f e c t s . a n i m a t e C l a s s . a p p l y ( t h i s ,   [ {   t o g g l e :   c l a s s N a m e s   } ,   f o r c e ,   s p e e d ,   e a s i n g ] ) ;  
                         }  
                 } ,  
  
                 s w i t c h C l a s s :   f u n c t i o n ( r e m o v e ,   a d d ,   s p e e d ,   e a s i n g ,   c a l l b a c k )   {  
                         r e t u r n   $ . e f f e c t s . a n i m a t e C l a s s . a p p l y ( t h i s ,   [ {   a d d :   a d d ,   r e m o v e :   r e m o v e   } ,   s p e e d ,   e a s i n g ,   c a l l b a c k ] ) ;  
                 }  
         } ) ;  
  
  
  
         / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
         / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *   E F F E C T S   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
         / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
  
         $ . e x t e n d ( $ . e f f e c t s ,   {  
                 v e r s i o n :   " 1 . 8 . 1 0 " ,  
  
                 / /   S a v e s   a   s e t   o f   p r o p e r t i e s   i n   a   d a t a   s t o r a g e  
                 s a v e :   f u n c t i o n ( e l e m e n t ,   s e t )   {  
                         f o r   ( v a r   i   =   0 ;   i   <   s e t . l e n g t h ;   i + + )   {  
                                 i f   ( s e t [ i ]   ! = =   n u l l )   e l e m e n t . d a t a ( " e c . s t o r a g e . "   +   s e t [ i ] ,   e l e m e n t [ 0 ] . s t y l e [ s e t [ i ] ] ) ;  
                         }  
                 } ,  
  
                 / /   R e s t o r e s   a   s e t   o f   p r e v i o u s l y   s a v e d   p r o p e r t i e s   f r o m   a   d a t a   s t o r a g e  
                 r e s t o r e :   f u n c t i o n ( e l e m e n t ,   s e t )   {  
                         f o r   ( v a r   i   =   0 ;   i   <   s e t . l e n g t h ;   i + + )   {  
                                 i f   ( s e t [ i ]   ! = =   n u l l )   e l e m e n t . c s s ( s e t [ i ] ,   e l e m e n t . d a t a ( " e c . s t o r a g e . "   +   s e t [ i ] ) ) ;  
                         }  
                 } ,  
  
                 s e t M o d e :   f u n c t i o n ( e l ,   m o d e )   {  
                         i f   ( m o d e   = =   ' t o g g l e ' )   m o d e   =   e l . i s ( ' : h i d d e n ' )   ?   ' s h o w '   :   ' h i d e ' ;   / /   S e t   f o r   t o g g l e  
                         r e t u r n   m o d e ;  
                 } ,  
  
                 g e t B a s e l i n e :   f u n c t i o n ( o r i g i n ,   o r i g i n a l )   {   / /   T r a n s l a t e s   a   [ t o p , l e f t ]   a r r a y   i n t o   a   b a s e l i n e   v a l u e  
                         / /   t h i s   s h o u l d   b e   a   l i t t l e   m o r e   f l e x i b l e   i n   t h e   f u t u r e   t o   h a n d l e   a   s t r i n g   &   h a s h  
                         v a r   y ,   x ;  
                         s w i t c h   ( o r i g i n [ 0 ] )   {  
                                 c a s e   ' t o p ' :   y   =   0 ;   b r e a k ;  
                                 c a s e   ' m i d d l e ' :   y   =   0 . 5 ;   b r e a k ;  
                                 c a s e   ' b o t t o m ' :   y   =   1 ;   b r e a k ;  
                                 d e f a u l t :   y   =   o r i g i n [ 0 ]   /   o r i g i n a l . h e i g h t ;  
                         } ;  
                         s w i t c h   ( o r i g i n [ 1 ] )   {  
                                 c a s e   ' l e f t ' :   x   =   0 ;   b r e a k ;  
                                 c a s e   ' c e n t e r ' :   x   =   0 . 5 ;   b r e a k ;  
                                 c a s e   ' r i g h t ' :   x   =   1 ;   b r e a k ;  
                                 d e f a u l t :   x   =   o r i g i n [ 1 ]   /   o r i g i n a l . w i d t h ;  
                         } ;  
                         r e t u r n   {   x :   x ,   y :   y   } ;  
                 } ,  
  
                 / /   W r a p s   t h e   e l e m e n t   a r o u n d   a   w r a p p e r   t h a t   c o p i e s   p o s i t i o n   p r o p e r t i e s  
                 c r e a t e W r a p p e r :   f u n c t i o n ( e l e m e n t )   {  
  
                         / /   i f   t h e   e l e m e n t   i s   a l r e a d y   w r a p p e d ,   r e t u r n   i t  
                         i f   ( e l e m e n t . p a r e n t ( ) . i s ( ' . u i - e f f e c t s - w r a p p e r ' ) )   {  
                                 r e t u r n   e l e m e n t . p a r e n t ( ) ;  
                         }  
  
                         / /   w r a p   t h e   e l e m e n t  
                         v a r   p r o p s   =   {  
                                 w i d t h :   e l e m e n t . o u t e r W i d t h ( t r u e ) ,  
                                 h e i g h t :   e l e m e n t . o u t e r H e i g h t ( t r u e ) ,  
                                 ' f l o a t ' :   e l e m e n t . c s s ( ' f l o a t ' )  
                         } ,  
 	 	 	 w r a p p e r   =   $ ( ' < d i v > < / d i v > ' )  
 	 	 	 	 . a d d C l a s s ( ' u i - e f f e c t s - w r a p p e r ' )  
 	 	 	 	 . c s s ( {  
 	 	 	 	         f o n t S i z e :   ' 1 0 0 % ' ,  
 	 	 	 	         b a c k g r o u n d :   ' t r a n s p a r e n t ' ,  
 	 	 	 	         b o r d e r :   ' n o n e ' ,  
 	 	 	 	         m a r g i n :   0 ,  
 	 	 	 	         p a d d i n g :   0  
 	 	 	 	 } ) ;  
  
                         e l e m e n t . w r a p ( w r a p p e r ) ;  
                         w r a p p e r   =   e l e m e n t . p a r e n t ( ) ;   / / H o t f i x   f o r   j Q u e r y   1 . 4   s i n c e   s o m e   c h a n g e   i n   w r a p ( )   s e e m s   t o   a c t u a l l y   l o o s e   t h e   r e f e r e n c e   t o   t h e   w r a p p e d   e l e m e n t  
  
                         / /   t r a n s f e r   p o s i t i o n i n g   p r o p e r t i e s   t o   t h e   w r a p p e r  
                         i f   ( e l e m e n t . c s s ( ' p o s i t i o n ' )   = =   ' s t a t i c ' )   {  
                                 w r a p p e r . c s s ( {   p o s i t i o n :   ' r e l a t i v e '   } ) ;  
                                 e l e m e n t . c s s ( {   p o s i t i o n :   ' r e l a t i v e '   } ) ;  
                         }   e l s e   {  
                                 $ . e x t e n d ( p r o p s ,   {  
                                         p o s i t i o n :   e l e m e n t . c s s ( ' p o s i t i o n ' ) ,  
                                         z I n d e x :   e l e m e n t . c s s ( ' z - i n d e x ' )  
                                 } ) ;  
                                 $ . e a c h ( [ ' t o p ' ,   ' l e f t ' ,   ' b o t t o m ' ,   ' r i g h t ' ] ,   f u n c t i o n ( i ,   p o s )   {  
                                         p r o p s [ p o s ]   =   e l e m e n t . c s s ( p o s ) ;  
                                         i f   ( i s N a N ( p a r s e I n t ( p r o p s [ p o s ] ,   1 0 ) ) )   {  
                                                 p r o p s [ p o s ]   =   ' a u t o ' ;  
                                         }  
                                 } ) ;  
                                 e l e m e n t . c s s ( {   p o s i t i o n :   ' r e l a t i v e ' ,   t o p :   0 ,   l e f t :   0 ,   r i g h t :   ' a u t o ' ,   b o t t o m :   ' a u t o '   } ) ;  
                         }  
  
                         r e t u r n   w r a p p e r . c s s ( p r o p s ) . s h o w ( ) ;  
                 } ,  
  
                 r e m o v e W r a p p e r :   f u n c t i o n ( e l e m e n t )   {  
                         i f   ( e l e m e n t . p a r e n t ( ) . i s ( ' . u i - e f f e c t s - w r a p p e r ' ) )  
                                 r e t u r n   e l e m e n t . p a r e n t ( ) . r e p l a c e W i t h ( e l e m e n t ) ;  
                         r e t u r n   e l e m e n t ;  
                 } ,  
  
                 s e t T r a n s i t i o n :   f u n c t i o n ( e l e m e n t ,   l i s t ,   f a c t o r ,   v a l u e )   {  
                         v a l u e   =   v a l u e   | |   { } ;  
                         $ . e a c h ( l i s t ,   f u n c t i o n ( i ,   x )   {  
                                 u n i t   =   e l e m e n t . c s s U n i t ( x ) ;  
                                 i f   ( u n i t [ 0 ]   >   0 )   v a l u e [ x ]   =   u n i t [ 0 ]   *   f a c t o r   +   u n i t [ 1 ] ;  
                         } ) ;  
                         r e t u r n   v a l u e ;  
                 }  
         } ) ;  
  
  
         f u n c t i o n   _ n o r m a l i z e A r g u m e n t s ( e f f e c t ,   o p t i o n s ,   s p e e d ,   c a l l b a c k )   {  
                 / /   s h i f t   p a r a m s   f o r   m e t h o d   o v e r l o a d i n g  
                 i f   ( t y p e o f   e f f e c t   = =   ' o b j e c t ' )   {  
                         c a l l b a c k   =   o p t i o n s ;  
                         s p e e d   =   n u l l ;  
                         o p t i o n s   =   e f f e c t ;  
                         e f f e c t   =   o p t i o n s . e f f e c t ;  
                 }  
                 i f   ( $ . i s F u n c t i o n ( o p t i o n s ) )   {  
                         c a l l b a c k   =   o p t i o n s ;  
                         s p e e d   =   n u l l ;  
                         o p t i o n s   =   { } ;  
                 }  
                 i f   ( t y p e o f   o p t i o n s   = =   ' n u m b e r '   | |   $ . f x . s p e e d s [ o p t i o n s ] )   {  
                         c a l l b a c k   =   s p e e d ;  
                         s p e e d   =   o p t i o n s ;  
                         o p t i o n s   =   { } ;  
                 }  
                 i f   ( $ . i s F u n c t i o n ( s p e e d ) )   {  
                         c a l l b a c k   =   s p e e d ;  
                         s p e e d   =   n u l l ;  
                 }  
  
                 o p t i o n s   =   o p t i o n s   | |   { } ;  
  
                 s p e e d   =   s p e e d   | |   o p t i o n s . d u r a t i o n ;  
                 s p e e d   =   $ . f x . o f f   ?   0   :   t y p e o f   s p e e d   = =   ' n u m b e r '  
 	 	 ?   s p e e d   :   s p e e d   i n   $ . f x . s p e e d s   ?   $ . f x . s p e e d s [ s p e e d ]   :   $ . f x . s p e e d s . _ d e f a u l t ;  
  
                 c a l l b a c k   =   c a l l b a c k   | |   o p t i o n s . c o m p l e t e ;  
  
                 r e t u r n   [ e f f e c t ,   o p t i o n s ,   s p e e d ,   c a l l b a c k ] ;  
         }  
  
         f u n c t i o n   s t a n d a r d S p e e d ( s p e e d )   {  
                 / /   v a l i d   s t a n d a r d   s p e e d s  
                 i f   ( ! s p e e d   | |   t y p e o f   s p e e d   = = =   " n u m b e r "   | |   $ . f x . s p e e d s [ s p e e d ] )   {  
                         r e t u r n   t r u e ;  
                 }  
  
                 / /   i n v a l i d   s t r i n g s   -   t r e a t   a s   " n o r m a l "   s p e e d  
                 i f   ( t y p e o f   s p e e d   = = =   " s t r i n g "   & &   ! $ . e f f e c t s [ s p e e d ] )   {  
                         r e t u r n   t r u e ;  
                 }  
  
                 r e t u r n   f a l s e ;  
         }  
  
         $ . f n . e x t e n d ( {  
                 e f f e c t :   f u n c t i o n ( e f f e c t ,   o p t i o n s ,   s p e e d ,   c a l l b a c k )   {  
                         v a r   a r g s   =   _ n o r m a l i z e A r g u m e n t s . a p p l y ( t h i s ,   a r g u m e n t s ) ,  
                         / /   T O D O :   m a k e   e f f e c t s   t a k e   a c t u a l   p a r a m e t e r s   i n s t e a d   o f   a   h a s h  
 	 	 	 a r g s 2   =   {  
 	 	 	         o p t i o n s :   a r g s [ 1 ] ,  
 	 	 	         d u r a t i o n :   a r g s [ 2 ] ,  
 	 	 	         c a l l b a c k :   a r g s [ 3 ]  
 	 	 	 } ,  
 	 	 	 m o d e   =   a r g s 2 . o p t i o n s . m o d e ,  
 	 	 	 e f f e c t M e t h o d   =   $ . e f f e c t s [ e f f e c t ] ;  
  
                         i f   ( $ . f x . o f f   | |   ! e f f e c t M e t h o d )   {  
                                 / /   d e l e g a t e   t o   t h e   o r i g i n a l   m e t h o d   ( e . g . ,   . s h o w ( ) )   i f   p o s s i b l e  
                                 i f   ( m o d e )   {  
                                         r e t u r n   t h i s [ m o d e ] ( a r g s 2 . d u r a t i o n ,   a r g s 2 . c a l l b a c k ) ;  
                                 }   e l s e   {  
                                         r e t u r n   t h i s . e a c h ( f u n c t i o n ( )   {  
                                                 i f   ( a r g s 2 . c a l l b a c k )   {  
                                                         a r g s 2 . c a l l b a c k . c a l l ( t h i s ) ;  
                                                 }  
                                         } ) ;  
                                 }  
                         }  
  
                         r e t u r n   e f f e c t M e t h o d . c a l l ( t h i s ,   a r g s 2 ) ;  
                 } ,  
  
                 _ s h o w :   $ . f n . s h o w ,  
                 s h o w :   f u n c t i o n ( s p e e d )   {  
                         i f   ( s t a n d a r d S p e e d ( s p e e d ) )   {  
                                 r e t u r n   t h i s . _ s h o w . a p p l y ( t h i s ,   a r g u m e n t s ) ;  
                         }   e l s e   {  
                                 v a r   a r g s   =   _ n o r m a l i z e A r g u m e n t s . a p p l y ( t h i s ,   a r g u m e n t s ) ;  
                                 a r g s [ 1 ] . m o d e   =   ' s h o w ' ;  
                                 r e t u r n   t h i s . e f f e c t . a p p l y ( t h i s ,   a r g s ) ;  
                         }  
                 } ,  
  
                 _ h i d e :   $ . f n . h i d e ,  
                 h i d e :   f u n c t i o n ( s p e e d )   {  
                         i f   ( s t a n d a r d S p e e d ( s p e e d ) )   {  
                                 r e t u r n   t h i s . _ h i d e . a p p l y ( t h i s ,   a r g u m e n t s ) ;  
                         }   e l s e   {  
                                 v a r   a r g s   =   _ n o r m a l i z e A r g u m e n t s . a p p l y ( t h i s ,   a r g u m e n t s ) ;  
                                 a r g s [ 1 ] . m o d e   =   ' h i d e ' ;  
                                 r e t u r n   t h i s . e f f e c t . a p p l y ( t h i s ,   a r g s ) ;  
                         }  
                 } ,  
  
                 / /   j Q u e r y   c o r e   o v e r l o a d s   t o g g l e   a n d   c r e a t e s   _ t o g g l e  
                 _ _ t o g g l e :   $ . f n . t o g g l e ,  
                 t o g g l e :   f u n c t i o n ( s p e e d )   {  
                         i f   ( s t a n d a r d S p e e d ( s p e e d )   | |   t y p e o f   s p e e d   = = =   " b o o l e a n "   | |   $ . i s F u n c t i o n ( s p e e d ) )   {  
                                 r e t u r n   t h i s . _ _ t o g g l e . a p p l y ( t h i s ,   a r g u m e n t s ) ;  
                         }   e l s e   {  
                                 v a r   a r g s   =   _ n o r m a l i z e A r g u m e n t s . a p p l y ( t h i s ,   a r g u m e n t s ) ;  
                                 a r g s [ 1 ] . m o d e   =   ' t o g g l e ' ;  
                                 r e t u r n   t h i s . e f f e c t . a p p l y ( t h i s ,   a r g s ) ;  
                         }  
                 } ,  
  
                 / /   h e l p e r   f u n c t i o n s  
                 c s s U n i t :   f u n c t i o n ( k e y )   {  
                         v a r   s t y l e   =   t h i s . c s s ( k e y ) ,   v a l   =   [ ] ;  
                         $ . e a c h ( [ ' e m ' ,   ' p x ' ,   ' % ' ,   ' p t ' ] ,   f u n c t i o n ( i ,   u n i t )   {  
                                 i f   ( s t y l e . i n d e x O f ( u n i t )   >   0 )  
                                         v a l   =   [ p a r s e F l o a t ( s t y l e ) ,   u n i t ] ;  
                         } ) ;  
                         r e t u r n   v a l ;  
                 }  
         } ) ;  
  
  
  
         / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
         / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *   E A S I N G   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
         / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
  
         / *  
         *   j Q u e r y   E a s i n g   v 1 . 3   -   h t t p : / / g s g d . c o . u k / s a n d b o x / j q u e r y / e a s i n g /  
         *  
         *   U s e s   t h e   b u i l t   i n   e a s i n g   c a p a b i l i t i e s   a d d e d   I n   j Q u e r y   1 . 1  
         *   t o   o f f e r   m u l t i p l e   e a s i n g   o p t i o n s  
         *  
         *   T E R M S   O F   U S E   -   j Q u e r y   E a s i n g  
         *  
         *   O p e n   s o u r c e   u n d e r   t h e   B S D   L i c e n s e .  
         *  
         *   C o p y r i g h t   2 0 0 8   G e o r g e   M c G i n l e y   S m i t h  
         *   A l l   r i g h t s   r e s e r v e d .  
         *  
         *   R e d i s t r i b u t i o n   a n d   u s e   i n   s o u r c e   a n d   b i n a r y   f o r m s ,   w i t h   o r   w i t h o u t   m o d i f i c a t i o n ,  
         *   a r e   p e r m i t t e d   p r o v i d e d   t h a t   t h e   f o l l o w i n g   c o n d i t i o n s   a r e   m e t :  
         *  
         *   R e d i s t r i b u t i o n s   o f   s o u r c e   c o d e   m u s t   r e t a i n   t h e   a b o v e   c o p y r i g h t   n o t i c e ,   t h i s   l i s t   o f  
         *   c o n d i t i o n s   a n d   t h e   f o l l o w i n g   d i s c l a i m e r .  
         *   R e d i s t r i b u t i o n s   i n   b i n a r y   f o r m   m u s t   r e p r o d u c e   t h e   a b o v e   c o p y r i g h t   n o t i c e ,   t h i s   l i s t  
         *   o f   c o n d i t i o n s   a n d   t h e   f o l l o w i n g   d i s c l a i m e r   i n   t h e   d o c u m e n t a t i o n   a n d / o r   o t h e r   m a t e r i a l s  
         *   p r o v i d e d   w i t h   t h e   d i s t r i b u t i o n .  
         *  
         *   N e i t h e r   t h e   n a m e   o f   t h e   a u t h o r   n o r   t h e   n a m e s   o f   c o n t r i b u t o r s   m a y   b e   u s e d   t o   e n d o r s e  
         *   o r   p r o m o t e   p r o d u c t s   d e r i v e d   f r o m   t h i s   s o f t w a r e   w i t h o u t   s p e c i f i c   p r i o r   w r i t t e n   p e r m i s s i o n .  
         *  
         *   T H I S   S O F T W A R E   I S   P R O V I D E D   B Y   T H E   C O P Y R I G H T   H O L D E R S   A N D   C O N T R I B U T O R S   " A S   I S "   A N D   A N Y  
         *   E X P R E S S   O R   I M P L I E D   W A R R A N T I E S ,   I N C L U D I N G ,   B U T   N O T   L I M I T E D   T O ,   T H E   I M P L I E D   W A R R A N T I E S   O F  
         *   M E R C H A N T A B I L I T Y   A N D   F I T N E S S   F O R   A   P A R T I C U L A R   P U R P O S E   A R E   D I S C L A I M E D .   I N   N O   E V E N T   S H A L L   T H E  
         *   C O P Y R I G H T   O W N E R   O R   C O N T R I B U T O R S   B E   L I A B L E   F O R   A N Y   D I R E C T ,   I N D I R E C T ,   I N C I D E N T A L ,   S P E C I A L ,  
         *   E X E M P L A R Y ,   O R   C O N S E Q U E N T I A L   D A M A G E S   ( I N C L U D I N G ,   B U T   N O T   L I M I T E D   T O ,   P R O C U R E M E N T   O F   S U B S T I T U T E  
         *   G O O D S   O R   S E R V I C E S ;   L O S S   O F   U S E ,   D A T A ,   O R   P R O F I T S ;   O R   B U S I N E S S   I N T E R R U P T I O N )   H O W E V E R   C A U S E D  
         *   A N D   O N   A N Y   T H E O R Y   O F   L I A B I L I T Y ,   W H E T H E R   I N   C O N T R A C T ,   S T R I C T   L I A B I L I T Y ,   O R   T O R T   ( I N C L U D I N G  
         *   N E G L I G E N C E   O R   O T H E R W I S E )   A R I S I N G   I N   A N Y   W A Y   O U T   O F   T H E   U S E   O F   T H I S   S O F T W A R E ,   E V E N   I F   A D V I S E D  
         *   O F   T H E   P O S S I B I L I T Y   O F   S U C H   D A M A G E .  
         *  
         * /  
  
         / /   t :   c u r r e n t   t i m e ,   b :   b e g I n n I n g   v a l u e ,   c :   c h a n g e   I n   v a l u e ,   d :   d u r a t i o n  
         $ . e a s i n g . j s w i n g   =   $ . e a s i n g . s w i n g ;  
  
         $ . e x t e n d ( $ . e a s i n g ,  
 {  
         d e f :   ' e a s e O u t Q u a d ' ,  
         s w i n g :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 / / a l e r t ( $ . e a s i n g . d e f a u l t ) ;  
                 r e t u r n   $ . e a s i n g [ $ . e a s i n g . d e f ] ( x ,   t ,   b ,   c ,   d ) ;  
         } ,  
         e a s e I n Q u a d :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   c   *   ( t   / =   d )   *   t   +   b ;  
         } ,  
         e a s e O u t Q u a d :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   - c   *   ( t   / =   d )   *   ( t   -   2 )   +   b ;  
         } ,  
         e a s e I n O u t Q u a d :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 i f   ( ( t   / =   d   /   2 )   <   1 )   r e t u r n   c   /   2   *   t   *   t   +   b ;  
                 r e t u r n   - c   /   2   *   ( ( - - t )   *   ( t   -   2 )   -   1 )   +   b ;  
         } ,  
         e a s e I n C u b i c :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   c   *   ( t   / =   d )   *   t   *   t   +   b ;  
         } ,  
         e a s e O u t C u b i c :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   c   *   ( ( t   =   t   /   d   -   1 )   *   t   *   t   +   1 )   +   b ;  
         } ,  
         e a s e I n O u t C u b i c :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 i f   ( ( t   / =   d   /   2 )   <   1 )   r e t u r n   c   /   2   *   t   *   t   *   t   +   b ;  
                 r e t u r n   c   /   2   *   ( ( t   - =   2 )   *   t   *   t   +   2 )   +   b ;  
         } ,  
         e a s e I n Q u a r t :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   c   *   ( t   / =   d )   *   t   *   t   *   t   +   b ;  
         } ,  
         e a s e O u t Q u a r t :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   - c   *   ( ( t   =   t   /   d   -   1 )   *   t   *   t   *   t   -   1 )   +   b ;  
         } ,  
         e a s e I n O u t Q u a r t :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 i f   ( ( t   / =   d   /   2 )   <   1 )   r e t u r n   c   /   2   *   t   *   t   *   t   *   t   +   b ;  
                 r e t u r n   - c   /   2   *   ( ( t   - =   2 )   *   t   *   t   *   t   -   2 )   +   b ;  
         } ,  
         e a s e I n Q u i n t :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   c   *   ( t   / =   d )   *   t   *   t   *   t   *   t   +   b ;  
         } ,  
         e a s e O u t Q u i n t :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   c   *   ( ( t   =   t   /   d   -   1 )   *   t   *   t   *   t   *   t   +   1 )   +   b ;  
         } ,  
         e a s e I n O u t Q u i n t :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 i f   ( ( t   / =   d   /   2 )   <   1 )   r e t u r n   c   /   2   *   t   *   t   *   t   *   t   *   t   +   b ;  
                 r e t u r n   c   /   2   *   ( ( t   - =   2 )   *   t   *   t   *   t   *   t   +   2 )   +   b ;  
         } ,  
         e a s e I n S i n e :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   - c   *   M a t h . c o s ( t   /   d   *   ( M a t h . P I   /   2 ) )   +   c   +   b ;  
         } ,  
         e a s e O u t S i n e :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   c   *   M a t h . s i n ( t   /   d   *   ( M a t h . P I   /   2 ) )   +   b ;  
         } ,  
         e a s e I n O u t S i n e :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   - c   /   2   *   ( M a t h . c o s ( M a t h . P I   *   t   /   d )   -   1 )   +   b ;  
         } ,  
         e a s e I n E x p o :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   ( t   = =   0 )   ?   b   :   c   *   M a t h . p o w ( 2 ,   1 0   *   ( t   /   d   -   1 ) )   +   b ;  
         } ,  
         e a s e O u t E x p o :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   ( t   = =   d )   ?   b   +   c   :   c   *   ( - M a t h . p o w ( 2 ,   - 1 0   *   t   /   d )   +   1 )   +   b ;  
         } ,  
         e a s e I n O u t E x p o :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 i f   ( t   = =   0 )   r e t u r n   b ;  
                 i f   ( t   = =   d )   r e t u r n   b   +   c ;  
                 i f   ( ( t   / =   d   /   2 )   <   1 )   r e t u r n   c   /   2   *   M a t h . p o w ( 2 ,   1 0   *   ( t   -   1 ) )   +   b ;  
                 r e t u r n   c   /   2   *   ( - M a t h . p o w ( 2 ,   - 1 0   *   - - t )   +   2 )   +   b ;  
         } ,  
         e a s e I n C i r c :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   - c   *   ( M a t h . s q r t ( 1   -   ( t   / =   d )   *   t )   -   1 )   +   b ;  
         } ,  
         e a s e O u t C i r c :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   c   *   M a t h . s q r t ( 1   -   ( t   =   t   /   d   -   1 )   *   t )   +   b ;  
         } ,  
         e a s e I n O u t C i r c :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 i f   ( ( t   / =   d   /   2 )   <   1 )   r e t u r n   - c   /   2   *   ( M a t h . s q r t ( 1   -   t   *   t )   -   1 )   +   b ;  
                 r e t u r n   c   /   2   *   ( M a t h . s q r t ( 1   -   ( t   - =   2 )   *   t )   +   1 )   +   b ;  
         } ,  
         e a s e I n E l a s t i c :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 v a r   s   =   1 . 7 0 1 5 8 ;   v a r   p   =   0 ;   v a r   a   =   c ;  
                 i f   ( t   = =   0 )   r e t u r n   b ;   i f   ( ( t   / =   d )   = =   1 )   r e t u r n   b   +   c ;   i f   ( ! p )   p   =   d   *   . 3 ;  
                 i f   ( a   <   M a t h . a b s ( c ) )   {   a   =   c ;   v a r   s   =   p   /   4 ;   }  
                 e l s e   v a r   s   =   p   /   ( 2   *   M a t h . P I )   *   M a t h . a s i n ( c   /   a ) ;  
                 r e t u r n   - ( a   *   M a t h . p o w ( 2 ,   1 0   *   ( t   - =   1 ) )   *   M a t h . s i n ( ( t   *   d   -   s )   *   ( 2   *   M a t h . P I )   /   p ) )   +   b ;  
         } ,  
         e a s e O u t E l a s t i c :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 v a r   s   =   1 . 7 0 1 5 8 ;   v a r   p   =   0 ;   v a r   a   =   c ;  
                 i f   ( t   = =   0 )   r e t u r n   b ;   i f   ( ( t   / =   d )   = =   1 )   r e t u r n   b   +   c ;   i f   ( ! p )   p   =   d   *   . 3 ;  
                 i f   ( a   <   M a t h . a b s ( c ) )   {   a   =   c ;   v a r   s   =   p   /   4 ;   }  
                 e l s e   v a r   s   =   p   /   ( 2   *   M a t h . P I )   *   M a t h . a s i n ( c   /   a ) ;  
                 r e t u r n   a   *   M a t h . p o w ( 2 ,   - 1 0   *   t )   *   M a t h . s i n ( ( t   *   d   -   s )   *   ( 2   *   M a t h . P I )   /   p )   +   c   +   b ;  
         } ,  
         e a s e I n O u t E l a s t i c :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 v a r   s   =   1 . 7 0 1 5 8 ;   v a r   p   =   0 ;   v a r   a   =   c ;  
                 i f   ( t   = =   0 )   r e t u r n   b ;   i f   ( ( t   / =   d   /   2 )   = =   2 )   r e t u r n   b   +   c ;   i f   ( ! p )   p   =   d   *   ( . 3   *   1 . 5 ) ;  
                 i f   ( a   <   M a t h . a b s ( c ) )   {   a   =   c ;   v a r   s   =   p   /   4 ;   }  
                 e l s e   v a r   s   =   p   /   ( 2   *   M a t h . P I )   *   M a t h . a s i n ( c   /   a ) ;  
                 i f   ( t   <   1 )   r e t u r n   - . 5   *   ( a   *   M a t h . p o w ( 2 ,   1 0   *   ( t   - =   1 ) )   *   M a t h . s i n ( ( t   *   d   -   s )   *   ( 2   *   M a t h . P I )   /   p ) )   +   b ;  
                 r e t u r n   a   *   M a t h . p o w ( 2 ,   - 1 0   *   ( t   - =   1 ) )   *   M a t h . s i n ( ( t   *   d   -   s )   *   ( 2   *   M a t h . P I )   /   p )   *   . 5   +   c   +   b ;  
         } ,  
         e a s e I n B a c k :   f u n c t i o n ( x ,   t ,   b ,   c ,   d ,   s )   {  
                 i f   ( s   = =   u n d e f i n e d )   s   =   1 . 7 0 1 5 8 ;  
                 r e t u r n   c   *   ( t   / =   d )   *   t   *   ( ( s   +   1 )   *   t   -   s )   +   b ;  
         } ,  
         e a s e O u t B a c k :   f u n c t i o n ( x ,   t ,   b ,   c ,   d ,   s )   {  
                 i f   ( s   = =   u n d e f i n e d )   s   =   1 . 7 0 1 5 8 ;  
                 r e t u r n   c   *   ( ( t   =   t   /   d   -   1 )   *   t   *   ( ( s   +   1 )   *   t   +   s )   +   1 )   +   b ;  
         } ,  
         e a s e I n O u t B a c k :   f u n c t i o n ( x ,   t ,   b ,   c ,   d ,   s )   {  
                 i f   ( s   = =   u n d e f i n e d )   s   =   1 . 7 0 1 5 8 ;  
                 i f   ( ( t   / =   d   /   2 )   <   1 )   r e t u r n   c   /   2   *   ( t   *   t   *   ( ( ( s   * =   ( 1 . 5 2 5 ) )   +   1 )   *   t   -   s ) )   +   b ;  
                 r e t u r n   c   /   2   *   ( ( t   - =   2 )   *   t   *   ( ( ( s   * =   ( 1 . 5 2 5 ) )   +   1 )   *   t   +   s )   +   2 )   +   b ;  
         } ,  
         e a s e I n B o u n c e :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 r e t u r n   c   -   $ . e a s i n g . e a s e O u t B o u n c e ( x ,   d   -   t ,   0 ,   c ,   d )   +   b ;  
         } ,  
         e a s e O u t B o u n c e :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 i f   ( ( t   / =   d )   <   ( 1   /   2 . 7 5 ) )   {  
                         r e t u r n   c   *   ( 7 . 5 6 2 5   *   t   *   t )   +   b ;  
                 }   e l s e   i f   ( t   <   ( 2   /   2 . 7 5 ) )   {  
                         r e t u r n   c   *   ( 7 . 5 6 2 5   *   ( t   - =   ( 1 . 5   /   2 . 7 5 ) )   *   t   +   . 7 5 )   +   b ;  
                 }   e l s e   i f   ( t   <   ( 2 . 5   /   2 . 7 5 ) )   {  
                         r e t u r n   c   *   ( 7 . 5 6 2 5   *   ( t   - =   ( 2 . 2 5   /   2 . 7 5 ) )   *   t   +   . 9 3 7 5 )   +   b ;  
                 }   e l s e   {  
                         r e t u r n   c   *   ( 7 . 5 6 2 5   *   ( t   - =   ( 2 . 6 2 5   /   2 . 7 5 ) )   *   t   +   . 9 8 4 3 7 5 )   +   b ;  
                 }  
         } ,  
         e a s e I n O u t B o u n c e :   f u n c t i o n ( x ,   t ,   b ,   c ,   d )   {  
                 i f   ( t   <   d   /   2 )   r e t u r n   $ . e a s i n g . e a s e I n B o u n c e ( x ,   t   *   2 ,   0 ,   c ,   d )   *   . 5   +   b ;  
                 r e t u r n   $ . e a s i n g . e a s e O u t B o u n c e ( x ,   t   *   2   -   d ,   0 ,   c ,   d )   *   . 5   +   c   *   . 5   +   b ;  
         }  
 } ) ;  
  
         / *  
         *  
         *   T E R M S   O F   U S E   -   E A S I N G   E Q U A T I O N S  
         *  
         *   O p e n   s o u r c e   u n d e r   t h e   B S D   L i c e n s e .  
         *  
         *   C o p y r i g h t   2 0 0 1   R o b e r t   P e n n e r  
         *   A l l   r i g h t s   r e s e r v e d .  
         *  
         *   R e d i s t r i b u t i o n   a n d   u s e   i n   s o u r c e   a n d   b i n a r y   f o r m s ,   w i t h   o r   w i t h o u t   m o d i f i c a t i o n ,  
         *   a r e   p e r m i t t e d   p r o v i d e d   t h a t   t h e   f o l l o w i n g   c o n d i t i o n s   a r e   m e t :  
         *  
         *   R e d i s t r i b u t i o n s   o f   s o u r c e   c o d e   m u s t   r e t a i n   t h e   a b o v e   c o p y r i g h t   n o t i c e ,   t h i s   l i s t   o f  
         *   c o n d i t i o n s   a n d   t h e   f o l l o w i n g   d i s c l a i m e r .  
         *   R e d i s t r i b u t i o n s   i n   b i n a r y   f o r m   m u s t   r e p r o d u c e   t h e   a b o v e   c o p y r i g h t   n o t i c e ,   t h i s   l i s t  
         *   o f   c o n d i t i o n s   a n d   t h e   f o l l o w i n g   d i s c l a i m e r   i n   t h e   d o c u m e n t a t i o n   a n d / o r   o t h e r   m a t e r i a l s  
         *   p r o v i d e d   w i t h   t h e   d i s t r i b u t i o n .  
         *  
         *   N e i t h e r   t h e   n a m e   o f   t h e   a u t h o r   n o r   t h e   n a m e s   o f   c o n t r i b u t o r s   m a y   b e   u s e d   t o   e n d o r s e  
         *   o r   p r o m o t e   p r o d u c t s   d e r i v e d   f r o m   t h i s   s o f t w a r e   w i t h o u t   s p e c i f i c   p r i o r   w r i t t e n   p e r m i s s i o n .  
         *  
         *   T H I S   S O F T W A R E   I S   P R O V I D E D   B Y   T H E   C O P Y R I G H T   H O L D E R S   A N D   C O N T R I B U T O R S   " A S   I S "   A N D   A N Y  
         *   E X P R E S S   O R   I M P L I E D   W A R R A N T I E S ,   I N C L U D I N G ,   B U T   N O T   L I M I T E D   T O ,   T H E   I M P L I E D   W A R R A N T I E S   O F  
         *   M E R C H A N T A B I L I T Y   A N D   F I T N E S S   F O R   A   P A R T I C U L A R   P U R P O S E   A R E   D I S C L A I M E D .   I N   N O   E V E N T   S H A L L   T H E  
         *   C O P Y R I G H T   O W N E R   O R   C O N T R I B U T O R S   B E   L I A B L E   F O R   A N Y   D I R E C T ,   I N D I R E C T ,   I N C I D E N T A L ,   S P E C I A L ,  
         *   E X E M P L A R Y ,   O R   C O N S E Q U E N T I A L   D A M A G E S   ( I N C L U D I N G ,   B U T   N O T   L I M I T E D   T O ,   P R O C U R E M E N T   O F   S U B S T I T U T E  
         *   G O O D S   O R   S E R V I C E S ;   L O S S   O F   U S E ,   D A T A ,   O R   P R O F I T S ;   O R   B U S I N E S S   I N T E R R U P T I O N )   H O W E V E R   C A U S E D  
         *   A N D   O N   A N Y   T H E O R Y   O F   L I A B I L I T Y ,   W H E T H E R   I N   C O N T R A C T ,   S T R I C T   L I A B I L I T Y ,   O R   T O R T   ( I N C L U D I N G  
         *   N E G L I G E N C E   O R   O T H E R W I S E )   A R I S I N G   I N   A N Y   W A Y   O U T   O F   T H E   U S E   O F   T H I S   S O F T W A R E ,   E V E N   I F   A D V I S E D  
         *   O F   T H E   P O S S I B I L I T Y   O F   S U C H   D A M A G E .  
         *  
         * /  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   E f f e c t s   B l i n d   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / E f f e c t s / B l i n d  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . e f f e c t s . c o r e . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . e f f e c t s . b l i n d   =   f u n c t i o n ( o )   {  
  
                 r e t u r n   t h i s . q u e u e ( f u n c t i o n ( )   {  
  
                         / /   C r e a t e   e l e m e n t  
                         v a r   e l   =   $ ( t h i s ) ,   p r o p s   =   [ ' p o s i t i o n ' ,   ' t o p ' ,   ' b o t t o m ' ,   ' l e f t ' ,   ' r i g h t ' ] ;  
  
                         / /   S e t   o p t i o n s  
                         v a r   m o d e   =   $ . e f f e c t s . s e t M o d e ( e l ,   o . o p t i o n s . m o d e   | |   ' h i d e ' ) ;   / /   S e t   M o d e  
                         v a r   d i r e c t i o n   =   o . o p t i o n s . d i r e c t i o n   | |   ' v e r t i c a l ' ;   / /   D e f a u l t   d i r e c t i o n  
  
                         / /   A d j u s t  
                         $ . e f f e c t s . s a v e ( e l ,   p r o p s ) ;   e l . s h o w ( ) ;   / /   S a v e   &   S h o w  
                         v a r   w r a p p e r   =   $ . e f f e c t s . c r e a t e W r a p p e r ( e l ) . c s s ( {   o v e r f l o w :   ' h i d d e n '   } ) ;   / /   C r e a t e   W r a p p e r  
                         v a r   r e f   =   ( d i r e c t i o n   = =   ' v e r t i c a l ' )   ?   ' h e i g h t '   :   ' w i d t h ' ;  
                         v a r   d i s t a n c e   =   ( d i r e c t i o n   = =   ' v e r t i c a l ' )   ?   w r a p p e r . h e i g h t ( )   :   w r a p p e r . w i d t h ( ) ;  
                         i f   ( m o d e   = =   ' s h o w ' )   w r a p p e r . c s s ( r e f ,   0 ) ;   / /   S h i f t  
  
                         / /   A n i m a t i o n  
                         v a r   a n i m a t i o n   =   { } ;  
                         a n i m a t i o n [ r e f ]   =   m o d e   = =   ' s h o w '   ?   d i s t a n c e   :   0 ;  
  
                         / /   A n i m a t e  
                         w r a p p e r . a n i m a t e ( a n i m a t i o n ,   o . d u r a t i o n ,   o . o p t i o n s . e a s i n g ,   f u n c t i o n ( )   {  
                                 i f   ( m o d e   = =   ' h i d e ' )   e l . h i d e ( ) ;   / /   H i d e  
                                 $ . e f f e c t s . r e s t o r e ( e l ,   p r o p s ) ;   $ . e f f e c t s . r e m o v e W r a p p e r ( e l ) ;   / /   R e s t o r e  
                                 i f   ( o . c a l l b a c k )   o . c a l l b a c k . a p p l y ( e l [ 0 ] ,   a r g u m e n t s ) ;   / /   C a l l b a c k  
                                 e l . d e q u e u e ( ) ;  
                         } ) ;  
  
                 } ) ;  
  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   E f f e c t s   B o u n c e   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / E f f e c t s / B o u n c e  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . e f f e c t s . c o r e . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . e f f e c t s . b o u n c e   =   f u n c t i o n ( o )   {  
  
                 r e t u r n   t h i s . q u e u e ( f u n c t i o n ( )   {  
  
                         / /   C r e a t e   e l e m e n t  
                         v a r   e l   =   $ ( t h i s ) ,   p r o p s   =   [ ' p o s i t i o n ' ,   ' t o p ' ,   ' b o t t o m ' ,   ' l e f t ' ,   ' r i g h t ' ] ;  
  
                         / /   S e t   o p t i o n s  
                         v a r   m o d e   =   $ . e f f e c t s . s e t M o d e ( e l ,   o . o p t i o n s . m o d e   | |   ' e f f e c t ' ) ;   / /   S e t   M o d e  
                         v a r   d i r e c t i o n   =   o . o p t i o n s . d i r e c t i o n   | |   ' u p ' ;   / /   D e f a u l t   d i r e c t i o n  
                         v a r   d i s t a n c e   =   o . o p t i o n s . d i s t a n c e   | |   2 0 ;   / /   D e f a u l t   d i s t a n c e  
                         v a r   t i m e s   =   o . o p t i o n s . t i m e s   | |   5 ;   / /   D e f a u l t   #   o f   t i m e s  
                         v a r   s p e e d   =   o . d u r a t i o n   | |   2 5 0 ;   / /   D e f a u l t   s p e e d   p e r   b o u n c e  
                         i f   ( / s h o w | h i d e / . t e s t ( m o d e ) )   p r o p s . p u s h ( ' o p a c i t y ' ) ;   / /   A v o i d   t o u c h i n g   o p a c i t y   t o   p r e v e n t   c l e a r T y p e   a n d   P N G   i s s u e s   i n   I E  
  
                         / /   A d j u s t  
                         $ . e f f e c t s . s a v e ( e l ,   p r o p s ) ;   e l . s h o w ( ) ;   / /   S a v e   &   S h o w  
                         $ . e f f e c t s . c r e a t e W r a p p e r ( e l ) ;   / /   C r e a t e   W r a p p e r  
                         v a r   r e f   =   ( d i r e c t i o n   = =   ' u p '   | |   d i r e c t i o n   = =   ' d o w n ' )   ?   ' t o p '   :   ' l e f t ' ;  
                         v a r   m o t i o n   =   ( d i r e c t i o n   = =   ' u p '   | |   d i r e c t i o n   = =   ' l e f t ' )   ?   ' p o s '   :   ' n e g ' ;  
                         v a r   d i s t a n c e   =   o . o p t i o n s . d i s t a n c e   | |   ( r e f   = =   ' t o p '   ?   e l . o u t e r H e i g h t ( {   m a r g i n :   t r u e   } )   /   3   :   e l . o u t e r W i d t h ( {   m a r g i n :   t r u e   } )   /   3 ) ;  
                         i f   ( m o d e   = =   ' s h o w ' )   e l . c s s ( ' o p a c i t y ' ,   0 ) . c s s ( r e f ,   m o t i o n   = =   ' p o s '   ?   - d i s t a n c e   :   d i s t a n c e ) ;   / /   S h i f t  
                         i f   ( m o d e   = =   ' h i d e ' )   d i s t a n c e   =   d i s t a n c e   /   ( t i m e s   *   2 ) ;  
                         i f   ( m o d e   ! =   ' h i d e ' )   t i m e s - - ;  
  
                         / /   A n i m a t e  
                         i f   ( m o d e   = =   ' s h o w ' )   {   / /   S h o w   B o u n c e  
                                 v a r   a n i m a t i o n   =   {   o p a c i t y :   1   } ;  
                                 a n i m a t i o n [ r e f ]   =   ( m o t i o n   = =   ' p o s '   ?   ' + = '   :   ' - = ' )   +   d i s t a n c e ;  
                                 e l . a n i m a t e ( a n i m a t i o n ,   s p e e d   /   2 ,   o . o p t i o n s . e a s i n g ) ;  
                                 d i s t a n c e   =   d i s t a n c e   /   2 ;  
                                 t i m e s - - ;  
                         } ;  
                         f o r   ( v a r   i   =   0 ;   i   <   t i m e s ;   i + + )   {   / /   B o u n c e s  
                                 v a r   a n i m a t i o n 1   =   { } ,   a n i m a t i o n 2   =   { } ;  
                                 a n i m a t i o n 1 [ r e f ]   =   ( m o t i o n   = =   ' p o s '   ?   ' - = '   :   ' + = ' )   +   d i s t a n c e ;  
                                 a n i m a t i o n 2 [ r e f ]   =   ( m o t i o n   = =   ' p o s '   ?   ' + = '   :   ' - = ' )   +   d i s t a n c e ;  
                                 e l . a n i m a t e ( a n i m a t i o n 1 ,   s p e e d   /   2 ,   o . o p t i o n s . e a s i n g ) . a n i m a t e ( a n i m a t i o n 2 ,   s p e e d   /   2 ,   o . o p t i o n s . e a s i n g ) ;  
                                 d i s t a n c e   =   ( m o d e   = =   ' h i d e ' )   ?   d i s t a n c e   *   2   :   d i s t a n c e   /   2 ;  
                         } ;  
                         i f   ( m o d e   = =   ' h i d e ' )   {   / /   L a s t   B o u n c e  
                                 v a r   a n i m a t i o n   =   {   o p a c i t y :   0   } ;  
                                 a n i m a t i o n [ r e f ]   =   ( m o t i o n   = =   ' p o s '   ?   ' - = '   :   ' + = ' )   +   d i s t a n c e ;  
                                 e l . a n i m a t e ( a n i m a t i o n ,   s p e e d   /   2 ,   o . o p t i o n s . e a s i n g ,   f u n c t i o n ( )   {  
                                         e l . h i d e ( ) ;   / /   H i d e  
                                         $ . e f f e c t s . r e s t o r e ( e l ,   p r o p s ) ;   $ . e f f e c t s . r e m o v e W r a p p e r ( e l ) ;   / /   R e s t o r e  
                                         i f   ( o . c a l l b a c k )   o . c a l l b a c k . a p p l y ( t h i s ,   a r g u m e n t s ) ;   / /   C a l l b a c k  
                                 } ) ;  
                         }   e l s e   {  
                                 v a r   a n i m a t i o n 1   =   { } ,   a n i m a t i o n 2   =   { } ;  
                                 a n i m a t i o n 1 [ r e f ]   =   ( m o t i o n   = =   ' p o s '   ?   ' - = '   :   ' + = ' )   +   d i s t a n c e ;  
                                 a n i m a t i o n 2 [ r e f ]   =   ( m o t i o n   = =   ' p o s '   ?   ' + = '   :   ' - = ' )   +   d i s t a n c e ;  
                                 e l . a n i m a t e ( a n i m a t i o n 1 ,   s p e e d   /   2 ,   o . o p t i o n s . e a s i n g ) . a n i m a t e ( a n i m a t i o n 2 ,   s p e e d   /   2 ,   o . o p t i o n s . e a s i n g ,   f u n c t i o n ( )   {  
                                         $ . e f f e c t s . r e s t o r e ( e l ,   p r o p s ) ;   $ . e f f e c t s . r e m o v e W r a p p e r ( e l ) ;   / /   R e s t o r e  
                                         i f   ( o . c a l l b a c k )   o . c a l l b a c k . a p p l y ( t h i s ,   a r g u m e n t s ) ;   / /   C a l l b a c k  
                                 } ) ;  
                         } ;  
                         e l . q u e u e ( ' f x ' ,   f u n c t i o n ( )   {   e l . d e q u e u e ( ) ;   } ) ;  
                         e l . d e q u e u e ( ) ;  
                 } ) ;  
  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   E f f e c t s   C l i p   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / E f f e c t s / C l i p  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . e f f e c t s . c o r e . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . e f f e c t s . c l i p   =   f u n c t i o n ( o )   {  
  
                 r e t u r n   t h i s . q u e u e ( f u n c t i o n ( )   {  
  
                         / /   C r e a t e   e l e m e n t  
                         v a r   e l   =   $ ( t h i s ) ,   p r o p s   =   [ ' p o s i t i o n ' ,   ' t o p ' ,   ' b o t t o m ' ,   ' l e f t ' ,   ' r i g h t ' ,   ' h e i g h t ' ,   ' w i d t h ' ] ;  
  
                         / /   S e t   o p t i o n s  
                         v a r   m o d e   =   $ . e f f e c t s . s e t M o d e ( e l ,   o . o p t i o n s . m o d e   | |   ' h i d e ' ) ;   / /   S e t   M o d e  
                         v a r   d i r e c t i o n   =   o . o p t i o n s . d i r e c t i o n   | |   ' v e r t i c a l ' ;   / /   D e f a u l t   d i r e c t i o n  
  
                         / /   A d j u s t  
                         $ . e f f e c t s . s a v e ( e l ,   p r o p s ) ;   e l . s h o w ( ) ;   / /   S a v e   &   S h o w  
                         v a r   w r a p p e r   =   $ . e f f e c t s . c r e a t e W r a p p e r ( e l ) . c s s ( {   o v e r f l o w :   ' h i d d e n '   } ) ;   / /   C r e a t e   W r a p p e r  
                         v a r   a n i m a t e   =   e l [ 0 ] . t a g N a m e   = =   ' I M G '   ?   w r a p p e r   :   e l ;  
                         v a r   r e f   =   {  
                                 s i z e :   ( d i r e c t i o n   = =   ' v e r t i c a l ' )   ?   ' h e i g h t '   :   ' w i d t h ' ,  
                                 p o s i t i o n :   ( d i r e c t i o n   = =   ' v e r t i c a l ' )   ?   ' t o p '   :   ' l e f t '  
                         } ;  
                         v a r   d i s t a n c e   =   ( d i r e c t i o n   = =   ' v e r t i c a l ' )   ?   a n i m a t e . h e i g h t ( )   :   a n i m a t e . w i d t h ( ) ;  
                         i f   ( m o d e   = =   ' s h o w ' )   {   a n i m a t e . c s s ( r e f . s i z e ,   0 ) ;   a n i m a t e . c s s ( r e f . p o s i t i o n ,   d i s t a n c e   /   2 ) ;   }   / /   S h i f t  
  
                         / /   A n i m a t i o n  
                         v a r   a n i m a t i o n   =   { } ;  
                         a n i m a t i o n [ r e f . s i z e ]   =   m o d e   = =   ' s h o w '   ?   d i s t a n c e   :   0 ;  
                         a n i m a t i o n [ r e f . p o s i t i o n ]   =   m o d e   = =   ' s h o w '   ?   0   :   d i s t a n c e   /   2 ;  
  
                         / /   A n i m a t e  
                         a n i m a t e . a n i m a t e ( a n i m a t i o n ,   {   q u e u e :   f a l s e ,   d u r a t i o n :   o . d u r a t i o n ,   e a s i n g :   o . 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   ( m o d e   = =   ' h i d e ' )   e l . h i d e ( ) ;   / /   H i d e  
                                 $ . e f f e c t s . r e s t o r e ( e l ,   p r o p s ) ;   $ . e f f e c t s . r e m o v e W r a p p e r ( e l ) ;   / /   R e s t o r e  
                                 i f   ( o . c a l l b a c k )   o . c a l l b a c k . a p p l y ( e l [ 0 ] ,   a r g u m e n t s ) ;   / /   C a l l b a c k  
                                 e l . d e q u e u e ( ) ;  
                         }    
                         } ) ;  
  
                 } ) ;  
  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   E f f e c t s   D r o p   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / E f f e c t s / D r o p  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . e f f e c t s . c o r e . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . e f f e c t s . d r o p   =   f u n c t i o n ( o )   {  
  
                 r e t u r n   t h i s . q u e u e ( f u n c t i o n ( )   {  
  
                         / /   C r e a t e   e l e m e n t  
                         v a r   e l   =   $ ( t h i s ) ,   p r o p s   =   [ ' p o s i t i o n ' ,   ' t o p ' ,   ' b o t t o m ' ,   ' l e f t ' ,   ' r i g h t ' ,   ' o p a c i t y ' ] ;  
  
                         / /   S e t   o p t i o n s  
                         v a r   m o d e   =   $ . e f f e c t s . s e t M o d e ( e l ,   o . o p t i o n s . m o d e   | |   ' h i d e ' ) ;   / /   S e t   M o d e  
                         v a r   d i r e c t i o n   =   o . o p t i o n s . d i r e c t i o n   | |   ' l e f t ' ;   / /   D e f a u l t   D i r e c t i o n  
  
                         / /   A d j u s t  
                         $ . e f f e c t s . s a v e ( e l ,   p r o p s ) ;   e l . s h o w ( ) ;   / /   S a v e   &   S h o w  
                         $ . e f f e c t s . c r e a t e W r a p p e r ( e l ) ;   / /   C r e a t e   W r a p p e r  
                         v a r   r e f   =   ( d i r e c t i o n   = =   ' u p '   | |   d i r e c t i o n   = =   ' d o w n ' )   ?   ' t o p '   :   ' l e f t ' ;  
                         v a r   m o t i o n   =   ( d i r e c t i o n   = =   ' u p '   | |   d i r e c t i o n   = =   ' l e f t ' )   ?   ' p o s '   :   ' n e g ' ;  
                         v a r   d i s t a n c e   =   o . o p t i o n s . d i s t a n c e   | |   ( r e f   = =   ' t o p '   ?   e l . o u t e r H e i g h t ( {   m a r g i n :   t r u e   } )   /   2   :   e l . o u t e r W i d t h ( {   m a r g i n :   t r u e   } )   /   2 ) ;  
                         i f   ( m o d e   = =   ' s h o w ' )   e l . c s s ( ' o p a c i t y ' ,   0 ) . c s s ( r e f ,   m o t i o n   = =   ' p o s '   ?   - d i s t a n c e   :   d i s t a n c e ) ;   / /   S h i f t  
  
                         / /   A n i m a t i o n  
                         v a r   a n i m a t i o n   =   {   o p a c i t y :   m o d e   = =   ' s h o w '   ?   1   :   0   } ;  
                         a n i m a t i o n [ r e f ]   =   ( m o d e   = =   ' s h o w '   ?   ( m o t i o n   = =   ' p o s '   ?   ' + = '   :   ' - = ' )   :   ( m o t i o n   = =   ' p o s '   ?   ' - = '   :   ' + = ' ) )   +   d i s t a n c e ;  
  
                         / /   A n i m a t e  
                         e l . a n i m a t e ( a n i m a t i o n ,   {   q u e u e :   f a l s e ,   d u r a t i o n :   o . d u r a t i o n ,   e a s i n g :   o . 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   ( m o d e   = =   ' h i d e ' )   e l . h i d e ( ) ;   / /   H i d e  
                                 $ . e f f e c t s . r e s t o r e ( e l ,   p r o p s ) ;   $ . e f f e c t s . r e m o v e W r a p p e r ( e l ) ;   / /   R e s t o r e  
                                 i f   ( o . c a l l b a c k )   o . c a l l b a c k . a p p l y ( t h i s ,   a r g u m e n t s ) ;   / /   C a l l b a c k  
                                 e l . d e q u e u e ( ) ;  
                         }    
                         } ) ;  
  
                 } ) ;  
  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   E f f e c t s   E x p l o d e   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / E f f e c t s / E x p l o d e  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . e f f e c t s . c o r e . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . e f f e c t s . e x p l o d e   =   f u n c t i o n ( o )   {  
  
                 r e t u r n   t h i s . q u e u e ( f u n c t i o n ( )   {  
  
                         v a r   r o w s   =   o . o p t i o n s . p i e c e s   ?   M a t h . r o u n d ( M a t h . s q r t ( o . o p t i o n s . p i e c e s ) )   :   3 ;  
                         v a r   c e l l s   =   o . o p t i o n s . p i e c e s   ?   M a t h . r o u n d ( M a t h . s q r t ( o . o p t i o n s . p i e c e s ) )   :   3 ;  
  
                         o . o p t i o n s . m o d e   =   o . o p t i o n s . m o d e   = =   ' t o g g l e '   ?   ( $ ( t h i s ) . i s ( ' : v i s i b l e ' )   ?   ' h i d e '   :   ' s h o w ' )   :   o . o p t i o n s . m o d e ;  
                         v a r   e l   =   $ ( t h i s ) . s h o w ( ) . c s s ( ' v i s i b i l i t y ' ,   ' h i d d e n ' ) ;  
                         v a r   o f f s e t   =   e l . o f f s e t ( ) ;  
  
                         / / S u b s t r a c t   t h e   m a r g i n s   -   n o t   f i x i n g   t h e   p r o b l e m   y e t .  
                         o f f s e t . t o p   - =   p a r s e I n t ( e l . c s s ( " m a r g i n T o p " ) ,   1 0 )   | |   0 ;  
                         o f f s e t . l e f t   - =   p a r s e I n t ( e l . c s s ( " m a r g i n L e f t " ) ,   1 0 )   | |   0 ;  
  
                         v a r   w i d t h   =   e l . o u t e r W i d t h ( t r u e ) ;  
                         v a r   h e i g h t   =   e l . o u t e r H e i g h t ( t r u e ) ;  
  
                         f o r   ( v a r   i   =   0 ;   i   <   r o w s ;   i + + )   {   / /   =  
                                 f o r   ( v a r   j   =   0 ;   j   <   c e l l s ;   j + + )   {   / /   | |  
                                         e l  
 	 	 	 	 . c l o n e ( )  
 	 	 	 	 . a p p e n d T o ( ' b o d y ' )  
 	 	 	 	 . w r a p ( ' < d i v > < / d i v > ' )  
 	 	 	 	 . c s s ( {  
 	 	 	 	         p o s i t i o n :   ' a b s o l u t e ' ,  
 	 	 	 	         v i s i b i l i t y :   ' v i s i b l e ' ,  
 	 	 	 	         l e f t :   - j   *   ( w i d t h   /   c e l l s ) ,  
 	 	 	 	         t o p :   - i   *   ( h e i g h t   /   r o w s )  
 	 	 	 	 } )  
 	 	 	 	 . p a r e n t ( )  
 	 	 	 	 . a d d C l a s s ( ' u i - e f f e c t s - e x p l o d e ' )  
 	 	 	 	 . c s s ( {  
 	 	 	 	         p o s i t i o n :   ' a b s o l u t e ' ,  
 	 	 	 	         o v e r f l o w :   ' h i d d e n ' ,  
 	 	 	 	         w i d t h :   w i d t h   /   c e l l s ,  
 	 	 	 	         h e i g h t :   h e i g h t   /   r o w s ,  
 	 	 	 	         l e f t :   o f f s e t . l e f t   +   j   *   ( w i d t h   /   c e l l s )   +   ( o . o p t i o n s . m o d e   = =   ' s h o w '   ?   ( j   -   M a t h . f l o o r ( c e l l s   /   2 ) )   *   ( w i d t h   /   c e l l s )   :   0 ) ,  
 	 	 	 	         t o p :   o f f s e t . t o p   +   i   *   ( h e i g h t   /   r o w s )   +   ( o . o p t i o n s . m o d e   = =   ' s h o w '   ?   ( i   -   M a t h . f l o o r ( r o w s   /   2 ) )   *   ( h e i g h t   /   r o w s )   :   0 ) ,  
 	 	 	 	         o p a c i t y :   o . o p t i o n s . m o d e   = =   ' s h o w '   ?   0   :   1  
 	 	 	 	 } ) . a n i m a t e ( {  
 	 	 	 	         l e f t :   o f f s e t . l e f t   +   j   *   ( w i d t h   /   c e l l s )   +   ( o . o p t i o n s . m o d e   = =   ' s h o w '   ?   0   :   ( j   -   M a t h . f l o o r ( c e l l s   /   2 ) )   *   ( w i d t h   /   c e l l s ) ) ,  
 	 	 	 	         t o p :   o f f s e t . t o p   +   i   *   ( h e i g h t   /   r o w s )   +   ( o . o p t i o n s . m o d e   = =   ' s h o w '   ?   0   :   ( i   -   M a t h . f l o o r ( r o w s   /   2 ) )   *   ( h e i g h t   /   r o w s ) ) ,  
 	 	 	 	         o p a c i t y :   o . o p t i o n s . m o d e   = =   ' s h o w '   ?   1   :   0  
 	 	 	 	 } ,   o . d u r a t i o n   | |   5 0 0 ) ;  
                                 }  
                         }  
  
                         / /   S e t   a   t i m e o u t ,   t o   c a l l   t h e   c a l l b a c k   a p p r o x .   w h e n   t h e   o t h e r   a n i m a t i o n s   h a v e   f i n i s h e d  
                         s e t T i m e o u t ( f u n c t i o n ( )   {  
  
                                 o . o p t i o n s . m o d e   = =   ' s h o w '   ?   e l . c s s ( {   v i s i b i l i t y :   ' v i s i b l e '   } )   :   e l . c s s ( {   v i s i b i l i t y :   ' v i s i b l e '   } ) . h i d e ( ) ;  
                                 i f   ( o . c a l l b a c k )   o . c a l l b a c k . a p p l y ( e l [ 0 ] ) ;   / /   C a l l b a c k  
                                 e l . d e q u e u e ( ) ;  
  
                                 $ ( ' d i v . u i - e f f e c t s - e x p l o d e ' ) . r e m o v e ( ) ;  
  
                         } ,   o . d u r a t i o n   | |   5 0 0 ) ;  
  
  
                 } ) ;  
  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   E f f e c t s   F a d e   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / E f f e c t s / F a d e  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . e f f e c t s . c o r e . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . e f f e c t s . f a d e   =   f u n c t i o n ( o )   {  
                 r e t u r n   t h i s . q u e u e ( f u n c t i o n ( )   {  
                         v a r   e l e m   =   $ ( t h i s ) ,  
 	 	 	 m o d e   =   $ . e f f e c t s . s e t M o d e ( e l e m ,   o . o p t i o n s . m o d e   | |   ' h i d e ' ) ;  
  
                         e l e m . a n i m a t e ( {   o p a c i t y :   m o d e   } ,   {  
                                 q u e u e :   f a l s e ,  
                                 d u r a t i o n :   o . d u r a t i o n ,  
                                 e a s i n g :   o . 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 ( )   {  
                                         ( o . c a l l b a c k   & &   o . c a l l b a c k . a p p l y ( t h i s ,   a r g u m e n t s ) ) ;  
                                         e l e m . d e q u e u e ( ) ;  
                                 }  
                         } ) ;  
                 } ) ;  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   E f f e c t s   F o l d   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / E f f e c t s / F o l d  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . e f f e c t s . c o r e . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . e f f e c t s . f o l d   =   f u n c t i o n ( o )   {  
  
                 r e t u r n   t h i s . q u e u e ( f u n c t i o n ( )   {  
  
                         / /   C r e a t e   e l e m e n t  
                         v a r   e l   =   $ ( t h i s ) ,   p r o p s   =   [ ' p o s i t i o n ' ,   ' t o p ' ,   ' b o t t o m ' ,   ' l e f t ' ,   ' r i g h t ' ] ;  
  
                         / /   S e t   o p t i o n s  
                         v a r   m o d e   =   $ . e f f e c t s . s e t M o d e ( e l ,   o . o p t i o n s . m o d e   | |   ' h i d e ' ) ;   / /   S e t   M o d e  
                         v a r   s i z e   =   o . o p t i o n s . s i z e   | |   1 5 ;   / /   D e f a u l t   f o l d   s i z e  
                         v a r   h o r i z F i r s t   =   ! ( ! o . o p t i o n s . h o r i z F i r s t ) ;   / /   E n s u r e   a   b o o l e a n   v a l u e  
                         v a r   d u r a t i o n   =   o . d u r a t i o n   ?   o . d u r a t i o n   /   2   :   $ . f x . s p e e d s . _ d e f a u l t   /   2 ;  
  
                         / /   A d j u s t  
                         $ . e f f e c t s . s a v e ( e l ,   p r o p s ) ;   e l . s h o w ( ) ;   / /   S a v e   &   S h o w  
                         v a r   w r a p p e r   =   $ . e f f e c t s . c r e a t e W r a p p e r ( e l ) . c s s ( {   o v e r f l o w :   ' h i d d e n '   } ) ;   / /   C r e a t e   W r a p p e r  
                         v a r   w i d t h F i r s t   =   ( ( m o d e   = =   ' s h o w ' )   ! =   h o r i z F i r s t ) ;  
                         v a r   r e f   =   w i d t h F i r s t   ?   [ ' w i d t h ' ,   ' h e i g h t ' ]   :   [ ' h e i g h t ' ,   ' w i d t h ' ] ;  
                         v a r   d i s t a n c e   =   w i d t h F i r s t   ?   [ w r a p p e r . w i d t h ( ) ,   w r a p p e r . h e i g h t ( ) ]   :   [ w r a p p e r . h e i g h t ( ) ,   w r a p p e r . w i d t h ( ) ] ;  
                         v a r   p e r c e n t   =   / ( [ 0 - 9 ] + ) % / . e x e c ( s i z e ) ;  
                         i f   ( p e r c e n t )   s i z e   =   p a r s e I n t ( p e r c e n t [ 1 ] ,   1 0 )   /   1 0 0   *   d i s t a n c e [ m o d e   = =   ' h i d e '   ?   0   :   1 ] ;  
                         i f   ( m o d e   = =   ' s h o w ' )   w r a p p e r . c s s ( h o r i z F i r s t   ?   {   h e i g h t :   0 ,   w i d t h :   s i z e }   :   {   h e i g h t :   s i z e ,   w i d t h :   0   } ) ;   / /   S h i f t  
  
                         / /   A n i m a t i o n  
                         v a r   a n i m a t i o n 1   =   { } ,   a n i m a t i o n 2   =   { } ;  
                         a n i m a t i o n 1 [ r e f [ 0 ] ]   =   m o d e   = =   ' s h o w '   ?   d i s t a n c e [ 0 ]   :   s i z e ;  
                         a n i m a t i o n 2 [ r e f [ 1 ] ]   =   m o d e   = =   ' s h o w '   ?   d i s t a n c e [ 1 ]   :   0 ;  
  
                         / /   A n i m a t e  
                         w r a p p e r . a n i m a t e ( a n i m a t i o n 1 ,   d u r a t i o n ,   o . o p t i o n s . e a s i n g )  
 	 	 . a n i m a t e ( a n i m a t i o n 2 ,   d u r a t i o n ,   o . o p t i o n s . e a s i n g ,   f u n c t i o n ( )   {  
 	 	         i f   ( m o d e   = =   ' h i d e ' )   e l . h i d e ( ) ;   / /   H i d e  
 	 	         $ . e f f e c t s . r e s t o r e ( e l ,   p r o p s ) ;   $ . e f f e c t s . r e m o v e W r a p p e r ( e l ) ;   / /   R e s t o r e  
 	 	         i f   ( o . c a l l b a c k )   o . c a l l b a c k . a p p l y ( e l [ 0 ] ,   a r g u m e n t s ) ;   / /   C a l l b a c k  
 	 	         e l . d e q u e u e ( ) ;  
 	 	 } ) ;  
  
                 } ) ;  
  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   E f f e c t s   H i g h l i g h t   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / E f f e c t s / H i g h l i g h t  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . e f f e c t s . c o r e . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . e f f e c t s . h i g h l i g h t   =   f u n c t i o n ( o )   {  
                 r e t u r n   t h i s . q u e u e ( f u n c t i o n ( )   {  
                         v a r   e l e m   =   $ ( t h i s ) ,  
 	 	 	 p r o p s   =   [ ' b a c k g r o u n d I m a g e ' ,   ' b a c k g r o u n d C o l o r ' ,   ' o p a c i t y ' ] ,  
 	 	 	 m o d e   =   $ . e f f e c t s . s e t M o d e ( e l e m ,   o . o p t i o n s . m o d e   | |   ' s h o w ' ) ,  
 	 	 	 a n i m a t i o n   =   {  
 	 	 	         b a c k g r o u n d C o l o r :   e l e m . c s s ( ' b a c k g r o u n d C o l o r ' )  
 	 	 	 } ;  
  
                         i f   ( m o d e   = =   ' h i d e ' )   {  
                                 a n i m a t i o n . o p a c i t y   =   0 ;  
                         }  
  
                         $ . e f f e c t s . s a v e ( e l e m ,   p r o p s ) ;  
                         e l e m  
 	 	 	 . s h o w ( )  
 	 	 	 . c s s ( {  
 	 	 	         b a c k g r o u n d I m a g e :   ' n o n e ' ,  
 	 	 	         b a c k g r o u n d C o l o r :   o . o p t i o n s . c o l o r   | |   ' # f f f f 9 9 '  
 	 	 	 } )  
 	 	 	 . a n i m a t e ( a n i m a t i o n ,   {  
 	 	 	         q u e u e :   f a l s e ,  
 	 	 	         d u r a t i o n :   o . d u r a t i o n ,  
 	 	 	         e a s i n g :   o . 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 ( )   {  
 	 	 	                 ( m o d e   = =   ' h i d e '   & &   e l e m . h i d e ( ) ) ;  
 	 	 	                 $ . e f f e c t s . r e s t o r e ( e l e m ,   p r o p s ) ;  
 	 	 	                 ( m o d e   = =   ' s h o w '   & &   ! $ . s u p p o r t . o p a c i t y   & &   t h i s . 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 ' ) ) ;  
 	 	 	                 ( o . c a l l b a c k   & &   o . c a l l b a c k . a p p l y ( t h i s ,   a r g u m e n t s ) ) ;  
 	 	 	                 e l e m . d e q u e u e ( ) ;  
 	 	 	         }  
 	 	 	 } ) ;  
                 } ) ;  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   E f f e c t s   P u l s a t e   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / E f f e c t s / P u l s a t e  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . e f f e c t s . c o r e . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . e f f e c t s . p u l s a t e   =   f u n c t i o n ( o )   {  
                 r e t u r n   t h i s . q u e u e ( f u n c t i o n ( )   {  
                         v a r   e l e m   =   $ ( t h i s ) ,  
 	 	 	 m o d e   =   $ . e f f e c t s . s e t M o d e ( e l e m ,   o . o p t i o n s . m o d e   | |   ' s h o w ' ) ;  
                         t i m e s   =   ( ( o . o p t i o n s . t i m e s   | |   5 )   *   2 )   -   1 ;  
                         d u r a t i o n   =   o . d u r a t i o n   ?   o . d u r a t i o n   /   2   :   $ . f x . s p e e d s . _ d e f a u l t   /   2 ,  
 	 	 	 i s V i s i b l e   =   e l e m . i s ( ' : v i s i b l e ' ) ,  
 	 	 	 a n i m a t e T o   =   0 ;  
  
                         i f   ( ! i s V i s i b l e )   {  
                                 e l e m . c s s ( ' o p a c i t y ' ,   0 ) . s h o w ( ) ;  
                                 a n i m a t e T o   =   1 ;  
                         }  
  
                         i f   ( ( m o d e   = =   ' h i d e '   & &   i s V i s i b l e )   | |   ( m o d e   = =   ' s h o w '   & &   ! i s V i s i b l e ) )   {  
                                 t i m e s - - ;  
                         }  
  
                         f o r   ( v a r   i   =   0 ;   i   <   t i m e s ;   i + + )   {  
                                 e l e m . a n i m a t e ( {   o p a c i t y :   a n i m a t e T o   } ,   d u r a t i o n ,   o . o p t i o n s . e a s i n g ) ;  
                                 a n i m a t e T o   =   ( a n i m a t e T o   +   1 )   %   2 ;  
                         }  
  
                         e l e m . a n i m a t e ( {   o p a c i t y :   a n i m a t e T o   } ,   d u r a t i o n ,   o . o p t i o n s . e a s i n g ,   f u n c t i o n ( )   {  
                                 i f   ( a n i m a t e T o   = =   0 )   {  
                                         e l e m . h i d e ( ) ;  
                                 }  
                                 ( o . c a l l b a c k   & &   o . c a l l b a c k . a p p l y ( t h i s ,   a r g u m e n t s ) ) ;  
                         } ) ;  
  
                         e l e m  
 	 	 	 . q u e u e ( ' f x ' ,   f u n c t i o n ( )   {   e l e m . d e q u e u e ( ) ;   } )  
 	 	 	 . d e q u e u e ( ) ;  
                 } ) ;  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   E f f e c t s   S c a l e   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / E f f e c t s / S c a l e  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . e f f e c t s . c o r e . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . e f f e c t s . p u f f   =   f u n c t i o n ( o )   {  
                 r e t u r n   t h i s . q u e u e ( f u n c t i o n ( )   {  
                         v a r   e l e m   =   $ ( t h i s ) ,  
 	 	 	 m o d e   =   $ . e f f e c t s . s e t M o d e ( e l e m ,   o . o p t i o n s . m o d e   | |   ' h i d e ' ) ,  
 	 	 	 p e r c e n t   =   p a r s e I n t ( o . o p t i o n s . p e r c e n t ,   1 0 )   | |   1 5 0 ,  
 	 	 	 f a c t o r   =   p e r c e n t   /   1 0 0 ,  
 	 	 	 o r i g i n a l   =   {   h e i g h t :   e l e m . h e i g h t ( ) ,   w i d t h :   e l e m . w i d t h ( )   } ;  
  
                         $ . e x t e n d ( o . o p t i o n s ,   {  
                                 f a d e :   t r u e ,  
                                 m o d e :   m o d e ,  
                                 p e r c e n t :   m o d e   = =   ' h i d e '   ?   p e r c e n t   :   1 0 0 ,  
                                 f r o m :   m o d e   = =   ' h i d e '  
 	 	 	 	 ?   o r i g i n a l  
 	 	 	 	 :   {  
 	 	 	 	         h e i g h t :   o r i g i n a l . h e i g h t   *   f a c t o r ,  
 	 	 	 	         w i d t h :   o r i g i n a l . w i d t h   *   f a c t o r  
 	 	 	 	 }  
                         } ) ;  
  
                         e l e m . e f f e c t ( ' s c a l e ' ,   o . o p t i o n s ,   o . d u r a t i o n ,   o . c a l l b a c k ) ;  
                         e l e m . d e q u e u e ( ) ;  
                 } ) ;  
         } ;  
  
         $ . e f f e c t s . s c a l e   =   f u n c t i o n ( o )   {  
  
                 r e t u r n   t h i s . q u e u e ( f u n c t i o n ( )   {  
  
                         / /   C r e a t e   e l e m e n t  
                         v a r   e l   =   $ ( t h i s ) ;  
  
                         / /   S e t   o p t i o n s  
                         v a r   o p t i o n s   =   $ . e x t e n d ( t r u e ,   { } ,   o . o p t i o n s ) ;  
                         v a r   m o d e   =   $ . e f f e c t s . s e t M o d e ( e l ,   o . o p t i o n s . m o d e   | |   ' e f f e c t ' ) ;   / /   S e t   M o d e  
                         v a r   p e r c e n t   =   p a r s e I n t ( o . o p t i o n s . p e r c e n t ,   1 0 )   | |   ( p a r s e I n t ( o . o p t i o n s . p e r c e n t ,   1 0 )   = =   0   ?   0   :   ( m o d e   = =   ' h i d e '   ?   0   :   1 0 0 ) ) ;   / /   S e t   d e f a u l t   s c a l i n g   p e r c e n t  
                         v a r   d i r e c t i o n   =   o . o p t i o n s . d i r e c t i o n   | |   ' b o t h ' ;   / /   S e t   d e f a u l t   a x i s  
                         v a r   o r i g i n   =   o . o p t i o n s . o r i g i n ;   / /   T h e   o r i g i n   o f   t h e   s c a l i n g  
                         i f   ( m o d e   ! =   ' e f f e c t ' )   {   / /   S e t   d e f a u l t   o r i g i n   a n d   r e s t o r e   f o r   s h o w / h i d e  
                                 o p t i o n s . o r i g i n   =   o r i g i n   | |   [ ' m i d d l e ' ,   ' c e n t e r ' ] ;  
                                 o p t i o n s . r e s t o r e   =   t r u e ;  
                         }  
                         v a r   o r i g i n a l   =   {   h e i g h t :   e l . h e i g h t ( ) ,   w i d t h :   e l . w i d t h ( )   } ;   / /   S a v e   o r i g i n a l  
                         e l . f r o m   =   o . o p t i o n s . f r o m   | |   ( m o d e   = =   ' s h o w '   ?   {   h e i g h t :   0 ,   w i d t h :   0 }   :   o r i g i n a l ) ;   / /   D e f a u l t   f r o m   s t a t e  
  
                         / /   A d j u s t  
                         v a r   f a c t o r   =   {   / /   S e t   s c a l i n g   f a c t o r  
                                 y :   d i r e c t i o n   ! =   ' h o r i z o n t a l '   ?   ( p e r c e n t   /   1 0 0 )   :   1 ,  
                                 x :   d i r e c t i o n   ! =   ' v e r t i c a l '   ?   ( p e r c e n t   /   1 0 0 )   :   1  
                         } ;  
                         e l . t o   =   {   h e i g h t :   o r i g i n a l . h e i g h t   *   f a c t o r . y ,   w i d t h :   o r i g i n a l . w i d t h   *   f a c t o r . x   } ;   / /   S e t   t o   s t a t e  
  
                         i f   ( o . o p t i o n s . f a d e )   {   / /   F a d e   o p t i o n   t o   s u p p o r t   p u f f  
                                 i f   ( m o d e   = =   ' s h o w ' )   {   e l . f r o m . o p a c i t y   =   0 ;   e l . t o . o p a c i t y   =   1 ;   } ;  
                                 i f   ( m o d e   = =   ' h i d e ' )   {   e l . f r o m . o p a c i t y   =   1 ;   e l . t o . o p a c i t y   =   0 ;   } ;  
                         } ;  
  
                         / /   A n i m a t i o n  
                         o p t i o n s . f r o m   =   e l . f r o m ;   o p t i o n s . t o   =   e l . t o ;   o p t i o n s . m o d e   =   m o d e ;  
  
                         / /   A n i m a t e  
                         e l . e f f e c t ( ' s i z e ' ,   o p t i o n s ,   o . d u r a t i o n ,   o . c a l l b a c k ) ;  
                         e l . d e q u e u e ( ) ;  
                 } ) ;  
  
         } ;  
  
         $ . e f f e c t s . s i z e   =   f u n c t i o n ( o )   {  
  
                 r e t u r n   t h i s . q u e u e ( f u n c t i o n ( )   {  
  
                         / /   C r e a t e   e l e m e n t  
                         v a r   e l   =   $ ( t h i s ) ,   p r o p s   =   [ ' p o s i t i o n ' ,   ' t o p ' ,   ' b o t t o m ' ,   ' l e f t ' ,   ' r i g h t ' ,   ' w i d t h ' ,   ' h e i g h t ' ,   ' o v e r f l o w ' ,   ' o p a c i t y ' ] ;  
                         v a r   p r o p s 1   =   [ ' p o s i t i o n ' ,   ' t o p ' ,   ' b o t t o m ' ,   ' l e f t ' ,   ' r i g h t ' ,   ' o v e r f l o w ' ,   ' o p a c i t y ' ] ;   / /   A l w a y s   r e s t o r e  
                         v a r   p r o p s 2   =   [ ' w i d t h ' ,   ' h e i g h t ' ,   ' o v e r f l o w ' ] ;   / /   C o p y   f o r   c h i l d r e n  
                         v a r   c P r o p s   =   [ ' f o n t S i z e ' ] ;  
                         v a r   v P r o p s   =   [ ' b o r d e r T o p W i d t h ' ,   ' b o r d e r B o t t o m W i d t h ' ,   ' p a d d i n g T o p ' ,   ' p a d d i n g B o t t o m ' ] ;  
                         v a r   h P r o p s   =   [ ' b o r d e r L e f t W i d t h ' ,   ' b o r d e r R i g h t W i d t h ' ,   ' p a d d i n g L e f t ' ,   ' p a d d i n g R i g h t ' ] ;  
  
                         / /   S e t   o p t i o n s  
                         v a r   m o d e   =   $ . e f f e c t s . s e t M o d e ( e l ,   o . o p t i o n s . m o d e   | |   ' e f f e c t ' ) ;   / /   S e t   M o d e  
                         v a r   r e s t o r e   =   o . o p t i o n s . r e s t o r e   | |   f a l s e ;   / /   D e f a u l t   r e s t o r e  
                         v a r   s c a l e   =   o . o p t i o n s . s c a l e   | |   ' b o t h ' ;   / /   D e f a u l t   s c a l e   m o d e  
                         v a r   o r i g i n   =   o . o p t i o n s . o r i g i n ;   / /   T h e   o r i g i n   o f   t h e   s i z i n g  
                         v a r   o r i g i n a l   =   {   h e i g h t :   e l . h e i g h t ( ) ,   w i d t h :   e l . w i d t h ( )   } ;   / /   S a v e   o r i g i n a l  
                         e l . f r o m   =   o . o p t i o n s . f r o m   | |   o r i g i n a l ;   / /   D e f a u l t   f r o m   s t a t e  
                         e l . t o   =   o . o p t i o n s . t o   | |   o r i g i n a l ;   / /   D e f a u l t   t o   s t a t e  
                         / /   A d j u s t  
                         i f   ( o r i g i n )   {   / /   C a l c u l a t e   b a s e l i n e   s h i f t s  
                                 v a r   b a s e l i n e   =   $ . e f f e c t s . g e t B a s e l i n e ( o r i g i n ,   o r i g i n a l ) ;  
                                 e l . f r o m . t o p   =   ( o r i g i n a l . h e i g h t   -   e l . f r o m . h e i g h t )   *   b a s e l i n e . y ;  
                                 e l . f r o m . l e f t   =   ( o r i g i n a l . w i d t h   -   e l . f r o m . w i d t h )   *   b a s e l i n e . x ;  
                                 e l . t o . t o p   =   ( o r i g i n a l . h e i g h t   -   e l . t o . h e i g h t )   *   b a s e l i n e . y ;  
                                 e l . t o . l e f t   =   ( o r i g i n a l . w i d t h   -   e l . t o . w i d t h )   *   b a s e l i n e . x ;  
                         } ;  
                         v a r   f a c t o r   =   {   / /   S e t   s c a l i n g   f a c t o r  
                                 f r o m :   {   y :   e l . f r o m . h e i g h t   /   o r i g i n a l . h e i g h t ,   x :   e l . f r o m . w i d t h   /   o r i g i n a l . w i d t h   } ,  
                                 t o :   {   y :   e l . t o . h e i g h t   /   o r i g i n a l . h e i g h t ,   x :   e l . t o . w i d t h   /   o r i g i n a l . w i d t h   }  
                         } ;  
                         i f   ( s c a l e   = =   ' b o x '   | |   s c a l e   = =   ' b o t h ' )   {   / /   S c a l e   t h e   c s s   b o x  
                                 i f   ( f a c t o r . f r o m . y   ! =   f a c t o r . t o . y )   {   / /   V e r t i c a l   p r o p s   s c a l i n g  
                                         p r o p s   =   p r o p s . c o n c a t ( v P r o p s ) ;  
                                         e l . f r o m   =   $ . e f f e c t s . s e t T r a n s i t i o n ( e l ,   v P r o p s ,   f a c t o r . f r o m . y ,   e l . f r o m ) ;  
                                         e l . t o   =   $ . e f f e c t s . s e t T r a n s i t i o n ( e l ,   v P r o p s ,   f a c t o r . t o . y ,   e l . t o ) ;  
                                 } ;  
                                 i f   ( f a c t o r . f r o m . x   ! =   f a c t o r . t o . x )   {   / /   H o r i z o n t a l   p r o p s   s c a l i n g  
                                         p r o p s   =   p r o p s . c o n c a t ( h P r o p s ) ;  
                                         e l . f r o m   =   $ . e f f e c t s . s e t T r a n s i t i o n ( e l ,   h P r o p s ,   f a c t o r . f r o m . x ,   e l . f r o m ) ;  
                                         e l . t o   =   $ . e f f e c t s . s e t T r a n s i t i o n ( e l ,   h P r o p s ,   f a c t o r . t o . x ,   e l . t o ) ;  
                                 } ;  
                         } ;  
                         i f   ( s c a l e   = =   ' c o n t e n t '   | |   s c a l e   = =   ' b o t h ' )   {   / /   S c a l e   t h e   c o n t e n t  
                                 i f   ( f a c t o r . f r o m . y   ! =   f a c t o r . t o . y )   {   / /   V e r t i c a l   p r o p s   s c a l i n g  
                                         p r o p s   =   p r o p s . c o n c a t ( c P r o p s ) ;  
                                         e l . f r o m   =   $ . e f f e c t s . s e t T r a n s i t i o n ( e l ,   c P r o p s ,   f a c t o r . f r o m . y ,   e l . f r o m ) ;  
                                         e l . t o   =   $ . e f f e c t s . s e t T r a n s i t i o n ( e l ,   c P r o p s ,   f a c t o r . t o . y ,   e l . t o ) ;  
                                 } ;  
                         } ;  
                         $ . e f f e c t s . s a v e ( e l ,   r e s t o r e   ?   p r o p s   :   p r o p s 1 ) ;   e l . s h o w ( ) ;   / /   S a v e   &   S h o w  
                         $ . e f f e c t s . c r e a t e W r a p p e r ( e l ) ;   / /   C r e a t e   W r a p p e r  
                         e l . c s s ( ' o v e r f l o w ' ,   ' h i d d e n ' ) . c s s ( e l . f r o m ) ;   / /   S h i f t  
  
                         / /   A n i m a t e  
                         i f   ( s c a l e   = =   ' c o n t e n t '   | |   s c a l e   = =   ' b o t h ' )   {   / /   S c a l e   t h e   c h i l d r e n  
                                 v P r o p s   =   v P r o p s . c o n c a t ( [ ' m a r g i n T o p ' ,   ' m a r g i n B o t t o m ' ] ) . c o n c a t ( c P r o p s ) ;   / /   A d d   m a r g i n s / f o n t - s i z e  
                                 h P r o p s   =   h P r o p s . c o n c a t ( [ ' m a r g i n L e f t ' ,   ' m a r g i n R i g h t ' ] ) ;   / /   A d d   m a r g i n s  
                                 p r o p s 2   =   p r o p s . c o n c a t ( v P r o p s ) . c o n c a t ( h P r o p s ) ;   / /   C o n c a t  
                                 e l . f i n d ( " * [ w i d t h ] " ) . e a c h ( f u n c t i o n ( )   {  
                                         c h i l d   =   $ ( t h i s ) ;  
                                         i f   ( r e s t o r e )   $ . e f f e c t s . s a v e ( c h i l d ,   p r o p s 2 ) ;  
                                         v a r   c _ o r i g i n a l   =   {   h e i g h t :   c h i l d . h e i g h t ( ) ,   w i d t h :   c h i l d . w i d t h ( )   } ;   / /   S a v e   o r i g i n a l  
                                         c h i l d . f r o m   =   {   h e i g h t :   c _ o r i g i n a l . h e i g h t   *   f a c t o r . f r o m . y ,   w i d t h :   c _ o r i g i n a l . w i d t h   *   f a c t o r . f r o m . x   } ;  
                                         c h i l d . t o   =   {   h e i g h t :   c _ o r i g i n a l . h e i g h t   *   f a c t o r . t o . y ,   w i d t h :   c _ o r i g i n a l . w i d t h   *   f a c t o r . t o . x   } ;  
                                         i f   ( f a c t o r . f r o m . y   ! =   f a c t o r . t o . y )   {   / /   V e r t i c a l   p r o p s   s c a l i n g  
                                                 c h i l d . f r o m   =   $ . e f f e c t s . s e t T r a n s i t i o n ( c h i l d ,   v P r o p s ,   f a c t o r . f r o m . y ,   c h i l d . f r o m ) ;  
                                                 c h i l d . t o   =   $ . e f f e c t s . s e t T r a n s i t i o n ( c h i l d ,   v P r o p s ,   f a c t o r . t o . y ,   c h i l d . t o ) ;  
                                         } ;  
                                         i f   ( f a c t o r . f r o m . x   ! =   f a c t o r . t o . x )   {   / /   H o r i z o n t a l   p r o p s   s c a l i n g  
                                                 c h i l d . f r o m   =   $ . e f f e c t s . s e t T r a n s i t i o n ( c h i l d ,   h P r o p s ,   f a c t o r . f r o m . x ,   c h i l d . f r o m ) ;  
                                                 c h i l d . t o   =   $ . e f f e c t s . s e t T r a n s i t i o n ( c h i l d ,   h P r o p s ,   f a c t o r . t o . x ,   c h i l d . t o ) ;  
                                         } ;  
                                         c h i l d . c s s ( c h i l d . f r o m ) ;   / /   S h i f t   c h i l d r e n  
                                         c h i l d . a n i m a t e ( c h i l d . t o ,   o . d u r a t i o n ,   o . o p t i o n s . e a s i n g ,   f u n c t i o n ( )   {  
                                                 i f   ( r e s t o r e )   $ . e f f e c t s . r e s t o r e ( c h i l d ,   p r o p s 2 ) ;   / /   R e s t o r e   c h i l d r e n  
                                         } ) ;   / /   A n i m a t e   c h i l d r e n  
                                 } ) ;  
                         } ;  
  
                         / /   A n i m a t e  
                         e l . a n i m a t e ( e l . t o ,   {   q u e u e :   f a l s e ,   d u r a t i o n :   o . d u r a t i o n ,   e a s i n g :   o . 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   ( e l . t o . o p a c i t y   = = =   0 )   {  
                                         e l . c s s ( ' o p a c i t y ' ,   e l . f r o m . o p a c i t y ) ;  
                                 }  
                                 i f   ( m o d e   = =   ' h i d e ' )   e l . h i d e ( ) ;   / /   H i d e  
                                 $ . e f f e c t s . r e s t o r e ( e l ,   r e s t o r e   ?   p r o p s   :   p r o p s 1 ) ;   $ . e f f e c t s . r e m o v e W r a p p e r ( e l ) ;   / /   R e s t o r e  
                                 i f   ( o . c a l l b a c k )   o . c a l l b a c k . a p p l y ( t h i s ,   a r g u m e n t s ) ;   / /   C a l l b a c k  
                                 e l . d e q u e u e ( ) ;  
                         }    
                         } ) ;  
  
                 } ) ;  
  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   E f f e c t s   S h a k e   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / E f f e c t s / S h a k e  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . e f f e c t s . c o r e . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . e f f e c t s . s h a k e   =   f u n c t i o n ( o )   {  
  
                 r e t u r n   t h i s . q u e u e ( f u n c t i o n ( )   {  
  
                         / /   C r e a t e   e l e m e n t  
                         v a r   e l   =   $ ( t h i s ) ,   p r o p s   =   [ ' p o s i t i o n ' ,   ' t o p ' ,   ' b o t t o m ' ,   ' l e f t ' ,   ' r i g h t ' ] ;  
  
                         / /   S e t   o p t i o n s  
                         v a r   m o d e   =   $ . e f f e c t s . s e t M o d e ( e l ,   o . o p t i o n s . m o d e   | |   ' e f f e c t ' ) ;   / /   S e t   M o d e  
                         v a r   d i r e c t i o n   =   o . o p t i o n s . d i r e c t i o n   | |   ' l e f t ' ;   / /   D e f a u l t   d i r e c t i o n  
                         v a r   d i s t a n c e   =   o . o p t i o n s . d i s t a n c e   | |   2 0 ;   / /   D e f a u l t   d i s t a n c e  
                         v a r   t i m e s   =   o . o p t i o n s . t i m e s   | |   3 ;   / /   D e f a u l t   #   o f   t i m e s  
                         v a r   s p e e d   =   o . d u r a t i o n   | |   o . o p t i o n s . d u r a t i o n   | |   1 4 0 ;   / /   D e f a u l t   s p e e d   p e r   s h a k e  
  
                         / /   A d j u s t  
                         $ . e f f e c t s . s a v e ( e l ,   p r o p s ) ;   e l . s h o w ( ) ;   / /   S a v e   &   S h o w  
                         $ . e f f e c t s . c r e a t e W r a p p e r ( e l ) ;   / /   C r e a t e   W r a p p e r  
                         v a r   r e f   =   ( d i r e c t i o n   = =   ' u p '   | |   d i r e c t i o n   = =   ' d o w n ' )   ?   ' t o p '   :   ' l e f t ' ;  
                         v a r   m o t i o n   =   ( d i r e c t i o n   = =   ' u p '   | |   d i r e c t i o n   = =   ' l e f t ' )   ?   ' p o s '   :   ' n e g ' ;  
  
                         / /   A n i m a t i o n  
                         v a r   a n i m a t i o n   =   { } ,   a n i m a t i o n 1   =   { } ,   a n i m a t i o n 2   =   { } ;  
                         a n i m a t i o n [ r e f ]   =   ( m o t i o n   = =   ' p o s '   ?   ' - = '   :   ' + = ' )   +   d i s t a n c e ;  
                         a n i m a t i o n 1 [ r e f ]   =   ( m o t i o n   = =   ' p o s '   ?   ' + = '   :   ' - = ' )   +   d i s t a n c e   *   2 ;  
                         a n i m a t i o n 2 [ r e f ]   =   ( m o t i o n   = =   ' p o s '   ?   ' - = '   :   ' + = ' )   +   d i s t a n c e   *   2 ;  
  
                         / /   A n i m a t e  
                         e l . a n i m a t e ( a n i m a t i o n ,   s p e e d ,   o . o p t i o n s . e a s i n g ) ;  
                         f o r   ( v a r   i   =   1 ;   i   <   t i m e s ;   i + + )   {   / /   S h a k e s  
                                 e l . a n i m a t e ( a n i m a t i o n 1 ,   s p e e d ,   o . o p t i o n s . e a s i n g ) . a n i m a t e ( a n i m a t i o n 2 ,   s p e e d ,   o . o p t i o n s . e a s i n g ) ;  
                         } ;  
                         e l . a n i m a t e ( a n i m a t i o n 1 ,   s p e e d ,   o . o p t i o n s . e a s i n g ) .  
 	 	 a n i m a t e ( a n i m a t i o n ,   s p e e d   /   2 ,   o . o p t i o n s . e a s i n g ,   f u n c t i o n ( )   {   / /   L a s t   s h a k e  
 	 	         $ . e f f e c t s . r e s t o r e ( e l ,   p r o p s ) ;   $ . e f f e c t s . r e m o v e W r a p p e r ( e l ) ;   / /   R e s t o r e  
 	 	         i f   ( o . c a l l b a c k )   o . c a l l b a c k . a p p l y ( t h i s ,   a r g u m e n t s ) ;   / /   C a l l b a c k  
 	 	 } ) ;  
                         e l . q u e u e ( ' f x ' ,   f u n c t i o n ( )   {   e l . d e q u e u e ( ) ;   } ) ;  
                         e l . d e q u e u e ( ) ;  
                 } ) ;  
  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   E f f e c t s   S l i d e   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / E f f e c t s / S l i d e  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . e f f e c t s . c o r e . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . e f f e c t s . s l i d e   =   f u n c t i o n ( o )   {  
  
                 r e t u r n   t h i s . q u e u e ( f u n c t i o n ( )   {  
  
                         / /   C r e a t e   e l e m e n t  
                         v a r   e l   =   $ ( t h i s ) ,   p r o p s   =   [ ' p o s i t i o n ' ,   ' t o p ' ,   ' b o t t o m ' ,   ' l e f t ' ,   ' r i g h t ' ] ;  
  
                         / /   S e t   o p t i o n s  
                         v a r   m o d e   =   $ . e f f e c t s . s e t M o d e ( e l ,   o . o p t i o n s . m o d e   | |   ' s h o w ' ) ;   / /   S e t   M o d e  
                         v a r   d i r e c t i o n   =   o . o p t i o n s . d i r e c t i o n   | |   ' l e f t ' ;   / /   D e f a u l t   D i r e c t i o n  
  
                         / /   A d j u s t  
                         $ . e f f e c t s . s a v e ( e l ,   p r o p s ) ;   e l . s h o w ( ) ;   / /   S a v e   &   S h o w  
                         $ . e f f e c t s . c r e a t e W r a p p e r ( e l ) . c s s ( {   o v e r f l o w :   ' h i d d e n '   } ) ;   / /   C r e a t e   W r a p p e r  
                         v a r   r e f   =   ( d i r e c t i o n   = =   ' u p '   | |   d i r e c t i o n   = =   ' d o w n ' )   ?   ' t o p '   :   ' l e f t ' ;  
                         v a r   m o t i o n   =   ( d i r e c t i o n   = =   ' u p '   | |   d i r e c t i o n   = =   ' l e f t ' )   ?   ' p o s '   :   ' n e g ' ;  
                         v a r   d i s t a n c e   =   o . o p t i o n s . d i s t a n c e   | |   ( r e f   = =   ' t o p '   ?   e l . o u t e r H e i g h t ( {   m a r g i n :   t r u e   } )   :   e l . o u t e r W i d t h ( {   m a r g i n :   t r u e   } ) ) ;  
                         i f   ( m o d e   = =   ' s h o w ' )   e l . c s s ( r e f ,   m o t i o n   = =   ' p o s '   ?   ( i s N a N ( d i s t a n c e )   ?   " - "   +   d i s t a n c e   :   - d i s t a n c e )   :   d i s t a n c e ) ;   / /   S h i f t  
  
                         / /   A n i m a t i o n  
                         v a r   a n i m a t i o n   =   { } ;  
                         a n i m a t i o n [ r e f ]   =   ( m o d e   = =   ' s h o w '   ?   ( m o t i o n   = =   ' p o s '   ?   ' + = '   :   ' - = ' )   :   ( m o t i o n   = =   ' p o s '   ?   ' - = '   :   ' + = ' ) )   +   d i s t a n c e ;  
  
                         / /   A n i m a t e  
                         e l . a n i m a t e ( a n i m a t i o n ,   {   q u e u e :   f a l s e ,   d u r a t i o n :   o . d u r a t i o n ,   e a s i n g :   o . 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   ( m o d e   = =   ' h i d e ' )   e l . h i d e ( ) ;   / /   H i d e  
                                 $ . e f f e c t s . r e s t o r e ( e l ,   p r o p s ) ;   $ . e f f e c t s . r e m o v e W r a p p e r ( e l ) ;   / /   R e s t o r e  
                                 i f   ( o . c a l l b a c k )   o . c a l l b a c k . a p p l y ( t h i s ,   a r g u m e n t s ) ;   / /   C a l l b a c k  
                                 e l . d e q u e u e ( ) ;  
                         }    
                         } ) ;  
  
                 } ) ;  
  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   E f f e c t s   T r a n s f e r   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / E f f e c t s / T r a n s f e r  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . e f f e c t s . c o r e . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . e f f e c t s . t r a n s f e r   =   f u n c t i o n ( o )   {  
                 r e t u r n   t h i s . q u e u e ( f u n c t i o n ( )   {  
                         v a r   e l e m   =   $ ( t h i s ) ,  
 	 	 	 t a r g e t   =   $ ( o . o p t i o n s . t o ) ,  
 	 	 	 e n d P o s i t i o n   =   t a r g e t . o f f s e t ( ) ,  
 	 	 	 a n i m a t i o n   =   {  
 	 	 	         t o p :   e n d P o s i t i o n . t o p ,  
 	 	 	         l e f t :   e n d P o s i t i o n . l e f t ,  
 	 	 	         h e i g h t :   t a r g e t . i n n e r H e i g h t ( ) ,  
 	 	 	         w i d t h :   t a r g e t . i n n e r W i d t h ( )  
 	 	 	 } ,  
 	 	 	 s t a r t P o s i t i o n   =   e l e m . o f f s e t ( ) ,  
 	 	 	 t r a n s f e r   =   $ ( ' < d i v   c l a s s = " u i - e f f e c t s - t r a n s f e r " > < / d i v > ' )  
 	 	 	 	 . a p p e n d T o ( d o c u m e n t . b o d y )  
 	 	 	 	 . a d d C l a s s ( o . o p t i o n s . c l a s s N a m e )  
 	 	 	 	 . c s s ( {  
 	 	 	 	         t o p :   s t a r t P o s i t i o n . t o p ,  
 	 	 	 	         l e f t :   s t a r t P o s i t i o n . l e f t ,  
 	 	 	 	         h e i g h t :   e l e m . i n n e r H e i g h t ( ) ,  
 	 	 	 	         w i d t h :   e l e m . i n n e r W i d t h ( ) ,  
 	 	 	 	         p o s i t i o n :   ' a b s o l u t e '  
 	 	 	 	 } )  
 	 	 	 	 . a n i m a t e ( a n i m a t i o n ,   o . d u r a t i o n ,   o . o p t i o n s . e a s i n g ,   f u n c t i o n ( )   {  
 	 	 	 	         t r a n s f e r . r e m o v e ( ) ;  
 	 	 	 	         ( o . c a l l b a c k   & &   o . c a l l b a c k . a p p l y ( e l e m [ 0 ] ,   a r g u m e n t s ) ) ;  
 	 	 	 	         e l e m . d e q u e u e ( ) ;  
 	 	 	 	 } ) ;  
                 } ) ;  
         } ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   A c c o r d i o n   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   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 :  
 * 	 j q u e r y . u i . c o r e . j s  
 * 	 j q u e r y . u i . w i d g e t . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         $ . w i d g e t ( " u i . a c c o r d i o n " ,   {  
                 o p t i o n s :   {  
                         a c t i v e :   0 ,  
                         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 ( ) ;  
                         }  
                 } ,  
  
                 _ c r e a t e :   f u n c t i o n ( )   {  
                         v a r   s e l f   =   t h i s ,  
 	 	 	 o p t i o n s   =   s e l f . o p t i o n s ;  
  
                         s e l f . r u n n i n g   =   0 ;  
  
                         s e l f . 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  
 	 	 	 . 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 " ) ;  
  
                         s e l f . h e a d e r s   =   s e l f . e l e m e n t . f i n d ( o p t i o n s . 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 ( )   {  
 	 	 	         i f   ( o p t i o n s . d i s a b l e d )   {  
 	 	 	                 r e t u r 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 ( )   {  
 	 	 	         i f   ( o p t i o n s . d i s a b l e d )   {  
 	 	 	                 r e t u r 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 ( )   {  
 	 	 	         i f   ( o p t i o n s . d i s a b l e d )   {  
 	 	 	                 r e t u r 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 ( )   {  
 	 	 	         i f   ( o p t i o n s . d i s a b l e d )   {  
 	 	 	                 r e t u r 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 " ) ;  
 	 	 	 } ) ;  
  
                         s e l f . 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 " ) ;  
  
                         i f   ( o p t i o n s . n a v i g a t i o n )   {  
                                 v a r   c u r r e n t   =   s e l f . e l e m e n t . f i n d ( " a " ) . f i l t e r ( o p t i o n s . n a v i g a t i o n F i l t e r ) . e q ( 0 ) ;  
                                 i f   ( c u r r e n t . l e n g t h )   {  
                                         v a r   h e a d e r   =   c u r r e n t . c l o s e s t ( " . u i - a c c o r d i o n - h e a d e r " ) ;  
                                         i f   ( h e a d e r . l e n g t h )   {  
                                                 / /   a n c h o r   w i t h i n   h e a d e r  
                                                 s e l f . a c t i v e   =   h e a d e r ;  
                                         }   e l s e   {  
                                                 / /   a n c h o r   w i t h i n   c o n t e n t  
                                                 s e l f . a c t i v e   =   c u r r e n t . c l o s e s t ( " . u i - a c c o r d i o n - c o n t e n t " ) . p r e v ( ) ;  
                                         }  
                                 }  
                         }  
  
                         s e l f . a c t i v e   =   s e l f . _ f i n d A c t i v e ( s e l f . a c t i v e   | |   o p t i o n s . a c t i v e )  
 	 	 	 . a d d C l a s s ( " u i - s t a t e - d e f a u l t   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 " ) ;  
                         s e l f . 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 " ) ;  
  
                         s e l f . _ c r e a t e I c o n s ( ) ;  
                         s e l f . r e s i z e ( ) ;  
  
                         / /   A R I A  
                         s e l f . e l e m e n t . a t t r ( " r o l e " ,   " t a b l i s t " ) ;  
  
                         s e l f . 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 . 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 . _ 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 " ) ;  
  
                         s e l f . h e a d e r s  
 	 	 	 . n o t ( s e l f . 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 " ,  
 	 	 	         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   ( ! s e l f . a c t i v e . l e n g t h )   {  
                                 s e l f . 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   {  
                                 s e l f . 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 " ,  
 	 	 	 	         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 )   {  
                                 s e l f . 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 p t i o n s . e v e n t )   {  
                                 s e l f . h e a d e r s . b i n d ( o p t i o n s . e v e n t . s p l i t ( "   " ) . j o i n ( " . a c c o r d i o n   " )   +   " . a c c o r d i o n " ,   f u n c t i o n ( e v e n t )   {  
                                         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 ) ;  
                                         e v e n t . p r e v e n t D e f a u l t ( ) ;  
                                 } ) ;  
                         }  
                 } ,  
  
                 _ c r e a t e I c o n s :   f u n c t i o n ( )   {  
                         v a r   o p t i o n s   =   t h i s . o p t i o n s ;  
                         i f   ( o p t i o n s . i c o n s )   {  
                                 $ ( " < s p a n > < / s p a n > " )  
 	 	 	 	 . a d d C l a s s ( " u i - i c o n   "   +   o p t i o n s . 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 . c h i l d r e n ( " . u i - i c o n " )  
 	 	 	 	 . t o g g l e C l a s s ( o p t i o n s . i c o n s . h e a d e r )  
 	 	 	 	 . t o g g l e C l a s s ( o p t i o n s . i c o n s . h e a d e r S e l e c t e d ) ;  
                                 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 - i c o n s " ) ;  
                         }  
                 } ,  
  
                 _ d e s t r o y I c o n s :   f u n c t i o n ( )   {  
                         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 ( ) ;  
                         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 - i c o n s " ) ;  
                 } ,  
  
                 d e s t r o y :   f u n c t i o n ( )   {  
                         v a r   o p t i o n s   =   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 " ) ;  
  
                         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 - a c c o r d i o n - d i s a b l e d   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 - s t a t e - d i s a b l e d   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 . _ d e s t r o y I c o n s ( ) ;  
                         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   u i - a c c o r d i o n - d i s a b l e d   u i - s t a t e - d i s a b l e d " ) ;  
                         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 . 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 " ,   " " ) ;  
                         }  
  
                         r e t u r n   $ . W i d g e t . p r o t o t y p e . d e s t r o y . c a l l ( t h i s ) ;  
                 } ,  
  
                 _ s e t O p t i o n :   f u n c t i o n ( k e y ,   v a l u e )   {  
                         $ . W i d g e t . p r o t o t y p e . _ s e t O p t i o n . a p p l y ( t h i s ,   a r g u m e n t s ) ;  
  
                         i f   ( k e y   = =   " a c t i v e " )   {  
                                 t h i s . a c t i v a t e ( v a l u e ) ;  
                         }  
                         i f   ( k e y   = =   " i c o n s " )   {  
                                 t h i s . _ d e s t r o y I c o n s ( ) ;  
                                 i f   ( v a l u e )   {  
                                         t h i s . _ c r e a t e I c o n s ( ) ;  
                                 }  
                         }  
                         / /   # 5 3 3 2   -   o p a c i t y   d o e s n ' t   c a s c a d e   t o   p o s i t i o n e d   e l e m e n t s   i n   I E  
                         / /   s o   w e   n e e d   t o   a d d   t h e   d i s a b l e d   c l a s s   t o   t h e   h e a d e r s   a n d   p a n e l s  
                         i f   ( k e y   = =   " d i s a b l e d " )   {  
                                 t h i s . h e a d e r s . a d d ( t h i s . h e a d e r s . n e x 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 " ] (  
 	 	 	 	 	 " u i - a c c o r d i o n - d i s a b l e d   u i - s t a t e - d i s a b l e d " ) ;  
                         }  
                 } ,  
  
                 _ k e y d o w n :   f u n c t i o n ( e v e n t )   {  
                         i f   ( t h i s . o p t i o n s . 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   k e y C o d e   =   $ . u i . k e y C o d e ,  
 	 	 	 l e n g t h   =   t h i s . h e a d e r s . l e n g t h ,  
 	 	 	 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 ) ,  
 	 	 	 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 :  
                                         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 ) ;  
                                         e v e n t . p r e v e n t D e f a u l 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 p t i o n s   =   t h i s . o p t i o n s ,  
 	 	 	 m a x H e i g h t ;  
  
                         i f   ( o p t i o n s . 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 ( t r u e ) ;  
                                 } ) ;  
  
                                 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 ( )   {  
 	 	 	 	         $ ( t h i s ) . h e i g h t ( M a t h . m a x ( 0 ,   m a x H e i g h t   -  
 	 	 	 	 	 	 $ ( 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 ( ) ) ) ;  
 	 	 	 	 } )  
 	 	 	 	 . c s s ( " o v e r f l o w " ,   " a u t o " ) ;  
                         }   e l s e   i f   ( o p t i o n s . 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 ) . h e i g h t ( " " ) . h e i g h t ( ) ) ;  
 	 	 	 	 } )  
 	 	 	 	 . h e i g h t ( m a x H e i g h t ) ;  
                         }  
  
                         r e t u r n   t h i s ;  
                 } ,  
  
                 a c t i v a t e :   f u n c t i o n ( i n d e x )   {  
                         / /   T O D O   t h i s   g e t s   c a l l e d   o n   i n i t ,   c h a n g i n g   t h e   o p t i o n   w i t h o u t   a n   e x p l i c i t   c a l l   f o r   t h a t  
                         t h i s . o p t i o n s . a c t i v e   =   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 ) ;  
  
                         r e t u r n   t h i s ;  
                 } ,  
  
                 _ 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 ) " ) ;  
                 } ,  
  
                 / /   T O D O   i s n ' t   e v e n t . t a r g e t   e n o u g h ?   w h y   t h e   s e p a r a t e   t a r g e t   a r g u m e n t ?  
                 _ 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 p t i o n s   =   t h i s . o p t i o n s ;  
                         i f   ( o p t i o n s . d i s a b l e d )   {  
                                 r e t u r n ;  
                         }  
  
                         / /   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 )   {  
                                 i f   ( ! o p t i o n s . c o l l a p s i b l e )   {  
                                         r e t u r n ;  
                                 }  
                                 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 " )  
 	 	 	 	 . c h i l d r e n ( " . u i - i c o n " )  
 	 	 	 	 	 . r e m o v e C l a s s ( o p t i o n s . 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 p t i o n s . 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 p t i o n s ,  
 	 	 	 	         n e w H e a d e r :   $ ( [ ] ) ,  
 	 	 	 	         o l d H e a d e r :   o p t i o n s . 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 ;  
                         }  
  
                         / /   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 ) ,  
 	 	 	 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 ] ;  
  
                         / /   T O D O   t h e   o p t i o n   i s   c h a n g e d ,   i s   t h a t   c o r r e c t ?  
                         / /   T O D O   i f   i t   i s   c o r r e c t ,   s h o u l d n ' t   t h a t   h a p p e n   a f t e r   d e t e r m i n i n g   t h a t   t h e   c l i c k   i s   v a l i d ?  
                         o p t i o n s . a c t i v e   =   o p t i o n s . 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   ?  
 	 	 	 f a l s e   :  
 	 	 	 t h i s . h e a d e r s . i n d e x ( c l i c k e d ) ;  
  
                         / /   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 p t i o n s . 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 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   a c t i v e   =   t h i s . a c t i v e ,  
 	 	 	 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 p t i o n s ,  
 	 	 	         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 p t i o n s . 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 p t i o n s . c o l l a p s i b l e   ?   $ ( [ ] )   :   t o S h o w ,  
 	 	 	         o l d C o n t e n t :   t o H i d e  
 	 	 	 } ,  
 	 	 	 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 ] ) ;  
  
                         / /   w h e n   t h e   c a l l   t o   . _ t o g g l e ( )   c o m e s   a f t e r   t h e   c l a s s   c h a n g e s  
                         / /   i t   c a u s e s   a   v e r y   o d d   b u g   i n   I E   8   ( s e e   # 6 7 2 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 ) ;  
  
                         / /   s w i t c h   c l a s s e 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 " )  
 	 	 	 . c h i l d r e n ( " . u i - i c o n " )  
 	 	 	 	 . r e m o v e C l a s s ( o p t i o n s . 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 p t i o n s . i c o n s . h e a d e r ) ;  
                         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 " )  
 	 	 	 	 . c h i l d r e n ( " . u i - i c o n " )  
 	 	 	 	 	 . r e m o v e C l a s s ( o p t i o n s . i c o n s . h e a d e r )  
 	 	 	 	 	 . a d d C l a s s ( o p t i o n s . 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 " ) ;  
                         }  
  
                         r e t u r n ;  
                 } ,  
  
                 _ 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   s e l f   =   t h i s ,  
 	 	 	 o p t i o n s   =   s e l f . o p t i o n s ;  
  
                         s e l f . t o S h o w   =   t o S h o w ;  
                         s e l f . t o H i d e   =   t o H i d e ;  
                         s e l f . 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  
                         s e l f . _ t r i g g e r ( " c h a n g e s t a r t " ,   n u l l ,   s e l f . 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  
                         s e l f . 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 p t i o n s . 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 p t i o n s . 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 p t i o n s . a u t o H e i g h t   | |   o p t i o n s . 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 p t i o n s . a u t o H e i g h t   | |   o p t i o n s . f i l l S p a c e  
                                         } ;  
                                 }  
  
                                 i f   ( ! o p t i o n s . p r o x i e d )   {  
                                         o p t i o n s . p r o x i e d   =   o p t i o n s . a n i m a t e d ;  
                                 }  
  
                                 i f   ( ! o p t i o n s . p r o x i e d D u r a t i o n )   {  
                                         o p t i o n s . p r o x i e d D u r a t i o n   =   o p t i o n s . d u r a t i o n ;  
                                 }  
  
                                 o p t i o n s . a n i m a t e d   =   $ . i s F u n c t i o n ( o p t i o n s . p r o x i e d )   ?  
 	 	 	 	 o p t i o n s . p r o x i e d ( a n i m O p t i o n s )   :  
 	 	 	 	 o p t i o n s . p r o x i e d ;  
  
                                 o p t i o n s . d u r a t i o n   =   $ . i s F u n c t i o n ( o p t i o n s . p r o x i e d D u r a t i o n )   ?  
 	 	 	 	 o p t i o n s . 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 t i o n s . 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 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 . a n i m a t e d ;  
  
                                 i f   ( e a s i n g   & &   ! a n i m a t i o n s [ e a s i n g ]   & &   ! $ . e a s i n g [ e a s i n g ] )   {  
                                         e a s i n g   =   " s l i d e " ;  
                                 }  
                                 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 p t i o n s . 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 D O   a s s e r t   t h a t   t h e   b l u r   a n d   f o c u s   t r i g g e r s   a r e   r e a l l y   n e c e s s a r y ,   r e m o v e   o t h e r w i s 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 " ,  
 	 	 	         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 " ,  
 	 	 	         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 )   {  
                         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   ( t h i s . o p t i o n s . 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 :   " "  
                                 } ) ;  
                         }  
  
                         / /   o t h e r   c l a s s e s   a r e   r e m o v e d   b e f o r e   t h e   a n i m a t i o n ;   t h i s   o n e   n e e d s   t o   s t a y   u n t i l   c o m p l e t e d  
                         t h i s . t o H i d e . r e m o v e 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 " ) ;  
                         / /   W o r k   a r o u n d   f o r   r e n d e r i n g   b u g   i n   I E   ( # 5 4 2 1 )  
                         i f   ( t h i s . t o H i d e . l e n g t h )   {  
                                 t h i s . t o H i d e . p a r e n t ( ) [ 0 ] . c l a s s N a m e   =   t h i s . t o H i d e . p a r e n t ( ) [ 0 ] . c l a s s N a m e ;  
                         }  
  
                         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 . 8 . 1 0 " ,  
                 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 " ,  
                                                 p a d d i n g T o p :   " s h o w " ,  
                                                 p a d d i n g B o t t o m :   " 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 " ,  
                                                 p a d d i n g T o p :   " h i d e " ,  
                                                 p a d d i n g B o t t o m :   " 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   =   0 ,  
 	 	 	 	 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 . e n d   -   s e t t i n g s . s t a r t   = = =   0 )   ?   0   :  
 	 	 	 	 	 	 	 ( 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 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  
                                 } ) ;  
                         }  
                 }  
         } ) ;  
  
 } ) ( j Q u e r y ) ;  
 / *  
 *   j Q u e r y   U I   A u t o c o m p l e t e   1 . 8 . 1 0  
 *  
 *   C o p y r i g h t   2 0 1 1 ,   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   o r   G P L   V e r s i o n   2   l i c e n s e s .  
 *   h t t p : / / j q u e r y . o r g / l i c e n s e  
 *  
 *   h t t p : / / d o c s . j q u e r y . c o m / U I / A u t o c o m p l e t e  
 *  
 *   D e p e n d s :  
 * 	 j q u e r y . u i . c o r e . j s  
 * 	 j q u e r y . u i . w i d g e t . j s  
 * 	 j q u e r y . u i . p o s i t i o n . j s  
 * /  
 ( f u n c t i o n ( $ ,   u n d e f i n e d )   {  
  
         / /   u s e d   t o   p r e v e n t   r a c e   c o n d i t i o n s   w i t h   r e m o t e   d a t a   s o u r c e s  
         v a r   r e q u e s t I n d e x   =   0 ;  
  
         $ . w i d g e t ( " u i . a u t o c o m p l e t e " ,   {  
                 o p t i o n s :   {  
                         a p p e n d T o :   " b o d y " ,  
                         d e l a y :   3 0 0 ,  
                         m i n L e n g t h :   1 ,  
                         p o s i t i o n :   {  
                                 m y :   " l e f t   t o p " ,  
                                 a t :   " l e f t   b o t t o m " ,  
                                 c o l l i s i o n :   " n o n e "  
                         } ,  
                         s o u r c e :   n u l l  
                 } ,  
  
                 p e n d i n g :   0 ,  
  
                 _ c r e a t e :   f u n c t i o n ( )   {  
                         v a r   s e l f   =   t h i s ,  
 	 	 	 d o c   =   t h i s . e l e m e n t [ 0 ] . o w n e r D o c u m e n t ,  
 	 	 	 s u p p r e s s K e y P r e s s ;  
  
                         t h i s . e l e m e n t  
 	 	 	 . a d d C l a s s ( " u i - a u t o c o m p l e t e - i n p u t " )  
 	 	 	 . a t t r ( " a u t o c o m p l e t e " ,   " o f f " )  
                         / /   T O D O   v e r i f y   t h e s e   a c t u a l l y   w o r k   a s   i n t e n d e d  
 	 	 	 . a t t r ( {  
 	 	 	         r o l e :   " t e x t b o x " ,  
 	 	 	         " a r i a - a u t o c o m p l e t e " :   " l i s t " ,  
 	 	 	         " a r i a - h a s p o p u p " :   " t r u e "  
 	 	 	 } )  
 	 	 	 . b i n d ( " k e y d o w n . a u t o c o m p l e t e " ,   f u n c t i o n ( e v e n t )   {  
 	 	 	         i f   ( s e l f . o p t i o n s . d i s a b l e d   | |   s e l f . e l e m e n t . a t t r ( " r e a d o n l y " ) )   {  
 	 	 	                 r e t u r n ;  
 	 	 	         }  
  
 	 	 	         s u p p r e s s K e y P r e s s   =   f a l s e ;  
 	 	 	         v a r   k e y C o d e   =   $ . u i . k e y C o d 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 . P A G E _ U P :  
 	 	 	                         s e l f . _ m o v e ( " p r e v i o u s P a g e " ,   e v e n t ) ;  
 	 	 	                         b r e a k ;  
 	 	 	                 c a s e   k e y C o d e . P A G E _ D O W N :  
 	 	 	                         s e l f . _ m o v e ( " n e x t P a g e " ,   e v e n t ) ;  
 	 	 	                         b r e a k ;  
 	 	 	                 c a s e   k e y C o d e . U P :  
 	 	 	                         s e l f . _ m o v e ( " p r e v i o u s " ,   e v e n t ) ;  
 	 	 	                         / /   p r e v e n t   m o v i n g   c u r s o r   t o   b e g i n n i n g   o f   t e x t   f i e l d   i n   s o m e   b r o w s e r s  
 	 	 	                         e v e n t . p r e v e n t D e f a u l t ( ) ;  
 	 	 	                         b r e a k ;  
 	 	 	                 c a s e   k e y C o d e . D O W N :  
 	 	 	                         s e l f . _ m o v e ( " n e x t " ,   e v e n t ) ;  
 	 	 	                         / /   p r e v e n t   m o v i n g   c u r s o r   t o   e n d   o f   t e x t   f i e l d   i n   s o m e   b r o w s e r s  
 	 	 	                         e v e n t . p r e v e n t D e f a u l t ( ) ;  
 	 	 	                         b r e a k ;  
 	 	 	                 c a s e   k e y C o d e . E N T E R :  
 	 	 	                 c a s e   k e y C o d e . N U M P A D _ E N T E R :  
 	 	 	                         / /   w h e n   m e n u   i s   o p e n   a n d   h a s   f o c u s  
 	 	 	                         i f   ( s e l f . m e n u . a c t i v e )   {  
 	 	 	                                 / /   # 6 0 5 5   -   O p e r a   s t i l l   a l l o w s   t h e   k e y p r e s s   t o   o c c u r  
 	 	 	                                 / /   w h i c h   c a u s e s   f o r m s   t o   s u b m i t  
 	 	 	                                 s u p p r e s s K e y P r e s s   =   t r u e ;  
 	 	 	                                 e v e n t . p r e v e n t D e f a u l t ( ) ;  
 	 	 	                         }  
 	 	 	                         / / p a s s t h r o u g h   -   E N T E R   a n d   T A B   b o t h   s e l e c t   t h e   c u r r e n t   e l e m e n t  
 	 	 	                 c a s e   k e y C o d e . T A B :  
 	 	 	                         i f   ( ! s e l f . m e n u . a c t i v e )   {  
 	 	 	                                 r e t u r n ;  
 	 	 	                         }  
 	 	 	                         s e l f . m e n u . s e l e c t ( e v e n t ) ;  
 	 	 	                         b r e a k ;  
 	 	 	                 c a s e   k e y C o d e . E S C A P E :  
 	 	 	                         s e l f . e l e m e n t . v a l ( s e l f . t e r m ) ;  
 	 	 	                         s e l f . c l o s e ( e v e n t ) ;  
 	 	 	                         b r e a k ;  
 	 	 	                 d e f a u l t :  
 	 	 	                         / /   k e y p r e s s   i s   t r i g g e r e d   b e f o r e   t h e   i n p u t   v a l u e   i s   c h a n g e d  
 	 	 	                         c l e a r T i m e o u t ( s e l f . s e a r c h i n g ) ;  
 	 	 	                         s e l f . s e a r c h i n g   =   s e t T i m e o u t ( f u n c t i o n ( )   {  
 	 	 	                                 / /   o n l y   s e a r c h   i f   t h e   v a l u e   h a s   c h a n g e d  
 	 	 	                                 i f   ( s e l f . t e r m   ! =   s e l f . e l e m e n t . v a l ( ) )   {  
 	 	 	                                         s e l f . s e l e c t e d I t e m   =   n u l l ;  
 	 	 	                                         s e l f . s e a r c h ( n u l l ,   e v e n t ) ;  
 	 	 	                                 }  
 	 	 	                         } ,   s e l f . o p t i o n s . d e l a y ) ;  
 	 	 	                         b r e a k ;  
 	 	 	         }  
 	 	 	 } )  
 	 	 	 . b i n d ( " k e y p r e s s . a u t o c o m p l e t e " ,   f u n c t i o n ( e v e n t )   {  
 	 	 	         i f   ( s u p p r e s s K e y P r e s s )   {  
 	 	 	                 s u p p r e s s K e y P r e s s   =   f a l s e ;  
 	 	 	                 e v e n t . p r e v e n t D e f a u l t ( ) ;  
 	 	 	         }  
 	 	 	 } )  
 	 	 	 . b i n d ( " f o c u s . a u t o c o m p l e t e " ,   f u n c t i o n ( )   {  
 	 	 	         i f   ( s e l f . o p t i o n s . d i s a b l e d )   {  
 	 	 	                 r e t u r n ;  
 	 	 	         }  
  
 	 	 	         s e l f . s e l e c t e d I t e m   =   n u l l ;  
 	 	 	         s e l f . p r e v i o u s   =   s e l f . e l e m e n t . v a l ( ) ;  
 	 	 	 } )  
 	 	 	 . b i n d ( " b l u r . a u t o c o m p l e t e " ,   f u n c t i o n ( e v e n t )   {  
 	 	 	         i f   ( s e l f . o p t i o n s . d i s a b l e d )   {  
 	 	 	                 r e t u r n ;  
 	 	 	         }  
  
 	 	 	         c l e a r T i m e o u t ( s e l f . s e a r c h i n g ) ;  
 	 	 	         / /   c l i c k s   o n   t h e   m e n u   ( o r   a   b u t t o n   t o   t r i g g e r   a   s e a r c h )   w i l l   c a u s e   a   b l u r   e v e n t  
 	 	 	         s e l f . c l o s i n g   =   s e t T i m e o u t ( f u n c t i o n ( )   {  
 	 	 	                 s e l f . c l o s e ( e v e n t ) ;  
 	 	 	                 s e l f . _ c h a n g e ( e v e n t ) ;  
 	 	 	         } ,   1 5 0 ) ;  
 	 	 	 } ) ;  
                         t h i s . _ i n i t S o u r c e ( ) ;  
                         t h i s . r e s p o n s e   =   f u n c t i o n ( )   {  
                                 r e t u r n   s e l f . _ r e s p o n s e . a p p l y ( s e l f ,   a r g u m e n t s ) ;  
                         } ;  
                         t h i s . m e n u   =   $ ( " < u l > < / u l > " )  
 	 	 	 . a d d C l a s s ( " u i - a u t o c o m p l e t e " )  
 	 	 	 . a p p e n d T o ( $ ( t h i s . o p t i o n s . a p p e n d T o   | |   " b o d y " ,   d o c ) [ 0 ] )  
                         / /   p r e v e n t   t h e   c l o s e - o n - b l u r   i n   c a s e   o f   a   " s l o w "   c l i c k   o n   t h e   m e n u   ( l o n g   m o u s e d o w n )  
 	 	 	 . m o u s e d o w n ( f u n c t i o n ( e v e n t )   {  
 	 	 	         / /   c l i c k i n g   o n   t h e   s c r o l l b a r   c a u s e s   f o c u s   t o   s h i f t   t o   t h e   b o d y  
 	 	 	         / /   b u t   w e   c a n ' t   d e t e c t   a   m o u s e u p   o r   a   c l i c k   i m m e d i a t e l y   a f t e r w a r d  
 	 	 	         / /   s o   w e   h a v e   t o   t r a c k   t h e   n e x t   m o u s e d o w n   a n d   c l o s e   t h e   m e n u   i f  
 	 	 	         / /   t h e   u s e r   c l i c k s   s o m e w h e r e   o u t s i d e   o f   t h e   a u t o c o m p l e t e  
 	 	 	         v a r   m e n u E l e m e n t   =   s e l f . m e n u . e l e m e n t [ 0 ] ;  
 	 	 	         i f   ( ! $ ( e v e n t . t a r g e t ) . c l o s e s t ( " . u i - m e n u - i t e m " ) . l e n g t h )   {  
 	 	 	                 s e t T i m e o u t ( f u n c t i o n ( )   {  
 	 	 	                         $ ( d o c u m e n t ) . o n e ( ' m o u s e d o w n ' ,   f u n c t i o n ( e v e n t )   {  
 	 	 	                                 i f   ( e v e n t . t a r g e t   ! = =   s e l f . e l e m e n t [ 0 ]   & &  
 	 	 	 	 	 	 	 	 e v e n t . t a r g e t   ! = =   m e n u E l e m e n t   & &  
 	 	 	 	 	 	 	 	 ! $ . u i . c o n t a i n s ( m e n u E l e m e n t ,   e v e n t . t a r g e t ) )   {  
 	 	 	                                         s e l f . c l o s e ( ) ;  
 	 	 	                                 }  
 	 	 	                         } ) ;  
 	 	 	                 } ,   1 ) ;  
 	 	 	         }  
  
 	 	 	         / /   u s e   a n o t h e r   t i m e o u t   t o   m a k e   s u r e   t h e   b l u r - e v e n t - h a n d l e r   o n   t h e   i n p u t   w a s   a l r e a d y   t r i g g e r e d  
 	 	 	         s e t T i m e o u t ( f u n c t i o n ( )   {  
 	 	 	                 c l e a r T i m e o u t ( s e l f . c l o s i n g ) ;  
 	 	 	         } ,   1 3 ) ;  
 	 	 	 } )  
 	 	 	 . m e n u ( {  
 	 	 	         f o c u s :   f u n c t i o n ( e v e n t ,   u i )   {  
 	 	 	                 v a r   i t e m   =   u i . i t e m . d a t a ( " i t e m . a u t o c o m p l e t e " ) ;  
 	 	 	                 i f   ( f a l s e   ! = =   s e l f . _ t r i g g e r ( " f o c u s " ,   e v e n t ,   {   i t e m :   i t e m   } ) )   {  
 	 	 	                         / /   u s e   v a l u e   t o   m a t c h   w h a t   w i l l   e n d   u p   i n   t h e   i n p u t ,   i f   i t   w a s   a   k e y   e v e n t  
 	 	 	                         i f   ( / ^ k e y / . t e s t ( e v e n t . o r i g i n a l E v e n t . t y p e ) )   {  
 	 	 	                                 s e l f . e l e m e n t . v a l ( i t e m . v a l u e ) ;  
 	 	 	                         }  
 	 	 	                 }  
 	 	 	         } ,  
 	 	 	         s e l e c t e d :   f u n c t i o n ( e v e n t ,   u i )   {  
 	 	 	                 v a r   i t e m   =   u i . i t e m . d a t a ( " i t e m . a u t o c o m p l e t e " ) ,  
 	 	 	 	 	 	 p r e v i o u s   =   s e l f . p r e v i o u s ;  
  
 	 	 	                 / /   o n l y   t r i g g e r   w h e n   f o c u s   w a s   l o s t   ( c l i c k   o n   m e n u )  
 	 	 	                 i f   ( s e l f . e l e m e n t [ 0 ]   ! = =   d o c . a c t i v e E l e m e n t )   {  
 	 	 	                         s e l f . e l e m e n t . f o c u s ( ) ;  
 	 	 	                         s e l f . p r e v i o u s   =   p r e v i o u s ;  
 	 	 	                         / /   # 6 1 0 9   -   I E   t r i g g e r s   t w o   f o c u s   e v e n t s   a n d   t h e   s e c o n d  
 	 	 	                         / /   i s   a s y n c h r o n o u s ,   s o   w e   n e e d   t o   r e s e t   t h e   p r e v i o u s  
 	 	 	                         / /   t e r m   s y n c h r o n o u s l y   a n d   a s y n c h r o n o u s l y   : - (  
 	 	 	                         s e t T i m e o u t ( f u n c t i o n ( )   {  
 	 	 	                                 s e l f . p r e v i o u s   =   p r e v i o u s ;  
 	 	 	                                 s e l f . s e l e c t e d I t e m   =   i t e m ;  
 	 	 	                         } ,   1 ) ;  
 	 	 	                 }  
  
 	 	 	                 i f   ( f a l s e   ! = =   s e l f . _ t r i g g e r ( " s e l e c t " ,   e v e n t ,   {   i t e m :   i t e m   } ) )   {  
 	 	 	                         s e l f . e l e m e n t . v a l ( i t e m . v a l u e ) ;  
 	 	 	                 }  
 	 	 	                 / /   r e s e t   t h e   t e r m   a f t e r   t h e   s e l e c t   e v e n t  
 	 	 	                 / /   t h i s   a l l o w s   c u s t o m   s e l e c t   h a n d l i n g   t o   w o r k   p r o p e r l y  
 	 	 	                 s e l f . t e r m   =   s e l f . e l e m e n t . v a l ( ) ;  
  
 	 	 	                 s e l f . c l o s e ( e v e n t ) ;  
 	 	 	                 s e l f . s e l e c t e d I t e m   =   i t e m ;  
 	 	 	         } ,  
 	 	 	         b l u r :   f u n c t i o n ( e v e n t ,   u i )   {  
 	 	 	                 / /   d o n ' t   s e t   t h e   v a l u e   o f   t h e   t e x t   f i e l d   i f   i t ' s   a l r e a d y   c o r r e c t  
 	 	 	                 / /   t h i s   p r e v e n t s   m o v i n g   t h e   c u r s o r   u n n e c e s s a r i l y  
 	 	 	                 i f   ( s e l f . m e n u . e l e m e n t . i s ( " : v i s i b l e " )   & &  
 	 	 	 	 	 	 ( s e l f . e l e m e n t . v a l ( )   ! = =   s e l f . t e r m ) )   {  
 	 	 	                         s e l f . e l e m e n t . v a l ( s e l f . t e r m ) ;  
 	 	 	                 }  
 	 	 	         }  
 	 	 	 } )  
 	 	 	 . z I n d e x ( t h i s . e l e m e n t . z I n d e x ( )   +   1 )  
                         / /   w o r k a r o u n d   f o r   j Q u e r y   b u g   # 5 7 8 1   h t t p : / / d e v . j q u e r y . c o m / t i c k e t / 5 7 8 1  
 	 	 	 . c s s ( {   t o p :   0 ,   l e f t :   0   } )  
 	 	 	 . h i d e ( )  
 	 	 	 . d a t a ( " m e n u " ) ;  
                         i f   ( $ . f n . b g i f r a m e )   {  
                                 t h i s . m e n u . e l e m e n t . b g i f r a m 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  
 	 	 	 . r e m o v e C l a s s ( " u i - a u t o c o m p l e t e - i n p u t " )  
 	 	 	 . r e m o v e A t t r ( " a u t o c o m p l e t e " )  
 	 	 	 . 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 - a u t o c o m p l e t e " )  
 	 	 	 . r e m o v e A t t r ( " a r i a - h a s p o p u p " ) ;  
                         t h i s . m e n u . e l e m e n t . r e m o v e ( ) ;  
                         $ . W i d g e t . p r o t o t y p e . d e s t r o y . c a l l ( t h i s ) ;  
                 } ,  
  
                 _ s e t O p t i o n :   f u n c t i o n ( k e y ,   v a l u e )   {  
                         $ . W i d g e t . p r o t o t y p e . _ s e t O p t i o n . a p p l y ( t h i s ,   a r g u m e n t s ) ;  
                         i f   ( k e y   = = =   " s o u r c e " )   {  
                                 t h i s . _ i n i t S o u r c e ( ) ;  
                         }  
                         i f   ( k e y   = = =   " a p p e n d T o " )   {  
                                 t h i s . m e n u . e l e m e n t . a p p e n d T o ( $ ( v a l u e   | |   " b o d y " ,   t h i s . e l e m e n t [ 0 ] . o w n e r D o c u m e n t ) [ 0 ] )  
                         }  
                         i f   ( k e y   = = =   " d i s a b l e d "   & &   v a l u e   & &   t h i s . x h r )   {  
                                 t h i s . x h r . a b o r t ( ) ;  
                         }  
                 } ,  
  
                 _ i n i t S o u r c e :   f u n c t i o n ( )   {  
                         v a r   s e l f   =   t h i s ,  
 	 	 	 a r r a y ,  
 	 	 	 u r l ;  
                         i f   ( $ . i s A r r a y ( t h i s . o p t i o n s . s o u r c e ) )   {  
                                 a r r a y   =   t h i s . o p t i o n s . s o u r c e ;  
                                 t h i s . s o u r c e   =   f u n c t i o n ( r e q u e s t ,   r e s p o n s e )   {  
                                         r e s p o n s e ( $ . u i . a u t o c o m p l e t e . f i l t e r ( a r r a y ,   r e q u e s t . t e r m ) ) ;  
                                 } ;  
                         }   e l s e   i f   ( t y p e o f   t h i s . o p t i o n s . s o u r c e   = = =   " s t r i n g " )   {  
                                 u r l   =   t h i s . o p t i o n s . s o u r c e ;  
                                 t h i s . s o u r c e   =   f u n c t i o n ( r e q u e s t ,   r e s p o n s e )   {  
                                         i f   ( s e l f . x h r )   {  
                                                 s e l f . x h r . a b o r t ( ) ;  
                                         }  
                                         s e l f . x h r   =   $ . a j a x ( {  
                                                 u r l :   u r l ,  
                                                 d a t a :   r e q u e s t ,  
                                                 d a t a T y p e :   " j s o n " ,  
                                                 a u t o c o m p l e t e R e q u e s t :   + + r e q u e s t I n d e x ,  
                                                 s u c c e s s :   f u n c t i o n ( d a t a ,   s t a t u s )   {  
                                                         i f   ( t h i s . a u t o c o m p l e t e R e q u e s t   = = =   r e q u e s t I n d e x )   {  
                                                                 r e s p o n s e ( d a t a ) ;  
                                                         }  
                                                 } ,  
                                                 e r r o r :   f u n c t i o n ( )   {  
                                                         i f   ( t h i s . a u t o c o m p l e t e R e q u e s t   = = =   r e q u e s t I n d e x )   {  
                                                                 r e s p o n s e ( [ ] ) ;  
                                                         }  
                                                 }  
                                         } ) ;  
                                 } ;  
                         }   e l s e   {  
                                 t h i s . s o u r c e   =   t h i s . o p t i o n s . s o u r c e ;  
                         }  
                 } ,  
  
                 s e a r c h :   f u n c t i o n ( v a l u e ,   e v e n t )   {  
                         v a l u e   =   v a l u e   ! =   n u l l   ?   v a l u e   :   t h i s . e l e m e n t . v a l ( ) ;  
  
                         / /   a l w a y s   s a v e   t h e   a c t u a l   v a l u e ,   n o t   t h e   o n e   p a s s e d   a s   a n   a r g u m e n t  
                         t h i s . t e r m   =   t h i s . e l e m e n t . v a l ( ) ;  
  
                         i f   ( v a l u e . l e n g t h   <   t h i s . o p t i o n s . m i n L e n g t h )   {  
                                 r e t u r n   t h i s . c l o s e ( e v e n t ) ;  
                         }  
  
                         c l e a r T i m e o u t ( t h i s . c l o s i n g ) ;  
                         i f   ( t h i s . _ t r i g g e r ( " s e a r c h " ,   e v e n t )   = = =   f a l s e )   {  
                                 r e t u r n ;  
                         }  
  
                         r e t u r n   t h i s . _ s e a r c h ( v a l u e ) ;  
                 } ,  
  
                 _ s e a r c h :   f u n c t i o n ( v a l u e )   {  
                         t h i s . p e n d i n g + + ;  
                         t h i s . e l e m e n t . a d d C l a s s ( " u i - a u t o c o m p l e t e - l o a d i n g " ) ;  
  
                         t h i s . s o u r c e ( {   t e r m :   v a l u e   } ,   t h i s . r e s p o n s e ) ;  
                 } ,  
  
                 _ r e s p o n s e :   f u n c t i o n ( c o n t e n t )   {  
                         i f   ( ! t h i s . o p t i o n s . d i s a b l e d   & &   c o n t e n t   & &   c o n t e n t . l e n g t h )   {  
                                 c o n t e n t   =   t h i s . _ n o r m a l i z e ( c o n t e n t ) ;  
                                 t h i s . _ s u g g e s t ( c o n t e n t ) ;  
                                 t h i s . _ t r i g g e r ( " o p e n " ) ;  
                         }   e l s e   {  
                                 t h i s . c l o s e ( ) ;  
                         }  
                         t h i s . p e n d i n g - - ;  
                         i f   ( ! t h i s . p e n d i n g )   {  
                                 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 u t o c o m p l e t e - l o a d i n g " ) ;  
                         }  
                 } ,  
  
                 c l o s e :   f u n c t i o n ( e v e n t )   {  
                         c l e a r T i m e o u t ( t h i s . c l o s i n g ) ;  
                         i f   ( t h i s . m e n u . e l e m e n t . i s ( " : v i s i b l e " ) )   {  
                                 t h i s . m e n u . e l e m e n t . h i d e ( ) ;  
                                 t h i s . m e n u . d e a c t i v a t e ( ) ;  
                                 t h i s . _ t r i g g e r ( " c l o s e " ,   e v e n t ) ;  
                         }  
                 } ,  
  
                 _ c h a n g e :   f u n c t i o n ( e v e n t )   {  
                         i f   ( t h i s . p r e v i o u s   ! = =   t h i s . e l e m e n t . v a l ( ) )   {  
                                 t h i s . _ t r i g g e r ( " c h a n g e " ,   e v e n t ,   {   i t e m :   t h i s . s e l e c t e d I t e m   } ) ;  
                         }  
                 } ,  
  
                 _ n o r m a l i z e :   f u n c t i o n ( i t e m s )   {  
                         / /   a s s u m e   a l l   i t e m s   h a v e   t h e   r i g h t   f o r m a t   w h e n   t h e   f i r s t   i t e m   i s   c o m p l e t e  
                         i f   ( i t e m s . l e n g t h   & &   i t e m s [ 0 ] . l a b e l   & &   i t e m s [ 0 ] . v a l u e )   {  
                                 r e t u r n   i t e m s ;  
                         }  
                         r e t u r n   $ . m a p ( i t e m s ,   f u n c t i o n ( i t e m )   {  
                                 i f   ( t y p e o f   i t e m   = = =   " s t r i n g " )   {  
                                         r e t u r n   {  
                                                 l a b e l :   i t e m ,  
                                                 v a l u e :   i t e m  
                                         } ;  
                                 }  
                                 r e t u r n   $ . e x t e n d ( {  
                                         l a b e l :   i t e m . l a b e l   | |   i t e m . v a l u e ,  
                                         v a l u e :   i t e m . v a l u e   | |   i t e m . l a b e l  
                                 } ,   i t e m ) ;  
                         } ) ;  
                 } ,  
  
                 _ s u g g e s t :   f u n c t i o n ( i t e m s )   {  
                         v a r   u l   =   t h i s . m e n u . e l e m e n t  
 	 	 	 . e m p t y ( )  
 	 	 	 . z I n d e x ( t h i s . e l e m e n t . z I n d e x ( )   +   1 ) ;  
                         t h i s . _ r e n d e r M e n u ( u l ,   i t e m s ) ;  
                         / /   T O D O   r e f r e s h   s h o u l d   c h e c k   i f   t h e   a c t i v e   i t e m   i s   s t i l l   i n   t h e   d o m ,   r e m o v i n g   t h e   n e e d   f o r   a   m a n u a l   d e a c t i v a t e  
                         t h i s . m e n u . d e a c t i v a t e ( ) ;  
                         t h i s . m e n u . r e f r e s h ( ) ;  
  
                         / /   s i z e   a n d   p o s i t i o n   m e n u  
                         u l . s h o w ( ) ;  
                         t h i s . _ r e s i z e M e n u ( ) ;  
                         u l . p o s i t i o n ( $ . e x t e n d ( {  
                                 o f :   t h i s . e l e m e n t  
                         } ,   t h i s . o p t i o n s . p o s i t i o n ) ) ;  
                 } ,  
  
                 _ r e s i z e M e n u :   f u n c t i o n ( )   {  
                         v a r   u l   =   t h i s . m e n u . e l e m e n t ;  
                         u l . o u t e r W i d t h ( M a t h . m a x (  
 	 	 	 u l . w i d t h ( " " ) . o u t e r W i d t h ( ) ,  
 	 	 	 t h i s . e l e m e n t . o u t e r W i d t h ( )  
 	 	 ) ) ;  
                 } ,  
  
                 _ r e n d e r M e n u :   f u n c t i o n ( u l ,   i t e m s )   {  
                         v a r   s e l f   =   t h i s ;  
                         $ . e a c h ( i t e m s ,   f u n c t i o n ( i n d e x ,   i t e m )   {  
                                 s e l f . _ r e n d e r I t e m ( u l ,   i t e m ) ;  
                         } ) ;  
                 } ,  
  
                 _ r e n d e r I t e m :   f u n c t i o n ( u l ,   i t e m )   {  
                         r e t u r n   $ ( " < l i > < / l i > " )  
 	 	 	 . d a t a ( " i t e m . a u t o c o m p l e t e " ,   i t e m )  
 	 	 	 . a p p e n d ( $ ( " < a > < / a > " ) . t e x t ( i t e m . l a b e l ) )  
 	 	 	 . a p p e n d T o ( u l ) ;  
                 } ,  
  
                 _ m o v e :   f u n c t i o n ( d i r e c t i o n ,   e v e n t )   {  
                         i f   ( ! t h i s . m e n u . e l e m e n t . i s ( " : v i s i b l e " ) )   {  
                                 t h i s . s e a r c h ( n u l l ,   e v e n t ) ;  
                                 r e t u r n ;  
                         }  
                         i f   ( t h i s . m e n u . f i r s t ( )   & &   / ^ p r e v i o u s / . t e s t ( d i r e c t i o n )   | |  
 	 	 	 	 t h i s . m e n u . l a s t ( )   & &   / ^ n e x t / . t e s t ( d i r e c t i o n ) )   {  
                                 t h i s . e l e m e n t . v a l ( t h i s . t e r m ) ;  
                                 t h i s . m e n u . d e a c t i v a t e ( ) ;  
                                 r e t u r n ;  
                         }  
                         t h i s . m e n u [ d i r e c t i o n ] ( e v e n t ) ;  
                 } ,  
  
                 w i d g e t :   f u n c t i o n ( )   {  
                         r e t u r n   t h i s . m e n u . e l e m e n t ;  
                 }  
         } ) ;  
  
         $ . e x t e n d ( $ . u i . a u t o c o m p l e t e ,   {  
                 e s c a p e R e g e x :   f u n c t i o n ( v a l u e )   {  
                         r e t u r n   v a l u e . r e p l a c e ( / [ - [ \ ] { } ( ) * + ? . , \ \ ^ $ | # \ s ] / g ,   " \ \ $ & " ) ;  
                 } ,  
                 f i l t e r :   f u n c t i o n ( a r r a y ,   t e r m )   {  
                         v a r   m a t c h e r   =   n e w   R e g E x p ( $ . u i . a u t o c o m p l e t e . e s c a p e R e g e x ( t e r m ) ,   " i " ) ;  
                         r 
