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