ÿþ/ * !  
   *   j Q u e r y   J a v a S c r i p t   L i b r a r y   v 1 . 6  
   *   h t t p : / / j q u e r y . c o m /  
   *  
   *   C o p y r i g h t   2 0 1 1 ,   J o h n   R e s i g  
   *   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  
   *  
   *   I n c l u d e s   S i z z l e . j s  
   *   h t t p : / / s i z z l e j s . c o m /  
   *   C o p y r i g h t   2 0 1 1 ,   T h e   D o j o   F o u n d a t i o n  
   *   R e l e a s e d   u n d e r   t h e   M I T ,   B S D ,   a n d   G P L   L i c e n s e s .  
   *  
   *   D a t e :   M o n   M a y   2   1 3 : 5 0 : 0 0   2 0 1 1   - 0 4 0 0  
   * /  
 ( f u n c t i o n (   w i n d o w ,   u n d e f i n e d   )   {  
  
 / /   U s e   t h e   c o r r e c t   d o c u m e n t   a c c o r d i n g l y   w i t h   w i n d o w   a r g u m e n t   ( s a n d b o x )  
 v a r   d o c u m e n t   =   w i n d o w . d o c u m e n t ,  
 	 n a v i g a t o r   =   w i n d o w . n a v i g a t o r ,  
 	 l o c a t i o n   =   w i n d o w . l o c a t i o n ;  
 v a r   j Q u e r y   =   ( f u n c t i o n ( )   {  
  
 / /   D e f i n e   a   l o c a l   c o p y   o f   j Q u e r y  
 v a r   j Q u e r y   =   f u n c t i o n (   s e l e c t o r ,   c o n t e x t   )   {  
 	 	 / /   T h e   j Q u e r y   o b j e c t   i s   a c t u a l l y   j u s t   t h e   i n i t   c o n s t r u c t o r   ' e n h a n c e d '  
 	 	 r e t u r n   n e w   j Q u e r y . f n . i n i t (   s e l e c t o r ,   c o n t e x t ,   r o o t j Q u e r y   ) ;  
 	 } ,  
  
 	 / /   M a p   o v e r   j Q u e r y   i n   c a s e   o f   o v e r w r i t e  
 	 _ j Q u e r y   =   w i n d o w . j Q u e r y ,  
  
 	 / /   M a p   o v e r   t h e   $   i n   c a s e   o f   o v e r w r i t e  
 	 _ $   =   w i n d o w . $ ,  
  
 	 / /   A   c e n t r a l   r e f e r e n c e   t o   t h e   r o o t   j Q u e r y ( d o c u m e n t )  
 	 r o o t j Q u e r y ,  
  
 	 / /   A   s i m p l e   w a y   t o   c h e c k   f o r   H T M L   s t r i n g s   o r   I D   s t r i n g s  
 	 / /   ( b o t h   o f   w h i c h   w e   o p t i m i z e   f o r )  
 	 q u i c k E x p r   =   / ^ ( ? : [ ^ < ] * ( < [ \ w \ W ] + > ) [ ^ > ] * $ | # ( [ \ w \ - ] * ) $ ) / ,  
  
 	 / /   C h e c k   i f   a   s t r i n g   h a s   a   n o n - w h i t e s p a c e   c h a r a c t e r   i n   i t  
 	 r n o t w h i t e   =   / \ S / ,  
  
 	 / /   U s e d   f o r   t r i m m i n g   w h i t e s p a c e  
 	 t r i m L e f t   =   / ^ \ s + / ,  
 	 t r i m R i g h t   =   / \ s + $ / ,  
  
 	 / /   C h e c k   f o r   d i g i t s  
 	 r d i g i t   =   / \ d / ,  
  
 	 / /   M a t c h   a   s t a n d a l o n e   t a g  
 	 r s i n g l e T a g   =   / ^ < ( \ w + ) \ s * \ / ? > ( ? : < \ / \ 1 > ) ? $ / ,  
  
 	 / /   J S O N   R e g E x p  
 	 r v a l i d c h a r s   =   / ^ [ \ ] , : { } \ s ] * $ / ,  
 	 r v a l i d e s c a p e   =   / \ \ ( ? : [ " \ \ \ / b f n r t ] | u [ 0 - 9 a - f A - F ] { 4 } ) / g ,  
 	 r v a l i d t o k e n s   =   / " [ ^ " \ \ \ n \ r ] * " | t r u e | f a l s e | n u l l | - ? \ d + ( ? : \ . \ d * ) ? ( ? : [ e E ] [ + \ - ] ? \ d + ) ? / g ,  
 	 r v a l i d b r a c e s   =   / ( ? : ^ | : | , ) ( ? : \ s * \ [ ) + / g ,  
  
 	 / /   U s e r a g e n t   R e g E x p  
 	 r w e b k i t   =   / ( w e b k i t ) [   \ / ] ( [ \ w . ] + ) / ,  
 	 r o p e r a   =   / ( o p e r a ) ( ? : . * v e r s i o n ) ? [   \ / ] ( [ \ w . ] + ) / ,  
 	 r m s i e   =   / ( m s i e )   ( [ \ w . ] + ) / ,  
 	 r m o z i l l a   =   / ( m o z i l l a ) ( ? : . * ?   r v : ( [ \ w . ] + ) ) ? / ,  
  
 	 / /   K e e p   a   U s e r A g e n t   s t r i n g   f o r   u s e   w i t h   j Q u e r y . b r o w s e r  
 	 u s e r A g e n t   =   n a v i g a t o r . u s e r A g e n t ,  
  
 	 / /   F o r   m a t c h i n g   t h e   e n g i n e   a n d   v e r s i o n   o f   t h e   b r o w s e r  
 	 b r o w s e r M a t c h ,  
  
 	 / /   T h e   d e f e r r e d   u s e d   o n   D O M   r e a d y  
 	 r e a d y L i s t ,  
  
 	 / /   T h e   r e a d y   e v e n t   h a n d l e r  
 	 D O M C o n t e n t L o a d e d ,  
  
 	 / /   S a v e   a   r e f e r e n c e   t o   s o m e   c o r e   m e t h o d s  
 	 t o S t r i n g   =   O b j e c t . p r o t o t y p e . t o S t r i n g ,  
 	 h a s O w n   =   O b j e c t . p r o t o t y p e . h a s O w n P r o p e r t y ,  
 	 p u s h   =   A r r a y . p r o t o t y p e . p u s h ,  
 	 s l i c e   =   A r r a y . p r o t o t y p e . s l i c e ,  
 	 t r i m   =   S t r i n g . p r o t o t y p e . t r i m ,  
 	 i n d e x O f   =   A r r a y . p r o t o t y p e . i n d e x O f ,  
  
 	 / /   [ [ C l a s s ] ]   - >   t y p e   p a i r s  
 	 c l a s s 2 t y p e   =   { } ;  
  
 j Q u e r y . f n   =   j Q u e r y . p r o t o t y p e   =   {  
 	 c o n s t r u c t o r :   j Q u e r y ,  
 	 i n i t :   f u n c t i o n (   s e l e c t o r ,   c o n t e x t ,   r o o t j Q u e r y   )   {  
 	 	 v a r   m a t c h ,   e l e m ,   r e t ,   d o c ;  
  
 	 	 / /   H a n d l e   $ ( " " ) ,   $ ( n u l l ) ,   o r   $ ( u n d e f i n e d )  
 	 	 i f   (   ! s e l e c t o r   )   {  
 	 	 	 r e t u r n   t h i s ;  
 	 	 }  
  
 	 	 / /   H a n d l e   $ ( D O M E l e m e n t )  
 	 	 i f   (   s e l e c t o r . n o d e T y p e   )   {  
 	 	 	 t h i s . c o n t e x t   =   t h i s [ 0 ]   =   s e l e c t o r ;  
 	 	 	 t h i s . l e n g t h   =   1 ;  
 	 	 	 r e t u r n   t h i s ;  
 	 	 }  
  
 	 	 / /   T h e   b o d y   e l e m e n t   o n l y   e x i s t s   o n c e ,   o p t i m i z e   f i n d i n g   i t  
 	 	 i f   (   s e l e c t o r   = = =   " b o d y "   & &   ! c o n t e x t   & &   d o c u m e n t . b o d y   )   {  
 	 	 	 t h i s . c o n t e x t   =   d o c u m e n t ;  
 	 	 	 t h i s [ 0 ]   =   d o c u m e n t . b o d y ;  
 	 	 	 t h i s . s e l e c t o r   =   s e l e c t o r ;  
 	 	 	 t h i s . l e n g t h   =   1 ;  
 	 	 	 r e t u r n   t h i s ;  
 	 	 }  
  
 	 	 / /   H a n d l e   H T M L   s t r i n g s  
 	 	 i f   (   t y p e o f   s e l e c t o r   = = =   " s t r i n g "   )   {  
 	 	 	 / /   A r e   w e   d e a l i n g   w i t h   H T M L   s t r i n g   o r   a n   I D ?  
 	 	 	 i f   (   s e l e c t o r . c h a r A t ( 0 )   = = =   " < "   & &   s e l e c t o r . c h a r A t (   s e l e c t o r . l e n g t h   -   1   )   = = =   " > "   & &   s e l e c t o r . l e n g t h   > =   3   )   {  
 	 	 	 	 / /   A s s u m e   t h a t   s t r i n g s   t h a t   s t a r t   a n d   e n d   w i t h   < >   a r e   H T M L   a n d   s k i p   t h e   r e g e x   c h e c k  
 	 	 	 	 m a t c h   =   [   n u l l ,   s e l e c t o r ,   n u l l   ] ;  
  
 	 	 	 }   e l s e   {  
 	 	 	 	 m a t c h   =   q u i c k E x p r . e x e c (   s e l e c t o r   ) ;  
 	 	 	 }  
  
 	 	 	 / /   V e r i f y   a   m a t c h ,   a n d   t h a t   n o   c o n t e x t   w a s   s p e c i f i e d   f o r   # i d  
 	 	 	 i f   (   m a t c h   & &   ( m a t c h [ 1 ]   | |   ! c o n t e x t )   )   {  
  
 	 	 	 	 / /   H A N D L E :   $ ( h t m l )   - >   $ ( a r r a y )  
 	 	 	 	 i f   (   m a t c h [ 1 ]   )   {  
 	 	 	 	 	 c o n t e x t   =   c o n t e x t   i n s t a n c e o f   j Q u e r y   ?   c o n t e x t [ 0 ]   :   c o n t e x t ;  
 	 	 	 	 	 d o c   =   ( c o n t e x t   ?   c o n t e x t . o w n e r D o c u m e n t   | |   c o n t e x t   :   d o c u m e n t ) ;  
  
 	 	 	 	 	 / /   I f   a   s i n g l e   s t r i n g   i s   p a s s e d   i n   a n d   i t ' s   a   s i n g l e   t a g  
 	 	 	 	 	 / /   j u s t   d o   a   c r e a t e E l e m e n t   a n d   s k i p   t h e   r e s t  
 	 	 	 	 	 r e t   =   r s i n g l e T a g . e x e c (   s e l e c t o r   ) ;  
  
 	 	 	 	 	 i f   (   r e t   )   {  
 	 	 	 	 	 	 i f   (   j Q u e r y . i s P l a i n O b j e c t (   c o n t e x t   )   )   {  
 	 	 	 	 	 	 	 s e l e c t o r   =   [   d o c u m e n t . c r e a t e E l e m e n t (   r e t [ 1 ]   )   ] ;  
 	 	 	 	 	 	 	 j Q u e r y . f n . a t t r . c a l l (   s e l e c t o r ,   c o n t e x t ,   t r u e   ) ;  
  
 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 s e l e c t o r   =   [   d o c . c r e a t e E l e m e n t (   r e t [ 1 ]   )   ] ;  
 	 	 	 	 	 	 }  
  
 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 r e t   =   j Q u e r y . b u i l d F r a g m e n t (   [   m a t c h [ 1 ]   ] ,   [   d o c   ]   ) ;  
 	 	 	 	 	 	 s e l e c t o r   =   ( r e t . c a c h e a b l e   ?   j Q u e r y . c l o n e ( r e t . f r a g m e n t )   :   r e t . f r a g m e n t ) . c h i l d N o d e s ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 r e t u r n   j Q u e r y . m e r g e (   t h i s ,   s e l e c t o r   ) ;  
  
 	 	 	 	 / /   H A N D L E :   $ ( " # i d " )  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 e l e m   =   d o c u m e n t . g e t E l e m e n t B y I d (   m a t c h [ 2 ]   ) ;  
  
 	 	 	 	 	 / /   C h e c k   p a r e n t N o d e   t o   c a t c h   w h e n   B l a c k b e r r y   4 . 6   r e t u r n s  
 	 	 	 	 	 / /   n o d e s   t h a t   a r e   n o   l o n g e r   i n   t h e   d o c u m e n t   # 6 9 6 3  
 	 	 	 	 	 i f   (   e l e m   & &   e l e m . p a r e n t N o d e   )   {  
 	 	 	 	 	 	 / /   H a n d l e   t h e   c a s e   w h e r e   I E   a n d   O p e r a   r e t u r n   i t e m s  
 	 	 	 	 	 	 / /   b y   n a m e   i n s t e a d   o f   I D  
 	 	 	 	 	 	 i f   (   e l e m . i d   ! = =   m a t c h [ 2 ]   )   {  
 	 	 	 	 	 	 	 r e t u r n   r o o t j Q u e r y . f i n d (   s e l e c t o r   ) ;  
 	 	 	 	 	 	 }  
  
 	 	 	 	 	 	 / /   O t h e r w i s e ,   w e   i n j e c t   t h e   e l e m e n t   d i r e c t l y   i n t o   t h e   j Q u e r y   o b j e c t  
 	 	 	 	 	 	 t h i s . l e n g t h   =   1 ;  
 	 	 	 	 	 	 t h i s [ 0 ]   =   e l e m ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 t h i s . c o n t e x t   =   d o c u m e n t ;  
 	 	 	 	 	 t h i s . s e l e c t o r   =   s e l e c t o r ;  
 	 	 	 	 	 r e t u r n   t h i s ;  
 	 	 	 	 }  
  
 	 	 	 / /   H A N D L E :   $ ( e x p r ,   $ ( . . . ) )  
 	 	 	 }   e l s e   i f   (   ! c o n t e x t   | |   c o n t e x t . j q u e r y   )   {  
 	 	 	 	 r e t u r n   ( c o n t e x t   | |   r o o t j Q u e r y ) . f i n d (   s e l e c t o r   ) ;  
  
 	 	 	 / /   H A N D L E :   $ ( e x p r ,   c o n t e x t )  
 	 	 	 / /   ( w h i c h   i s   j u s t   e q u i v a l e n t   t o :   $ ( c o n t e x t ) . f i n d ( e x p r )  
 	 	 	 }   e l s e   {  
 	 	 	 	 r e t u r n   t h i s . c o n s t r u c t o r (   c o n t e x t   ) . f i n d (   s e l e c t o r   ) ;  
 	 	 	 }  
  
 	 	 / /   H A N D L E :   $ ( f u n c t i o n )  
 	 	 / /   S h o r t c u t   f o r   d o c u m e n t   r e a d y  
 	 	 }   e l s e   i f   (   j Q u e r y . i s F u n c t i o n (   s e l e c t o r   )   )   {  
 	 	 	 r e t u r n   r o o t j Q u e r y . r e a d y (   s e l e c t o r   ) ;  
 	 	 }  
  
 	 	 i f   ( s e l e c t o r . s e l e c t o r   ! = =   u n d e f i n e d )   {  
 	 	 	 t h i s . s e l e c t o r   =   s e l e c t o r . s e l e c t o r ;  
 	 	 	 t h i s . c o n t e x t   =   s e l e c t o r . c o n t e x t ;  
 	 	 }  
  
 	 	 r e t u r n   j Q u e r y . m a k e A r r a y (   s e l e c t o r ,   t h i s   ) ;  
 	 } ,  
  
 	 / /   S t a r t   w i t h   a n   e m p t y   s e l e c t o r  
 	 s e l e c t o r :   " " ,  
  
 	 / /   T h e   c u r r e n t   v e r s i o n   o f   j Q u e r y   b e i n g   u s e d  
 	 j q u e r y :   " 1 . 6 " ,  
  
 	 / /   T h e   d e f a u l t   l e n g t h   o f   a   j Q u e r y   o b j e c t   i s   0  
 	 l e n g t h :   0 ,  
  
 	 / /   T h e   n u m b e r   o f   e l e m e n t s   c o n t a i n e d   i n   t h e   m a t c h e d   e l e m e n t   s e t  
 	 s i z e :   f u n c t i o n ( )   {  
 	 	 r e t u r n   t h i s . l e n g t h ;  
 	 } ,  
  
 	 t o A r r a y :   f u n c t i o n ( )   {  
 	 	 r e t u r n   s l i c e . c a l l (   t h i s ,   0   ) ;  
 	 } ,  
  
 	 / /   G e t   t h e   N t h   e l e m e n t   i n   t h e   m a t c h e d   e l e m e n t   s e t   O R  
 	 / /   G e t   t h e   w h o l e   m a t c h e d   e l e m e n t   s e t   a s   a   c l e a n   a r r a y  
 	 g e t :   f u n c t i o n (   n u m   )   {  
 	 	 r e t u r n   n u m   = =   n u l l   ?  
  
 	 	 	 / /   R e t u r n   a   ' c l e a n '   a r r a y  
 	 	 	 t h i s . t o A r r a y ( )   :  
  
 	 	 	 / /   R e t u r n   j u s t   t h e   o b j e c t  
 	 	 	 (   n u m   <   0   ?   t h i s [   t h i s . l e n g t h   +   n u m   ]   :   t h i s [   n u m   ]   ) ;  
 	 } ,  
  
 	 / /   T a k e   a n   a r r a y   o f   e l e m e n t s   a n d   p u s h   i t   o n t o   t h e   s t a c k  
 	 / /   ( r e t u r n i n g   t h e   n e w   m a t c h e d   e l e m e n t   s e t )  
 	 p u s h S t a c k :   f u n c t i o n (   e l e m s ,   n a m e ,   s e l e c t o r   )   {  
 	 	 / /   B u i l d   a   n e w   j Q u e r y   m a t c h e d   e l e m e n t   s e t  
 	 	 v a r   r e t   =   t h i s . c o n s t r u c t o r ( ) ;  
  
 	 	 i f   (   j Q u e r y . i s A r r a y (   e l e m s   )   )   {  
 	 	 	 p u s h . a p p l y (   r e t ,   e l e m s   ) ;  
  
 	 	 }   e l s e   {  
 	 	 	 j Q u e r y . m e r g e (   r e t ,   e l e m s   ) ;  
 	 	 }  
  
 	 	 / /   A d d   t h e   o l d   o b j e c t   o n t o   t h e   s t a c k   ( a s   a   r e f e r e n c e )  
 	 	 r e t . p r e v O b j e c t   =   t h i s ;  
  
 	 	 r e t . c o n t e x t   =   t h i s . c o n t e x t ;  
  
 	 	 i f   (   n a m e   = = =   " f i n d "   )   {  
 	 	 	 r e t . s e l e c t o r   =   t h i s . s e l e c t o r   +   ( t h i s . s e l e c t o r   ?   "   "   :   " " )   +   s e l e c t o r ;  
 	 	 }   e l s e   i f   (   n a m e   )   {  
 	 	 	 r e t . s e l e c t o r   =   t h i s . s e l e c t o r   +   " . "   +   n a m e   +   " ( "   +   s e l e c t o r   +   " ) " ;  
 	 	 }  
  
 	 	 / /   R e t u r n   t h e   n e w l y - f o r m e d   e l e m e n t   s e t  
 	 	 r e t u r n   r e t ;  
 	 } ,  
  
 	 / /   E x e c u t e   a   c a l l b a c k   f o r   e v e r y   e l e m e n t   i n   t h e   m a t c h e d   s e t .  
 	 / /   ( Y o u   c a n   s e e d   t h e   a r g u m e n t s   w i t h   a n   a r r a y   o f   a r g s ,   b u t   t h i s   i s  
 	 / /   o n l y   u s e d   i n t e r n a l l y . )  
 	 e a c h :   f u n c t i o n (   c a l l b a c k ,   a r g s   )   {  
 	 	 r e t u r n   j Q u e r y . e a c h (   t h i s ,   c a l l b a c k ,   a r g s   ) ;  
 	 } ,  
  
 	 r e a d y :   f u n c t i o n (   f n   )   {  
 	 	 / /   A t t a c h   t h e   l i s t e n e r s  
 	 	 j Q u e r y . b i n d R e a d y ( ) ;  
  
 	 	 / /   A d d   t h e   c a l l b a c k  
 	 	 r e a d y L i s t . d o n e (   f n   ) ;  
  
 	 	 r e t u r n   t h i s ;  
 	 } ,  
  
 	 e q :   f u n c t i o n (   i   )   {  
 	 	 r e t u r n   i   = = =   - 1   ?  
 	 	 	 t h i s . s l i c e (   i   )   :  
 	 	 	 t h i s . s l i c e (   i ,   + i   +   1   ) ;  
 	 } ,  
  
 	 f i r s t :   f u n c t i o n ( )   {  
 	 	 r e t u r n   t h i s . e q (   0   ) ;  
 	 } ,  
  
 	 l a s t :   f u n c t i o n ( )   {  
 	 	 r e t u r n   t h i s . e q (   - 1   ) ;  
 	 } ,  
  
 	 s l i c e :   f u n c t i o n ( )   {  
 	 	 r e t u r n   t h i s . p u s h S t a c k (   s l i c e . a p p l y (   t h i s ,   a r g u m e n t s   ) ,  
 	 	 	 " s l i c e " ,   s l i c e . c a l l ( a r g u m e n t s ) . j o i n ( " , " )   ) ;  
 	 } ,  
  
 	 m a p :   f u n c t i o n (   c a l l b a c k   )   {  
 	 	 r e t u r n   t h i s . p u s h S t a c k (   j Q u e r y . m a p ( t h i s ,   f u n c t i o n (   e l e m ,   i   )   {  
 	 	 	 r e t u r n   c a l l b a c k . c a l l (   e l e m ,   i ,   e l e m   ) ;  
 	 	 } ) ) ;  
 	 } ,  
  
 	 e n d :   f u n c t i o n ( )   {  
 	 	 r e t u r n   t h i s . p r e v O b j e c t   | |   t h i s . c o n s t r u c t o r ( n u l l ) ;  
 	 } ,  
  
 	 / /   F o r   i n t e r n a l   u s e   o n l y .  
 	 / /   B e h a v e s   l i k e   a n   A r r a y ' s   m e t h o d ,   n o t   l i k e   a   j Q u e r y   m e t h o d .  
 	 p u s h :   p u s h ,  
 	 s o r t :   [ ] . s o r t ,  
 	 s p l i c e :   [ ] . s p l i c e  
 } ;  
  
 / /   G i v e   t h e   i n i t   f u n c t i o n   t h e   j Q u e r y   p r o t o t y p e   f o r   l a t e r   i n s t a n t i a t i o n  
 j Q u e r y . f n . i n i t . p r o t o t y p e   =   j Q u e r y . f n ;  
  
 j Q u e r y . e x t e n d   =   j Q u e r y . f n . e x t e n d   =   f u n c t i o n ( )   {  
 	 v a r   o p t i o n s ,   n a m e ,   s r c ,   c o p y ,   c o p y I s A r r a y ,   c l o n e ,  
 	 	 t a r g e t   =   a r g u m e n t s [ 0 ]   | |   { } ,  
 	 	 i   =   1 ,  
 	 	 l e n g t h   =   a r g u m e n t s . l e n g t h ,  
 	 	 d e e p   =   f a l s e ;  
  
 	 / /   H a n d l e   a   d e e p   c o p y   s i t u a t i o n  
 	 i f   (   t y p e o f   t a r g e t   = = =   " b o o l e a n "   )   {  
 	 	 d e e p   =   t a r g e t ;  
 	 	 t a r g e t   =   a r g u m e n t s [ 1 ]   | |   { } ;  
 	 	 / /   s k i p   t h e   b o o l e a n   a n d   t h e   t a r g e t  
 	 	 i   =   2 ;  
 	 }  
  
 	 / /   H a n d l e   c a s e   w h e n   t a r g e t   i s   a   s t r i n g   o r   s o m e t h i n g   ( p o s s i b l e   i n   d e e p   c o p y )  
 	 i f   (   t y p e o f   t a r g e t   ! = =   " o b j e c t "   & &   ! j Q u e r y . i s F u n c t i o n ( t a r g e t )   )   {  
 	 	 t a r g e t   =   { } ;  
 	 }  
  
 	 / /   e x t e n d   j Q u e r y   i t s e l f   i f   o n l y   o n e   a r g u m e n t   i s   p a s s e d  
 	 i f   (   l e n g t h   = = =   i   )   {  
 	 	 t a r g e t   =   t h i s ;  
 	 	 - - i ;  
 	 }  
  
 	 f o r   (   ;   i   <   l e n g t h ;   i + +   )   {  
 	 	 / /   O n l y   d e a l   w i t h   n o n - n u l l / u n d e f i n e d   v a l u e s  
 	 	 i f   (   ( o p t i o n s   =   a r g u m e n t s [   i   ] )   ! =   n u l l   )   {  
 	 	 	 / /   E x t e n d   t h e   b a s e   o b j e c t  
 	 	 	 f o r   (   n a m e   i n   o p t i o n s   )   {  
 	 	 	 	 s r c   =   t a r g e t [   n a m e   ] ;  
 	 	 	 	 c o p y   =   o p t i o n s [   n a m e   ] ;  
  
 	 	 	 	 / /   P r e v e n t   n e v e r - e n d i n g   l o o p  
 	 	 	 	 i f   (   t a r g e t   = = =   c o p y   )   {  
 	 	 	 	 	 c o n t i n u e ;  
 	 	 	 	 }  
  
 	 	 	 	 / /   R e c u r s e   i f   w e ' r e   m e r g i n g   p l a i n   o b j e c t s   o r   a r r a y s  
 	 	 	 	 i f   (   d e e p   & &   c o p y   & &   (   j Q u e r y . i s P l a i n O b j e c t ( c o p y )   | |   ( c o p y I s A r r a y   =   j Q u e r y . i s A r r a y ( c o p y ) )   )   )   {  
 	 	 	 	 	 i f   (   c o p y I s A r r a y   )   {  
 	 	 	 	 	 	 c o p y I s A r r a y   =   f a l s e ;  
 	 	 	 	 	 	 c l o n e   =   s r c   & &   j Q u e r y . i s A r r a y ( s r c )   ?   s r c   :   [ ] ;  
  
 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 c l o n e   =   s r c   & &   j Q u e r y . i s P l a i n O b j e c t ( s r c )   ?   s r c   :   { } ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 / /   N e v e r   m o v e   o r i g i n a l   o b j e c t s ,   c l o n e   t h e m  
 	 	 	 	 	 t a r g e t [   n a m e   ]   =   j Q u e r y . e x t e n d (   d e e p ,   c l o n e ,   c o p y   ) ;  
  
 	 	 	 	 / /   D o n ' t   b r i n g   i n   u n d e f i n e d   v a l u e s  
 	 	 	 	 }   e l s e   i f   (   c o p y   ! = =   u n d e f i n e d   )   {  
 	 	 	 	 	 t a r g e t [   n a m e   ]   =   c o p y ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 }  
  
 	 / /   R e t u r n   t h e   m o d i f i e d   o b j e c t  
 	 r e t u r n   t a r g e t ;  
 } ;  
  
 j Q u e r y . e x t e n d ( {  
 	 n o C o n f l i c t :   f u n c t i o n (   d e e p   )   {  
 	 	 i f   (   w i n d o w . $   = = =   j Q u e r y   )   {  
 	 	 	 w i n d o w . $   =   _ $ ;  
 	 	 }  
  
 	 	 i f   (   d e e p   & &   w i n d o w . j Q u e r y   = = =   j Q u e r y   )   {  
 	 	 	 w i n d o w . j Q u e r y   =   _ j Q u e r y ;  
 	 	 }  
  
 	 	 r e t u r n   j Q u e r y ;  
 	 } ,  
  
 	 / /   I s   t h e   D O M   r e a d y   t o   b e   u s e d ?   S e t   t o   t r u e   o n c e   i t   o c c u r s .  
 	 i s R e a d y :   f a l s e ,  
  
 	 / /   A   c o u n t e r   t o   t r a c k   h o w   m a n y   i t e m s   t o   w a i t   f o r   b e f o r e  
 	 / /   t h e   r e a d y   e v e n t   f i r e s .   S e e   # 6 7 8 1  
 	 r e a d y W a i t :   1 ,  
  
 	 / /   H o l d   ( o r   r e l e a s e )   t h e   r e a d y   e v e n t  
 	 h o l d R e a d y :   f u n c t i o n (   h o l d   )   {  
 	 	 i f   (   h o l d   )   {  
 	 	 	 j Q u e r y . r e a d y W a i t + + ;  
 	 	 }   e l s e   {  
 	 	 	 j Q u e r y . r e a d y (   t r u e   ) ;  
 	 	 }  
 	 } ,  
  
 	 / /   H a n d l e   w h e n   t h e   D O M   i s   r e a d y  
 	 r e a d y :   f u n c t i o n (   w a i t   )   {  
 	 	 / /   E i t h e r   a   r e l e a s e d   h o l d   o r   a n   D O M r e a d y / l o a d   e v e n t   a n d   n o t   y e t   r e a d y  
 	 	 i f   (   ( w a i t   = = =   t r u e   & &   ! - - j Q u e r y . r e a d y W a i t )   | |   ( w a i t   ! = =   t r u e   & &   ! j Q u e r y . i s R e a d y )   )   {  
 	 	 	 / /   M a k e   s u r e   b o d y   e x i s t s ,   a t   l e a s t ,   i n   c a s e   I E   g e t s   a   l i t t l e   o v e r z e a l o u s   ( t i c k e t   # 5 4 4 3 ) .  
 	 	 	 i f   (   ! d o c u m e n t . b o d y   )   {  
 	 	 	 	 r e t u r n   s e t T i m e o u t (   j Q u e r y . r e a d y ,   1   ) ;  
 	 	 	 }  
  
 	 	 	 / /   R e m e m b e r   t h a t   t h e   D O M   i s   r e a d y  
 	 	 	 j Q u e r y . i s R e a d y   =   t r u e ;  
  
 	 	 	 / /   I f   a   n o r m a l   D O M   R e a d y   e v e n t   f i r e d ,   d e c r e m e n t ,   a n d   w a i t   i f   n e e d   b e  
 	 	 	 i f   (   w a i t   ! = =   t r u e   & &   - - j Q u e r y . r e a d y W a i t   >   0   )   {  
 	 	 	 	 r e t u r n ;  
 	 	 	 }  
  
 	 	 	 / /   I f   t h e r e   a r e   f u n c t i o n s   b o u n d ,   t o   e x e c u t e  
 	 	 	 r e a d y L i s t . r e s o l v e W i t h (   d o c u m e n t ,   [   j Q u e r y   ]   ) ;  
  
 	 	 	 / /   T r i g g e r   a n y   b o u n d   r e a d y   e v e n t s  
 	 	 	 i f   (   j Q u e r y . f n . t r i g g e r   )   {  
 	 	 	 	 j Q u e r y (   d o c u m e n t   ) . t r i g g e r (   " r e a d y "   ) . u n b i n d (   " r e a d y "   ) ;  
 	 	 	 }  
 	 	 }  
 	 } ,  
  
 	 b i n d R e a d y :   f u n c t i o n ( )   {  
 	 	 i f   (   r e a d y L i s t   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 r e a d y L i s t   =   j Q u e r y . _ D e f e r r e d ( ) ;  
  
 	 	 / /   C a t c h   c a s e s   w h e r e   $ ( d o c u m e n t ) . r e a d y ( )   i s   c a l l e d   a f t e r   t h e  
 	 	 / /   b r o w s e r   e v e n t   h a s   a l r e a d y   o c c u r r e d .  
 	 	 i f   (   d o c u m e n t . r e a d y S t a t e   = = =   " c o m p l e t e "   )   {  
 	 	 	 / /   H a n d l e   i t   a s y n c h r o n o u s l y   t o   a l l o w   s c r i p t s   t h e   o p p o r t u n i t y   t o   d e l a y   r e a d y  
 	 	 	 r e t u r n   s e t T i m e o u t (   j Q u e r y . r e a d y ,   1   ) ;  
 	 	 }  
  
 	 	 / /   M o z i l l a ,   O p e r a   a n d   w e b k i t   n i g h t l i e s   c u r r e n t l y   s u p p o r t   t h i s   e v e n t  
 	 	 i f   (   d o c u m e n t . a d d E v e n t L i s t e n e r   )   {  
 	 	 	 / /   U s e   t h e   h a n d y   e v e n t   c a l l b a c k  
 	 	 	 d o c u m e n t . a d d E v e n t L i s t e n e r (   " D O M C o n t e n t L o a d e d " ,   D O M C o n t e n t L o a d e d ,   f a l s e   ) ;  
  
 	 	 	 / /   A   f a l l b a c k   t o   w i n d o w . o n l o a d ,   t h a t   w i l l   a l w a y s   w o r k  
 	 	 	 w i n d o w . a d d E v e n t L i s t e n e r (   " l o a d " ,   j Q u e r y . r e a d y ,   f a l s e   ) ;  
  
 	 	 / /   I f   I E   e v e n t   m o d e l   i s   u s e d  
 	 	 }   e l s e   i f   (   d o c u m e n t . a t t a c h E v e n t   )   {  
 	 	 	 / /   e n s u r e   f i r i n g   b e f o r e   o n l o a d ,  
 	 	 	 / /   m a y b e   l a t e   b u t   s a f e   a l s o   f o r   i f r a m e s  
 	 	 	 d o c u m e n t . a t t a c h E v e n t (   " o n r e a d y s t a t e c h a n g e " ,   D O M C o n t e n t L o a d e d   ) ;  
  
 	 	 	 / /   A   f a l l b a c k   t o   w i n d o w . o n l o a d ,   t h a t   w i l l   a l w a y s   w o r k  
 	 	 	 w i n d o w . a t t a c h E v e n t (   " o n l o a d " ,   j Q u e r y . r e a d y   ) ;  
  
 	 	 	 / /   I f   I E   a n d   n o t   a   f r a m e  
 	 	 	 / /   c o n t i n u a l l y   c h e c k   t o   s e e   i f   t h e   d o c u m e n t   i s   r e a d y  
 	 	 	 v a r   t o p l e v e l   =   f a l s e ;  
  
 	 	 	 t r y   {  
 	 	 	 	 t o p l e v e l   =   w i n d o w . f r a m e E l e m e n t   = =   n u l l ;  
 	 	 	 }   c a t c h ( e )   { }  
  
 	 	 	 i f   (   d o c u m e n t . d o c u m e n t E l e m e n t . d o S c r o l l   & &   t o p l e v e l   )   {  
 	 	 	 	 d o S c r o l l C h e c k ( ) ;  
 	 	 	 }  
 	 	 }  
 	 } ,  
  
 	 / /   S e e   t e s t / u n i t / c o r e . j s   f o r   d e t a i l s   c o n c e r n i n g   i s F u n c t i o n .  
 	 / /   S i n c e   v e r s i o n   1 . 3 ,   D O M   m e t h o d s   a n d   f u n c t i o n s   l i k e   a l e r t  
 	 / /   a r e n ' t   s u p p o r t e d .   T h e y   r e t u r n   f a l s e   o n   I E   ( # 2 9 6 8 ) .  
 	 i s F u n c t i o n :   f u n c t i o n (   o b j   )   {  
 	 	 r e t u r n   j Q u e r y . t y p e ( o b j )   = = =   " f u n c t i o n " ;  
 	 } ,  
  
 	 i s A r r a y :   A r r a y . i s A r r a y   | |   f u n c t i o n (   o b j   )   {  
 	 	 r e t u r n   j Q u e r y . t y p e ( o b j )   = = =   " a r r a y " ;  
 	 } ,  
  
 	 / /   A   c r u d e   w a y   o f   d e t e r m i n i n g   i f   a n   o b j e c t   i s   a   w i n d o w  
 	 i s W i n d o w :   f u n c t i o n (   o b j   )   {  
 	 	 r e t u r n   o b j   & &   t y p e o f   o b j   = = =   " o b j e c t "   & &   " s e t I n t e r v a l "   i n   o b j ;  
 	 } ,  
  
 	 i s N a N :   f u n c t i o n (   o b j   )   {  
 	 	 r e t u r n   o b j   = =   n u l l   | |   ! r d i g i t . t e s t (   o b j   )   | |   i s N a N (   o b j   ) ;  
 	 } ,  
  
 	 t y p e :   f u n c t i o n (   o b j   )   {  
 	 	 r e t u r n   o b j   = =   n u l l   ?  
 	 	 	 S t r i n g (   o b j   )   :  
 	 	 	 c l a s s 2 t y p e [   t o S t r i n g . c a l l ( o b j )   ]   | |   " o b j e c t " ;  
 	 } ,  
  
 	 i s P l a i n O b j e c t :   f u n c t i o n (   o b j   )   {  
 	 	 / /   M u s t   b e   a n   O b j e c t .  
 	 	 / /   B e c a u s e   o f   I E ,   w e   a l s o   h a v e   t o   c h e c k   t h e   p r e s e n c e   o f   t h e   c o n s t r u c t o r   p r o p e r t y .  
 	 	 / /   M a k e   s u r e   t h a t   D O M   n o d e s   a n d   w i n d o w   o b j e c t s   d o n ' t   p a s s   t h r o u g h ,   a s   w e l l  
 	 	 i f   (   ! o b j   | |   j Q u e r y . t y p e ( o b j )   ! = =   " o b j e c t "   | |   o b j . n o d e T y p e   | |   j Q u e r y . i s W i n d o w (   o b j   )   )   {  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
  
 	 	 / /   N o t   o w n   c o n s t r u c t o r   p r o p e r t y   m u s t   b e   O b j e c t  
 	 	 i f   (   o b j . c o n s t r u c t o r   & &  
 	 	 	 ! h a s O w n . c a l l ( o b j ,   " c o n s t r u c t o r " )   & &  
 	 	 	 ! h a s O w n . c a l l ( o b j . c o n s t r u c t o r . p r o t o t y p e ,   " i s P r o t o t y p e O f " )   )   {  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
  
 	 	 / /   O w n   p r o p e r t i e s   a r e   e n u m e r a t e d   f i r s t l y ,   s o   t o   s p e e d   u p ,  
 	 	 / /   i f   l a s t   o n e   i s   o w n ,   t h e n   a l l   p r o p e r t i e s   a r e   o w n .  
  
 	 	 v a r   k e y ;  
 	 	 f o r   (   k e y   i n   o b j   )   { }  
  
 	 	 r e t u r n   k e y   = = =   u n d e f i n e d   | |   h a s O w n . c a l l (   o b j ,   k e y   ) ;  
 	 } ,  
  
 	 i s E m p t y O b j e c t :   f u n c t i o n (   o b j   )   {  
 	 	 f o r   (   v a r   n a m e   i n   o b j   )   {  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 	 r e t u r n   t r u e ;  
 	 } ,  
  
 	 e r r o r :   f u n c t i o n (   m s g   )   {  
 	 	 t h r o w   m s g ;  
 	 } ,  
  
 	 p a r s e J S O N :   f u n c t i o n (   d a t a   )   {  
 	 	 i f   (   t y p e o f   d a t a   ! = =   " s t r i n g "   | |   ! d a t a   )   {  
 	 	 	 r e t u r n   n u l l ;  
 	 	 }  
  
 	 	 / /   M a k e   s u r e   l e a d i n g / t r a i l i n g   w h i t e s p a c e   i s   r e m o v e d   ( I E   c a n ' t   h a n d l e   i t )  
 	 	 d a t a   =   j Q u e r y . t r i m (   d a t a   ) ;  
  
 	 	 / /   A t t e m p t   t o   p a r s e   u s i n g   t h e   n a t i v e   J S O N   p a r s e r   f i r s t  
 	 	 i f   (   w i n d o w . J S O N   & &   w i n d o w . J S O N . p a r s e   )   {  
 	 	 	 r e t u r n   w i n d o w . J S O N . p a r s e (   d a t a   ) ;  
 	 	 }  
  
 	 	 / /   M a k e   s u r e   t h e   i n c o m i n g   d a t a   i s   a c t u a l   J S O N  
 	 	 / /   L o g i c   b o r r o w e d   f r o m   h t t p : / / j s o n . o r g / j s o n 2 . j s  
 	 	 i f   (   r v a l i d c h a r s . t e s t (   d a t a . r e p l a c e (   r v a l i d e s c a p e ,   " @ "   )  
 	 	 	 . r e p l a c e (   r v a l i d t o k e n s ,   " ] "   )  
 	 	 	 . r e p l a c e (   r v a l i d b r a c e s ,   " " ) )   )   {  
  
 	 	 	 r e t u r n   ( n e w   F u n c t i o n (   " r e t u r n   "   +   d a t a   ) ) ( ) ;  
  
 	 	 }  
 	 	 j Q u e r y . e r r o r (   " I n v a l i d   J S O N :   "   +   d a t a   ) ;  
 	 } ,  
  
 	 / /   C r o s s - b r o w s e r   x m l   p a r s i n g  
 	 / /   ( x m l   &   t m p   u s e d   i n t e r n a l l y )  
 	 p a r s e X M L :   f u n c t i o n (   d a t a   ,   x m l   ,   t m p   )   {  
  
 	 	 i f   (   w i n d o w . D O M P a r s e r   )   {   / /   S t a n d a r d  
 	 	 	 t m p   =   n e w   D O M P a r s e r ( ) ;  
 	 	 	 x m l   =   t m p . p a r s e F r o m S t r i n g (   d a t a   ,   " t e x t / x m l "   ) ;  
 	 	 }   e l s e   {   / /   I E  
 	 	 	 x m l   =   n e w   A c t i v e X O b j e c t (   " M i c r o s o f t . X M L D O M "   ) ;  
 	 	 	 x m l . a s y n c   =   " f a l s e " ;  
 	 	 	 x m l . l o a d X M L (   d a t a   ) ;  
 	 	 }  
  
 	 	 t m p   =   x m l . d o c u m e n t E l e m e n t ;  
  
 	 	 i f   (   !   t m p   | |   !   t m p . n o d e N a m e   | |   t m p . n o d e N a m e   = = =   " p a r s e r e r r o r "   )   {  
 	 	 	 j Q u e r y . e r r o r (   " I n v a l i d   X M L :   "   +   d a t a   ) ;  
 	 	 }  
  
 	 	 r e t u r n   x m l ;  
 	 } ,  
  
 	 n o o p :   f u n c t i o n ( )   { } ,  
  
 	 / /   E v a l u a t e s   a   s c r i p t   i n   a   g l o b a l   c o n t e x t  
 	 / /   W o r k a r o u n d s   b a s e d   o n   f i n d i n g s   b y   J i m   D r i s c o l l  
 	 / /   h t t p : / / w e b l o g s . j a v a . n e t / b l o g / d r i s c o l l / a r c h i v e / 2 0 0 9 / 0 9 / 0 8 / e v a l - j a v a s c r i p t - g l o b a l - c o n t e x t  
 	 g l o b a l E v a l :   f u n c t i o n (   d a t a   )   {  
 	 	 i f   (   d a t a   & &   r n o t w h i t e . t e s t (   d a t a   )   )   {  
 	 	 	 / /   W e   u s e   e x e c S c r i p t   o n   I n t e r n e t   E x p l o r e r  
 	 	 	 / /   W e   u s e   a n   a n o n y m o u s   f u n c t i o n   s o   t h a t   c o n t e x t   i s   w i n d o w  
 	 	 	 / /   r a t h e r   t h a n   j Q u e r y   i n   F i r e f o x  
 	 	 	 (   w i n d o w . e x e c S c r i p t   | |   f u n c t i o n (   d a t a   )   {  
 	 	 	 	 w i n d o w [   " e v a l "   ] . c a l l (   w i n d o w ,   d a t a   ) ;  
 	 	 	 }   ) (   d a t a   ) ;  
 	 	 }  
 	 } ,  
  
 	 n o d e N a m e :   f u n c t i o n (   e l e m ,   n a m e   )   {  
 	 	 r e t u r n   e l e m . n o d e N a m e   & &   e l e m . n o d e N a m e . t o U p p e r C a s e ( )   = = =   n a m e . t o U p p e r C a s e ( ) ;  
 	 } ,  
  
 	 / /   a r g s   i s   f o r   i n t e r n a l   u s a g e   o n l y  
 	 e a c h :   f u n c t i o n (   o b j e c t ,   c a l l b a c k ,   a r g s   )   {  
 	 	 v a r   n a m e ,   i   =   0 ,  
 	 	 	 l e n g t h   =   o b j e c t . l e n g t h ,  
 	 	 	 i s O b j   =   l e n g t h   = = =   u n d e f i n e d   | |   j Q u e r y . i s F u n c t i o n (   o b j e c t   ) ;  
  
 	 	 i f   (   a r g s   )   {  
 	 	 	 i f   (   i s O b j   )   {  
 	 	 	 	 f o r   (   n a m e   i n   o b j e c t   )   {  
 	 	 	 	 	 i f   (   c a l l b a c k . a p p l y (   o b j e c t [   n a m e   ] ,   a r g s   )   = = =   f a l s e   )   {  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }   e l s e   {  
 	 	 	 	 f o r   (   ;   i   <   l e n g t h ;   )   {  
 	 	 	 	 	 i f   (   c a l l b a c k . a p p l y (   o b j e c t [   i + +   ] ,   a r g s   )   = = =   f a l s e   )   {  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 / /   A   s p e c i a l ,   f a s t ,   c a s e   f o r   t h e   m o s t   c o m m o n   u s e   o f   e a c h  
 	 	 }   e l s e   {  
 	 	 	 i f   (   i s O b j   )   {  
 	 	 	 	 f o r   (   n a m e   i n   o b j e c t   )   {  
 	 	 	 	 	 i f   (   c a l l b a c k . c a l l (   o b j e c t [   n a m e   ] ,   n a m e ,   o b j e c t [   n a m e   ]   )   = = =   f a l s e   )   {  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }   e l s e   {  
 	 	 	 	 f o r   (   ;   i   <   l e n g t h ;   )   {  
 	 	 	 	 	 i f   (   c a l l b a c k . c a l l (   o b j e c t [   i   ] ,   i ,   o b j e c t [   i + +   ]   )   = = =   f a l s e   )   {  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   o b j e c t ;  
 	 } ,  
  
 	 / /   U s e   n a t i v e   S t r i n g . t r i m   f u n c t i o n   w h e r e v e r   p o s s i b l e  
 	 t r i m :   t r i m   ?  
 	 	 f u n c t i o n (   t e x t   )   {  
 	 	 	 r e t u r n   t e x t   = =   n u l l   ?  
 	 	 	 	 " "   :  
 	 	 	 	 t r i m . c a l l (   t e x t   ) ;  
 	 	 }   :  
  
 	 	 / /   O t h e r w i s e   u s e   o u r   o w n   t r i m m i n g   f u n c t i o n a l i t y  
 	 	 f u n c t i o n (   t e x t   )   {  
 	 	 	 r e t u r n   t e x t   = =   n u l l   ?  
 	 	 	 	 " "   :  
 	 	 	 	 t e x t . t o S t r i n g ( ) . r e p l a c e (   t r i m L e f t ,   " "   ) . r e p l a c e (   t r i m R i g h t ,   " "   ) ;  
 	 	 } ,  
  
 	 / /   r e s u l t s   i s   f o r   i n t e r n a l   u s a g e   o n l y  
 	 m a k e A r r a y :   f u n c t i o n (   a r r a y ,   r e s u l t s   )   {  
 	 	 v a r   r e t   =   r e s u l t s   | |   [ ] ;  
  
 	 	 i f   (   a r r a y   ! =   n u l l   )   {  
 	 	 	 / /   T h e   w i n d o w ,   s t r i n g s   ( a n d   f u n c t i o n s )   a l s o   h a v e   ' l e n g t h '  
 	 	 	 / /   T h e   e x t r a   t y p e o f   f u n c t i o n   c h e c k   i s   t o   p r e v e n t   c r a s h e s  
 	 	 	 / /   i n   S a f a r i   2   ( S e e :   # 3 0 3 9 )  
 	 	 	 / /   T w e a k e d   l o g i c   s l i g h t l y   t o   h a n d l e   B l a c k b e r r y   4 . 7   R e g E x p   i s s u e s   # 6 9 3 0  
 	 	 	 v a r   t y p e   =   j Q u e r y . t y p e (   a r r a y   ) ;  
  
 	 	 	 i f   (   a r r a y . l e n g t h   = =   n u l l   | |   t y p e   = = =   " s t r i n g "   | |   t y p e   = = =   " f u n c t i o n "   | |   t y p e   = = =   " r e g e x p "   | |   j Q u e r y . i s W i n d o w (   a r r a y   )   )   {  
 	 	 	 	 p u s h . c a l l (   r e t ,   a r r a y   ) ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 j Q u e r y . m e r g e (   r e t ,   a r r a y   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   r e t ;  
 	 } ,  
  
 	 i n A r r a y :   f u n c t i o n (   e l e m ,   a r r a y   )   {  
  
 	 	 i f   (   i n d e x O f   )   {  
 	 	 	 r e t u r n   i n d e x O f . c a l l (   a r r a y ,   e l e m   ) ;  
 	 	 }  
  
 	 	 f o r   (   v a r   i   =   0 ,   l e n g t h   =   a r r a y . l e n g t h ;   i   <   l e n g t h ;   i + +   )   {  
 	 	 	 i f   (   a r r a y [   i   ]   = = =   e l e m   )   {  
 	 	 	 	 r e t u r n   i ;  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   - 1 ;  
 	 } ,  
  
 	 m e r g e :   f u n c t i o n (   f i r s t ,   s e c o n d   )   {  
 	 	 v a r   i   =   f i r s t . l e n g t h ,  
 	 	 	 j   =   0 ;  
  
 	 	 i f   (   t y p e o f   s e c o n d . l e n g t h   = = =   " n u m b e r "   )   {  
 	 	 	 f o r   (   v a r   l   =   s e c o n d . l e n g t h ;   j   <   l ;   j + +   )   {  
 	 	 	 	 f i r s t [   i + +   ]   =   s e c o n d [   j   ] ;  
 	 	 	 }  
  
 	 	 }   e l s e   {  
 	 	 	 w h i l e   (   s e c o n d [ j ]   ! = =   u n d e f i n e d   )   {  
 	 	 	 	 f i r s t [   i + +   ]   =   s e c o n d [   j + +   ] ;  
 	 	 	 }  
 	 	 }  
  
 	 	 f i r s t . l e n g t h   =   i ;  
  
 	 	 r e t u r n   f i r s t ;  
 	 } ,  
  
 	 g r e p :   f u n c t i o n (   e l e m s ,   c a l l b a c k ,   i n v   )   {  
 	 	 v a r   r e t   =   [ ] ,   r e t V a l ;  
 	 	 i n v   =   ! ! i n v ;  
  
 	 	 / /   G o   t h r o u g h   t h e   a r r a y ,   o n l y   s a v i n g   t h e   i t e m s  
 	 	 / /   t h a t   p a s s   t h e   v a l i d a t o r   f u n c t i o n  
 	 	 f o r   (   v a r   i   =   0 ,   l e n g t h   =   e l e m s . l e n g t h ;   i   <   l e n g t h ;   i + +   )   {  
 	 	 	 r e t V a l   =   ! ! c a l l b a c k (   e l e m s [   i   ] ,   i   ) ;  
 	 	 	 i f   (   i n v   ! = =   r e t V a l   )   {  
 	 	 	 	 r e t . p u s h (   e l e m s [   i   ]   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   r e t ;  
 	 } ,  
  
 	 / /   a r g   i s   f o r   i n t e r n a l   u s a g e   o n l y  
 	 m a p :   f u n c t i o n (   e l e m s ,   c a l l b a c k ,   a r g   )   {  
 	 	 v a r   v a l u e ,   k e y ,   r e t   =   [ ] ,  
 	 	 	 i   =   0 ,  
 	 	 	 l e n g t h   =   e l e m s . l e n g t h ,  
 	 	 	 / /   j q u e r y   o b j e c t s   a r e   t r e a t e d   a s   a r r a y s  
 	 	 	 i s A r r a y   =   e l e m s   i n s t a n c e o f   j Q u e r y   | |   l e n g t h   ! = =   u n d e f i n e d   & &   t y p e o f   l e n g t h   = = =   " n u m b e r "   & &   (   (   l e n g t h   >   0   & &   e l e m s [   0   ]   & &   e l e m s [   l e n g t h   - 1   ]   )   | |   l e n g t h   = = =   0   | |   j Q u e r y . i s A r r a y (   e l e m s   )   )   ;  
  
 	 	 / /   G o   t h r o u g h   t h e   a r r a y ,   t r a n s l a t i n g   e a c h   o f   t h e   i t e m s   t o   t h e i r  
 	 	 i f   (   i s A r r a y   )   {  
 	 	 	 f o r   (   ;   i   <   l e n g t h ;   i + +   )   {  
 	 	 	 	 v a l u e   =   c a l l b a c k (   e l e m s [   i   ] ,   i ,   a r g   ) ;  
  
 	 	 	 	 i f   (   v a l u e   ! =   n u l l   )   {  
 	 	 	 	 	 r e t [   r e t . l e n g t h   ]   =   v a l u e ;  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 / /   G o   t h r o u g h   e v e r y   k e y   o n   t h e   o b j e c t ,  
 	 	 }   e l s e   {  
 	 	 	 f o r   (   k e y   i n   e l e m s   )   {  
 	 	 	 	 v a l u e   =   c a l l b a c k (   e l e m s [   k e y   ] ,   k e y ,   a r g   ) ;  
  
 	 	 	 	 i f   (   v a l u e   ! =   n u l l   )   {  
 	 	 	 	 	 r e t [   r e t . l e n g t h   ]   =   v a l u e ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 / /   F l a t t e n   a n y   n e s t e d   a r r a y s  
 	 	 r e t u r n   r e t . c o n c a t . a p p l y (   [ ] ,   r e t   ) ;  
 	 } ,  
  
 	 / /   A   g l o b a l   G U I D   c o u n t e r   f o r   o b j e c t s  
 	 g u i d :   1 ,  
  
 	 / /   B i n d   a   f u n c t i o n   t o   a   c o n t e x t ,   o p t i o n a l l y   p a r t i a l l y   a p p l y i n g   a n y  
 	 / /   a r g u m e n t s .  
 	 p r o x y :   f u n c t i o n (   f n ,   c o n t e x t   )   {  
 	 	 i f   (   t y p e o f   c o n t e x t   = = =   " s t r i n g "   )   {  
 	 	 	 v a r   t m p   =   f n [   c o n t e x t   ] ;  
 	 	 	 c o n t e x t   =   f n ;  
 	 	 	 f n   =   t m p ;  
 	 	 }  
  
 	 	 / /   Q u i c k   c h e c k   t o   d e t e r m i n e   i f   t a r g e t   i s   c a l l a b l e ,   i n   t h e   s p e c  
 	 	 / /   t h i s   t h r o w s   a   T y p e E r r o r ,   b u t   w e   w i l l   j u s t   r e t u r n   u n d e f i n e d .  
 	 	 i f   (   ! j Q u e r y . i s F u n c t i o n (   f n   )   )   {  
 	 	 	 r e t u r n   u n d e f i n e d ;  
 	 	 }  
  
 	 	 / /   S i m u l a t e d   b i n d  
 	 	 v a r   a r g s   =   s l i c e . c a l l (   a r g u m e n t s ,   2   ) ,  
 	 	 	 p r o x y   =   f u n c t i o n ( )   {  
 	 	 	 	 r e t u r n   f n . a p p l y (   c o n t e x t ,   a r g s . c o n c a t (   s l i c e . c a l l (   a r g u m e n t s   )   )   ) ;  
 	 	 	 } ;  
  
 	 	 / /   S e t   t h e   g u i d   o f   u n i q u e   h a n d l e r   t o   t h e   s a m e   o f   o r i g i n a l   h a n d l e r ,   s o   i t   c a n   b e   r e m o v e d  
 	 	 p r o x y . g u i d   =   f n . g u i d   =   f n . g u i d   | |   p r o x y . g u i d   | |   j Q u e r y . g u i d + + ;  
  
 	 	 r e t u r n   p r o x y ;  
 	 } ,  
  
 	 / /   M u t i f u n c t i o n a l   m e t h o d   t o   g e t   a n d   s e t   v a l u e s   t o   a   c o l l e c t i o n  
 	 / /   T h e   v a l u e / s   c a n   b e   o p t i o n a l l y   b y   e x e c u t e d   i f   i t s   a   f u n c t i o n  
 	 a c c e s s :   f u n c t i o n (   e l e m s ,   k e y ,   v a l u e ,   e x e c ,   f n ,   p a s s   )   {  
 	 	 v a r   l e n g t h   =   e l e m s . l e n g t h ;  
  
 	 	 / /   S e t t i n g   m a n y   a t t r i b u t e s  
 	 	 i f   (   t y p e o f   k e y   = = =   " o b j e c t "   )   {  
 	 	 	 f o r   (   v a r   k   i n   k e y   )   {  
 	 	 	 	 j Q u e r y . a c c e s s (   e l e m s ,   k ,   k e y [ k ] ,   e x e c ,   f n ,   v a l u e   ) ;  
 	 	 	 }  
 	 	 	 r e t u r n   e l e m s ;  
 	 	 }  
  
 	 	 / /   S e t t i n g   o n e   a t t r i b u t e  
 	 	 i f   (   v a l u e   ! = =   u n d e f i n e d   )   {  
 	 	 	 / /   O p t i o n a l l y ,   f u n c t i o n   v a l u e s   g e t   e x e c u t e d   i f   e x e c   i s   t r u e  
 	 	 	 e x e c   =   ! p a s s   & &   e x e c   & &   j Q u e r y . i s F u n c t i o n ( v a l u e ) ;  
  
 	 	 	 f o r   (   v a r   i   =   0 ;   i   <   l e n g t h ;   i + +   )   {  
 	 	 	 	 f n (   e l e m s [ i ] ,   k e y ,   e x e c   ?   v a l u e . c a l l (   e l e m s [ i ] ,   i ,   f n (   e l e m s [ i ] ,   k e y   )   )   :   v a l u e ,   p a s s   ) ;  
 	 	 	 }  
  
 	 	 	 r e t u r n   e l e m s ;  
 	 	 }  
  
 	 	 / /   G e t t i n g   a n   a t t r i b u t e  
 	 	 r e t u r n   l e n g t h   ?   f n (   e l e m s [ 0 ] ,   k e y   )   :   u n d e f i n e d ;  
 	 } ,  
  
 	 n o w :   f u n c t i o n ( )   {  
 	 	 r e t u r n   ( n e w   D a t e ( ) ) . g e t T i m e ( ) ;  
 	 } ,  
  
 	 / /   U s e   o f   j Q u e r y . b r o w s e r   i s   f r o w n e d   u p o n .  
 	 / /   M o r e   d e t a i l s :   h t t p : / / d o c s . j q u e r y . c o m / U t i l i t i e s / j Q u e r y . b r o w s e r  
 	 u a M a t c h :   f u n c t i o n (   u a   )   {  
 	 	 u a   =   u a . t o L o w e r C a s e ( ) ;  
  
 	 	 v a r   m a t c h   =   r w e b k i t . e x e c (   u a   )   | |  
 	 	 	 r o p e r a . e x e c (   u a   )   | |  
 	 	 	 r m s i e . e x e c (   u a   )   | |  
 	 	 	 u a . i n d e x O f ( " c o m p a t i b l e " )   <   0   & &   r m o z i l l a . e x e c (   u a   )   | |  
 	 	 	 [ ] ;  
  
 	 	 r e t u r n   {   b r o w s e r :   m a t c h [ 1 ]   | |   " " ,   v e r s i o n :   m a t c h [ 2 ]   | |   " 0 "   } ;  
 	 } ,  
  
 	 s u b :   f u n c t i o n ( )   {  
 	 	 f u n c t i o n   j Q u e r y S u b (   s e l e c t o r ,   c o n t e x t   )   {  
 	 	 	 r e t u r n   n e w   j Q u e r y S u b . f n . i n i t (   s e l e c t o r ,   c o n t e x t   ) ;  
 	 	 }  
 	 	 j Q u e r y . e x t e n d (   t r u e ,   j Q u e r y S u b ,   t h i s   ) ;  
 	 	 j Q u e r y S u b . s u p e r c l a s s   =   t h i s ;  
 	 	 j Q u e r y S u b . f n   =   j Q u e r y S u b . p r o t o t y p e   =   t h i s ( ) ;  
 	 	 j Q u e r y S u b . f n . c o n s t r u c t o r   =   j Q u e r y S u b ;  
 	 	 j Q u e r y S u b . s u b   =   t h i s . s u b ;  
 	 	 j Q u e r y S u b . f n . i n i t   =   f u n c t i o n   i n i t (   s e l e c t o r ,   c o n t e x t   )   {  
 	 	 	 i f   (   c o n t e x t   & &   c o n t e x t   i n s t a n c e o f   j Q u e r y   & &   ! ( c o n t e x t   i n s t a n c e o f   j Q u e r y S u b )   )   {  
 	 	 	 	 c o n t e x t   =   j Q u e r y S u b (   c o n t e x t   ) ;  
 	 	 	 }  
  
 	 	 	 r e t u r n   j Q u e r y . f n . i n i t . c a l l (   t h i s ,   s e l e c t o r ,   c o n t e x t ,   r o o t j Q u e r y S u b   ) ;  
 	 	 } ;  
 	 	 j Q u e r y S u b . f n . i n i t . p r o t o t y p e   =   j Q u e r y S u b . f n ;  
 	 	 v a r   r o o t j Q u e r y S u b   =   j Q u e r y S u b ( d o c u m e n t ) ;  
 	 	 r e t u r n   j Q u e r y S u b ;  
 	 } ,  
  
 	 b r o w s e r :   { }  
 } ) ;  
  
 / /   P o p u l a t e   t h e   c l a s s 2 t y p e   m a p  
 j Q u e r y . e a c h ( " B o o l e a n   N u m b e r   S t r i n g   F u n c t i o n   A r r a y   D a t e   R e g E x p   O b j e c t " . s p l i t ( "   " ) ,   f u n c t i o n ( i ,   n a m e )   {  
 	 c l a s s 2 t y p e [   " [ o b j e c t   "   +   n a m e   +   " ] "   ]   =   n a m e . t o L o w e r C a s e ( ) ;  
 } ) ;  
  
 b r o w s e r M a t c h   =   j Q u e r y . u a M a t c h (   u s e r A g e n t   ) ;  
 i f   (   b r o w s e r M a t c h . b r o w s e r   )   {  
 	 j Q u e r y . b r o w s e r [   b r o w s e r M a t c h . b r o w s e r   ]   =   t r u e ;  
 	 j Q u e r y . b r o w s e r . v e r s i o n   =   b r o w s e r M a t c h . v e r s i o n ;  
 }  
  
 / /   D e p r e c a t e d ,   u s e   j Q u e r y . b r o w s e r . w e b k i t   i n s t e a d  
 i f   (   j Q u e r y . b r o w s e r . w e b k i t   )   {  
 	 j Q u e r y . b r o w s e r . s a f a r i   =   t r u e ;  
 }  
  
 / /   I E   d o e s n ' t   m a t c h   n o n - b r e a k i n g   s p a c e s   w i t h   \ s  
 i f   (   r n o t w h i t e . t e s t (   " \ x A 0 "   )   )   {  
 	 t r i m L e f t   =   / ^ [ \ s \ x A 0 ] + / ;  
 	 t r i m R i g h t   =   / [ \ s \ x A 0 ] + $ / ;  
 }  
  
 / /   A l l   j Q u e r y   o b j e c t s   s h o u l d   p o i n t   b a c k   t o   t h e s e  
 r o o t j Q u e r y   =   j Q u e r y ( d o c u m e n t ) ;  
  
 / /   C l e a n u p   f u n c t i o n s   f o r   t h e   d o c u m e n t   r e a d y   m e t h o d  
 i f   (   d o c u m e n t . a d d E v e n t L i s t e n e r   )   {  
 	 D O M C o n t e n t L o a d e d   =   f u n c t i o n ( )   {  
 	 	 d o c u m e n t . r e m o v e E v e n t L i s t e n e r (   " D O M C o n t e n t L o a d e d " ,   D O M C o n t e n t L o a d e d ,   f a l s e   ) ;  
 	 	 j Q u e r y . r e a d y ( ) ;  
 	 } ;  
  
 }   e l s e   i f   (   d o c u m e n t . a t t a c h E v e n t   )   {  
 	 D O M C o n t e n t L o a d e d   =   f u n c t i o n ( )   {  
 	 	 / /   M a k e   s u r e   b o d y   e x i s t s ,   a t   l e a s t ,   i n   c a s e   I E   g e t s   a   l i t t l e   o v e r z e a l o u s   ( t i c k e t   # 5 4 4 3 ) .  
 	 	 i f   (   d o c u m e n t . r e a d y S t a t e   = = =   " c o m p l e t e "   )   {  
 	 	 	 d o c u m e n t . d e t a c h E v e n t (   " o n r e a d y s t a t e c h a n g e " ,   D O M C o n t e n t L o a d e d   ) ;  
 	 	 	 j Q u e r y . r e a d y ( ) ;  
 	 	 }  
 	 } ;  
 }  
  
 / /   T h e   D O M   r e a d y   c h e c k   f o r   I n t e r n e t   E x p l o r e r  
 f u n c t i o n   d o S c r o l l C h e c k ( )   {  
 	 i f   (   j Q u e r y . i s R e a d y   )   {  
 	 	 r e t u r n ;  
 	 }  
  
 	 t r y   {  
 	 	 / /   I f   I E   i s   u s e d ,   u s e   t h e   t r i c k   b y   D i e g o   P e r i n i  
 	 	 / /   h t t p : / / j a v a s c r i p t . n w b o x . c o m / I E C o n t e n t L o a d e d /  
 	 	 d o c u m e n t . d o c u m e n t E l e m e n t . d o S c r o l l ( " l e f t " ) ;  
 	 }   c a t c h ( e )   {  
 	 	 s e t T i m e o u t (   d o S c r o l l C h e c k ,   1   ) ;  
 	 	 r e t u r n ;  
 	 }  
  
 	 / /   a n d   e x e c u t e   a n y   w a i t i n g   f u n c t i o n s  
 	 j Q u e r y . r e a d y ( ) ;  
 }  
  
 / /   E x p o s e   j Q u e r y   t o   t h e   g l o b a l   o b j e c t  
 r e t u r n   j Q u e r y ;  
  
 } ) ( ) ;  
  
  
 v a r   / /   P r o m i s e   m e t h o d s  
 	 p r o m i s e M e t h o d s   =   " d o n e   f a i l   i s R e s o l v e d   i s R e j e c t e d   p r o m i s e   t h e n   a l w a y s   p i p e " . s p l i t (   "   "   ) ,  
 	 / /   S t a t i c   r e f e r e n c e   t o   s l i c e  
 	 s l i c e D e f e r r e d   =   [ ] . s l i c e ;  
  
 j Q u e r y . e x t e n d ( {  
 	 / /   C r e a t e   a   s i m p l e   d e f e r r e d   ( o n e   c a l l b a c k s   l i s t )  
 	 _ D e f e r r e d :   f u n c t i o n ( )   {  
 	 	 v a r   / /   c a l l b a c k s   l i s t  
 	 	 	 c a l l b a c k s   =   [ ] ,  
 	 	 	 / /   s t o r e d   [   c o n t e x t   ,   a r g s   ]  
 	 	 	 f i r e d ,  
 	 	 	 / /   t o   a v o i d   f i r i n g   w h e n   a l r e a d y   d o i n g   s o  
 	 	 	 f i r i n g ,  
 	 	 	 / /   f l a g   t o   k n o w   i f   t h e   d e f e r r e d   h a s   b e e n   c a n c e l l e d  
 	 	 	 c a n c e l l e d ,  
 	 	 	 / /   t h e   d e f e r r e d   i t s e l f  
 	 	 	 d e f e r r e d     =   {  
  
 	 	 	 	 / /   d o n e (   f 1 ,   f 2 ,   . . . )  
 	 	 	 	 d o n e :   f u n c t i o n ( )   {  
 	 	 	 	 	 i f   (   ! c a n c e l l e d   )   {  
 	 	 	 	 	 	 v a r   a r g s   =   a r g u m e n t s ,  
 	 	 	 	 	 	 	 i ,  
 	 	 	 	 	 	 	 l e n g t h ,  
 	 	 	 	 	 	 	 e l e m ,  
 	 	 	 	 	 	 	 t y p e ,  
 	 	 	 	 	 	 	 _ f i r e d ;  
 	 	 	 	 	 	 i f   (   f i r e d   )   {  
 	 	 	 	 	 	 	 _ f i r e d   =   f i r e d ;  
 	 	 	 	 	 	 	 f i r e d   =   0 ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 f o r   (   i   =   0 ,   l e n g t h   =   a r g s . l e n g t h ;   i   <   l e n g t h ;   i + +   )   {  
 	 	 	 	 	 	 	 e l e m   =   a r g s [   i   ] ;  
 	 	 	 	 	 	 	 t y p e   =   j Q u e r y . t y p e (   e l e m   ) ;  
 	 	 	 	 	 	 	 i f   (   t y p e   = = =   " a r r a y "   )   {  
 	 	 	 	 	 	 	 	 d e f e r r e d . d o n e . a p p l y (   d e f e r r e d ,   e l e m   ) ;  
 	 	 	 	 	 	 	 }   e l s e   i f   (   t y p e   = = =   " f u n c t i o n "   )   {  
 	 	 	 	 	 	 	 	 c a l l b a c k s . p u s h (   e l e m   ) ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 i f   (   _ f i r e d   )   {  
 	 	 	 	 	 	 	 d e f e r r e d . r e s o l v e W i t h (   _ f i r e d [   0   ] ,   _ f i r e d [   1   ]   ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 	 r e t u r n   t h i s ;  
 	 	 	 	 } ,  
  
 	 	 	 	 / /   r e s o l v e   w i t h   g i v e n   c o n t e x t   a n d   a r g s  
 	 	 	 	 r e s o l v e W i t h :   f u n c t i o n (   c o n t e x t ,   a r g s   )   {  
 	 	 	 	 	 i f   (   ! c a n c e l l e d   & &   ! f i r e d   & &   ! f i r i n g   )   {  
 	 	 	 	 	 	 / /   m a k e   s u r e   a r g s   a r e   a v a i l a b l e   ( # 8 4 2 1 )  
 	 	 	 	 	 	 a r g s   =   a r g s   | |   [ ] ;  
 	 	 	 	 	 	 f i r i n g   =   1 ;  
 	 	 	 	 	 	 t r y   {  
 	 	 	 	 	 	 	 w h i l e (   c a l l b a c k s [   0   ]   )   {  
 	 	 	 	 	 	 	 	 c a l l b a c k s . s h i f t ( ) . a p p l y (   c o n t e x t ,   a r g s   ) ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 f i n a l l y   {  
 	 	 	 	 	 	 	 f i r e d   =   [   c o n t e x t ,   a r g s   ] ;  
 	 	 	 	 	 	 	 f i r i n g   =   0 ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 	 r e t u r n   t h i s ;  
 	 	 	 	 } ,  
  
 	 	 	 	 / /   r e s o l v e   w i t h   t h i s   a s   c o n t e x t   a n d   g i v e n   a r g u m e n t s  
 	 	 	 	 r e s o l v e :   f u n c t i o n ( )   {  
 	 	 	 	 	 d e f e r r e d . r e s o l v e W i t h (   t h i s ,   a r g u m e n t s   ) ;  
 	 	 	 	 	 r e t u r n   t h i s ;  
 	 	 	 	 } ,  
  
 	 	 	 	 / /   H a s   t h i s   d e f e r r e d   b e e n   r e s o l v e d ?  
 	 	 	 	 i s R e s o l v e d :   f u n c t i o n ( )   {  
 	 	 	 	 	 r e t u r n   ! ! (   f i r i n g   | |   f i r e d   ) ;  
 	 	 	 	 } ,  
  
 	 	 	 	 / /   C a n c e l  
 	 	 	 	 c a n c e l :   f u n c t i o n ( )   {  
 	 	 	 	 	 c a n c e l l e d   =   1 ;  
 	 	 	 	 	 c a l l b a c k s   =   [ ] ;  
 	 	 	 	 	 r e t u r n   t h i s ;  
 	 	 	 	 }  
 	 	 	 } ;  
  
 	 	 r e t u r n   d e f e r r e d ;  
 	 } ,  
  
 	 / /   F u l l   f l e d g e d   d e f e r r e d   ( t w o   c a l l b a c k s   l i s t )  
 	 D e f e r r e d :   f u n c t i o n (   f u n c   )   {  
 	 	 v a r   d e f e r r e d   =   j Q u e r y . _ D e f e r r e d ( ) ,  
 	 	 	 f a i l D e f e r r e d   =   j Q u e r y . _ D e f e r r e d ( ) ,  
 	 	 	 p r o m i s e ;  
 	 	 / /   A d d   e r r o r D e f e r r e d   m e t h o d s ,   t h e n   a n d   p r o m i s e  
 	 	 j Q u e r y . e x t e n d (   d e f e r r e d ,   {  
 	 	 	 t h e n :   f u n c t i o n (   d o n e C a l l b a c k s ,   f a i l C a l l b a c k s   )   {  
 	 	 	 	 d e f e r r e d . d o n e (   d o n e C a l l b a c k s   ) . f a i l (   f a i l C a l l b a c k s   ) ;  
 	 	 	 	 r e t u r n   t h i s ;  
 	 	 	 } ,  
 	 	 	 a l w a y s :   f u n c t i o n ( )   {  
 	 	 	 	 r e t u r n   d e f e r r e d . d o n e . a p p l y (   d e f e r r e d ,   a r g u m e n t s   ) . f a i l . a p p l y (   t h i s ,   a r g u m e n t s   ) ;  
 	 	 	 } ,  
 	 	 	 f a i l :   f a i l D e f e r r e d . d o n e ,  
 	 	 	 r e j e c t W i t h :   f a i l D e f e r r e d . r e s o l v e W i t h ,  
 	 	 	 r e j e c t :   f a i l D e f e r r e d . r e s o l v e ,  
 	 	 	 i s R e j e c t e d :   f a i l D e f e r r e d . i s R e s o l v e d ,  
 	 	 	 p i p e :   f u n c t i o n (   f n D o n e ,   f n F a i l   )   {  
 	 	 	 	 r e t u r n   j Q u e r y . D e f e r r e d ( f u n c t i o n (   n e w D e f e r   )   {  
 	 	 	 	 	 j Q u e r y . e a c h (   {  
 	 	 	 	 	 	 d o n e :   [   f n D o n e ,   " r e s o l v e "   ] ,  
 	 	 	 	 	 	 f a i l :   [   f n F a i l ,   " r e j e c t "   ]  
 	 	 	 	 	 } ,   f u n c t i o n (   h a n d l e r ,   d a t a   )   {  
 	 	 	 	 	 	 v a r   f n   =   d a t a [   0   ] ,  
 	 	 	 	 	 	 	 a c t i o n   =   d a t a [   1   ] ,  
 	 	 	 	 	 	 	 r e t u r n e d ;  
 	 	 	 	 	 	 i f   (   j Q u e r y . i s F u n c t i o n (   f n   )   )   {  
 	 	 	 	 	 	 	 d e f e r r e d [   h a n d l e r   ] ( f u n c t i o n ( )   {  
 	 	 	 	 	 	 	 	 r e t u r n e d   =   f n . a p p l y (   t h i s ,   a r g u m e n t s   ) ;  
 	 	 	 	 	 	 	 	 i f   (   j Q u e r y . i s F u n c t i o n (   r e t u r n e d . p r o m i s e   )   )   {  
 	 	 	 	 	 	 	 	 	 r e t u r n e d . p r o m i s e ( ) . t h e n (   n e w D e f e r . r e s o l v e ,   n e w D e f e r . r e j e c t   ) ;  
 	 	 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 	 	 n e w D e f e r [   a c t i o n   ] (   r e t u r n e d   ) ;  
 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 } ) ;  
 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 d e f e r r e d [   h a n d l e r   ] (   n e w D e f e r [   a c t i o n   ]   ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 } ) ;  
 	 	 	 	 } ) . p r o m i s e ( ) ;  
 	 	 	 } ,  
 	 	 	 / /   G e t   a   p r o m i s e   f o r   t h i s   d e f e r r e d  
 	 	 	 / /   I f   o b j   i s   p r o v i d e d ,   t h e   p r o m i s e   a s p e c t   i s   a d d e d   t o   t h e   o b j e c t  
 	 	 	 p r o m i s e :   f u n c t i o n (   o b j   )   {  
 	 	 	 	 i f   (   o b j   = =   n u l l   )   {  
 	 	 	 	 	 i f   (   p r o m i s e   )   {  
 	 	 	 	 	 	 r e t u r n   p r o m i s e ;  
 	 	 	 	 	 }  
 	 	 	 	 	 p r o m i s e   =   o b j   =   { } ;  
 	 	 	 	 }  
 	 	 	 	 v a r   i   =   p r o m i s e M e t h o d s . l e n g t h ;  
 	 	 	 	 w h i l e (   i - -   )   {  
 	 	 	 	 	 o b j [   p r o m i s e M e t h o d s [ i ]   ]   =   d e f e r r e d [   p r o m i s e M e t h o d s [ i ]   ] ;  
 	 	 	 	 }  
 	 	 	 	 r e t u r n   o b j ;  
 	 	 	 }  
 	 	 } ) ;  
 	 	 / /   M a k e   s u r e   o n l y   o n e   c a l l b a c k   l i s t   w i l l   b e   u s e d  
 	 	 d e f e r r e d . d o n e (   f a i l D e f e r r e d . c a n c e l   ) . f a i l (   d e f e r r e d . c a n c e l   ) ;  
 	 	 / /   U n e x p o s e   c a n c e l  
 	 	 d e l e t e   d e f e r r e d . c a n c e l ;  
 	 	 / /   C a l l   g i v e n   f u n c   i f   a n y  
 	 	 i f   (   f u n c   )   {  
 	 	 	 f u n c . c a l l (   d e f e r r e d ,   d e f e r r e d   ) ;  
 	 	 }  
 	 	 r e t u r n   d e f e r r e d ;  
 	 } ,  
  
 	 / /   D e f e r r e d   h e l p e r  
 	 w h e n :   f u n c t i o n (   f i r s t P a r a m   )   {  
 	 	 v a r   a r g s   =   a r g u m e n t s ,  
 	 	 	 i   =   0 ,  
 	 	 	 l e n g t h   =   a r g s . l e n g t h ,  
 	 	 	 c o u n t   =   l e n g t h ,  
 	 	 	 d e f e r r e d   =   l e n g t h   < =   1   & &   f i r s t P a r a m   & &   j Q u e r y . i s F u n c t i o n (   f i r s t P a r a m . p r o m i s e   )   ?  
 	 	 	 	 f i r s t P a r a m   :  
 	 	 	 	 j Q u e r y . D e f e r r e d ( ) ;  
 	 	 f u n c t i o n   r e s o l v e F u n c (   i   )   {  
 	 	 	 r e t u r n   f u n c t i o n (   v a l u e   )   {  
 	 	 	 	 a r g s [   i   ]   =   a r g u m e n t s . l e n g t h   >   1   ?   s l i c e D e f e r r e d . c a l l (   a r g u m e n t s ,   0   )   :   v a l u e ;  
 	 	 	 	 i f   (   ! (   - - c o u n t   )   )   {  
 	 	 	 	 	 / /   S t r a n g e   b u g   i n   F F 4 :  
 	 	 	 	 	 / /   V a l u e s   c h a n g e d   o n t o   t h e   a r g u m e n t s   o b j e c t   s o m e t i m e s   e n d   u p   a s   u n d e f i n e d   v a l u e s  
 	 	 	 	 	 / /   o u t s i d e   t h e   $ . w h e n   m e t h o d .   C l o n i n g   t h e   o b j e c t   i n t o   a   f r e s h   a r r a y   s o l v e s   t h e   i s s u e  
 	 	 	 	 	 d e f e r r e d . r e s o l v e W i t h (   d e f e r r e d ,   s l i c e D e f e r r e d . c a l l (   a r g s ,   0   )   ) ;  
 	 	 	 	 }  
 	 	 	 } ;  
 	 	 }  
 	 	 i f   (   l e n g t h   >   1   )   {  
 	 	 	 f o r (   ;   i   <   l e n g t h ;   i + +   )   {  
 	 	 	 	 i f   (   a r g s [   i   ]   & &   j Q u e r y . i s F u n c t i o n (   a r g s [   i   ] . p r o m i s e   )   )   {  
 	 	 	 	 	 a r g s [   i   ] . p r o m i s e ( ) . t h e n (   r e s o l v e F u n c ( i ) ,   d e f e r r e d . r e j e c t   ) ;  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 - - c o u n t ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 	 i f   (   ! c o u n t   )   {  
 	 	 	 	 d e f e r r e d . r e s o l v e W i t h (   d e f e r r e d ,   a r g s   ) ;  
 	 	 	 }  
 	 	 }   e l s e   i f   (   d e f e r r e d   ! = =   f i r s t P a r a m   )   {  
 	 	 	 d e f e r r e d . r e s o l v e W i t h (   d e f e r r e d ,   l e n g t h   ?   [   f i r s t P a r a m   ]   :   [ ]   ) ;  
 	 	 }  
 	 	 r e t u r n   d e f e r r e d . p r o m i s e ( ) ;  
 	 }  
 } ) ;  
  
  
  
 j Q u e r y . s u p p o r t   =   ( f u n c t i o n ( )   {  
  
 	 v a r   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 "   ) ,  
 	 	 a l l ,  
 	 	 a ,  
 	 	 s e l e c t ,  
 	 	 o p t ,  
 	 	 i n p u t ,  
 	 	 m a r g i n D i v ,  
 	 	 s u p p o r t ,  
 	 	 f r a g m e n t ,  
 	 	 b o d y ,  
 	 	 b o d y S t y l e ,  
 	 	 t d s ,  
 	 	 e v e n t s ,  
 	 	 e v e n t N a m e ,  
 	 	 i ,  
 	 	 i s S u p p o r t e d ;  
  
 	 / /   P r e l i m i n a r y   t e s t s  
 	 d i v . s e t A t t r i b u t e ( " c l a s s N a m e " ,   " t " ) ;  
 	 d i v . i n n e r H T M L   =   "       < l i n k / > < t a b l e > < / t a b l e > < a   h r e f = ' / a '   s t y l e = ' t o p : 1 p x ; f l o a t : l e f t ; o p a c i t y : . 5 5 ; ' > a < / a > < i n p u t   t y p e = ' c h e c k b o x ' / > " ;  
  
 	 a l l   =   d i v . g e t E l e m e n t s B y T a g N a m e (   " * "   ) ;  
 	 a   =   d i v . g e t E l e m e n t s B y T a g N a m e (   " a "   ) [   0   ] ;  
  
 	 / /   C a n ' t   g e t   b a s i c   t e s t   s u p p o r t  
 	 i f   (   ! a l l   | |   ! a l l . l e n g t h   | |   ! a   )   {  
 	 	 r e t u r n   { } ;  
 	 }  
  
 	 / /   F i r s t   b a t c h   o f   s u p p o r t s   t e s t s  
 	 s e l e c t   =   d o c u m e n t . c r e a t e E l e m e n t (   " s e l e c t "   ) ;  
 	 o p t   =   s e l e c t . a p p e n d C h i l d (   d o c u m e n t . c r e a t e E l e m e n t ( " o p t i o n " )   ) ;  
 	 i n p u t   =   d i v . g e t E l e m e n t s B y T a g N a m e (   " i n p u t "   ) [   0   ] ;  
  
 	 s u p p o r t   =   {  
 	 	 / /   I E   s t r i p s   l e a d i n g   w h i t e s p a c e   w h e n   . i n n e r H T M L   i s   u s e d  
 	 	 l e a d i n g W h i t e s p a c e :   (   d i v . f i r s t C h i l d . n o d e T y p e   = = =   3   ) ,  
  
 	 	 / /   M a k e   s u r e   t h a t   t b o d y   e l e m e n t s   a r e n ' t   a u t o m a t i c a l l y   i n s e r t e d  
 	 	 / /   I E   w i l l   i n s e r t   t h e m   i n t o   e m p t y   t a b l e s  
 	 	 t b o d y :   ! d i v . g e t E l e m e n t s B y T a g N a m e (   " t b o d y "   ) . l e n g t h ,  
  
 	 	 / /   M a k e   s u r e   t h a t   l i n k   e l e m e n t s   g e t   s e r i a l i z e d   c o r r e c t l y   b y   i n n e r H T M L  
 	 	 / /   T h i s   r e q u i r e s   a   w r a p p e r   e l e m e n t   i n   I E  
 	 	 h t m l S e r i a l i z e :   ! ! d i v . g e t E l e m e n t s B y T a g N a m e (   " l i n k "   ) . l e n g t h ,  
  
 	 	 / /   G e t   t h e   s t y l e   i n f o r m a t i o n   f r o m   g e t A t t r i b u t e  
 	 	 / /   ( I E   u s e s   . c s s T e x t   i n s t e a d )  
 	 	 s t y l e :   / t o p / . t e s t (   a . g e t A t t r i b u t e ( " s t y l e " )   ) ,  
  
 	 	 / /   M a k e   s u r e   t h a t   U R L s   a r e n ' t   m a n i p u l a t e d  
 	 	 / /   ( I E   n o r m a l i z e s   i t   b y   d e f a u l t )  
 	 	 h r e f N o r m a l i z e d :   (   a . g e t A t t r i b u t e (   " h r e f "   )   = = =   " / a "   ) ,  
  
 	 	 / /   M a k e   s u r e   t h a t   e l e m e n t   o p a c i t y   e x i s t s  
 	 	 / /   ( I E   u s e s   f i l t e r   i n s t e a d )  
 	 	 / /   U s e   a   r e g e x   t o   w o r k   a r o u n d   a   W e b K i t   i s s u e .   S e e   # 5 1 4 5  
 	 	 o p a c i t y :   / ^ 0 . 5 5 $ / . t e s t (   a . s t y l e . o p a c i t y   ) ,  
  
 	 	 / /   V e r i f y   s t y l e   f l o a t   e x i s t e n c e  
 	 	 / /   ( I E   u s e s   s t y l e F l o a t   i n s t e a d   o f   c s s F l o a t )  
 	 	 c s s F l o a t :   ! ! a . s t y l e . c s s F l o a t ,  
  
 	 	 / /   M a k e   s u r e   t h a t   i f   n o   v a l u e   i s   s p e c i f i e d   f o r   a   c h e c k b o x  
 	 	 / /   t h a t   i t   d e f a u l t s   t o   " o n " .  
 	 	 / /   ( W e b K i t   d e f a u l t s   t o   " "   i n s t e a d )  
 	 	 c h e c k O n :   (   i n p u t . v a l u e   = = =   " o n "   ) ,  
  
 	 	 / /   M a k e   s u r e   t h a t   a   s e l e c t e d - b y - d e f a u l t   o p t i o n   h a s   a   w o r k i n g   s e l e c t e d   p r o p e r t y .  
 	 	 / /   ( W e b K i t   d e f a u l t s   t o   f a l s e   i n s t e a d   o f   t r u e ,   I E   t o o ,   i f   i t ' s   i n   a n   o p t g r o u p )  
 	 	 o p t S e l e c t e d :   o p t . s e l e c t e d ,  
  
 	 	 / /   T e s t   s e t A t t r i b u t e   o n   c a m e l C a s e   c l a s s .   I f   i t   w o r k s ,   w e   n e e d   a t t r F i x e s   w h e n   d o i n g   g e t / s e t A t t r i b u t e   ( i e 6 / 7 )  
 	 	 g e t S e t A t t r i b u t e :   d i v . c l a s s N a m e   ! = =   " t " ,  
  
 	 	 / /   W i l l   b e   d e f i n e d   l a t e r  
 	 	 s u b m i t B u b b l e s :   t r u e ,  
 	 	 c h a n g e B u b b l e s :   t r u e ,  
 	 	 f o c u s i n B u b b l e s :   f a l s e ,  
 	 	 d e l e t e E x p a n d o :   t r u e ,  
 	 	 n o C l o n e E v e n t :   t r u e ,  
 	 	 i n l i n e B l o c k N e e d s L a y o u t :   f a l s e ,  
 	 	 s h r i n k W r a p B l o c k s :   f a l s e ,  
 	 	 r e l i a b l e M a r g i n R i g h t :   t r u e  
 	 } ;  
  
 	 / /   M a k e   s u r e   c h e c k e d   s t a t u s   i s   p r o p e r l y   c l o n e d  
 	 i n p u t . c h e c k e d   =   t r u e ;  
 	 s u p p o r t . n o C l o n e C h e c k e d   =   i n p u t . c l o n e N o d e (   t r u e   ) . c h e c k e d ;  
  
 	 / /   M a k e   s u r e   t h a t   t h e   o p t i o n s   i n s i d e   d i s a b l e d   s e l e c t s   a r e n ' t   m a r k e d   a s   d i s a b l e d  
 	 / /   ( W e b K i t   m a r k s   t h e m   a s   d i s a b l e d )  
 	 s e l e c t . d i s a b l e d   =   t r u e ;  
 	 s u p p o r t . o p t D i s a b l e d   =   ! o p t . d i s a b l e d ;  
  
 	 / /   T e s t   t o   s e e   i f   i t ' s   p o s s i b l e   t o   d e l e t e   a n   e x p a n d o   f r o m   a n   e l e m e n t  
 	 / /   F a i l s   i n   I n t e r n e t   E x p l o r e r  
 	 t r y   {  
 	 	 d e l e t e   d i v . t e s t ;  
 	 }   c a t c h (   e   )   {  
 	 	 s u p p o r t . d e l e t e E x p a n d o   =   f a l s e ;  
 	 }  
  
 	 i f   (   ! d i v . a d d E v e n t L i s t e n e r   & &   d i v . a t t a c h E v e n t   & &   d i v . f i r e E v e n t   )   {  
 	 	 d i v . a t t a c h E v e n t (   " o n c l i c k " ,   f u n c t i o n   c l i c k ( )   {  
 	 	 	 / /   C l o n i n g   a   n o d e   s h o u l d n ' t   c o p y   o v e r   a n y  
 	 	 	 / /   b o u n d   e v e n t   h a n d l e r s   ( I E   d o e s   t h i s )  
 	 	 	 s u p p o r t . n o C l o n e E v e n t   =   f a l s e ;  
 	 	 	 d i v . d e t a c h E v e n t (   " o n c l i c k " ,   c l i c k   ) ;  
 	 	 } ) ;  
 	 	 d i v . c l o n e N o d e (   t r u e   ) . f i r e E v e n t (   " o n c l i c k "   ) ;  
 	 }  
  
 	 / /   C h e c k   i f   a   r a d i o   m a i n t a i n s   i t ' s   v a l u e  
 	 / /   a f t e r   b e i n g   a p p e n d e d   t o   t h e   D O M  
 	 i n p u t   =   d o c u m e n t . c r e a t e E l e m e n t ( " i n p u t " ) ;  
 	 i n p u t . v a l u e   =   " t " ;  
 	 i n p u t . s e t A t t r i b u t e ( " t y p e " ,   " r a d i o " ) ;  
 	 s u p p o r t . r a d i o V a l u e   =   i n p u t . v a l u e   = = =   " t " ;  
  
 	 i n p u t . s e t A t t r i b u t e ( " c h e c k e d " ,   " c h e c k e d " ) ;  
 	 d i v . a p p e n d C h i l d (   i n p u t   ) ;  
 	 f r a g m e n t   =   d o c u m e n t . c r e a t e D o c u m e n t F r a g m e n t ( ) ;  
 	 f r a g m e n t . a p p e n d C h i l d (   d i v . f i r s t C h i l d   ) ;  
  
 	 / /   W e b K i t   d o e s n ' t   c l o n e   c h e c k e d   s t a t e   c o r r e c t l y   i n   f r a g m e n t s  
 	 s u p p o r t . c h e c k C l o n e   =   f r a g m e n t . c l o n e N o d e (   t r u e   ) . c l o n e N o d e (   t r u e   ) . l a s t C h i l d . c h e c k e d ;  
  
 	 d i v . i n n e r H T M L   =   " " ;  
  
 	 / /   F i g u r e   o u t   i f   t h e   W 3 C   b o x   m o d e l   w o r k s   a s   e x p e c t e d  
 	 d i v . s t y l e . w i d t h   =   d i v . s t y l e . p a d d i n g L e f t   =   " 1 p x " ;  
  
 	 / /   W e   u s e   o u r   o w n ,   i n v i s i b l e ,   b o d y  
 	 b o d y   =   d o c u m e n t . c r e a t e E l e m e n t (   " b o d y "   ) ;  
 	 b o d y S t y l e   =   {  
 	 	 v i s i b i l i t y :   " h i d d e n " ,  
 	 	 w i d t h :   0 ,  
 	 	 h e i g h t :   0 ,  
 	 	 b o r d e r :   0 ,  
 	 	 m a r g i n :   0 ,  
 	 	 / /   S e t   b a c k g r o u n d   t o   a v o i d   I E   c r a s h e s   w h e n   r e m o v i n g   ( # 9 0 2 8 )  
 	 	 b a c k g r o u n d :   " n o n e "  
 	 } ;  
 	 f o r   (   i   i n   b o d y S t y l e   )   {  
 	 	 b o d y . s t y l e [   i   ]   =   b o d y S t y l e [   i   ] ;  
 	 }  
 	 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 . d o c u m e n t E l e m e n t . a p p e n d C h i l d (   b o d y   ) ;  
  
 	 / /   C h e c k   i f   a   d i s c o n n e c t e d   c h e c k b o x   w i l l   r e t a i n   i t s   c h e c k e d  
 	 / /   v a l u e   o f   t r u e   a f t e r   a p p e n d e d   t o   t h e   D O M   ( I E 6 / 7 )  
 	 s u p p o r t . a p p e n d C h e c k e d   =   i n p u t . c h e c k e d ;  
  
 	 s u p p o r t . b o x M o d e l   =   d i v . o f f s e t W i d t h   = = =   2 ;  
  
 	 i f   (   " z o o m "   i n   d i v . s t y l e   )   {  
 	 	 / /   C h e c k   i f   n a t i v e l y   b l o c k - l e v e l   e l e m e n t s   a c t   l i k e   i n l i n e - b l o c k  
 	 	 / /   e l e m e n t s   w h e n   s e t t i n g   t h e i r   d i s p l a y   t o   ' i n l i n e '   a n d   g i v i n g  
 	 	 / /   t h e m   l a y o u t  
 	 	 / /   ( I E   <   8   d o e s   t h i s )  
 	 	 d i v . s t y l e . d i s p l a y   =   " i n l i n e " ;  
 	 	 d i v . s t y l e . z o o m   =   1 ;  
 	 	 s u p p o r t . i n l i n e B l o c k N e e d s L a y o u t   =   (   d i v . o f f s e t W i d t h   = = =   2   ) ;  
  
 	 	 / /   C h e c k   i f   e l e m e n t s   w i t h   l a y o u t   s h r i n k - w r a p   t h e i r   c h i l d r e n  
 	 	 / /   ( I E   6   d o e s   t h i s )  
 	 	 d i v . s t y l e . d i s p l a y   =   " " ;  
 	 	 d i v . i n n e r H T M L   =   " < d i v   s t y l e = ' w i d t h : 4 p x ; ' > < / d i v > " ;  
 	 	 s u p p o r t . s h r i n k W r a p B l o c k s   =   (   d i v . o f f s e t W i d t h   ! = =   2   ) ;  
 	 }  
  
 	 d i v . i n n e r H T M L   =   " < t a b l e > < t r > < t d   s t y l e = ' p a d d i n g : 0 ; b o r d e r : 0 ; d i s p l a y : n o n e ' > < / t d > < t d > t < / t d > < / t r > < / t a b l e > " ;  
 	 t d s   =   d i v . g e t E l e m e n t s B y T a g N a m e (   " t d "   ) ;  
  
 	 / /   C h e c k   i f   t a b l e   c e l l s   s t i l l   h a v e   o f f s e t W i d t h / H e i g h t   w h e n   t h e y   a r e   s e t  
 	 / /   t o   d i s p l a y : n o n e   a n d   t h e r e   a r e   s t i l l   o t h e r   v i s i b l e   t a b l e   c e l l s   i n   a  
 	 / /   t a b l e   r o w ;   i f   s o ,   o f f s e t W i d t h / H e i g h t   a r e   n o t   r e l i a b l e   f o r   u s e   w h e n  
 	 / /   d e t e r m i n i n g   i f   a n   e l e m e n t   h a s   b e e n   h i d d e n   d i r e c t l y   u s i n g  
 	 / /   d i s p l a y : n o n e   ( i t   i s   s t i l l   s a f e   t o   u s e   o f f s e t s   i f   a   p a r e n t   e l e m e n t   i s  
 	 / /   h i d d e n ;   d o n   s a f e t y   g o g g l e s   a n d   s e e   b u g   # 4 5 1 2   f o r   m o r e   i n f o r m a t i o n ) .  
 	 / /   ( o n l y   I E   8   f a i l s   t h i s   t e s t )  
 	 i s S u p p o r t e d   =   (   t d s [   0   ] . o f f s e t H e i g h t   = = =   0   ) ;  
  
 	 t d s [   0   ] . s t y l e . d i s p l a y   =   " " ;  
 	 t d s [   1   ] . s t y l e . d i s p l a y   =   " n o n e " ;  
  
 	 / /   C h e c k   i f   e m p t y   t a b l e   c e l l s   s t i l l   h a v e   o f f s e t W i d t h / H e i g h t  
 	 / /   ( I E   <   8   f a i l   t h i s   t e s t )  
 	 s u p p o r t . r e l i a b l e H i d d e n O f f s e t s   =   i s S u p p o r t e d   & &   (   t d s [   0   ] . o f f s e t H e i g h t   = = =   0   ) ;  
 	 d i v . i n n e r H T M L   =   " " ;  
  
 	 / /   C h e c k   i f   d i v   w i t h   e x p l i c i t   w i d t h   a n d   n o   m a r g i n - r i g h t   i n c o r r e c t l y  
 	 / /   g e t s   c o m p u t e d   m a r g i n - r i g h t   b a s e d   o n   w i d t h   o f   c o n t a i n e r .   F o r   m o r e  
 	 / /   i n f o   s e e   b u g   # 3 3 3 3  
 	 / /   F a i l s   i n   W e b K i t   b e f o r e   F e b   2 0 1 1   n i g h t l i e s  
 	 / /   W e b K i t   B u g   1 3 3 4 3   -   g e t C o m p u t e d S t y l e   r e t u r n s   w r o n g   v a l u e   f o r   m a r g i n - r i g h t  
 	 i f   (   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   )   {  
 	 	 m a r g i n 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 "   ) ;  
 	 	 m a r g i n D i v . s t y l e . w i d t h   =   " 0 " ;  
 	 	 m a r g i n D i v . s t y l e . m a r g i n R i g h t   =   " 0 " ;  
 	 	 d i v . a p p e n d C h i l d (   m a r g i n D i v   ) ;  
 	 	 s u p p o r t . r e l i a b l e M a r g i n R i g h t   =  
 	 	 	 (   p a r s e I n t (   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 (   m a r g i n D i v ,   n u l l   ) . m a r g i n R i g h t ,   1 0   )   | |   0   )   = = =   0 ;  
 	 }  
  
 	 / /   R e m o v e   t h e   b o d y   e l e m e n t   w e   a d d e d  
 	 b o d y . i n n e r H T M L   =   " " ;  
 	 d o c u m e n t . d o c u m e n t E l e m e n t . r e m o v e C h i l d (   b o d y   ) ;  
  
 	 / /   T e c h n i q u e   f r o m   J u r i y   Z a y t s e v  
 	 / /   h t t p : / / t h i n k w e b 2 . c o m / p r o j e c t s / p r o t o t y p e / d e t e c t i n g - e v e n t - s u p p o r t - w i t h o u t - b r o w s e r - s n i f f i n g /  
 	 / /   W e   o n l y   c a r e   a b o u t   t h e   c a s e   w h e r e   n o n - s t a n d a r d   e v e n t   s y s t e m s  
 	 / /   a r e   u s e d ,   n a m e l y   i n   I E .   S h o r t - c i r c u i t i n g   h e r e   h e l p s   u s   t o  
 	 / /   a v o i d   a n   e v a l   c a l l   ( i n   s e t A t t r i b u t e )   w h i c h   c a n   c a u s e   C S P  
 	 / /   t o   g o   h a y w i r e .   S e e :   h t t p s : / / d e v e l o p e r . m o z i l l a . o r g / e n / S e c u r i t y / C S P  
 	 i f   (   d i v . a t t a c h E v e n t   )   {  
 	 	 f o r (   i   i n   {  
 	 	 	 s u b m i t :   1 ,  
 	 	 	 c h a n g e :   1 ,  
 	 	 	 f o c u s i n :   1  
 	 	 }   )   {  
 	 	 	 e v e n t N a m e   =   " o n "   +   i ;  
 	 	 	 i s S u p p o r t e d   =   (   e v e n t N a m e   i n   d i v   ) ;  
 	 	 	 i f   (   ! i s S u p p o r t e d   )   {  
 	 	 	 	 d i v . s e t A t t r i b u t e (   e v e n t N a m e ,   " r e t u r n ; "   ) ;  
 	 	 	 	 i s S u p p o r t e d   =   (   t y p e o f   d i v [   e v e n t N a m e   ]   = = =   " f u n c t i o n "   ) ;  
 	 	 	 }  
 	 	 	 s u p p o r t [   i   +   " B u b b l e s "   ]   =   i s S u p p o r t e d ;  
 	 	 }  
 	 }  
  
 	 r e t u r n   s u p p o r t ;  
 } ) ( ) ;  
  
 / /   K e e p   t r a c k   o f   b o x M o d e l  
 j Q u e r y . b o x M o d e l   =   j Q u e r y . s u p p o r t . b o x M o d e l ;  
  
  
  
  
 v a r   r b r a c e   =   / ^ ( ? : \ { . * \ } | \ [ . * \ ] ) $ / ,  
 	 r m u l t i D a s h   =   / ( [ a - z ] ) ( [ A - Z ] ) / g ;  
  
 j Q u e r y . e x t e n d ( {  
 	 c a c h e :   { } ,  
  
 	 / /   P l e a s e   u s e   w i t h   c a u t i o n  
 	 u u i d :   0 ,  
  
 	 / /   U n i q u e   f o r   e a c h   c o p y   o f   j Q u e r y   o n   t h e   p a g e  
 	 / /   N o n - d i g i t s   r e m o v e d   t o   m a t c h   r i n l i n e j Q u e r y  
 	 e x p a n d o :   " j Q u e r y "   +   (   j Q u e r y . f n . j q u e r y   +   M a t h . r a n d o m ( )   ) . r e p l a c e (   / \ D / g ,   " "   ) ,  
  
 	 / /   T h e   f o l l o w i n g   e l e m e n t s   t h r o w   u n c a t c h a b l e   e x c e p t i o n s   i f   y o u  
 	 / /   a t t e m p t   t o   a d d   e x p a n d o   p r o p e r t i e s   t o   t h e m .  
 	 n o D a t a :   {  
 	 	 " e m b e d " :   t r u e ,  
 	 	 / /   B a n   a l l   o b j e c t s   e x c e p t   f o r   F l a s h   ( w h i c h   h a n d l e   e x p a n d o s )  
 	 	 " o b j e c t " :   " c l s i d : D 2 7 C D B 6 E - A E 6 D - 1 1 c f - 9 6 B 8 - 4 4 4 5 5 3 5 4 0 0 0 0 " ,  
 	 	 " a p p l e t " :   t r u e  
 	 } ,  
  
 	 h a s D a t a :   f u n c t i o n (   e l e m   )   {  
 	 	 e l e m   =   e l e m . n o d e T y p e   ?   j Q u e r y . c a c h e [   e l e m [ j Q u e r y . e x p a n d o ]   ]   :   e l e m [   j Q u e r y . e x p a n d o   ] ;  
  
 	 	 r e t u r n   ! ! e l e m   & &   ! i s E m p t y D a t a O b j e c t (   e l e m   ) ;  
 	 } ,  
  
 	 d a t a :   f u n c t i o n (   e l e m ,   n a m e ,   d a t a ,   p v t   / *   I n t e r n a l   U s e   O n l y   * /   )   {  
 	 	 i f   (   ! j Q u e r y . a c c e p t D a t a (   e l e m   )   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 v a r   i n t e r n a l K e y   =   j Q u e r y . e x p a n d o ,   g e t B y N a m e   =   t y p e o f   n a m e   = = =   " s t r i n g " ,   t h i s C a c h e ,  
  
 	 	 	 / /   W e   h a v e   t o   h a n d l e   D O M   n o d e s   a n d   J S   o b j e c t s   d i f f e r e n t l y   b e c a u s e   I E 6 - 7  
 	 	 	 / /   c a n ' t   G C   o b j e c t   r e f e r e n c e s   p r o p e r l y   a c r o s s   t h e   D O M - J S   b o u n d a r y  
 	 	 	 i s N o d e   =   e l e m . n o d e T y p e ,  
  
 	 	 	 / /   O n l y   D O M   n o d e s   n e e d   t h e   g l o b a l   j Q u e r y   c a c h e ;   J S   o b j e c t   d a t a   i s  
 	 	 	 / /   a t t a c h e d   d i r e c t l y   t o   t h e   o b j e c t   s o   G C   c a n   o c c u r   a u t o m a t i c a l l y  
 	 	 	 c a c h e   =   i s N o d e   ?   j Q u e r y . c a c h e   :   e l e m ,  
  
 	 	 	 / /   O n l y   d e f i n i n g   a n   I D   f o r   J S   o b j e c t s   i f   i t s   c a c h e   a l r e a d y   e x i s t s   a l l o w s  
 	 	 	 / /   t h e   c o d e   t o   s h o r t c u t   o n   t h e   s a m e   p a t h   a s   a   D O M   n o d e   w i t h   n o   c a c h e  
 	 	 	 i d   =   i s N o d e   ?   e l e m [   j Q u e r y . e x p a n d o   ]   :   e l e m [   j Q u e r y . e x p a n d o   ]   & &   j Q u e r y . e x p a n d o ;  
  
 	 	 / /   A v o i d   d o i n g   a n y   m o r e   w o r k   t h a n   w e   n e e d   t o   w h e n   t r y i n g   t o   g e t   d a t a   o n   a n  
 	 	 / /   o b j e c t   t h a t   h a s   n o   d a t a   a t   a l l  
 	 	 i f   (   ( ! i d   | |   ( p v t   & &   i d   & &   ! c a c h e [   i d   ] [   i n t e r n a l K e y   ] ) )   & &   g e t B y N a m e   & &   d a t a   = = =   u n d e f i n e d   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 i f   (   ! i d   )   {  
 	 	 	 / /   O n l y   D O M   n o d e s   n e e d   a   n e w   u n i q u e   I D   f o r   e a c h   e l e m e n t   s i n c e   t h e i r   d a t a  
 	 	 	 / /   e n d s   u p   i n   t h e   g l o b a l   c a c h e  
 	 	 	 i f   (   i s N o d e   )   {  
 	 	 	 	 e l e m [   j Q u e r y . e x p a n d o   ]   =   i d   =   + + j Q u e r y . u u i d ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 i d   =   j Q u e r y . e x p a n d o ;  
 	 	 	 }  
 	 	 }  
  
 	 	 i f   (   ! c a c h e [   i d   ]   )   {  
 	 	 	 c a c h e [   i d   ]   =   { } ;  
  
 	 	 	 / /   T O D O :   T h i s   i s   a   h a c k   f o r   1 . 5   O N L Y .   A v o i d s   e x p o s i n g   j Q u e r y  
 	 	 	 / /   m e t a d a t a   o n   p l a i n   J S   o b j e c t s   w h e n   t h e   o b j e c t   i s   s e r i a l i z e d   u s i n g  
 	 	 	 / /   J S O N . s t r i n g i f y  
 	 	 	 i f   (   ! i s N o d e   )   {  
 	 	 	 	 c a c h e [   i d   ] . t o J S O N   =   j Q u e r y . n o o p ;  
 	 	 	 }  
 	 	 }  
  
 	 	 / /   A n   o b j e c t   c a n   b e   p a s s e d   t o   j Q u e r y . d a t a   i n s t e a d   o f   a   k e y / v a l u e   p a i r ;   t h i s   g e t s  
 	 	 / /   s h a l l o w   c o p i e d   o v e r   o n t o   t h e   e x i s t i n g   c a c h e  
 	 	 i f   (   t y p e o f   n a m e   = = =   " o b j e c t "   | |   t y p e o f   n a m e   = = =   " f u n c t i o n "   )   {  
 	 	 	 i f   (   p v t   )   {  
 	 	 	 	 c a c h e [   i d   ] [   i n t e r n a l K e y   ]   =   j Q u e r y . e x t e n d ( c a c h e [   i d   ] [   i n t e r n a l K e y   ] ,   n a m e ) ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 c a c h e [   i d   ]   =   j Q u e r y . e x t e n d ( c a c h e [   i d   ] ,   n a m e ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 t h i s C a c h e   =   c a c h e [   i d   ] ;  
  
 	 	 / /   I n t e r n a l   j Q u e r y   d a t a   i s   s t o r e d   i n   a   s e p a r a t e   o b j e c t   i n s i d e   t h e   o b j e c t ' s   d a t a  
 	 	 / /   c a c h e   i n   o r d e r   t o   a v o i d   k e y   c o l l i s i o n s   b e t w e e n   i n t e r n a l   d a t a   a n d   u s e r - d e f i n e d  
 	 	 / /   d a t a  
 	 	 i f   (   p v t   )   {  
 	 	 	 i f   (   ! t h i s C a c h e [   i n t e r n a l K e y   ]   )   {  
 	 	 	 	 t h i s C a c h e [   i n t e r n a l K e y   ]   =   { } ;  
 	 	 	 }  
  
 	 	 	 t h i s C a c h e   =   t h i s C a c h e [   i n t e r n a l K e y   ] ;  
 	 	 }  
  
 	 	 i f   (   d a t a   ! = =   u n d e f i n e d   )   {  
 	 	 	 t h i s C a c h e [   n a m e   ]   =   d a t a ;  
 	 	 }  
  
 	 	 / /   T O D O :   T h i s   i s   a   h a c k   f o r   1 . 5   O N L Y .   I t   w i l l   b e   r e m o v e d   i n   1 . 6 .   U s e r s   s h o u l d  
 	 	 / /   n o t   a t t e m p t   t o   i n s p e c t   t h e   i n t e r n a l   e v e n t s   o b j e c t   u s i n g   j Q u e r y . d a t a ,   a s   t h i s  
 	 	 / /   i n t e r n a l   d a t a   o b j e c t   i s   u n d o c u m e n t e d   a n d   s u b j e c t   t o   c h a n g e .  
 	 	 i f   (   n a m e   = = =   " e v e n t s "   & &   ! t h i s C a c h e [ n a m e ]   )   {  
 	 	 	 r e t u r n   t h i s C a c h e [   i n t e r n a l K e y   ]   & &   t h i s C a c h e [   i n t e r n a l K e y   ] . e v e n t s ;  
 	 	 }  
  
 	 	 r e t u r n   g e t B y N a m e   ?   t h i s C a c h e [   n a m e   ]   :   t h i s C a c h e ;  
 	 } ,  
  
 	 r e m o v e D a t a :   f u n c t i o n (   e l e m ,   n a m e ,   p v t   / *   I n t e r n a l   U s e   O n l y   * /   )   {  
 	 	 i f   (   ! j Q u e r y . a c c e p t D a t a (   e l e m   )   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 v a r   i n t e r n a l K e y   =   j Q u e r y . e x p a n d o ,   i s N o d e   =   e l e m . n o d e T y p e ,  
  
 	 	 	 / /   S e e   j Q u e r y . d a t a   f o r   m o r e   i n f o r m a t i o n  
 	 	 	 c a c h e   =   i s N o d e   ?   j Q u e r y . c a c h e   :   e l e m ,  
  
 	 	 	 / /   S e e   j Q u e r y . d a t a   f o r   m o r e   i n f o r m a t i o n  
 	 	 	 i d   =   i s N o d e   ?   e l e m [   j Q u e r y . e x p a n d o   ]   :   j Q u e r y . e x p a n d o ;  
  
 	 	 / /   I f   t h e r e   i s   a l r e a d y   n o   c a c h e   e n t r y   f o r   t h i s   o b j e c t ,   t h e r e   i s   n o  
 	 	 / /   p u r p o s e   i n   c o n t i n u i n g  
 	 	 i f   (   ! c a c h e [   i d   ]   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 i f   (   n a m e   )   {  
 	 	 	 v a r   t h i s C a c h e   =   p v t   ?   c a c h e [   i d   ] [   i n t e r n a l K e y   ]   :   c a c h e [   i d   ] ;  
  
 	 	 	 i f   (   t h i s C a c h e   )   {  
 	 	 	 	 d e l e t e   t h i s C a c h e [   n a m e   ] ;  
  
 	 	 	 	 / /   I f   t h e r e   i s   n o   d a t a   l e f t   i n   t h e   c a c h e ,   w e   w a n t   t o   c o n t i n u e  
 	 	 	 	 / /   a n d   l e t   t h e   c a c h e   o b j e c t   i t s e l f   g e t   d e s t r o y e d  
 	 	 	 	 i f   (   ! i s E m p t y D a t a O b j e c t ( t h i s C a c h e )   )   {  
 	 	 	 	 	 r e t u r n ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 / /   S e e   j Q u e r y . d a t a   f o r   m o r e   i n f o r m a t i o n  
 	 	 i f   (   p v t   )   {  
 	 	 	 d e l e t e   c a c h e [   i d   ] [   i n t e r n a l K e y   ] ;  
  
 	 	 	 / /   D o n ' t   d e s t r o y   t h e   p a r e n t   c a c h e   u n l e s s   t h e   i n t e r n a l   d a t a   o b j e c t  
 	 	 	 / /   h a d   b e e n   t h e   o n l y   t h i n g   l e f t   i n   i t  
 	 	 	 i f   (   ! i s E m p t y D a t a O b j e c t ( c a c h e [   i d   ] )   )   {  
 	 	 	 	 r e t u r n ;  
 	 	 	 }  
 	 	 }  
  
 	 	 v a r   i n t e r n a l C a c h e   =   c a c h e [   i d   ] [   i n t e r n a l K e y   ] ;  
  
 	 	 / /   B r o w s e r s   t h a t   f a i l   e x p a n d o   d e l e t i o n   a l s o   r e f u s e   t o   d e l e t e   e x p a n d o s   o n  
 	 	 / /   t h e   w i n d o w ,   b u t   i t   w i l l   a l l o w   i t   o n   a l l   o t h e r   J S   o b j e c t s ;   o t h e r   b r o w s e r s  
 	 	 / /   d o n ' t   c a r e  
 	 	 i f   (   j Q u e r y . s u p p o r t . d e l e t e E x p a n d o   | |   c a c h e   ! =   w i n d o w   )   {  
 	 	 	 d e l e t e   c a c h e [   i d   ] ;  
 	 	 }   e l s e   {  
 	 	 	 c a c h e [   i d   ]   =   n u l l ;  
 	 	 }  
  
 	 	 / /   W e   d e s t r o y e d   t h e   e n t i r e   u s e r   c a c h e   a t   o n c e   b e c a u s e   i t ' s   f a s t e r   t h a n  
 	 	 / /   i t e r a t i n g   t h r o u g h   e a c h   k e y ,   b u t   w e   n e e d   t o   c o n t i n u e   t o   p e r s i s t   i n t e r n a l  
 	 	 / /   d a t a   i f   i t   e x i s t e d  
 	 	 i f   (   i n t e r n a l C a c h e   )   {  
 	 	 	 c a c h e [   i d   ]   =   { } ;  
 	 	 	 / /   T O D O :   T h i s   i s   a   h a c k   f o r   1 . 5   O N L Y .   A v o i d s   e x p o s i n g   j Q u e r y  
 	 	 	 / /   m e t a d a t a   o n   p l a i n   J S   o b j e c t s   w h e n   t h e   o b j e c t   i s   s e r i a l i z e d   u s i n g  
 	 	 	 / /   J S O N . s t r i n g i f y  
 	 	 	 i f   (   ! i s N o d e   )   {  
 	 	 	 	 c a c h e [   i d   ] . t o J S O N   =   j Q u e r y . n o o p ;  
 	 	 	 }  
  
 	 	 	 c a c h e [   i d   ] [   i n t e r n a l K e y   ]   =   i n t e r n a l C a c h e ;  
  
 	 	 / /   O t h e r w i s e ,   w e   n e e d   t o   e l i m i n a t e   t h e   e x p a n d o   o n   t h e   n o d e   t o   a v o i d  
 	 	 / /   f a l s e   l o o k u p s   i n   t h e   c a c h e   f o r   e n t r i e s   t h a t   n o   l o n g e r   e x i s t  
 	 	 }   e l s e   i f   (   i s N o d e   )   {  
 	 	 	 / /   I E   d o e s   n o t   a l l o w   u s   t o   d e l e t e   e x p a n d o   p r o p e r t i e s   f r o m   n o d e s ,  
 	 	 	 / /   n o r   d o e s   i t   h a v e   a   r e m o v e A t t r i b u t e   f u n c t i o n   o n   D o c u m e n t   n o d e s ;  
 	 	 	 / /   w e   m u s t   h a n d l e   a l l   o f   t h e s e   c a s e s  
 	 	 	 i f   (   j Q u e r y . s u p p o r t . d e l e t e E x p a n d o   )   {  
 	 	 	 	 d e l e t e   e l e m [   j Q u e r y . e x p a n d o   ] ;  
 	 	 	 }   e l s e   i f   (   e l e m . r e m o v e A t t r i b u t e   )   {  
 	 	 	 	 e l e m . r e m o v e A t t r i b u t e (   j Q u e r y . e x p a n d o   ) ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 e l e m [   j Q u e r y . e x p a n d o   ]   =   n u l l ;  
 	 	 	 }  
 	 	 }  
 	 } ,  
  
 	 / /   F o r   i n t e r n a l   u s e   o n l y .  
 	 _ d a t a :   f u n c t i o n (   e l e m ,   n a m e ,   d a t a   )   {  
 	 	 r e t u r n   j Q u e r y . d a t a (   e l e m ,   n a m e ,   d a t a ,   t r u e   ) ;  
 	 } ,  
  
 	 / /   A   m e t h o d   f o r   d e t e r m i n i n g   i f   a   D O M   n o d e   c a n   h a n d l e   t h e   d a t a   e x p a n d o  
 	 a c c e p t D a t a :   f u n c t i o n (   e l e m   )   {  
 	 	 i f   (   e l e m . n o d e N a m e   )   {  
 	 	 	 v a r   m a t c h   =   j Q u e r y . n o D a t a [   e l e m . n o d e N a m e . t o L o w e r C a s e ( )   ] ;  
  
 	 	 	 i f   (   m a t c h   )   {  
 	 	 	 	 r e t u r n   ! ( m a t c h   = = =   t r u e   | |   e l e m . g e t A t t r i b u t e ( " c l a s s i d " )   ! = =   m a t c h ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   t r u e ;  
 	 }  
 } ) ;  
  
 j Q u e r y . f n . e x t e n d ( {  
 	 d a t a :   f u n c t i o n (   k e y ,   v a l u e   )   {  
 	 	 v a r   d a t a   =   n u l l ;  
  
 	 	 i f   (   t y p e o f   k e y   = = =   " u n d e f i n e d "   )   {  
 	 	 	 i f   (   t h i s . l e n g t h   )   {  
 	 	 	 	 d a t a   =   j Q u e r y . d a t a (   t h i s [ 0 ]   ) ;  
  
 	 	 	 	 i f   (   t h i s [ 0 ] . n o d e T y p e   = = =   1   )   {  
 	 	 	         v a r   a t t r   =   t h i s [ 0 ] . a t t r i b u t e s ,   n a m e ;  
 	 	 	 	 	 f o r   (   v a r   i   =   0 ,   l   =   a t t r . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 	 	 	 n a m e   =   a t t r [ i ] . n a m e ;  
  
 	 	 	 	 	 	 i f   (   n a m e . i n d e x O f (   " d a t a - "   )   = = =   0   )   {  
 	 	 	 	 	 	 	 n a m e   =   j Q u e r y . c a m e l C a s e (   n a m e . s u b s t r i n g ( 5 )   ) ;  
  
 	 	 	 	 	 	 	 d a t a A t t r (   t h i s [ 0 ] ,   n a m e ,   d a t a [   n a m e   ]   ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 r e t u r n   d a t a ;  
  
 	 	 }   e l s e   i f   (   t y p e o f   k e y   = = =   " o b j e c t "   )   {  
 	 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( )   {  
 	 	 	 	 j Q u e r y . d a t a (   t h i s ,   k e y   ) ;  
 	 	 	 } ) ;  
 	 	 }  
  
 	 	 v a r   p a r t s   =   k e y . s p l i t ( " . " ) ;  
 	 	 p a r t s [ 1 ]   =   p a r t s [ 1 ]   ?   " . "   +   p a r t s [ 1 ]   :   " " ;  
  
 	 	 i f   (   v a l u e   = = =   u n d e f i n e d   )   {  
 	 	 	 d a t a   =   t h i s . t r i g g e r H a n d l e r ( " g e t D a t a "   +   p a r t s [ 1 ]   +   " ! " ,   [ p a r t s [ 0 ] ] ) ;  
  
 	 	 	 / /   T r y   t o   f e t c h   a n y   i n t e r n a l l y   s t o r e d   d a t a   f i r s t  
 	 	 	 i f   (   d a t a   = = =   u n d e f i n e d   & &   t h i s . l e n g t h   )   {  
 	 	 	 	 d a t a   =   j Q u e r y . d a t a (   t h i s [ 0 ] ,   k e y   ) ;  
 	 	 	 	 d a t a   =   d a t a A t t r (   t h i s [ 0 ] ,   k e y ,   d a t a   ) ;  
 	 	 	 }  
  
 	 	 	 r e t u r n   d a t a   = = =   u n d e f i n e d   & &   p a r t s [ 1 ]   ?  
 	 	 	 	 t h i s . d a t a (   p a r t s [ 0 ]   )   :  
 	 	 	 	 d a t a ;  
  
 	 	 }   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 ( )   {  
 	 	 	 	 v a r   $ t h i s   =   j Q u e r y (   t h i s   ) ,  
 	 	 	 	 	 a r g s   =   [   p a r t s [ 0 ] ,   v a l u e   ] ;  
  
 	 	 	 	 $ t h i s . t r i g g e r H a n d l e r (   " s e t D a t a "   +   p a r t s [ 1 ]   +   " ! " ,   a r g s   ) ;  
 	 	 	 	 j Q u e r y . d a t a (   t h i s ,   k e y ,   v a l u e   ) ;  
 	 	 	 	 $ t h i s . t r i g g e r H a n d l e r (   " c h a n g e D a t a "   +   p a r t s [ 1 ]   +   " ! " ,   a r g s   ) ;  
 	 	 	 } ) ;  
 	 	 }  
 	 } ,  
  
 	 r e m o v e 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 . e a c h ( f u n c t i o n ( )   {  
 	 	 	 j Q u e r y . r e m o v e D a t a (   t h i s ,   k e y   ) ;  
 	 	 } ) ;  
 	 }  
 } ) ;  
  
 f u n c t i o n   d a t a A t t r (   e l e m ,   k e y ,   d a t a   )   {  
 	 / /   I f   n o t h i n g   w a s   f o u n d   i n t e r n a l l y ,   t r y   t o   f e t c h   a n y  
 	 / /   d a t a   f r o m   t h e   H T M L 5   d a t a - *   a t t r i b u t e  
 	 i f   (   d a t a   = = =   u n d e f i n e d   & &   e l e m . n o d e T y p e   = = =   1   )   {  
 	 	 n a m e   =   " d a t a - "   +   k e y . r e p l a c e (   r m u l t i D a s h ,   " $ 1 - $ 2 "   ) . t o L o w e r C a s e ( ) ;  
  
 	 	 d a t a   =   e l e m . g e t A t t r i b u t e (   n a m e   ) ;  
  
 	 	 i f   (   t y p e o f   d a t a   = = =   " s t r i n g "   )   {  
 	 	 	 t r y   {  
 	 	 	 	 d a t a   =   d a t a   = = =   " t r u e "   ?   t r u e   :  
 	 	 	 	 d a t a   = = =   " f a l s e "   ?   f a l s e   :  
 	 	 	 	 d a t a   = = =   " n u l l "   ?   n u l l   :  
 	 	 	 	 ! j Q u e r y . i s N a N (   d a t a   )   ?   p a r s e F l o a t (   d a t a   )   :  
 	 	 	 	 	 r b r a c e . t e s t (   d a t a   )   ?   j Q u e r y . p a r s e J S O N (   d a t a   )   :  
 	 	 	 	 	 d a t a ;  
 	 	 	 }   c a t c h (   e   )   { }  
  
 	 	 	 / /   M a k e   s u r e   w e   s e t   t h e   d a t a   s o   i t   i s n ' t   c h a n g e d   l a t e r  
 	 	 	 j Q u e r y . d a t a (   e l e m ,   k e y ,   d a t a   ) ;  
  
 	 	 }   e l s e   {  
 	 	 	 d a t a   =   u n d e f i n e d ;  
 	 	 }  
 	 }  
  
 	 r e t u r n   d a t a ;  
 }  
  
 / /   T O D O :   T h i s   i s   a   h a c k   f o r   1 . 5   O N L Y   t o   a l l o w   o b j e c t s   w i t h   a   s i n g l e   t o J S O N  
 / /   p r o p e r t y   t o   b e   c o n s i d e r e d   e m p t y   o b j e c t s ;   t h i s   p r o p e r t y   a l w a y s   e x i s t s   i n  
 / /   o r d e r   t o   m a k e   s u r e   J S O N . s t r i n g i f y   d o e s   n o t   e x p o s e   i n t e r n a l   m e t a d a t a  
 f u n c t i o n   i s E m p t y D a t a O b j e c t (   o b j   )   {  
 	 f o r   (   v a r   n a m e   i n   o b j   )   {  
 	 	 i f   (   n a m e   ! = =   " t o J S O N "   )   {  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 }  
  
 	 r e t u r n   t r u e ;  
 }  
  
  
  
  
 f u n c t i o n   h a n d l e Q u e u e M a r k D e f e r (   e l e m ,   t y p e ,   s r c   )   {  
 	 v a r   d e f e r D a t a K e y   =   t y p e   +   " d e f e r " ,  
 	 	 q u e u e D a t a K e y   =   t y p e   +   " q u e u e " ,  
 	 	 m a r k D a t a K e y   =   t y p e   +   " m a r k " ,  
 	 	 d e f e r   =   j Q u e r y . d a t a (   e l e m ,   d e f e r D a t a K e y ,   u n d e f i n e d ,   t r u e   ) ;  
 	 i f   (   d e f e r   & &  
 	 	 (   s r c   = = =   " q u e u e "   | |   ! j Q u e r y . d a t a (   e l e m ,   q u e u e D a t a K e y ,   u n d e f i n e d ,   t r u e   )   )   & &  
 	 	 (   s r c   = = =   " m a r k "   | |   ! j Q u e r y . d a t a (   e l e m ,   m a r k D a t a K e y ,   u n d e f i n e d ,   t r u e   )   )   )   {  
 	 	 / /   G i v e   r o o m   f o r   h a r d - c o d e d   c a l l b a c k s   t o   f i r e   f i r s t  
 	 	 / /   a n d   e v e n t u a l l y   m a r k / q u e u e   s o m e t h i n g   e l s e   o n   t h e   e l e m e n t  
 	 	 s e t T i m e o u t (   f u n c t i o n ( )   {  
 	 	 	 i f   (   ! j Q u e r y . d a t a (   e l e m ,   q u e u e D a t a K e y ,   u n d e f i n e d ,   t r u e   )   & &  
 	 	 	 	 ! j Q u e r y . d a t a (   e l e m ,   m a r k D a t a K e y ,   u n d e f i n e d ,   t r u e   )   )   {  
 	 	 	 	 j Q u e r y . r e m o v e D a t a (   e l e m ,   d e f e r D a t a K e y ,   t r u e   ) ;  
 	 	 	 	 d e f e r . r e s o l v e ( ) ;  
 	 	 	 }  
 	 	 } ,   0   ) ;  
 	 }  
 }  
  
 j Q u e r y . e x t e n d ( {  
  
 	 _ m a r k :   f u n c t i o n (   e l e m ,   t y p e   )   {  
 	 	 i f   (   e l e m   )   {  
 	 	 	 t y p e   =   ( t y p e   | |   " f x " )   +   " m a r k " ;  
 	 	 	 j Q u e r y . d a t a (   e l e m ,   t y p e ,   ( j Q u e r y . d a t a ( e l e m , t y p e , u n d e f i n e d , t r u e )   | |   0 )   +   1 ,   t r u e   ) ;  
 	 	 }  
 	 } ,  
  
 	 _ u n m a r k :   f u n c t i o n (   f o r c e ,   e l e m ,   t y p e   )   {  
 	 	 i f   (   f o r c e   ! = =   t r u e   )   {  
 	 	 	 t y p e   =   e l e m ;  
 	 	 	 e l e m   =   f o r c e ;  
 	 	 	 f o r c e   =   f a l s e ;  
 	 	 }  
 	 	 i f   (   e l e m   )   {  
 	 	 	 t y p e   =   t y p e   | |   " f x " ;  
 	 	 	 v a r   k e y   =   t y p e   +   " m a r k " ,  
 	 	 	 	 c o u n t   =   f o r c e   ?   0   :   (   ( j Q u e r y . d a t a (   e l e m ,   k e y ,   u n d e f i n e d ,   t r u e )   | |   1   )   -   1   ) ;  
 	 	 	 i f   (   c o u n t   )   {  
 	 	 	 	 j Q u e r y . d a t a (   e l e m ,   k e y ,   c o u n t ,   t r u e   ) ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 j Q u e r y . r e m o v e D a t a (   e l e m ,   k e y ,   t r u e   ) ;  
 	 	 	 	 h a n d l e Q u e u e M a r k D e f e r (   e l e m ,   t y p e ,   " m a r k "   ) ;  
 	 	 	 }  
 	 	 }  
 	 } ,  
  
 	 q u e u e :   f u n c t i o n (   e l e m ,   t y p e ,   d a t a   )   {  
 	 	 i f   (   e l e m   )   {  
 	 	 	 t y p e   =   ( t y p e   | |   " f x " )   +   " q u e u e " ;  
 	 	 	 v a r   q   =   j Q u e r y . d a t a (   e l e m ,   t y p e ,   u n d e f i n e d ,   t r u e   ) ;  
 	 	 	 / /   S p e e d   u p   d e q u e u e   b y   g e t t i n g   o u t   q u i c k l y   i f   t h i s   i s   j u s t   a   l o o k u p  
 	 	 	 i f   (   d a t a   )   {  
 	 	 	 	 i f   (   ! q   | |   j Q u e r y . i s A r r a y ( d a t a )   )   {  
 	 	 	 	 	 q   =   j Q u e r y . d a t a (   e l e m ,   t y p e ,   j Q u e r y . m a k e A r r a y ( d a t a ) ,   t r u e   ) ;  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 q . p u s h (   d a t a   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 	 r e t u r n   q   | |   [ ] ;  
 	 	 }  
 	 } ,  
  
 	 d e q u e u e :   f u n c t i o n (   e l e m ,   t y p e   )   {  
 	 	 t y p e   =   t y p e   | |   " f x " ;  
  
 	 	 v a r   q u e u e   =   j Q u e r y . q u e u e (   e l e m ,   t y p e   ) ,  
 	 	 	 f n   =   q u e u e . s h i f t ( ) ,  
 	 	 	 d e f e r ;  
  
 	 	 / /   I f   t h e   f x   q u e u e   i s   d e q u e u e d ,   a l w a y s   r e m o v e   t h e   p r o g r e s s   s e n t i n e l  
 	 	 i f   (   f n   = = =   " i n p r o g r e s s "   )   {  
 	 	 	 f n   =   q u e u e . s h i f t ( ) ;  
 	 	 }  
  
 	 	 i f   (   f n   )   {  
 	 	 	 / /   A d d   a   p r o g r e s s   s e n t i n e l   t o   p r e v e n t   t h e   f x   q u e u e   f r o m   b e i n g  
 	 	 	 / /   a u t o m a t i c a l l y   d e q u e u e d  
 	 	 	 i f   (   t y p e   = = =   " f x "   )   {  
 	 	 	 	 q u e u e . u n s h i f t ( " i n p r o g r e s s " ) ;  
 	 	 	 }  
  
 	 	 	 f n . c a l l ( e l e m ,   f u n c t i o n ( )   {  
 	 	 	 	 j Q u e r y . d e q u e u e ( e l e m ,   t y p e ) ;  
 	 	 	 } ) ;  
 	 	 }  
  
 	 	 i f   (   ! q u e u e . l e n g t h   )   {  
 	 	 	 j Q u e r y . r e m o v e D a t a (   e l e m ,   t y p e   +   " q u e u e " ,   t r u e   ) ;  
 	 	 	 h a n d l e Q u e u e M a r k D e f e r (   e l e m ,   t y p e ,   " q u e u e "   ) ;  
 	 	 }  
 	 }  
 } ) ;  
  
 j Q u e r y . f n . e x t e n d ( {  
 	 q u e u e :   f u n c t i o n (   t y p e ,   d a t a   )   {  
 	 	 i f   (   t y p e o f   t y p e   ! = =   " s t r i n g "   )   {  
 	 	 	 d a t a   =   t y p e ;  
 	 	 	 t y p e   =   " f x " ;  
 	 	 }  
  
 	 	 i f   (   d a t a   = = =   u n d e f i n e d   )   {  
 	 	 	 r e t u r n   j Q u e r y . q u e u e (   t h i s [ 0 ] ,   t y p e   ) ;  
 	 	 }  
 	 	 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   q u e u e   =   j Q u e r y . q u e u e (   t h i s ,   t y p e ,   d a t a   ) ;  
  
 	 	 	 i f   (   t y p e   = = =   " f x "   & &   q u e u e [ 0 ]   ! = =   " i n p r o g r e s s "   )   {  
 	 	 	 	 j Q u e r y . d e q u e u e (   t h i s ,   t y p e   ) ;  
 	 	 	 }  
 	 	 } ) ;  
 	 } ,  
 	 d e q u e u e :   f u n c t i o n (   t y p e   )   {  
 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( )   {  
 	 	 	 j Q u e r y . d e q u e u e (   t h i s ,   t y p e   ) ;  
 	 	 } ) ;  
 	 } ,  
 	 / /   B a s e d   o f f   o f   t h e   p l u g i n   b y   C l i n t   H e l f e r s ,   w i t h   p e r m i s s i o n .  
 	 / /   h t t p : / / b l i n d s i g n a l s . c o m / i n d e x . p h p / 2 0 0 9 / 0 7 / j q u e r y - d e l a y /  
 	 d e l a y :   f u n c t i o n (   t i m e ,   t y p e   )   {  
 	 	 t i m e   =   j Q u e r y . f x   ?   j Q u e r y . f x . s p e e d s [ t i m e ]   | |   t i m e   :   t i m e ;  
 	 	 t y p e   =   t y p e   | |   " f x " ;  
  
 	 	 r e t u r n   t h i s . q u e u e (   t y p e ,   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 ( )   {  
 	 	 	 	 j Q u e r y . d e q u e u e (   e l e m ,   t y p e   ) ;  
 	 	 	 } ,   t i m e   ) ;  
 	 	 } ) ;  
 	 } ,  
 	 c l e a r Q u e u e :   f u n c t i o n (   t y p e   )   {  
 	 	 r e t u r n   t h i s . q u e u e (   t y p e   | |   " f x " ,   [ ]   ) ;  
 	 } ,  
 	 / /   G e t   a   p r o m i s e   r e s o l v e d   w h e n   q u e u e s   o f   a   c e r t a i n   t y p e  
 	 / /   a r e   e m p t i e d   ( f x   i s   t h e   t y p e   b y   d e f a u l t )  
 	 p r o m i s e :   f u n c t i o n (   t y p e ,   o b j e c t   )   {  
 	 	 i f   (   t y p e o f   t y p e   ! = =   " s t r i n g "   )   {  
 	 	 	 o b j e c t   =   t y p e ;  
 	 	 	 t y p e   =   u n d e f i n e d ;  
 	 	 }  
 	 	 t y p e   =   t y p e   | |   " f x " ;  
 	 	 v a r   d e f e r   =   j Q u e r y . D e f e r r e d ( ) ,  
 	 	 	 e l e m e n t s   =   t h i s ,  
 	 	 	 i   =   e l e m e n t s . l e n g t h ,  
 	 	 	 c o u n t   =   1 ,  
 	 	 	 d e f e r D a t a K e y   =   t y p e   +   " d e f e r " ,  
 	 	 	 q u e u e D a t a K e y   =   t y p e   +   " q u e u e " ,  
 	 	 	 m a r k D a t a K e y   =   t y p e   +   " m a r k " ;  
 	 	 f u n c t i o n   r e s o l v e ( )   {  
 	 	 	 i f   (   ! (   - - c o u n t   )   )   {  
 	 	 	 	 d e f e r . r e s o l v e W i t h (   e l e m e n t s ,   [   e l e m e n t s   ]   ) ;  
 	 	 	 }  
 	 	 }  
 	 	 w h i l e (   i - -   )   {  
 	 	 	 i f   ( (   t m p   =   j Q u e r y . d a t a (   e l e m e n t s [   i   ] ,   d e f e r D a t a K e y ,   u n d e f i n e d ,   t r u e   )   | |  
 	 	 	 	 	 (   j Q u e r y . d a t a (   e l e m e n t s [   i   ] ,   q u e u e D a t a K e y ,   u n d e f i n e d ,   t r u e   )   | |  
 	 	 	 	 	 	 j Q u e r y . d a t a (   e l e m e n t s [   i   ] ,   m a r k D a t a K e y ,   u n d e f i n e d ,   t r u e   )   )   & &  
 	 	 	 	 	 j Q u e r y . d a t a (   e l e m e n t s [   i   ] ,   d e f e r D a t a K e y ,   j Q u e r y . _ D e f e r r e d ( ) ,   t r u e   )   ) )   {  
 	 	 	 	 c o u n t + + ;  
 	 	 	 	 t m p . d o n e (   r e s o l v e   ) ;  
 	 	 	 }  
 	 	 }  
 	 	 r e s o l v e ( ) ;  
 	 	 r e t u r n   d e f e r . p r o m i s e ( ) ;  
 	 }  
 } ) ;  
  
  
  
  
 v a r   r c l a s s   =   / [ \ n \ t \ r ] / g ,  
 	 r s p a c e   =   / \ s + / ,  
 	 r r e t u r n   =   / \ r / g ,  
 	 r t y p e   =   / ^ ( ? : b u t t o n | i n p u t ) $ / i ,  
 	 r f o c u s a b l e   =   / ^ ( ? : b u t t o n | i n p u t | o b j e c t | s e l e c t | t e x t a r e a ) $ / i ,  
 	 r c l i c k a b l e   =   / ^ a ( ? : r e a ) ? $ / i ,  
 	 r s p e c i a l   =   / ^ ( ? : d a t a - | a r i a - ) / ,  
 	 r i n v a l i d C h a r   =   / \ : / ,  
 	 f o r m H o o k ;  
  
 j Q u e r y . f n . e x t e n d ( {  
 	 a t t r :   f u n c t i o n (   n a m e ,   v a l u e   )   {  
 	 	 r e t u r n   j Q u e r y . a c c e s s (   t h i s ,   n a m e ,   v a l u e ,   t r u e ,   j Q u e r y . a t t r   ) ;  
 	 } ,  
  
 	 r e m o v e A t t r :   f u n c t i o n (   n a m e   )   {  
 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( )   {  
 	 	 	 j Q u e r y . r e m o v e A t t r (   t h i s ,   n a m e   ) ;  
 	 	 } ) ;  
 	 } ,  
 	  
 	 p r o p :   f u n c t i o n (   n a m e ,   v a l u e   )   {  
 	 	 r e t u r n   j Q u e r y . a c c e s s (   t h i s ,   n a m e ,   v a l u e ,   t r u e ,   j Q u e r y . p r o p   ) ;  
 	 } ,  
 	  
 	 r e m o v e P r o p :   f u n c t i o n (   n a m e   )   {  
 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( )   {  
 	 	 	 / /   t r y / c a t c h   h a n d l e s   c a s e s   w h e r e   I E   b a l k s   ( s u c h   a s   r e m o v i n g   a   p r o p e r t y   o n   w i n d o w )  
 	 	 	 t r y   {  
 	 	 	 	 t h i s [   n a m e   ]   =   u n d e f i n e d ;  
 	 	 	 	 d e l e t e   t h i s [   n a m e   ] ;  
 	 	 	 }   c a t c h (   e   )   { }  
 	 	 } ) ;  
 	 } ,  
  
 	 a d d C l a s s :   f u n c t i o n (   v a l u e   )   {  
 	 	 i f   (   j Q u e r y . i s F u n c t i o n (   v a l u e   )   )   {  
 	 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( i )   {  
 	 	 	 	 v a r   s e l f   =   j Q u e r y ( t h i s ) ;  
 	 	 	 	 s e l f . a d d C l a s s (   v a l u e . c a l l ( t h i s ,   i ,   s e l f . a t t r ( " c l a s s " )   | |   " " )   ) ;  
 	 	 	 } ) ;  
 	 	 }  
  
 	 	 i f   (   v a l u e   & &   t y p e o f   v a l u e   = = =   " s t r i n g "   )   {  
 	 	 	 v a r   c l a s s N a m e s   =   ( v a l u e   | |   " " ) . s p l i t (   r s p a c e   ) ;  
  
 	 	 	 f o r   (   v a r   i   =   0 ,   l   =   t h i s . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 	 v a r   e l e m   =   t h i s [ i ] ;  
  
 	 	 	 	 i f   (   e l e m . n o d e T y p e   = = =   1   )   {  
 	 	 	 	 	 i f   (   ! e l e m . c l a s s N a m e   )   {  
 	 	 	 	 	 	 e l e m . c l a s s N a m e   =   v a l u e ;  
  
 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 v a r   c l a s s N a m e   =   "   "   +   e l e m . c l a s s N a m e   +   "   " ,  
 	 	 	 	 	 	 	 s e t C l a s s   =   e l e m . c l a s s N a m e ;  
  
 	 	 	 	 	 	 f o r   (   v a r   c   =   0 ,   c l   =   c l a s s N a m e s . l e n g t h ;   c   <   c l ;   c + +   )   {  
 	 	 	 	 	 	 	 i f   (   c l a s s N a m e . i n d e x O f (   "   "   +   c l a s s N a m e s [ c ]   +   "   "   )   <   0   )   {  
 	 	 	 	 	 	 	 	 s e t C l a s s   + =   "   "   +   c l a s s N a m e s [ c ] ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 e l e m . c l a s s N a m e   =   j Q u e r y . t r i m (   s e t C l a s s   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   t h i s ;  
 	 } ,  
  
 	 r e m o v e C l a s s :   f u n c t i o n (   v a l u e   )   {  
 	 	 i f   (   j Q u e r y . i s F u n c t i o n ( v a l u e )   )   {  
 	 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( i )   {  
 	 	 	 	 v a r   s e l f   =   j Q u e r y ( t h i s ) ;  
 	 	 	 	 s e l f . r e m o v e C l a s s (   v a l u e . c a l l ( t h i s ,   i ,   s e l f . a t t r ( " c l a s s " ) )   ) ;  
 	 	 	 } ) ;  
 	 	 }  
  
 	 	 i f   (   ( v a l u e   & &   t y p e o f   v a l u e   = = =   " s t r i n g " )   | |   v a l u e   = = =   u n d e f i n e d   )   {  
 	 	 	 v a r   c l a s s N a m e s   =   ( v a l u e   | |   " " ) . s p l i t (   r s p a c e   ) ;  
  
 	 	 	 f o r   (   v a r   i   =   0 ,   l   =   t h i s . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 	 v a r   e l e m   =   t h i s [ i ] ;  
  
 	 	 	 	 i f   (   e l e m . n o d e T y p e   = = =   1   & &   e l e m . c l a s s N a m e   )   {  
 	 	 	 	 	 i f   (   v a l u e   )   {  
 	 	 	 	 	 	 v a r   c l a s s N a m e   =   ( "   "   +   e l e m . c l a s s N a m e   +   "   " ) . r e p l a c e ( r c l a s s ,   "   " ) ;  
 	 	 	 	 	 	 f o r   (   v a r   c   =   0 ,   c l   =   c l a s s N a m e s . l e n g t h ;   c   <   c l ;   c + +   )   {  
 	 	 	 	 	 	 	 c l a s s N a m e   =   c l a s s N a m e . r e p l a c e ( "   "   +   c l a s s N a m e s [ c ]   +   "   " ,   "   " ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 e l e m . c l a s s N a m e   =   j Q u e r y . t r i m (   c l a s s N a m e   ) ;  
  
 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 e l e m . c l a s s N a m e   =   " " ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   t h i s ;  
 	 } ,  
  
 	 t o g g l e C l a s s :   f u n c t i o n (   v a l u e ,   s t a t e V a l   )   {  
 	 	 v a r   t y p e   =   t y p e o f   v a l u e ,  
 	 	 	 i s B o o l   =   t y p e o f   s t a t e V a l   = = =   " b o o l e a n " ;  
  
 	 	 i f   (   j Q u e r y . i s F u n c t i o n (   v a l u e   )   )   {  
 	 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( i )   {  
 	 	 	 	 v a r   s e l f   =   j Q u e r y ( t h i s ) ;  
 	 	 	 	 s e l f . t o g g l e C l a s s (   v a l u e . c a l l ( t h i s ,   i ,   s e l f . a t t r ( " c l a s s " ) ,   s t a t e V a l ) ,   s t a t e V a l   ) ;  
 	 	 	 } ) ;  
 	 	 }  
  
 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( )   {  
 	 	 	 i f   (   t y p e   = = =   " s t r i n g "   )   {  
 	 	 	 	 / /   t o g g l e   i n d i v i d u a l   c l a s s   n a m e s  
 	 	 	 	 v a r   c l a s s N a m e ,  
 	 	 	 	 	 i   =   0 ,  
 	 	 	 	 	 s e l f   =   j Q u e r y (   t h i s   ) ,  
 	 	 	 	 	 s t a t e   =   s t a t e V a l ,  
 	 	 	 	 	 c l a s s N a m e s   =   v a l u e . s p l i t (   r s p a c e   ) ;  
  
 	 	 	 	 w h i l e   (   ( c l a s s N a m e   =   c l a s s N a m e s [   i + +   ] )   )   {  
 	 	 	 	 	 / /   c h e c k   e a c h   c l a s s N a m e   g i v e n ,   s p a c e   s e p e r a t e d   l i s t  
 	 	 	 	 	 s t a t e   =   i s B o o l   ?   s t a t e   :   ! s e l f . h a s C l a s s (   c l a s s N a m e   ) ;  
 	 	 	 	 	 s e l f [   s t a t e   ?   " a d d C l a s s "   :   " r e m o v e C l a s s "   ] (   c l a s s N a m e   ) ;  
 	 	 	 	 }  
  
 	 	 	 }   e l s e   i f   (   t y p e   = = =   " u n d e f i n e d "   | |   t y p e   = = =   " b o o l e a n "   )   {  
 	 	 	 	 i f   (   t h i s . c l a s s N a m e   )   {  
 	 	 	 	 	 / /   s t o r e   c l a s s N a m e   i f   s e t  
 	 	 	 	 	 j Q u e r y . _ d a t a (   t h i s ,   " _ _ c l a s s N a m e _ _ " ,   t h i s . c l a s s N a m e   ) ;  
 	 	 	 	 }  
  
 	 	 	 	 / /   t o g g l e   w h o l e   c l a s s N a m e  
 	 	 	 	 t h i s . c l a s s N a m e   =   t h i s . c l a s s N a m e   | |   v a l u e   = = =   f a l s e   ?   " "   :   j Q u e r y . _ d a t a (   t h i s ,   " _ _ c l a s s N a m e _ _ "   )   | |   " " ;  
 	 	 	 }  
 	 	 } ) ;  
 	 } ,  
  
 	 h a s C l a s s :   f u n c t i o n (   s e l e c t o r   )   {  
 	 	 v a r   c l a s s N a m e   =   "   "   +   s e l e c t o r   +   "   " ;  
 	 	 f o r   (   v a r   i   =   0 ,   l   =   t h i s . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 i f   (   ( "   "   +   t h i s [ i ] . c l a s s N a m e   +   "   " ) . r e p l a c e ( r c l a s s ,   "   " ) . i n d e x O f (   c l a s s N a m e   )   >   - 1   )   {  
 	 	 	 	 r e t u r n   t r u e ;  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   f a l s e ;  
 	 } ,  
  
 	 v a l :   f u n c t i o n (   v a l u e   )   {  
 	 	 v a r   h o o k s ,   r e t ,  
 	 	 	 e l e m   =   t h i s [ 0 ] ;  
 	 	  
 	 	 i f   (   ! a r g u m e n t s . l e n g t h   )   {  
 	 	 	 i f   (   e l e m   )   {  
 	 	 	 	 h o o k s   =   j Q u e r y . v a l H o o k s [   e l e m . n o d e N a m e . t o L o w e r C a s e ( )   ]   | |   j Q u e r y . v a l H o o k s [   e l e m . t y p e   ] ;  
  
 	 	 	 	 i f   (   h o o k s   & &   " g e t "   i n   h o o k s   & &   ( r e t   =   h o o k s . g e t (   e l e m ,   " v a l u e "   ) )   ! = =   u n d e f i n e d   )   {  
 	 	 	 	 	 r e t u r n   r e t ;  
 	 	 	 	 }  
  
 	 	 	 	 r e t u r n   ( e l e m . v a l u e   | |   " " ) . r e p l a c e ( r r e t u r n ,   " " ) ;  
 	 	 	 }  
  
 	 	 	 r e t u r n   u n d e f i n e d ;  
 	 	 }  
  
 	 	 v a r   i s F u n c t i o n   =   j Q u e r y . i s F u n c t i o n (   v a l u e   ) ;  
  
 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n (   i   )   {  
 	 	 	 v a r   s e l f   =   j Q u e r y ( t h i s ) ,   v a l ;  
  
 	 	 	 i f   (   t h i s . n o d e T y p e   ! = =   1   )   {  
 	 	 	 	 r e t u r n ;  
 	 	 	 }  
  
 	 	 	 i f   (   i s F u n c t i o n   )   {  
 	 	 	 	 v a l   =   v a l u e . c a l l (   t h i s ,   i ,   s e l f . v a l ( )   ) ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 v a l   =   v a l u e ;  
 	 	 	 }  
  
 	 	 	 / /   T r e a t   n u l l / u n d e f i n e d   a s   " " ;   c o n v e r t   n u m b e r s   t o   s t r i n g  
 	 	 	 i f   (   v a l   = =   n u l l   )   {  
 	 	 	 	 v a l   =   " " ;  
 	 	 	 }   e l s e   i f   (   t y p e o f   v a l   = = =   " n u m b e r "   )   {  
 	 	 	 	 v a l   + =   " " ;  
 	 	 	 }   e l s e   i f   (   j Q u e r y . i s A r r a y (   v a l   )   )   {  
 	 	 	 	 v a l   =   j Q u e r y . m a p ( v a l ,   f u n c t i o n   (   v a l u e   )   {  
 	 	 	 	 	 r e t u r n   v a l u e   = =   n u l l   ?   " "   :   v a l u e   +   " " ;  
 	 	 	 	 } ) ;  
 	 	 	 }  
  
 	 	 	 h o o k s   =   j Q u e r y . v a l H o o k s [   t h i s . n o d e N a m e . t o L o w e r C a s e ( )   ]   | |   j Q u e r y . v a l H o o k s [   t h i s . t y p e   ] ;  
  
 	 	 	 / /   I f   s e t   r e t u r n s   u n d e f i n e d ,   f a l l   b a c k   t o   n o r m a l   s e t t i n g  
 	 	 	 i f   (   ! h o o k s   | |   ( " s e t "   i n   h o o k s   & &   h o o k s . s e t (   t h i s ,   v a l ,   " v a l u e "   )   = = =   u n d e f i n e d )   )   {  
 	 	 	 	 t h i s . v a l u e   =   v a l ;  
 	 	 	 }  
 	 	 } ) ;  
 	 }  
 } ) ;  
  
 j Q u e r y . e x t e n d ( {  
 	 v a l H o o k s :   {  
 	 	 o p t i o n :   {  
 	 	 	 g e t :   f u n c t i o n (   e l e m   )   {  
 	 	 	 	 / /   a t t r i b u t e s . v a l u e   i s   u n d e f i n e d   i n   B l a c k b e r r y   4 . 7   b u t  
 	 	 	 	 / /   u s e s   . v a l u e .   S e e   # 6 9 3 2  
 	 	 	 	 v a r   v a l   =   e l e m . a t t r i b u t e s . v a l u e ;  
 	 	 	 	 r e t u r n   ! v a l   | |   v a l . s p e c i f i e d   ?   e l e m . v a l u e   :   e l e m . t e x t ;  
 	 	 	 }  
 	 	 } ,  
 	 	 s e l e c t :   {  
 	 	 	 g e t :   f u n c t i o n (   e l e m   )   {  
 	 	 	 	 v a r   i n d e x   =   e l e m . s e l e c t e d I n d e x ,  
 	 	 	 	 	 v a l u e s   =   [ ] ,  
 	 	 	 	 	 o p t i o n s   =   e l e m . o p t i o n s ,  
 	 	 	 	 	 o n e   =   e l e m . t y p e   = = =   " s e l e c t - o n e " ;  
  
 	 	 	 	 / /   N o t h i n g   w a s   s e l e c t e d  
 	 	 	 	 i f   (   i n d e x   <   0   )   {  
 	 	 	 	 	 r e t u r n   n u l l ;  
 	 	 	 	 }  
  
 	 	 	 	 / /   L o o p   t h r o u g h   a l l   t h e   s e l e c t e d   o p t i o n s  
 	 	 	 	 f o r   (   v a r   i   =   o n e   ?   i n d e x   :   0 ,   m a x   =   o n e   ?   i n d e x   +   1   :   o p t i o n s . l e n g t h ;   i   <   m a x ;   i + +   )   {  
 	 	 	 	 	 v a r   o p t i o n   =   o p t i o n s [   i   ] ;  
  
 	 	 	 	 	 / /   D o n ' t   r e t u r n   o p t i o n s   t h a t   a r e   d i s a b l e d   o r   i n   a   d i s a b l e d   o p t g r o u p  
 	 	 	 	 	 i f   (   o p t i o n . s e l e c t e d   & &   ( j Q u e r y . s u p p o r t . o p t D i s a b l e d   ?   ! o p t i o n . d i s a b l e d   :   o p t i o n . g e t A t t r i b u t e ( " d i s a b l e d " )   = = =   n u l l )   & &  
 	 	 	 	 	 	 	 ( ! o p t i o n . p a r e n t N o d e . d i s a b l e d   | |   ! j Q u e r y . n o d e N a m e (   o p t i o n . p a r e n t N o d e ,   " o p t g r o u p "   ) )   )   {  
  
 	 	 	 	 	 	 / /   G e t   t h e   s p e c i f i c   v a l u e   f o r   t h e   o p t i o n  
 	 	 	 	 	 	 v a l u e   =   j Q u e r y (   o p t i o n   ) . v a l ( ) ;  
  
 	 	 	 	 	 	 / /   W e   d o n ' t   n e e d   a n   a r r a y   f o r   o n e   s e l e c t s  
 	 	 	 	 	 	 i f   (   o n e   )   {  
 	 	 	 	 	 	 	 r e t u r n   v a l u e ;  
 	 	 	 	 	 	 }  
  
 	 	 	 	 	 	 / /   M u l t i - S e l e c t s   r e t u r n   a n   a r r a y  
 	 	 	 	 	 	 v a l u e s . p u s h (   v a l u e   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 / /   F i x e s   B u g   # 2 5 5 1   - -   s e l e c t . v a l ( )   b r o k e n   i n   I E   a f t e r   f o r m . r e s e t ( )  
 	 	 	 	 i f   (   o n e   & &   ! v a l u e s . l e n g t h   & &   o p t i o n s . l e n g t h   )   {  
 	 	 	 	 	 r e t u r n   j Q u e r y (   o p t i o n s [   i n d e x   ]   ) . v a l ( ) ;  
 	 	 	 	 }  
  
 	 	 	 	 r e t u r n   v a l u e s ;  
 	 	 	 } ,  
  
 	 	 	 s e t :   f u n c t i o n (   e l e m ,   v a l u e   )   {  
 	 	 	 	 v a r   v a l u e s   =   j Q u e r y . m a k e A r r a y (   v a l u e   ) ;  
  
 	 	 	 	 j Q u e r y ( e l e m ) . f i n d ( " o p t i o n " ) . e a c h ( f u n c t i o n ( )   {  
 	 	 	 	 	 t h i s . s e l e c t e d   =   j Q u e r y . i n A r r a y (   j Q u e r y ( t h i s ) . v a l ( ) ,   v a l u e s   )   > =   0 ;  
 	 	 	 	 } ) ;  
  
 	 	 	 	 i f   (   ! v a l u e s . l e n g t h   )   {  
 	 	 	 	 	 e l e m . s e l e c t e d I n d e x   =   - 1 ;  
 	 	 	 	 }  
 	 	 	 	 r e t u r n   v a l u e s ;  
 	 	 	 }  
 	 	 }  
 	 } ,  
  
 	 a t t r F n :   {  
 	 	 v a l :   t r u e ,  
 	 	 c s s :   t r u e ,  
 	 	 h t m l :   t r u e ,  
 	 	 t e x t :   t r u e ,  
 	 	 d a t a :   t r u e ,  
 	 	 w i d t h :   t r u e ,  
 	 	 h e i g h t :   t r u e ,  
 	 	 o f f s e t :   t r u e  
 	 } ,  
 	  
 	 a t t r F i x :   {  
 	 	 / /   A l w a y s   n o r m a l i z e   t o   e n s u r e   h o o k   u s a g e  
 	 	 t a b i n d e x :   " t a b I n d e x " ,  
 	 	 r e a d o n l y :   " r e a d O n l y "  
 	 } ,  
 	  
 	 a t t r :   f u n c t i o n (   e l e m ,   n a m e ,   v a l u e ,   p a s s   )   {  
 	 	 v a r   n T y p e   =   e l e m . n o d e T y p e ;  
 	 	  
 	 	 / /   d o n ' t   g e t / s e t   a t t r i b u t e s   o n   t e x t ,   c o m m e n t   a n d   a t t r i b u t e   n o d e s  
 	 	 i f   (   ! e l e m   | |   n T y p e   = = =   3   | |   n T y p e   = = =   8   | |   n T y p e   = = =   2   )   {  
 	 	 	 r e t u r n   u n d e f i n e d ;  
 	 	 }  
  
 	 	 i f   (   p a s s   & &   n a m e   i n   j Q u e r y . a t t r F n   )   {  
 	 	 	 r e t u r n   j Q u e r y (   e l e m   ) [   n a m e   ] (   v a l u e   ) ;  
 	 	 }  
 	 	  
 	 	 v a r   r e t ,   h o o k s ,  
 	 	 	 n o t x m l   =   n T y p e   ! = =   1   | |   ! j Q u e r y . i s X M L D o c (   e l e m   ) ;  
 	 	  
 	 	 / /   N o r m a l i z e   t h e   n a m e   i f   n e e d e d  
 	 	 n a m e   =   n o t x m l   & &   j Q u e r y . a t t r F i x [   n a m e   ]   | |   n a m e ;  
  
 	 	 / /   G e t   t h e   a p p r o p r i a t e   h o o k ,   o r   t h e   f o r m H o o k  
 	 	 / /   i f   g e t S e t A t t r i b u t e   i s   n o t   s u p p o r t e d   a n d   w e   h a v e   f o r m   o b j e c t s   i n   I E 6 / 7  
 	 	 h o o k s   =   j Q u e r y . a t t r H o o k s [   n a m e   ]   | |  
 	 	 	 (   f o r m H o o k   & &   ( j Q u e r y . n o d e N a m e (   e l e m ,   " f o r m "   )   | |   r i n v a l i d C h a r . t e s t (   n a m e   ) )   ?  
 	 	 	 	 f o r m H o o k   :  
 	 	 	 	 u n d e f i n e d   ) ;  
  
 	 	 i f   (   v a l u e   ! = =   u n d e f i n e d   )   {  
  
 	 	 	 i f   (   v a l u e   = = =   n u l l   | |   ( v a l u e   = = =   f a l s e   & &   ! r s p e c i a l . t e s t (   n a m e   ) )   )   {  
 	 	 	 	 j Q u e r y . r e m o v e A t t r (   e l e m ,   n a m e   ) ;  
 	 	 	 	 r e t u r n   u n d e f i n e d ;  
  
 	 	 	 }   e l s e   i f   (   h o o k s   & &   " s e t "   i n   h o o k s   & &   n o t x m l   & &   ( r e t   =   h o o k s . s e t (   e l e m ,   v a l u e ,   n a m e   ) )   ! = =   u n d e f i n e d   )   {  
 	 	 	 	 r e t u r n   r e t ;  
  
 	 	 	 }   e l s e   {  
  
 	 	 	 	 / /   S e t   b o o l e a n   a t t r i b u t e s   t o   t h e   s a m e   n a m e  
 	 	 	 	 i f   (   v a l u e   = = =   t r u e   & &   ! r s p e c i a l . t e s t (   n a m e   )   )   {  
 	 	 	 	 	 v a l u e   =   n a m e ;  
 	 	 	 	 }  
  
 	 	 	 	 e l e m . s e t A t t r i b u t e (   n a m e ,   " "   +   v a l u e   ) ;  
 	 	 	 	 r e t u r n   v a l u e ;  
 	 	 	 }  
  
 	 	 }   e l s e   {  
  
 	 	 	 i f   (   h o o k s   & &   " g e t "   i n   h o o k s   & &   n o t x m l   )   {  
 	 	 	 	 r e t u r n   h o o k s . g e t (   e l e m ,   n a m e   ) ;  
  
 	 	 	 }   e l s e   {  
  
 	 	 	 	 r e t   =   e l e m . g e t A t t r i b u t e (   n a m e   ) ;  
  
 	 	 	 	 / /   N o n - e x i s t e n t   a t t r i b u t e s   r e t u r n   n u l l ,   w e   n o r m a l i z e   t o   u n d e f i n e d  
 	 	 	 	 r e t u r n   r e t   = = =   n u l l   ?  
 	 	 	 	 	 u n d e f i n e d   :  
 	 	 	 	 	 r e t ;  
 	 	 	 }  
 	 	 }  
 	 } ,  
 	  
 	 r e m o v e A t t r :   f u n c t i o n (   e l e m ,   n a m e   )   {  
 	 	 i f   (   e l e m . n o d e T y p e   = = =   1   )   {  
 	 	 	 n a m e   =   j Q u e r y . a t t r F i x [   n a m e   ]   | |   n a m e ;  
 	 	  
 	 	 	 i f   (   j Q u e r y . s u p p o r t . g e t S e t A t t r i b u t e   )   {  
 	 	 	 	 / /   U s e   r e m o v e A t t r i b u t e   i n   b r o w s e r s   t h a t   s u p p o r t   i t  
 	 	 	 	 e l e m . r e m o v e A t t r i b u t e (   n a m e   ) ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 j Q u e r y . a t t r (   e l e m ,   n a m e ,   " "   ) ;  
 	 	 	 	 e l e m . r e m o v e A t t r i b u t e N o d e (   e l e m . g e t A t t r i b u t e N o d e (   n a m e   )   ) ;  
 	 	 	 }  
 	 	 }  
 	 } ,  
  
 	 a t t r H o o k s :   {  
 	 	 t y p e :   {  
 	 	 	 s e t :   f u n c t i o n (   e l e m ,   v a l u e   )   {  
 	 	 	 	 / /   W e   c a n ' t   a l l o w   t h e   t y p e   p r o p e r t y   t o   b e   c h a n g e d   ( s i n c e   i t   c a u s e s   p r o b l e m s   i n   I E )  
 	 	 	 	 i f   (   r t y p e . t e s t (   e l e m . n o d e N a m e   )   & &   e l e m . p a r e n t N o d e   )   {  
 	 	 	 	 	 j Q u e r y . e r r o r (   " t y p e   p r o p e r t y   c a n ' t   b e   c h a n g e d "   ) ;  
 	 	 	 	 }   e l s e   i f   (   ! j Q u e r y . s u p p o r t . r a d i o V a l u e   & &   v a l u e   = = =   " r a d i o "   & &   j Q u e r y . n o d e N a m e ( e l e m ,   " i n p u t " )   )   {  
 	 	 	 	 	 / /   S e t t i n g   t h e   t y p e   o n   a   r a d i o   b u t t o n   a f t e r   t h e   v a l u e   r e s e t s   t h e   v a l u e   i n   I E 6 - 9  
 	 	 	 	 	 / /   R e s e t   v a l u e   t o   i t ' s   d e f a u l t   i n   c a s e   t y p e   i s   s e t   a f t e r   v a l u e  
 	 	 	 	 	 / /   T h i s   i s   f o r   e l e m e n t   c r e a t i o n  
 	 	 	 	 	 v a r   v a l   =   e l e m . g e t A t t r i b u t e ( " v a l u e " ) ;  
 	 	 	 	 	 e l e m . s e t A t t r i b u t e (   " t y p e " ,   v a l u e   ) ;  
 	 	 	 	 	 i f   (   v a l   )   {  
 	 	 	 	 	 	 e l e m . v a l u e   =   v a l ;  
 	 	 	 	 	 }  
 	 	 	 	 	 r e t u r n   v a l u e ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 } ,  
 	 	 t a b I n d e x :   {  
 	 	 	 g e t :   f u n c t i o n (   e l e m   )   {  
 	 	 	 	 / /   e l e m . t a b I n d e x   d o e s n ' t   a l w a y s   r e t u r n   t h e   c o r r e c t   v a l u e   w h e n   i t   h a s n ' t   b e e n   e x p l i c i t l y   s e t  
 	 	 	 	 / /   h t t p : / / f l u i d p r o j e c t . o r g / b l o g / 2 0 0 8 / 0 1 / 0 9 / g e t t i n g - s e t t i n g - a n d - r e m o v i n g - t a b i n d e x - v a l u e s - w i t h - j a v a s c r i p t /  
 	 	 	 	 v a r   a t t r i b u t e N o d e   =   e l e m . g e t A t t r i b u t e N o d e ( " t a b I n d e x " ) ;  
  
 	 	 	 	 r e t u r n   a t t r i b u t e N o d e   & &   a t t r i b u t e N o d e . s p e c i f i e d   ?  
 	 	 	 	 	 p a r s e I n t (   a t t r i b u t e N o d e . v a l u e ,   1 0   )   :  
 	 	 	 	 	 r f o c u s a b l e . t e s t (   e l e m . n o d e N a m e   )   | |   r c l i c k a b l e . t e s t (   e l e m . n o d e N a m e   )   & &   e l e m . h r e f   ?  
 	 	 	 	 	 	 0   :  
 	 	 	 	 	 	 u n d e f i n e d ;  
 	 	 	 }  
 	 	 }  
 	 } ,  
 	  
 	 p r o p F i x :   { } ,  
 	  
 	 p r o p :   f u n c t i o n (   e l e m ,   n a m e ,   v a l u e   )   {  
 	 	 v a r   n T y p e   =   e l e m . n o d e T y p e ;  
 	 	  
 	 	 / /   d o n ' t   g e t / s e t   p r o p e r t i e s   o n   t e x t ,   c o m m e n t   a n d   a t t r i b u t e   n o d e s  
 	 	 i f   (   ! e l e m   | |   n T y p e   = = =   3   | |   n T y p e   = = =   8   | |   n T y p e   = = =   2   )   {  
 	 	 	 r e t u r n   u n d e f i n e d ;  
 	 	 }  
 	 	  
 	 	 v a r   r e t ,   h o o k s ,  
 	 	 	 n o t x m l   =   n T y p e   ! = =   1   | |   ! j Q u e r y . i s X M L D o c (   e l e m   ) ;  
 	 	  
 	 	 / /   T r y   t o   n o r m a l i z e / f i x   t h e   n a m e  
 	 	 n a m e   =   n o t x m l   & &   j Q u e r y . p r o p F i x [   n a m e   ]   | |   n a m e ;  
 	 	  
 	 	 h o o k s   =   j Q u e r y . p r o p H o o k s [   n a m e   ] ;  
 	 	  
 	 	 i f   (   v a l u e   ! = =   u n d e f i n e d   )   {  
 	 	 	 i f   (   h o o k s   & &   " s e t "   i n   h o o k s   & &   ( r e t   =   h o o k s . s e t (   e l e m ,   v a l u e ,   n a m e   ) )   ! = =   u n d e f i n e d   )   {  
 	 	 	 	 r e t u r n   r e t ;  
 	 	 	  
 	 	 	 }   e l s e   {  
 	 	 	 	 r e t u r n   ( e l e m [   n a m e   ]   =   v a l u e ) ;  
 	 	 	 }  
 	 	  
 	 	 }   e l s e   {  
 	 	 	 i f   (   h o o k s   & &   " g e t "   i n   h o o k s   & &   ( r e t   =   h o o k s . g e t (   e l e m ,   n a m e   ) )   ! = =   u n d e f i n e d   )   {  
 	 	 	 	 r e t u r n   r e t ;  
 	 	 	 	  
 	 	 	 }   e l s e   {  
 	 	 	 	 r e t u r n   e l e m [   n a m e   ] ;  
 	 	 	 }  
 	 	 }  
 	 } ,  
 	  
 	 p r o p H o o k s :   { }  
 } ) ;  
  
 / /   I E 6 / 7   d o   n o t   s u p p o r t   g e t t i n g / s e t t i n g   s o m e   a t t r i b u t e s   w i t h   g e t / s e t A t t r i b u t e  
 i f   (   ! j Q u e r y . s u p p o r t . g e t S e t A t t r i b u t e   )   {  
 	 j Q u e r y . a t t r F i x   =   j Q u e r y . e x t e n d (   j Q u e r y . a t t r F i x ,   {  
 	 	 " f o r " :   " h t m l F o r " ,  
 	 	 " c l a s s " :   " c l a s s N a m e " ,  
 	 	 m a x l e n g t h :   " m a x L e n g t h " ,  
 	 	 c e l l s p a c i n g :   " c e l l S p a c i n g " ,  
 	 	 c e l l p a d d i n g :   " c e l l P a d d i n g " ,  
 	 	 r o w s p a n :   " r o w S p a n " ,  
 	 	 c o l s p a n :   " c o l S p a n " ,  
 	 	 u s e m a p :   " u s e M a p " ,  
 	 	 f r a m e b o r d e r :   " f r a m e B o r d e r "  
 	 } ) ;  
 	  
 	 / /   U s e   t h i s   f o r   a n y   a t t r i b u t e   o n   a   f o r m   i n   I E 6 / 7  
 	 f o r m H o o k   =   j Q u e r y . a t t r H o o k s . n a m e   =   j Q u e r y . a t t r H o o k s . v a l u e   =   j Q u e r y . v a l H o o k s . b u t t o n   =   {  
 	 	 g e t :   f u n c t i o n (   e l e m ,   n a m e   )   {  
 	 	 	 v a r   r e t ;  
 	 	 	 i f   (   n a m e   = = =   " v a l u e "   & &   ! j Q u e r y . n o d e N a m e (   e l e m ,   " b u t t o n "   )   )   {  
 	 	 	 	 r e t u r n   e l e m . g e t A t t r i b u t e (   n a m e   ) ;  
 	 	 	 }  
 	 	 	 r e t   =   e l e m . g e t A t t r i b u t e N o d e (   n a m e   ) ;  
 	 	 	 / /   R e t u r n   u n d e f i n e d   i f   n o t   s p e c i f i e d   i n s t e a d   o f   e m p t y   s t r i n g  
 	 	 	 r e t u r n   r e t   & &   r e t . s p e c i f i e d   ?  
 	 	 	 	 r e t . n o d e V a l u e   :  
 	 	 	 	 u n d e f i n e d ;  
 	 	 } ,  
 	 	 s e t :   f u n c t i o n (   e l e m ,   v a l u e ,   n a m e   )   {  
 	 	 	 / /   C h e c k   f o r m   o b j e c t s   i n   I E   ( m u l t i p l e   b u g s   r e l a t e d )  
 	 	 	 / /   O n l y   u s e   n o d e V a l u e   i f   t h e   a t t r i b u t e   n o d e   e x i s t s   o n   t h e   f o r m  
 	 	 	 v a r   r e t   =   e l e m . g e t A t t r i b u t e N o d e (   n a m e   ) ;  
 	 	 	 i f   (   r e t   )   {  
 	 	 	 	 r e t . n o d e V a l u e   =   v a l u e ;  
 	 	 	 	 r e t u r n   v a l u e ;  
 	 	 	 }  
 	 	 }  
 	 } ;  
  
 	 / /   S e t   w i d t h   a n d   h e i g h t   t o   a u t o   i n s t e a d   o f   0   o n   e m p t y   s t r i n g (   B u g   # 8 1 5 0   )  
 	 / /   T h i s   i s   f o r   r e m o v a l s  
 	 j Q u e r y . 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   )   {  
 	 	 j Q u e r y . a t t r H o o k s [   n a m e   ]   =   j Q u e r y . e x t e n d (   j Q u e r y . a t t r H o o k s [   n a m e   ] ,   {  
 	 	 	 s e t :   f u n c t i o n (   e l e m ,   v a l u e   )   {  
 	 	 	 	 i f   (   v a l u e   = = =   " "   )   {  
 	 	 	 	 	 e l e m . s e t A t t r i b u t e (   n a m e ,   " a u t o "   ) ;  
 	 	 	 	 	 r e t u r n   v a l u e ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 } ) ;  
 	 } ) ;  
 }  
  
  
 / /   S o m e   a t t r i b u t e s   r e q u i r e   a   s p e c i a l   c a l l   o n   I E  
 i f   (   ! j Q u e r y . s u p p o r t . h r e f N o r m a l i z e d   )   {  
 	 j Q u e r y . e a c h ( [   " h r e f " ,   " s r c " ,   " w i d t h " ,   " h e i g h t "   ] ,   f u n c t i o n (   i ,   n a m e   )   {  
 	 	 j Q u e r y . a t t r H o o k s [   n a m e   ]   =   j Q u e r y . e x t e n d (   j Q u e r y . a t t r H o o k s [   n a m e   ] ,   {  
 	 	 	 g e t :   f u n c t i o n (   e l e m   )   {  
 	 	 	 	 v a r   r e t   =   e l e m . g e t A t t r i b u t e (   n a m e ,   2   ) ;  
 	 	 	 	 r e t u r n   r e t   = = =   n u l l   ?   u n d e f i n e d   :   r e t ;  
 	 	 	 }  
 	 	 } ) ;  
 	 } ) ;  
 }  
  
 i f   (   ! j Q u e r y . s u p p o r t . s t y l e   )   {  
 	 j Q u e r y . a t t r H o o k s . s t y l e   =   {  
 	 	 g e t :   f u n c t i o n (   e l e m   )   {  
 	 	 	 / /   R e t u r n   u n d e f i n e d   i n   t h e   c a s e   o f   e m p t y   s t r i n g  
 	 	 	 / /   N o r m a l i z e   t o   l o w e r c a s e   s i n c e   I E   u p p e r c a s e s   c s s   p r o p e r t y   n a m e s  
 	 	 	 r e t u r n   e l e m . s t y l e . c s s T e x t . t o L o w e r C a s e ( )   | |   u n d e f i n e d ;  
 	 	 } ,  
 	 	 s e t :   f u n c t i o n (   e l e m ,   v a l u e   )   {  
 	 	 	 r e t u r n   ( e l e m . s t y l e . c s s T e x t   =   " "   +   v a l u e ) ;  
 	 	 }  
 	 } ;  
 }  
  
 / /   S a f a r i   m i s - r e p o r t s   t h e   d e f a u l t   s e l e c t e d   p r o p e r t y   o f   a n   o p t i o n  
 / /   A c c e s s i n g   t h e   p a r e n t ' s   s e l e c t e d I n d e x   p r o p e r t y   f i x e s   i t  
 i f   (   ! j Q u e r y . s u p p o r t . o p t S e l e c t e d   )   {  
 	 j Q u e r y . p r o p H o o k s . s e l e c t e d   =   j Q u e r y . e x t e n d (   j Q u e r y . p r o p H o o k s . s e l e c t e d ,   {  
 	 	 g e t :   f u n c t i o n (   e l e m   )   {  
 	 	 	 v a r   p a r e n t   =   e l e m . p a r e n t N o d e ;  
  
 	 	 	 i f   (   p a r e n t   )   {  
 	 	 	 	 p a r e n t . s e l e c t e d I n d e x ;  
  
 	 	 	 	 / /   M a k e   s u r e   t h a t   i t   a l s o   w o r k s   w i t h   o p t g r o u p s ,   s e e   # 5 7 0 1  
 	 	 	 	 i f   (   p a r e n t . p a r e n t N o d e   )   {  
 	 	 	 	 	 p a r e n t . p a r e n t N o d e . s e l e c t e d I n d e x ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 } ) ;  
 }  
  
 / /   R a d i o s   a n d   c h e c k b o x e s   g e t t e r / s e t t e r  
 i f   (   ! j Q u e r y . s u p p o r t . c h e c k O n   )   {  
 	 j Q u e r y . e a c h ( [   " r a d i o " ,   " c h e c k b o x "   ] ,   f u n c t i o n ( )   {  
 	 	 j Q u e r y . v a l H o o k s [   t h i s   ]   =   {  
 	 	 	 g e t :   f u n c t i o n (   e l e m   )   {  
 	 	 	 	 / /   H a n d l e   t h e   c a s e   w h e r e   i n   W e b k i t   " "   i s   r e t u r n e d   i n s t e a d   o f   " o n "   i f   a   v a l u e   i s n ' t   s p e c i f i e d  
 	 	 	 	 r e t u r n   e l e m . g e t A t t r i b u t e ( " v a l u e " )   = = =   n u l l   ?   " o n "   :   e l e m . v a l u e ;  
 	 	 	 }  
 	 	 } ;  
 	 } ) ;  
 }  
 j Q u e r y . e a c h ( [   " r a d i o " ,   " c h e c k b o x "   ] ,   f u n c t i o n ( )   {  
 	 j Q u e r y . v a l H o o k s [   t h i s   ]   =   j Q u e r y . e x t e n d (   j Q u e r y . v a l H o o k s [   t h i s   ] ,   {  
 	 	 s e t :   f u n c t i o n (   e l e m ,   v a l u e   )   {  
 	 	 	 i f   (   j Q u e r y . i s A r r a y (   v a l u e   )   )   {  
 	 	 	 	 r e t u r n   ( e l e m . c h e c k e d   =   j Q u e r y . i n A r r a y (   j Q u e r y ( e l e m ) . v a l ( ) ,   v a l u e   )   > =   0 ) ;  
 	 	 	 }  
 	 	 }  
 	 } ) ;  
 } ) ;  
  
  
  
  
 v a r   h a s O w n   =   O b j e c t . p r o t o t y p e . h a s O w n P r o p e r t y ,  
 	 r n a m e s p a c e s   =   / \ . ( . * ) $ / ,  
 	 r f o r m E l e m s   =   / ^ ( ? : t e x t a r e a | i n p u t | s e l e c t ) $ / i ,  
 	 r p e r i o d   =   / \ . / g ,  
 	 r s p a c e s   =   /   / g ,  
 	 r e s c a p e   =   / [ ^ \ w \ s . | ` ] / g ,  
 	 f c l e a n u p   =   f u n c t i o n (   n m   )   {  
 	 	 r e t u r n   n m . r e p l a c e ( r e s c a p e ,   " \ \ $ & " ) ;  
 	 } ;  
  
 / *  
   *   A   n u m b e r   o f   h e l p e r   f u n c t i o n s   u s e d   f o r   m a n a g i n g   e v e n t s .  
   *   M a n y   o f   t h e   i d e a s   b e h i n d   t h i s   c o d e   o r i g i n a t e d   f r o m  
   *   D e a n   E d w a r d s '   a d d E v e n t   l i b r a r y .  
   * /  
 j Q u e r y . e v e n t   =   {  
  
 	 / /   B i n d   a n   e v e n t   t o   a n   e l e m e n t  
 	 / /   O r i g i n a l   b y   D e a n   E d w a r d s  
 	 a d d :   f u n c t i o n (   e l e m ,   t y p e s ,   h a n d l e r ,   d a t a   )   {  
 	 	 i f   (   e l e m . n o d e T y p e   = = =   3   | |   e l e m . n o d e T y p e   = = =   8   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 i f   (   h a n d l e r   = = =   f a l s e   )   {  
 	 	 	 h a n d l e r   =   r e t u r n F a l s e ;  
 	 	 }   e l s e   i f   (   ! h a n d l e r   )   {  
 	 	 	 / /   F i x e s   b u g   # 7 2 2 9 .   F i x   r e c o m m e n d e d   b y   j d a l t o n  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 v a r   h a n d l e O b j I n ,   h a n d l e O b j ;  
  
 	 	 i f   (   h a n d l e r . h a n d l e r   )   {  
 	 	 	 h a n d l e O b j I n   =   h a n d l e r ;  
 	 	 	 h a n d l e r   =   h a n d l e O b j I n . h a n d l e r ;  
 	 	 }  
  
 	 	 / /   M a k e   s u r e   t h a t   t h e   f u n c t i o n   b e i n g   e x e c u t e d   h a s   a   u n i q u e   I D  
 	 	 i f   (   ! h a n d l e r . g u i d   )   {  
 	 	 	 h a n d l e r . g u i d   =   j Q u e r y . g u i d + + ;  
 	 	 }  
  
 	 	 / /   I n i t   t h e   e l e m e n t ' s   e v e n t   s t r u c t u r e  
 	 	 v a r   e l e m D a t a   =   j Q u e r y . _ d a t a (   e l e m   ) ;  
  
 	 	 / /   I f   n o   e l e m D a t a   i s   f o u n d   t h e n   w e   m u s t   b e   t r y i n g   t o   b i n d   t o   o n e   o f   t h e  
 	 	 / /   b a n n e d   n o D a t a   e l e m e n t s  
 	 	 i f   (   ! e l e m D a t a   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 v a r   e v e n t s   =   e l e m D a t a . e v e n t s ,  
 	 	 	 e v e n t H a n d l e   =   e l e m D a t a . h a n d l e ;  
  
 	 	 i f   (   ! e v e n t s   )   {  
 	 	 	 e l e m D a t a . e v e n t s   =   e v e n t s   =   { } ;  
 	 	 }  
  
 	 	 i f   (   ! e v e n t H a n d l e   )   {  
 	 	 	 e l e m D a t a . h a n d l e   =   e v e n t H a n d l e   =   f u n c t i o n (   e   )   {  
 	 	 	 	 / /   D i s c a r d   t h e   s e c o n d   e v e n t   o f   a   j Q u e r y . e v e n t . t r i g g e r ( )   a n d  
 	 	 	 	 / /   w h e n   a n   e v e n t   i s   c a l l e d   a f t e r   a   p a g e   h a s   u n l o a d e d  
 	 	 	 	 r e t u r n   t y p e o f   j Q u e r y   ! = =   " u n d e f i n e d "   & &   ( ! e   | |   j Q u e r y . e v e n t . t r i g g e r e d   ! = =   e . t y p e )   ?  
 	 	 	 	 	 j Q u e r y . e v e n t . h a n d l e . a p p l y (   e v e n t H a n d l e . e l e m ,   a r g u m e n t s   )   :  
 	 	 	 	 	 u n d e f i n e d ;  
 	 	 	 } ;  
 	 	 }  
  
 	 	 / /   A d d   e l e m   a s   a   p r o p e r t y   o f   t h e   h a n d l e   f u n c t i o n  
 	 	 / /   T h i s   i s   t o   p r e v e n t   a   m e m o r y   l e a k   w i t h   n o n - n a t i v e   e v e n t s   i n   I E .  
 	 	 e v e n t H a n d l e . e l e m   =   e l e m ;  
  
 	 	 / /   H a n d l e   m u l t i p l e   e v e n t s   s e p a r a t e d   b y   a   s p a c e  
 	 	 / /   j Q u e r y ( . . . ) . b i n d ( " m o u s e o v e r   m o u s e o u t " ,   f n ) ;  
 	 	 t y p e s   =   t y p e s . s p l i t ( "   " ) ;  
  
 	 	 v a r   t y p e ,   i   =   0 ,   n a m e s p a c e s ;  
  
 	 	 w h i l e   (   ( t y p e   =   t y p e s [   i + +   ] )   )   {  
 	 	 	 h a n d l e O b j   =   h a n d l e O b j I n   ?  
 	 	 	 	 j Q u e r y . e x t e n d ( { } ,   h a n d l e O b j I n )   :  
 	 	 	 	 {   h a n d l e r :   h a n d l e r ,   d a t a :   d a t a   } ;  
  
 	 	 	 / /   N a m e s p a c e d   e v e n t   h a n d l e r s  
 	 	 	 i f   (   t y p e . i n d e x O f ( " . " )   >   - 1   )   {  
 	 	 	 	 n a m e s p a c e s   =   t y p e . s p l i t ( " . " ) ;  
 	 	 	 	 t y p e   =   n a m e s p a c e s . s h i f t ( ) ;  
 	 	 	 	 h a n d l e O b j . n a m e s p a c e   =   n a m e s p a c e s . s l i c e ( 0 ) . s o r t ( ) . j o i n ( " . " ) ;  
  
 	 	 	 }   e l s e   {  
 	 	 	 	 n a m e s p a c e s   =   [ ] ;  
 	 	 	 	 h a n d l e O b j . n a m e s p a c e   =   " " ;  
 	 	 	 }  
  
 	 	 	 h a n d l e O b j . t y p e   =   t y p e ;  
 	 	 	 i f   (   ! h a n d l e O b j . g u i d   )   {  
 	 	 	 	 h a n d l e O b j . g u i d   =   h a n d l e r . g u i d ;  
 	 	 	 }  
  
 	 	 	 / /   G e t   t h e   c u r r e n t   l i s t   o f   f u n c t i o n s   b o u n d   t o   t h i s   e v e n t  
 	 	 	 v a r   h a n d l e r s   =   e v e n t s [   t y p e   ] ,  
 	 	 	 	 s p e c i a l   =   j Q u e r y . e v e n t . s p e c i a l [   t y p e   ]   | |   { } ;  
  
 	 	 	 / /   I n i t   t h e   e v e n t   h a n d l e r   q u e u e  
 	 	 	 i f   (   ! h a n d l e r s   )   {  
 	 	 	 	 h a n d l e r s   =   e v e n t s [   t y p e   ]   =   [ ] ;  
  
 	 	 	 	 / /   C h e c k   f o r   a   s p e c i a l   e v e n t   h a n d l e r  
 	 	 	 	 / /   O n l y   u s e   a d d E v e n t L i s t e n e r / a t t a c h E v e n t   i f   t h e   s p e c i a l  
 	 	 	 	 / /   e v e n t s   h a n d l e r   r e t u r n s   f a l s e  
 	 	 	 	 i f   (   ! s p e c i a l . s e t u p   | |   s p e c i a l . s e t u p . c a l l (   e l e m ,   d a t a ,   n a m e s p a c e s ,   e v e n t H a n d l e   )   = = =   f a l s e   )   {  
 	 	 	 	 	 / /   B i n d   t h e   g l o b a l   e v e n t   h a n d l e r   t o   t h e   e l e m e n t  
 	 	 	 	 	 i f   (   e l e m . a d d E v e n t L i s t e n e r   )   {  
 	 	 	 	 	 	 e l e m . a d d E v e n t L i s t e n e r (   t y p e ,   e v e n t H a n d l e ,   f a l s e   ) ;  
  
 	 	 	 	 	 }   e l s e   i f   (   e l e m . a t t a c h E v e n t   )   {  
 	 	 	 	 	 	 e l e m . a t t a c h E v e n t (   " o n "   +   t y p e ,   e v e n t H a n d l e   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 i f   (   s p e c i a l . a d d   )   {  
 	 	 	 	 s p e c i a l . a d d . c a l l (   e l e m ,   h a n d l e O b j   ) ;  
  
 	 	 	 	 i f   (   ! h a n d l e O b j . h a n d l e r . g u i d   )   {  
 	 	 	 	 	 h a n d l e O b j . h a n d l e r . g u i d   =   h a n d l e r . g u i d ;  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 / /   A d d   t h e   f u n c t i o n   t o   t h e   e l e m e n t ' s   h a n d l e r   l i s t  
 	 	 	 h a n d l e r s . p u s h (   h a n d l e O b j   ) ;  
  
 	 	 	 / /   K e e p   t r a c k   o f   w h i c h   e v e n t s   h a v e   b e e n   u s e d ,   f o r   e v e n t   o p t i m i z a t i o n  
 	 	 	 j Q u e r y . e v e n t . g l o b a l [   t y p e   ]   =   t r u e ;  
 	 	 }  
  
 	 	 / /   N u l l i f y   e l e m   t o   p r e v e n t   m e m o r y   l e a k s   i n   I E  
 	 	 e l e m   =   n u l l ;  
 	 } ,  
  
 	 g l o b a l :   { } ,  
  
 	 / /   D e t a c h   a n   e v e n t   o r   s e t   o f   e v e n t s   f r o m   a n   e l e m e n t  
 	 r e m o v e :   f u n c t i o n (   e l e m ,   t y p e s ,   h a n d l e r ,   p o s   )   {  
 	 	 / /   d o n ' t   d o   e v e n t s   o n   t e x t   a n d   c o m m e n t   n o d e s  
 	 	 i f   (   e l e m . n o d e T y p e   = = =   3   | |   e l e m . n o d e T y p e   = = =   8   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 i f   (   h a n d l e r   = = =   f a l s e   )   {  
 	 	 	 h a n d l e r   =   r e t u r n F a l s e ;  
 	 	 }  
  
 	 	 v a r   r e t ,   t y p e ,   f n ,   j ,   i   =   0 ,   a l l ,   n a m e s p a c e s ,   n a m e s p a c e ,   s p e c i a l ,   e v e n t T y p e ,   h a n d l e O b j ,   o r i g T y p e ,  
 	 	 	 e l e m D a t a   =   j Q u e r y . h a s D a t a (   e l e m   )   & &   j Q u e r y . _ d a t a (   e l e m   ) ,  
 	 	 	 e v e n t s   =   e l e m D a t a   & &   e l e m D a t a . e v e n t s ;  
  
 	 	 i f   (   ! e l e m D a t a   | |   ! e v e n t s   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 / /   t y p e s   i s   a c t u a l l y   a n   e v e n t   o b j e c t   h e r e  
 	 	 i f   (   t y p e s   & &   t y p e s . t y p e   )   {  
 	 	 	 h a n d l e r   =   t y p e s . h a n d l e r ;  
 	 	 	 t y p e s   =   t y p e s . t y p e ;  
 	 	 }  
  
 	 	 / /   U n b i n d   a l l   e v e n t s   f o r   t h e   e l e m e n t  
 	 	 i f   (   ! t y p e s   | |   t y p e o f   t y p e s   = = =   " s t r i n g "   & &   t y p e s . c h a r A t ( 0 )   = = =   " . "   )   {  
 	 	 	 t y p e s   =   t y p e s   | |   " " ;  
  
 	 	 	 f o r   (   t y p e   i n   e v e n t s   )   {  
 	 	 	 	 j Q u e r y . e v e n t . r e m o v e (   e l e m ,   t y p e   +   t y p e s   ) ;  
 	 	 	 }  
  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 / /   H a n d l e   m u l t i p l e   e v e n t s   s e p a r a t e d   b y   a   s p a c e  
 	 	 / /   j Q u e r y ( . . . ) . u n b i n d ( " m o u s e o v e r   m o u s e o u t " ,   f n ) ;  
 	 	 t y p e s   =   t y p e s . s p l i t ( "   " ) ;  
  
 	 	 w h i l e   (   ( t y p e   =   t y p e s [   i + +   ] )   )   {  
 	 	 	 o r i g T y p e   =   t y p e ;  
 	 	 	 h a n d l e O b j   =   n u l l ;  
 	 	 	 a l l   =   t y p e . i n d e x O f ( " . " )   <   0 ;  
 	 	 	 n a m e s p a c e s   =   [ ] ;  
  
 	 	 	 i f   (   ! a l l   )   {  
 	 	 	 	 / /   N a m e s p a c e d   e v e n t   h a n d l e r s  
 	 	 	 	 n a m e s p a c e s   =   t y p e . s p l i t ( " . " ) ;  
 	 	 	 	 t y p e   =   n a m e s p a c e s . s h i f t ( ) ;  
  
 	 	 	 	 n a m e s p a c e   =   n e w   R e g E x p ( " ( ^ | \ \ . ) "   +  
 	 	 	 	 	 j Q u e r y . m a p (   n a m e s p a c e s . s l i c e ( 0 ) . s o r t ( ) ,   f c l e a n u p   ) . j o i n ( " \ \ . ( ? : . * \ \ . ) ? " )   +   " ( \ \ . | $ ) " ) ;  
 	 	 	 }  
  
 	 	 	 e v e n t T y p e   =   e v e n t s [   t y p e   ] ;  
  
 	 	 	 i f   (   ! e v e n t T y p e   )   {  
 	 	 	 	 c o n t i n u e ;  
 	 	 	 }  
  
 	 	 	 i f   (   ! h a n d l e r   )   {  
 	 	 	 	 f o r   (   j   =   0 ;   j   <   e v e n t T y p e . l e n g t h ;   j + +   )   {  
 	 	 	 	 	 h a n d l e O b j   =   e v e n t T y p e [   j   ] ;  
  
 	 	 	 	 	 i f   (   a l l   | |   n a m e s p a c e . t e s t (   h a n d l e O b j . n a m e s p a c e   )   )   {  
 	 	 	 	 	 	 j Q u e r y . e v e n t . r e m o v e (   e l e m ,   o r i g T y p e ,   h a n d l e O b j . h a n d l e r ,   j   ) ;  
 	 	 	 	 	 	 e v e n t T y p e . s p l i c e (   j - - ,   1   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 c o n t i n u e ;  
 	 	 	 }  
  
 	 	 	 s p e c i a l   =   j Q u e r y . e v e n t . s p e c i a l [   t y p e   ]   | |   { } ;  
  
 	 	 	 f o r   (   j   =   p o s   | |   0 ;   j   <   e v e n t T y p e . l e n g t h ;   j + +   )   {  
 	 	 	 	 h a n d l e O b j   =   e v e n t T y p e [   j   ] ;  
  
 	 	 	 	 i f   (   h a n d l e r . g u i d   = = =   h a n d l e O b j . g u i d   )   {  
 	 	 	 	 	 / /   r e m o v e   t h e   g i v e n   h a n d l e r   f o r   t h e   g i v e n   t y p e  
 	 	 	 	 	 i f   (   a l l   | |   n a m e s p a c e . t e s t (   h a n d l e O b j . n a m e s p a c e   )   )   {  
 	 	 	 	 	 	 i f   (   p o s   = =   n u l l   )   {  
 	 	 	 	 	 	 	 e v e n t T y p e . s p l i c e (   j - - ,   1   ) ;  
 	 	 	 	 	 	 }  
  
 	 	 	 	 	 	 i f   (   s p e c i a l . r e m o v e   )   {  
 	 	 	 	 	 	 	 s p e c i a l . r e m o v e . c a l l (   e l e m ,   h a n d l e O b j   ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
  
 	 	 	 	 	 i f   (   p o s   ! =   n u l l   )   {  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 / /   r e m o v e   g e n e r i c   e v e n t   h a n d l e r   i f   n o   m o r e   h a n d l e r s   e x i s t  
 	 	 	 i f   (   e v e n t T y p e . l e n g t h   = = =   0   | |   p o s   ! =   n u l l   & &   e v e n t T y p e . l e n g t h   = = =   1   )   {  
 	 	 	 	 i f   (   ! s p e c i a l . t e a r d o w n   | |   s p e c i a l . t e a r d o w n . c a l l (   e l e m ,   n a m e s p a c e s   )   = = =   f a l s e   )   {  
 	 	 	 	 	 j Q u e r y . r e m o v e E v e n t (   e l e m ,   t y p e ,   e l e m D a t a . h a n d l e   ) ;  
 	 	 	 	 }  
  
 	 	 	 	 r e t   =   n u l l ;  
 	 	 	 	 d e l e t e   e v e n t s [   t y p e   ] ;  
 	 	 	 }  
 	 	 }  
  
 	 	 / /   R e m o v e   t h e   e x p a n d o   i f   i t ' s   n o   l o n g e r   u s e d  
 	 	 i f   (   j Q u e r y . i s E m p t y O b j e c t (   e v e n t s   )   )   {  
 	 	 	 v a r   h a n d l e   =   e l e m D a t a . h a n d l e ;  
 	 	 	 i f   (   h a n d l e   )   {  
 	 	 	 	 h a n d l e . e l e m   =   n u l l ;  
 	 	 	 }  
  
 	 	 	 d e l e t e   e l e m D a t a . e v e n t s ;  
 	 	 	 d e l e t e   e l e m D a t a . h a n d l e ;  
  
 	 	 	 i f   (   j Q u e r y . i s E m p t y O b j e c t (   e l e m D a t a   )   )   {  
 	 	 	 	 j Q u e r y . r e m o v e D a t a (   e l e m ,   u n d e f i n e d ,   t r u e   ) ;  
 	 	 	 }  
 	 	 }  
 	 } ,  
 	  
 	 / /   E v e n t s   t h a t   a r e   s a f e   t o   s h o r t - c i r c u i t   i f   n o   h a n d l e r s   a r e   a t t a c h e d .  
 	 / /   N a t i v e   D O M   e v e n t s   s h o u l d   n o t   b e   a d d e d ,   t h e y   m a y   h a v e   i n l i n e   h a n d l e r s .  
 	 c u s t o m E v e n t :   {  
 	 	 " g e t D a t a " :   t r u e ,  
 	 	 " s e t D a t a " :   t r u e ,  
 	 	 " c h a n g e D a t a " :   t r u e  
 	 } ,  
  
 	 t r i g g e r :   f u n c t i o n (   e v e n t ,   d a t a ,   e l e m ,   o n l y H a n d l e r s   )   {  
 	 	 / /   E v e n t   o b j e c t   o r   e v e n t   t y p e  
 	 	 v a r   t y p e   =   e v e n t . t y p e   | |   e v e n t ,  
 	 	 	 n a m e s p a c e s   =   [ ] ,  
 	 	 	 e x c l u s i v e ;  
  
 	 	 i f   (   t y p e . i n d e x O f ( " ! " )   > =   0   )   {  
 	 	 	 / /   E x c l u s i v e   e v e n t s   t r i g g e r   o n l y   f o r   t h e   e x a c t   e v e n t   ( n o   n a m e s p a c e s )  
 	 	 	 t y p e   =   t y p e . s l i c e ( 0 ,   - 1 ) ;  
 	 	 	 e x c l u s i v e   =   t r u e ;  
 	 	 }  
  
 	 	 i f   (   t y p e . i n d e x O f ( " . " )   > =   0   )   {  
 	 	 	 / /   N a m e s p a c e d   t r i g g e r ;   c r e a t e   a   r e g e x p   t o   m a t c h   e v e n t   t y p e   i n   h a n d l e ( )  
 	 	 	 n a m e s p a c e s   =   t y p e . s p l i t ( " . " ) ;  
 	 	 	 t y p e   =   n a m e s p a c e s . s h i f t ( ) ;  
 	 	 	 n a m e s p a c e s . s o r t ( ) ;  
 	 	 }  
  
 	 	 i f   (   ( ! e l e m   | |   j Q u e r y . e v e n t . c u s t o m E v e n t [   t y p e   ] )   & &   ! j Q u e r y . e v e n t . g l o b a l [   t y p e   ]   )   {  
 	 	 	 / /   N o   j Q u e r y   h a n d l e r s   f o r   t h i s   e v e n t   t y p e ,   a n d   i t   c a n ' t   h a v e   i n l i n e   h a n d l e r s  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 / /   C a l l e r   c a n   p a s s   i n   a n   E v e n t ,   O b j e c t ,   o r   j u s t   a n   e v e n t   t y p e   s t r i n g  
 	 	 e v e n t   =   t y p e o f   e v e n t   = = =   " o b j e c t "   ?  
 	 	 	 / /   j Q u e r y . E v e n t   o b j e c t  
 	 	 	 e v e n t [   j Q u e r y . e x p a n d o   ]   ?   e v e n t   :  
 	 	 	 / /   O b j e c t   l i t e r a l  
 	 	 	 n e w   j Q u e r y . E v e n t (   t y p e ,   e v e n t   )   :  
 	 	 	 / /   J u s t   t h e   e v e n t   t y p e   ( s t r i n g )  
 	 	 	 n e w   j Q u e r y . E v e n t (   t y p e   ) ;  
  
 	 	 e v e n t . t y p e   =   t y p e ;  
 	 	 e v e n t . e x c l u s i v e   =   e x c l u s i v e ;  
 	 	 e v e n t . n a m e s p a c e   =   n a m e s p a c e s . j o i n ( " . " ) ;  
 	 	 e v e n t . n a m e s p a c e _ r e   =   n e w   R e g E x p ( " ( ^ | \ \ . ) "   +   n a m e s p a c e s . j o i n ( " \ \ . ( ? : . * \ \ . ) ? " )   +   " ( \ \ . | $ ) " ) ;  
 	 	  
 	 	 / /   t r i g g e r H a n d l e r ( )   a n d   g l o b a l   e v e n t s   d o n ' t   b u b b l e   o r   r u n   t h e   d e f a u l t   a c t i o n  
 	 	 i f   (   o n l y H a n d l e r s   | |   ! e l e m   )   {  
 	 	 	 e v e n t . p r e v e n t D e f a u l t ( ) ;  
 	 	 	 e v e n t . s t o p P r o p a g a t i o n ( ) ;  
 	 	 }  
  
 	 	 / /   H a n d l e   a   g l o b a l   t r i g g e r  
 	 	 i f   (   ! e l e m   )   {  
 	 	 	 / /   T O D O :   S t o p   t a u n t i n g   t h e   d a t a   c a c h e ;   r e m o v e   g l o b a l   e v e n t s   a n d   a l w a y s   a t t a c h   t o   d o c u m e n t  
 	 	 	 j Q u e r y . e a c h (   j Q u e r y . c a c h e ,   f u n c t i o n ( )   {  
 	 	 	 	 / /   i n t e r n a l K e y   v a r i a b l e   i s   j u s t   u s e d   t o   m a k e   i t   e a s i e r   t o   f i n d  
 	 	 	 	 / /   a n d   p o t e n t i a l l y   c h a n g e   t h i s   s t u f f   l a t e r ;   c u r r e n t l y   i t   j u s t  
 	 	 	 	 / /   p o i n t s   t o   j Q u e r y . e x p a n d o  
 	 	 	 	 v a r   i n t e r n a l K e y   =   j Q u e r y . e x p a n d o ,  
 	 	 	 	 	 i n t e r n a l C a c h e   =   t h i s [   i n t e r n a l K e y   ] ;  
 	 	 	 	 i f   (   i n t e r n a l C a c h e   & &   i n t e r n a l C a c h e . e v e n t s   & &   i n t e r n a l C a c h e . e v e n t s [   t y p e   ]   )   {  
 	 	 	 	 	 j Q u e r y . e v e n t . t r i g g e r (   e v e n t ,   d a t a ,   i n t e r n a l C a c h e . h a n d l e . e l e m   ) ;  
 	 	 	 	 }  
 	 	 	 } ) ;  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 / /   D o n ' t   d o   e v e n t s   o n   t e x t   a n d   c o m m e n t   n o d e s  
 	 	 i f   (   e l e m . n o d e T y p e   = = =   3   | |   e l e m . n o d e T y p e   = = =   8   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 / /   C l e a n   u p   t h e   e v e n t   i n   c a s e   i t   i s   b e i n g   r e u s e d  
 	 	 e v e n t . r e s u l t   =   u n d e f i n e d ;  
 	 	 e v e n t . t a r g e t   =   e l e m ;  
  
 	 	 / /   C l o n e   a n y   i n c o m i n g   d a t a   a n d   p r e p e n d   t h e   e v e n t ,   c r e a t i n g   t h e   h a n d l e r   a r g   l i s t  
 	 	 d a t a   =   d a t a   ?   j Q u e r y . m a k e A r r a y (   d a t a   )   :   [ ] ;  
 	 	 d a t a . u n s h i f t (   e v e n t   ) ;  
  
 	 	 v a r   c u r   =   e l e m ,  
 	 	 	 / /   I E   d o e s n ' t   l i k e   m e t h o d   n a m e s   w i t h   a   c o l o n   ( # 3 5 3 3 ,   # 8 2 7 2 )  
 	 	 	 o n t y p e   =   t y p e . i n d e x O f ( " : " )   <   0   ?   " o n "   +   t y p e   :   " " ;  
  
 	 	 / /   F i r e   e v e n t   o n   t h e   c u r r e n t   e l e m e n t ,   t h e n   b u b b l e   u p   t h e   D O M   t r e e  
 	 	 d o   {  
 	 	 	 v a r   h a n d l e   =   j Q u e r y . _ d a t a (   c u r ,   " h a n d l e "   ) ;  
  
 	 	 	 e v e n t . c u r r e n t T a r g e t   =   c u r ;  
 	 	 	 i f   (   h a n d l e   )   {  
 	 	 	 	 h a n d l e . a p p l y (   c u r ,   d a t a   ) ;  
 	 	 	 }  
  
 	 	 	 / /   T r i g g e r   a n   i n l i n e   b o u n d   s c r i p t  
 	 	 	 i f   (   o n t y p e   & &   j Q u e r y . a c c e p t D a t a (   c u r   )   & &   c u r [   o n t y p e   ]   & &   c u r [   o n t y p e   ] . a p p l y (   c u r ,   d a t a   )   = = =   f a l s e   )   {  
 	 	 	 	 e v e n t . r e s u l t   =   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 u b b l e   u p   t o   d o c u m e n t ,   t h e n   t o   w i n d o w  
 	 	 	 c u r   =   c u r . p a r e n t N o d e   | |   c u r . o w n e r D o c u m e n t   | |   c u r   = = =   e v e n t . t a r g e t . o w n e r D o c u m e n t   & &   w i n d o w ;  
 	 	 }   w h i l e   (   c u r   & &   ! e v e n t . i s P r o p a g a t i o n S t o p p e d ( )   ) ;  
  
 	 	 / /   I f   n o b o d y   p r e v e n t e d   t h e   d e f a u l t   a c t i o n ,   d o   i t   n o w  
 	 	 i f   (   ! e v e n t . i s D e f a u l t P r e v e n t e d ( )   )   {  
 	 	 	 v a r   o l d ,  
 	 	 	 	 s p e c i a l   =   j Q u e r y . e v e n t . s p e c i a l [   t y p e   ]   | |   { } ;  
  
 	 	 	 i f   (   ( ! s p e c i a l . _ d e f a u l t   | |   s p e c i a l . _ d e f a u l t . c a l l (   e l e m . o w n e r D o c u m e n t ,   e v e n t   )   = = =   f a l s e )   & &  
 	 	 	 	 ! ( t y p e   = = =   " c l i c k "   & &   j Q u e r y . n o d e N a m e (   e l e m ,   " a "   ) )   & &   j Q u e r y . a c c e p t D a t a (   e l e m   )   )   {  
  
 	 	 	 	 / /   C a l l   a   n a t i v e   D O M   m e t h o d   o n   t h e   t a r g e t   w i t h   t h e   s a m e   n a m e   n a m e   a s   t h e   e v e n t .  
 	 	 	 	 / /   C a n ' t   u s e   a n   . i s F u n c t i o n ) ( )   c h e c k   h e r e   b e c a u s e   I E 6 / 7   f a i l s   t h a t   t e s t .  
 	 	 	 	 / /   I E < 9   d i e s   o n   f o c u s   t o   h i d d e n   e l e m e n t   ( # 1 4 8 6 ) ,   m a y   w a n t   t o   r e v i s i t   a   t r y / c a t c h .  
 	 	 	 	 t r y   {  
 	 	 	 	 	 i f   (   o n t y p e   & &   e l e m [   t y p e   ]   )   {  
 	 	 	 	 	 	 / /   D o n ' t   r e - t r i g g e r   a n   o n F O O   e v e n t   w h e n   w e   c a l l   i t s   F O O ( )   m e t h o d  
 	 	 	 	 	 	 o l d   =   e l e m [   o n t y p e   ] ;  
  
 	 	 	 	 	 	 i f   (   o l d   )   {  
 	 	 	 	 	 	 	 e l e m [   o n t y p e   ]   =   n u l l ;  
 	 	 	 	 	 	 }  
  
 	 	 	 	 	 	 j Q u e r y . e v e n t . t r i g g e r e d   =   t y p e ;  
 	 	 	 	 	 	 e l e m [   t y p e   ] ( ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }   c a t c h   (   i e E r r o r   )   { }  
  
 	 	 	 	 i f   (   o l d   )   {  
 	 	 	 	 	 e l e m [   o n t y p e   ]   =   o l d ;  
 	 	 	 	 }  
  
 	 	 	 	 j Q u e r y . e v e n t . t r i g g e r e d   =   u n d e f i n e d ;  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 r e t u r n   e v e n t . r e s u l t ;  
 	 } ,  
  
 	 h a n d l e :   f u n c t i o n (   e v e n t   )   {  
 	 	 e v e n t   =   j Q u e r y . e v e n t . f i x (   e v e n t   | |   w i n d o w . e v e n t   ) ;  
 	 	 / /   S n a p s h o t   t h e   h a n d l e r s   l i s t   s i n c e   a   c a l l e d   h a n d l e r   m a y   a d d / r e m o v e   e v e n t s .  
 	 	 v a r   h a n d l e r s   =   ( ( j Q u e r y . _ d a t a (   t h i s ,   " e v e n t s "   )   | |   { } ) [   e v e n t . t y p e   ]   | |   [ ] ) . s l i c e ( 0 ) ,  
 	 	 	 r u n _ a l l   =   ! e v e n t . e x c l u s i v e   & &   ! e v e n t . n a m e s p a c e ,  
 	 	 	 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 ,   0   ) ;  
  
 	 	 / /   U s e   t h e   f i x - e d   E v e n t   r a t h e r   t h a n   t h e   ( r e a d - o n l y )   n a t i v e   e v e n t  
 	 	 a r g s [ 0 ]   =   e v e n t ;  
 	 	 e v e n t . c u r r e n t T a r g e t   =   t h i s ;  
  
 	 	 f o r   (   v a r   j   =   0 ,   l   =   h a n d l e r s . l e n g t h ;   j   <   l ;   j + +   )   {  
 	 	 	 v a r   h a n d l e O b j   =   h a n d l e r s [   j   ] ;  
  
 	 	 	 / /   T r i g g e r e d   e v e n t   m u s t   1 )   b e   n o n - e x c l u s i v e   a n d   h a v e   n o   n a m e s p a c e ,   o r  
 	 	 	 / /   2 )   h a v e   n a m e s p a c e ( s )   a   s u b s e t   o r   e q u a l   t o   t h o s e   i n   t h e   b o u n d   e v e n t .  
 	 	 	 i f   (   r u n _ a l l   | |   e v e n t . n a m e s p a c e _ r e . t e s t (   h a n d l e O b j . n a m e s p a c e   )   )   {  
 	 	 	 	 / /   P a s s   i n   a   r e f e r e n c e   t o   t h e   h a n d l e r   f u n c t i o n   i t s e l f  
 	 	 	 	 / /   S o   t h a t   w e   c a n   l a t e r   r e m o v e   i t  
 	 	 	 	 e v e n t . h a n d l e r   =   h a n d l e O b j . h a n d l e r ;  
 	 	 	 	 e v e n t . d a t a   =   h a n d l e O b j . d a t a ;  
 	 	 	 	 e v e n t . h a n d l e O b j   =   h a n d l e O b j ;  
  
 	 	 	 	 v a r   r e t   =   h a n d l e O b j . h a n d l e r . a p p l y (   t h i s ,   a r g s   ) ;  
  
 	 	 	 	 i f   (   r e t   ! = =   u n d e f i n e d   )   {  
 	 	 	 	 	 e v e n t . r e s u l t   =   r e t ;  
 	 	 	 	 	 i f   (   r e t   = = =   f a l s 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 . s t o p P r o p a g a t i o n ( ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   e v e n t . i s I m m e d i a t e P r o p a g a t i o n S t o p p e d ( )   )   {  
 	 	 	 	 	 b r e a k ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	 r e t u r n   e v e n t . r e s u l t ;  
 	 } ,  
  
 	 p r o p s :   " a l t K e y   a t t r C h a n g e   a t t r N a m e   b u b b l e s   b u t t o n   c a n c e l a b l e   c h a r C o d e   c l i e n t X   c l i e n t Y   c t r l K e y   c u r r e n t T a r g e t   d a t a   d e t a i l   e v e n t P h a s e   f r o m E l e m e n t   h a n d l e r   k e y C o d e   l a y e r X   l a y e r Y   m e t a K e y   n e w V a l u e   o f f s e t X   o f f s e t Y   p a g e X   p a g e Y   p r e v V a l u e   r e l a t e d N o d e   r e l a t e d T a r g e t   s c r e e n X   s c r e e n Y   s h i f t K e y   s r c E l e m e n t   t a r g e t   t o E l e m e n t   v i e w   w h e e l D e l t a   w h i c h " . s p l i t ( "   " ) ,  
  
 	 f i x :   f u n c t i o n (   e v e n t   )   {  
 	 	 i f   (   e v e n t [   j Q u e r y . e x p a n d o   ]   )   {  
 	 	 	 r e t u r n   e v e n t ;  
 	 	 }  
  
 	 	 / /   s t o r e   a   c o p y   o f   t h e   o r i g i n a l   e v e n t   o b j e c t  
 	 	 / /   a n d   " c l o n e "   t o   s e t   r e a d - o n l y   p r o p e r t i e s  
 	 	 v a r   o r i g i n a l E v e n t   =   e v e n t ;  
 	 	 e v e n t   =   j Q u e r y . 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   =   t h i s . p r o p s . l e n g t h ,   p r o p ;   i ;   )   {  
 	 	 	 p r o p   =   t h i s . p r o p s [   - - i   ] ;  
 	 	 	 e v e n t [   p r o p   ]   =   o r i g i n a l E v e n t [   p r o p   ] ;  
 	 	 }  
  
 	 	 / /   F i x   t a r g e t   p r o p e r t y ,   i f   n e c e s s a r y  
 	 	 i f   (   ! e v e n t . t a r g e t   )   {  
 	 	 	 / /   F i x e s   # 1 9 2 5   w h e r e   s r c E l e m e n t   m i g h t   n o t   b e   d e f i n e d   e i t h e r  
 	 	 	 e v e n t . t a r g e t   =   e v e n t . s r c E l e m e n t   | |   d o c u m e n t ;  
 	 	 }  
  
 	 	 / /   c h e c k   i f   t a r g e t   i s   a   t e x t n o d e   ( s a f a r i )  
 	 	 i f   (   e v e n t . t a r g e t . n o d e T y p e   = = =   3   )   {  
 	 	 	 e v e n t . t a r g e t   =   e v e n t . t a r g e t . p a r e n t N o d e ;  
 	 	 }  
  
 	 	 / /   A d d   r e l a t e d T a r g e t ,   i f   n e c e s s a r y  
 	 	 i f   (   ! e v e n t . r e l a t e d T a r g e t   & &   e v e n t . f r o m E l e m e n t   )   {  
 	 	 	 e v e n t . r e l a t e d T a r g e t   =   e v e n t . f r o m E l e m e n t   = = =   e v e n t . t a r g e t   ?   e v e n t . t o E l e m e n t   :   e v e n t . f r o m E l e m e n t ;  
 	 	 }  
  
 	 	 / /   C a l c u l a t e   p a g e X / Y   i f   m i s s i n g   a n d   c l i e n t X / Y   a v a i l a b l e  
 	 	 i f   (   e v e n t . p a g e X   = =   n u l l   & &   e v e n t . c l i e n t X   ! =   n u l l   )   {  
 	 	 	 v a r   e v e n t D o c u m e n t   =   e v e n t . t a r g e t . o w n e r D o c u m e n t   | |   d o c u m e n t ,  
 	 	 	 	 d o c   =   e v e n t D o c u m e n t . d o c u m e n t E l e m e n t ,  
 	 	 	 	 b o d y   =   e v e n t D o c u m e n t . b o d y ;  
  
 	 	 	 e v e n t . p a g e X   =   e v e n t . c l i e n t X   +   ( d o c   & &   d o c . s c r o l l L e f t   | |   b o d y   & &   b o d y . s c r o l l L e f t   | |   0 )   -   ( d o c   & &   d o c . c l i e n t L e f t   | |   b o d y   & &   b o d y . c l i e n t L e f t   | |   0 ) ;  
 	 	 	 e v e n t . p a g e Y   =   e v e n t . c l i e n t Y   +   ( d o c   & &   d o c . s c r o l l T o p     | |   b o d y   & &   b o d y . s c r o l l T o p     | |   0 )   -   ( d o c   & &   d o c . c l i e n t T o p     | |   b o d y   & &   b o d y . c l i e n t T o p     | |   0 ) ;  
 	 	 }  
  
 	 	 / /   A d d   w h i c h   f o r   k e y   e v e n t s  
 	 	 i f   (   e v e n t . w h i c h   = =   n u l l   & &   ( e v e n t . c h a r C o d e   ! =   n u l l   | |   e v e n t . k e y C o d e   ! =   n u l l )   )   {  
 	 	 	 e v e n t . w h i c h   =   e v e n t . c h a r C o d e   ! =   n u l l   ?   e v e n t . c h a r C o d e   :   e v e n t . k e y C o d e ;  
 	 	 }  
  
 	 	 / /   A d d   m e t a K e y   t o   n o n - M a c   b r o w s e r s   ( u s e   c t r l   f o r   P C ' s   a n d   M e t a   f o r   M a c s )  
 	 	 i f   (   ! e v e n t . m e t a K e y   & &   e v e n t . c t r l K e y   )   {  
 	 	 	 e v e n t . m e t a K e y   =   e v e n t . c t r l K e y ;  
 	 	 }  
  
 	 	 / /   A d d   w h i c h   f o r   c l i c k :   1   = = =   l e f t ;   2   = = =   m i d d l e ;   3   = = =   r i g h t  
 	 	 / /   N o t e :   b u t t o n   i s   n o t   n o r m a l i z e d ,   s o   d o n ' t   u s e   i t  
 	 	 i f   (   ! e v e n t . w h i c h   & &   e v e n t . b u t t o n   ! = =   u n d e f i n e d   )   {  
 	 	 	 e v e n t . w h i c h   =   ( e v e n t . b u t t o n   &   1   ?   1   :   (   e v e n t . b u t t o n   &   2   ?   3   :   (   e v e n t . b u t t o n   &   4   ?   2   :   0   )   ) ) ;  
 	 	 }  
  
 	 	 r e t u r n   e v e n t ;  
 	 } ,  
  
 	 / /   D e p r e c a t e d ,   u s e   j Q u e r y . g u i d   i n s t e a d  
 	 g u i d :   1 E 8 ,  
  
 	 / /   D e p r e c a t e d ,   u s e   j Q u e r y . p r o x y   i n s t e a d  
 	 p r o x y :   j Q u e r y . p r o x y ,  
  
 	 s p e c i a l :   {  
 	 	 r e a d y :   {  
 	 	 	 / /   M a k e   s u r e   t h e   r e a d y   e v e n t   i s   s e t u p  
 	 	 	 s e t u p :   j Q u e r y . b i n d R e a d y ,  
 	 	 	 t e a r d o w n :   j Q u e r y . n o o p  
 	 	 } ,  
  
 	 	 l i v e :   {  
 	 	 	 a d d :   f u n c t i o n (   h a n d l e O b j   )   {  
 	 	 	 	 j Q u e r y . e v e n t . a d d (   t h i s ,  
 	 	 	 	 	 l i v e C o n v e r t (   h a n d l e O b j . o r i g T y p e ,   h a n d l e O b j . s e l e c t o r   ) ,  
 	 	 	 	 	 j Q u e r y . e x t e n d ( { } ,   h a n d l e O b j ,   { h a n d l e r :   l i v e H a n d l e r ,   g u i d :   h a n d l e O b j . h a n d l e r . g u i d } )   ) ;  
 	 	 	 } ,  
  
 	 	 	 r e m o v e :   f u n c t i o n (   h a n d l e O b j   )   {  
 	 	 	 	 j Q u e r y . e v e n t . r e m o v e (   t h i s ,   l i v e C o n v e r t (   h a n d l e O b j . o r i g T y p e ,   h a n d l e O b j . s e l e c t o r   ) ,   h a n d l e O b j   ) ;  
 	 	 	 }  
 	 	 } ,  
  
 	 	 b e f o r e u n l o a d :   {  
 	 	 	 s e t u p :   f u n c t i o n (   d a t a ,   n a m e s p a c e s ,   e v e n t H a n d l e   )   {  
 	 	 	 	 / /   W e   o n l y   w a n t   t o   d o   t h i s   s p e c i a l   c a s e   o n   w i n d o w s  
 	 	 	 	 i f   (   j Q u e r y . i s W i n d o w (   t h i s   )   )   {  
 	 	 	 	 	 t h i s . o n b e f o r e u n l o a d   =   e v e n t H a n d l e ;  
 	 	 	 	 }  
 	 	 	 } ,  
  
 	 	 	 t e a r d o w n :   f u n c t i o n (   n a m e s p a c e s ,   e v e n t H a n d l e   )   {  
 	 	 	 	 i f   (   t h i s . o n b e f o r e u n l o a d   = = =   e v e n t H a n d l e   )   {  
 	 	 	 	 	 t h i s . o n b e f o r e u n l o a d   =   n u l l ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 }  
 } ;  
  
 j Q u e r y . r e m o v e E v e n t   =   d o c u m e n t . r e m o v e E v e n t L i s t e n e r   ?  
 	 f u n c t i o n (   e l e m ,   t y p e ,   h a n d l e   )   {  
 	 	 i f   (   e l e m . r e m o v e E v e n t L i s t e n e r   )   {  
 	 	 	 e l e m . r e m o v e E v e n t L i s t e n e r (   t y p e ,   h a n d l e ,   f a l s e   ) ;  
 	 	 }  
 	 }   :  
 	 f u n c t i o n (   e l e m ,   t y p e ,   h a n d l e   )   {  
 	 	 i f   (   e l e m . d e t a c h E v e n t   )   {  
 	 	 	 e l e m . d e t a c h E v e n t (   " o n "   +   t y p e ,   h a n d l e   ) ;  
 	 	 }  
 	 } ;  
  
 j Q u e r y . E v e n t   =   f u n c t i o n (   s r c ,   p r o p s   )   {  
 	 / /   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   t h e   ' n e w '   k e y w o r d  
 	 i f   (   ! t h i s . p r e v e n t D e f a u l t   )   {  
 	 	 r e t u r n   n e w   j Q u e r y . E v e n t (   s r c ,   p r o p s   ) ;  
 	 }  
  
 	 / /   E v e n t   o b j e c t  
 	 i f   (   s r c   & &   s r c . t y p e   )   {  
 	 	 t h i s . o r i g i n a l E v e n t   =   s r c ;  
 	 	 t h i s . t y p e   =   s r c . t y p e ;  
  
 	 	 / /   E v e n t s   b u b b l i n g   u p   t h e   d o c u m e n t   m a y   h a v e   b e e n   m a r k e d   a s   p r e v e n t e d  
 	 	 / /   b y   a   h a n d l e r   l o w e r   d o w n   t h e   t r e e ;   r e f l e c t   t h e   c o r r e c t   v a l u e .  
 	 	 t h i s . i s D e f a u l t P r e v e n t e d   =   ( s r c . d e f a u l t P r e v e n t e d   | |   s r c . r e t u r n V a l u e   = = =   f a l s e   | |  
 	 	 	 s r c . g e t P r e v e n t D e f a u l t   & &   s r c . g e 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   :   r e t u r n F a l s e ;  
  
 	 / /   E v e n t   t y p e  
 	 }   e l s e   {  
 	 	 t h i s . t y p e   =   s r c ;  
 	 }  
  
 	 / /   P u t   e x p l i c i t l y   p r o v i d e d   p r o p e r t i e s   o n t o   t h e   e v e n t   o b j e c t  
 	 i f   (   p r o p s   )   {  
 	 	 j Q u e r y . e x t e n d (   t h i s ,   p r o p s   ) ;  
 	 }  
  
 	 / /   t i m e S t a m p   i s   b u g g y   f o r   s o m e   e v e n t s   o n   F i r e f o x ( # 3 8 4 3 )  
 	 / /   S o   w e   w o n ' t   r e l y   o n   t h e   n a t i v e   v a l u e  
 	 t h i s . t i m e S t a m p   =   j Q u e r y . n o w ( ) ;  
  
 	 / /   M a r k   i t   a s   f i x e d  
 	 t h i s [   j Q u e r y . e x p a n d o   ]   =   t r u e ;  
 } ;  
  
 f u n c t i o n   r e t u r n F a l s e ( )   {  
 	 r e t u r n   f a l s e ;  
 }  
 f u n c t i o n   r e t u r n T r u e ( )   {  
 	 r e t u r n   t r u e ;  
 }  
  
 / /   j Q u e r y . E v e n t   i s   b a s e d   o n   D O M 3   E v e n t s   a s   s p e c i f i e d   b y   t h e   E C M A S c r i p t   L a n g u a g e   B i n d i n g  
 / /   h t t p : / / w w w . w 3 . o r g / T R / 2 0 0 3 / W D - D O M - L e v e l - 3 - E v e n t s - 2 0 0 3 0 3 3 1 / e c m a - s c r i p t - b i n d i n g . h t m l  
 j Q u e r y . E v e n t . p r o t o t y p e   =   {  
 	 p r e v e n t D e f a u l t :   f u n c t i o n ( )   {  
 	 	 t h i s . i s D e f a u l t P r e v e n t e d   =   r e t u r n T r u e ;  
  
 	 	 v a r   e   =   t h i s . o r i g i n a l E v e n t ;  
 	 	 i f   (   ! e   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 / /   i f   p r e v e n t D e f a u l t   e x i s t s   r u n   i t   o n   t h e   o r i g i n a l   e v e n t  
 	 	 i f   (   e . p r e v e n t D e f a u l t   )   {  
 	 	 	 e . p r e v e n t D e f a u l t ( ) ;  
  
 	 	 / /   o t h e r w i s e   s e t   t h e   r e t u r n V a l u e   p r o p e r t y   o f   t h e   o r i g i n a l   e v e n t   t o   f a l s e   ( I E )  
 	 	 }   e l s e   {  
 	 	 	 e . r e t u r n V a l u e   =   f a l s e ;  
 	 	 }  
 	 } ,  
 	 s t o p P r o p a g a t i o n :   f u n c t i o n ( )   {  
 	 	 t h i s . i s P r o p a g a t i o n S t o p p e d   =   r e t u r n T r u e ;  
  
 	 	 v a r   e   =   t h i s . o r i g i n a l E v e n t ;  
 	 	 i f   (   ! e   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
 	 	 / /   i f   s t o p P r o p a g a t i o n   e x i s t s   r u n   i t   o n   t h e   o r i g i n a l   e v e n t  
 	 	 i f   (   e . s t o p P r o p a g a t i o n   )   {  
 	 	 	 e . s t o p P r o p a g a t i o n ( ) ;  
 	 	 }  
 	 	 / /   o t h e r w i s e   s e t   t h e   c a n c e l B u b b l e   p r o p e r t y   o f   t h e   o r i g i n a l   e v e n t   t o   t r u e   ( I E )  
 	 	 e . c a n c e l B u b b l e   =   t r u e ;  
 	 } ,  
 	 s t o p I m m e d i a t e P r o p a g a t i o n :   f u n c t i o n ( )   {  
 	 	 t h i s . i s I m m e d i a t e P r o p a g a t i o n S t o p p e d   =   r e t u r n T r u e ;  
 	 	 t h i s . s t o p P r o p a g a t i o n ( ) ;  
 	 } ,  
 	 i s D e f a u l t P r e v e n t e d :   r e t u r n F a l s e ,  
 	 i s P r o p a g a t i o n S t o p p e d :   r e t u r n F a l s e ,  
 	 i s I m m e d i a t e P r o p a g a t i o n S t o p p e d :   r e t u r n F a l s e  
 } ;  
  
 / /   C h e c k s   i f   a n   e v e n t   h a p p e n e d   o n   a n   e l e m e n t   w i t h i n   a n o t h e r   e l e m e n t  
 / /   U s e d   i n   j Q u e r y . e v e n t . s p e c i a l . m o u s e e n t e r   a n d   m o u s e l e a v e   h a n d l e r s  
 v a r   w i t h i n E l e m e n t   =   f u n c t i o n (   e v e n t   )   {  
 	 / /   C h e c k   i f   m o u s e ( o v e r | o u t )   a r e   s t i l l   w i t h i n   t h e   s a m e   p a r e n t   e l e m e n t  
 	 v a r   p a r e n t   =   e v e n t . r e l a t e d T a r g e t ;  
  
 	 / /   F i r e f o x   s o m e t i m e s   a s s i g n s   r e l a t e d T a r g e t   a   X U L   e l e m e n t  
 	 / /   w h i c h   w e   c a n n o t   a c c e s s   t h e   p a r e n t N o d e   p r o p e r t y   o f  
 	 t r y   {  
  
 	 	 / /   C h r o m e   d o e s   s o m e t h i n g   s i m i l a r ,   t h e   p a r e n t N o d e   p r o p e r t y  
 	 	 / /   c a n   b e   a c c e s s e d   b u t   i s   n u l l .  
 	 	 i f   (   p a r e n t   & &   p a r e n t   ! = =   d o c u m e n t   & &   ! p a r e n t . p a r e n t N o d e   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
 	 	 / /   T r a v e r s e   u p   t h e   t r e e  
 	 	 w h i l e   (   p a r e n t   & &   p a r e n t   ! = =   t h i s   )   {  
 	 	 	 p a r e n t   =   p a r e n t . p a r e n t N o d e ;  
 	 	 }  
  
 	 	 i f   (   p a r e n t   ! = =   t h i s   )   {  
 	 	 	 / /   s e t   t h e   c o r r e c t   e v e n t   t y p e  
 	 	 	 e v e n t . t y p e   =   e v e n t . d a t a ;  
  
 	 	 	 / /   h a n d l e   e v e n t   i f   w e   a c t u a l l y   j u s t   m o u s e d   o n   t o   a   n o n   s u b - e l e m e n t  
 	 	 	 j Q u e r y . e v e n t . h a n d l e . a p p l y (   t h i s ,   a r g u m e n t s   ) ;  
 	 	 }  
  
 	 / /   a s s u m i n g   w e ' v e   l e f t   t h e   e l e m e n t   s i n c e   w e   m o s t   l i k e l y   m o u s e d o v e r   a   x u l   e l e m e n t  
 	 }   c a t c h ( e )   {   }  
 } ,  
  
 / /   I n   c a s e   o f   e v e n t   d e l e g a t i o n ,   w e   o n l y   n e e d   t o   r e n a m e   t h e   e v e n t . t y p e ,  
 / /   l i v e H a n d l e r   w i l l   t a k e   c a r e   o f   t h e   r e s t .  
 d e l e g a t e   =   f u n c t i o n (   e v e n t   )   {  
 	 e v e n t . t y p e   =   e v e n t . d a t a ;  
 	 j Q u e r y . e v e n t . h a n d l e . a p p l y (   t h i s ,   a r g u m e n t s   ) ;  
 } ;  
  
 / /   C r e a t e   m o u s e e n t e r   a n d   m o u s e l e a v e   e v e n t s  
 j Q u e r y . e a c h ( {  
 	 m o u s e e n t e r :   " m o u s e o v e r " ,  
 	 m o u s e l e a v e :   " m o u s e o u t "  
 } ,   f u n c t i o n (   o r i g ,   f i x   )   {  
 	 j Q u e r y . e v e n t . s p e c i a l [   o r i g   ]   =   {  
 	 	 s e t u p :   f u n c t i o n (   d a t a   )   {  
 	 	 	 j Q u e r y . e v e n t . a d d (   t h i s ,   f i x ,   d a t a   & &   d a t a . s e l e c t o r   ?   d e l e g a t e   :   w i t h i n E l e m e n t ,   o r i g   ) ;  
 	 	 } ,  
 	 	 t e a r d o w n :   f u n c t i o n (   d a t a   )   {  
 	 	 	 j Q u e r y . e v e n t . r e m o v e (   t h i s ,   f i x ,   d a t a   & &   d a t a . s e l e c t o r   ?   d e l e g a t e   :   w i t h i n E l e m e n t   ) ;  
 	 	 }  
 	 } ;  
 } ) ;  
  
 / /   s u b m i t   d e l e g a t i o n  
 i f   (   ! j Q u e r y . s u p p o r t . s u b m i t B u b b l e s   )   {  
  
 	 j Q u e r y . e v e n t . s p e c i a l . s u b m i t   =   {  
 	 	 s e t u p :   f u n c t i o n (   d a t a ,   n a m e s p a c e s   )   {  
 	 	 	 i f   (   ! j Q u e r y . n o d e N a m e (   t h i s ,   " f o r m "   )   )   {  
 	 	 	 	 j Q u e r y . e v e n t . a d d ( t h i s ,   " c l i c k . s p e c i a l S u b m i t " ,   f u n c t i o n (   e   )   {  
 	 	 	 	 	 v a r   e l e m   =   e . t a r g e t ,  
 	 	 	 	 	 	 t y p e   =   e l e m . t y p e ;  
  
 	 	 	 	 	 i f   (   ( t y p e   = = =   " s u b m i t "   | |   t y p e   = = =   " i m a g e " )   & &   j Q u e r y (   e l e m   ) . c l o s e s t ( " f o r m " ) . l e n g t h   )   {  
 	 	 	 	 	 	 t r i g g e r (   " s u b m i t " ,   t h i s ,   a r g u m e n t s   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 } ) ;  
  
 	 	 	 	 j Q u e r y . e v e n t . a d d ( t h i s ,   " k e y p r e s s . s p e c i a l S u b m i t " ,   f u n c t i o n (   e   )   {  
 	 	 	 	 	 v a r   e l e m   =   e . t a r g e t ,  
 	 	 	 	 	 	 t y p e   =   e l e m . t y p e ;  
  
 	 	 	 	 	 i f   (   ( t y p e   = = =   " t e x t "   | |   t y p e   = = =   " p a s s w o r d " )   & &   j Q u e r y (   e l e m   ) . c l o s e s t ( " f o r m " ) . l e n g t h   & &   e . k e y C o d e   = = =   1 3   )   {  
 	 	 	 	 	 	 t r i g g e r (   " s u b m i t " ,   t h i s ,   a r g u m e n t s   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 } ) ;  
  
 	 	 	 }   e l s e   {  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 } ,  
  
 	 	 t e a r d o w n :   f u n c t i o n (   n a m e s p a c e s   )   {  
 	 	 	 j Q u e r y . e v e n t . r e m o v e (   t h i s ,   " . s p e c i a l S u b m i t "   ) ;  
 	 	 }  
 	 } ;  
  
 }  
  
 / /   c h a n g e   d e l e g a t i o n ,   h a p p e n s   h e r e   s o   w e   h a v e   b i n d .  
 i f   (   ! j Q u e r y . s u p p o r t . c h a n g e B u b b l e s   )   {  
  
 	 v a r   c h a n g e F i l t e r s ,  
  
 	 g e t V a l   =   f u n c t i o n (   e l e m   )   {  
 	 	 v a r   t y p e   =   e l e m . t y p e ,   v a l   =   e l e m . v a l u e ;  
  
 	 	 i f   (   t y p e   = = =   " r a d i o "   | |   t y p e   = = =   " c h e c k b o x "   )   {  
 	 	 	 v a l   =   e l e m . c h e c k e d ;  
  
 	 	 }   e l s e   i f   (   t y p e   = = =   " s e l e c t - m u l t i p l e "   )   {  
 	 	 	 v a l   =   e l e m . s e l e c t e d I n d e x   >   - 1   ?  
 	 	 	 	 j Q u e r y . m a p (   e l e m . o p t i o n s ,   f u n c t i o n (   e l e m   )   {  
 	 	 	 	 	 r e t u r n   e l e m . s e l e c t e d ;  
 	 	 	 	 } ) . j o i n ( " - " )   :  
 	 	 	 	 " " ;  
  
 	 	 }   e l s e   i f   (   j Q u e r y . n o d e N a m e (   e l e m ,   " s e l e c t "   )   )   {  
 	 	 	 v a l   =   e l e m . s e l e c t e d I n d e x ;  
 	 	 }  
  
 	 	 r e t u r n   v a l ;  
 	 } ,  
  
 	 t e s t C h a n g e   =   f u n c t i o n   t e s t C h a n g e (   e   )   {  
 	 	 v a r   e l e m   =   e . t a r g e t ,   d a t a ,   v a l ;  
  
 	 	 i f   (   ! r f o r m E l e m s . t e s t (   e l e m . n o d e N a m e   )   | |   e l e m . r e a d O n l y   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 d a t a   =   j Q u e r y . _ d a t a (   e l e m ,   " _ c h a n g e _ d a t a "   ) ;  
 	 	 v a l   =   g e t V a l ( e l e m ) ;  
  
 	 	 / /   t h e   c u r r e n t   d a t a   w i l l   b e   a l s o   r e t r i e v e d   b y   b e f o r e a c t i v a t e  
 	 	 i f   (   e . t y p e   ! = =   " f o c u s o u t "   | |   e l e m . t y p e   ! = =   " r a d i o "   )   {  
 	 	 	 j Q u e r y . _ d a t a (   e l e m ,   " _ c h a n g e _ d a t a " ,   v a l   ) ;  
 	 	 }  
  
 	 	 i f   (   d a t a   = = =   u n d e f i n e d   | |   v a l   = = =   d a t a   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 i f   (   d a t a   ! =   n u l l   | |   v a l   )   {  
 	 	 	 e . t y p e   =   " c h a n g e " ;  
 	 	 	 e . l i v e F i r e d   =   u n d e f i n e d ;  
 	 	 	 j Q u e r y . e v e n t . t r i g g e r (   e ,   a r g u m e n t s [ 1 ] ,   e l e m   ) ;  
 	 	 }  
 	 } ;  
  
 	 j Q u e r y . e v e n t . s p e c i a l . c h a n g e   =   {  
 	 	 f i l t e r s :   {  
 	 	 	 f o c u s o u t :   t e s t C h a n g e ,  
  
 	 	 	 b e f o r e d e a c t i v a t e :   t e s t C h a n g e ,  
  
 	 	 	 c l i c k :   f u n c t i o n (   e   )   {  
 	 	 	 	 v a r   e l e m   =   e . t a r g e t ,   t y p e   =   j Q u e r y . n o d e N a m e (   e l e m ,   " i n p u t "   )   ?   e l e m . t y p e   :   " " ;  
  
 	 	 	 	 i f   (   t y p e   = = =   " r a d i o "   | |   t y p e   = = =   " c h e c k b o x "   | |   j Q u e r y . n o d e N a m e (   e l e m ,   " s e l e c t "   )   )   {  
 	 	 	 	 	 t e s t C h a n g e . c a l l (   t h i s ,   e   ) ;  
 	 	 	 	 }  
 	 	 	 } ,  
  
 	 	 	 / /   C h a n g e   h a s   t o   b e   c a l l e d   b e f o r e   s u b m i t  
 	 	 	 / /   K e y d o w n   w i l l   b e   c a l l e d   b e f o r e   k e y p r e s s ,   w h i c h   i s   u s e d   i n   s u b m i t - e v e n t   d e l e g a t i o n  
 	 	 	 k e y d o w n :   f u n c t i o n (   e   )   {  
 	 	 	 	 v a r   e l e m   =   e . t a r g e t ,   t y p e   =   j Q u e r y . n o d e N a m e (   e l e m ,   " i n p u t "   )   ?   e l e m . t y p e   :   " " ;  
  
 	 	 	 	 i f   (   ( e . k e y C o d e   = = =   1 3   & &   ! j Q u e r y . n o d e N a m e (   e l e m ,   " t e x t a r e a "   )   )   | |  
 	 	 	 	 	 ( e . k e y C o d e   = = =   3 2   & &   ( t y p e   = = =   " c h e c k b o x "   | |   t y p e   = = =   " r a d i o " ) )   | |  
 	 	 	 	 	 t y p e   = = =   " s e l e c t - m u l t i p l e "   )   {  
 	 	 	 	 	 t e s t C h a n g e . c a l l (   t h i s ,   e   ) ;  
 	 	 	 	 }  
 	 	 	 } ,  
  
 	 	 	 / /   B e f o r e a c t i v a t e   h a p p e n s   a l s o   b e f o r e   t h e   p r e v i o u s   e l e m e n t   i s   b l u r r e d  
 	 	 	 / /   w i t h   t h i s   e v e n t   y o u   c a n ' t   t r i g g e r   a   c h a n g e   e v e n t ,   b u t   y o u   c a n   s t o r e  
 	 	 	 / /   i n f o r m a t i o n  
 	 	 	 b e f o r e a c t i v a t e :   f u n c t i o n (   e   )   {  
 	 	 	 	 v a r   e l e m   =   e . t a r g e t ;  
 	 	 	 	 j Q u e r y . _ d a t a (   e l e m ,   " _ c h a n g e _ d a t a " ,   g e t V a l ( e l e m )   ) ;  
 	 	 	 }  
 	 	 } ,  
  
 	 	 s e t u p :   f u n c t i o n (   d a t a ,   n a m e s p a c e s   )   {  
 	 	 	 i f   (   t h i s . t y p e   = = =   " f i l e "   )   {  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
  
 	 	 	 f o r   (   v a r   t y p e   i n   c h a n g e F i l t e r s   )   {  
 	 	 	 	 j Q u e r y . e v e n t . a d d (   t h i s ,   t y p e   +   " . s p e c i a l C h a n g e " ,   c h a n g e F i l t e r s [ t y p e ]   ) ;  
 	 	 	 }  
  
 	 	 	 r e t u r n   r f o r m E l e m s . t e s t (   t h i s . n o d e N a m e   ) ;  
 	 	 } ,  
  
 	 	 t e a r d o w n :   f u n c t i o n (   n a m e s p a c e s   )   {  
 	 	 	 j Q u e r y . e v e n t . r e m o v e (   t h i s ,   " . s p e c i a l C h a n g e "   ) ;  
  
 	 	 	 r e t u r n   r f o r m E l e m s . t e s t (   t h i s . n o d e N a m e   ) ;  
 	 	 }  
 	 } ;  
  
 	 c h a n g e F i l t e r s   =   j Q u e r y . e v e n t . s p e c i a l . c h a n g e . f i l t e r s ;  
  
 	 / /   H a n d l e   w h e n   t h e   i n p u t   i s   . f o c u s ( ) ' d  
 	 c h a n g e F i l t e r s . f o c u s   =   c h a n g e F i l t e r s . b e f o r e a c t i v a t e ;  
 }  
  
 f u n c t i o n   t r i g g e r (   t y p e ,   e l e m ,   a r g s   )   {  
 	 / /   P i g g y b a c k   o n   a   d o n o r   e v e n t   t o   s i m u l a t e   a   d i f f e r e n t   o n e .  
 	 / /   F a k e   o r i g i n a l E v e n t   t o   a v o i d   d o n o r ' s   s t o p P r o p a g a t i o n ,   b u t   i f   t h e  
 	 / /   s i m u l a t e d   e v e n t   p r e v e n t s   d e f a u l t   t h e n   w e   d o   t h e   s a m e   o n   t h e   d o n o r .  
 	 / /   D o n ' t   p a s s   a r g s   o r   r e m e m b e r   l i v e F i r e d ;   t h e y   a p p l y   t o   t h e   d o n o r   e v e n t .  
 	 v a r   e v e n t   =   j Q u e r y . e x t e n d (   { } ,   a r g s [   0   ]   ) ;  
 	 e v e n t . t y p e   =   t y p e ;  
 	 e v e n t . o r i g i n a l E v e n t   =   { } ;  
 	 e v e n t . l i v e F i r e d   =   u n d e f i n e d ;  
 	 j Q u e r y . e v e n t . h a n d l e . c a l l (   e l e m ,   e v e n t   ) ;  
 	 i f   (   e v e n t . i s D e f a u l t P r e v e n t e d ( )   )   {  
 	 	 a r g s [   0   ] . p r e v e n t D e f a u l t ( ) ;  
 	 }  
 }  
  
 / /   C r e a t e   " b u b b l i n g "   f o c u s   a n d   b l u r   e v e n t s  
 i f   (   ! j Q u e r y . s u p p o r t . f o c u s i n B u b b l e s   )   {  
 	 j Q u e r y . e a c h ( {   f o c u s :   " f o c u s i n " ,   b l u r :   " f o c u s o u t "   } ,   f u n c t i o n (   o r i g ,   f i x   )   {  
  
 	 	 / /   A t t a c h   a   s i n g l e   c a p t u r i n g   h a n d l e r   w h i l e   s o m e o n e   w a n t s   f o c u s i n / f o c u s o u t  
 	 	 v a r   a t t a c h e s   =   0 ;  
  
 	 	 j Q u e r y . e v e n t . s p e c i a l [   f i x   ]   =   {  
 	 	 	 s e t u p :   f u n c t i o n ( )   {  
 	 	 	 	 i f   (   a t t a c h e s + +   = = =   0   )   {  
 	 	 	 	 	 d o c u m e n t . a d d E v e n t L i s t e n e r (   o r i g ,   h a n d l e r ,   t r u e   ) ;  
 	 	 	 	 }  
 	 	 	 } ,  
 	 	 	 t e a r d o w n :   f u n c t i o n ( )   {  
 	 	 	 	 i f   (   - - a t t a c h e s   = = =   0   )   {  
 	 	 	 	 	 d o c u m e n t . r e m o v e E v e n t L i s t e n e r (   o r i g ,   h a n d l e r ,   t r u e   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 } ;  
  
 	 	 f u n c t i o n   h a n d l e r (   d o n o r   )   {  
 	 	 	 / /   D o n o r   e v e n t   i s   a l w a y s   a   n a t i v e   o n e ;   f i x   i t   a n d   s w i t c h   i t s   t y p e .  
 	 	 	 / /   L e t   f o c u s i n / o u t   h a n d l e r   c a n c e l   t h e   d o n o r   f o c u s / b l u r   e v e n t .  
 	 	 	 v a r   e   =   j Q u e r y . e v e n t . f i x (   d o n o r   ) ;  
 	 	 	 e . t y p e   =   f i x ;  
 	 	 	 e . o r i g i n a l E v e n t   =   { } ;  
 	 	 	 j Q u e r y . e v e n t . t r i g g e r (   e ,   n u l l ,   e . t a r g e t   ) ;  
 	 	 	 i f   (   e . i s D e f a u l t P r e v e n t e d ( )   )   {  
 	 	 	 	 d o n o r . p r e v e n t D e f a u l t ( ) ;  
 	 	 	 }  
 	 	 }  
 	 } ) ;  
 }  
  
 j Q u e r y . e a c h ( [ " b i n d " ,   " o n e " ] ,   f u n c t i o n (   i ,   n a m e   )   {  
 	 j Q u e r y . f n [   n a m e   ]   =   f u n c t i o n (   t y p e ,   d a t a ,   f n   )   {  
 	 	 v a r   h a n d l e r ;  
  
 	 	 / /   H a n d l e   o b j e c t   l i t e r a l s  
 	 	 i f   (   t y p e o f   t y p e   = = =   " o b j e c t "   )   {  
 	 	 	 f o r   (   v a r   k e y   i n   t y p e   )   {  
 	 	 	 	 t h i s [   n a m e   ] ( k e y ,   d a t a ,   t y p e [ k e y ] ,   f n ) ;  
 	 	 	 }  
 	 	 	 r e t u r n   t h i s ;  
 	 	 }  
  
 	 	 i f   (   a r g u m e n t s . l e n g t h   = = =   2   | |   d a t a   = = =   f a l s e   )   {  
 	 	 	 f n   =   d a t a ;  
 	 	 	 d a t a   =   u n d e f i n e d ;  
 	 	 }  
  
 	 	 i f   (   n a m e   = = =   " o n e "   )   {  
 	 	 	 h a n d l e r   =   f u n c t i o n (   e v e n t   )   {  
 	 	 	 	 j Q u e r y (   t h i s   ) . u n b i n d (   e v e n t ,   h a n d l e r   ) ;  
 	 	 	 	 r e t u r n   f n . a p p l y (   t h i s ,   a r g u m e n t s   ) ;  
 	 	 	 } ;  
 	 	 	 h a n d l e r . g u i d   =   f n . g u i d   | |   j Q u e r y . g u i d + + ;  
 	 	 }   e l s e   {  
 	 	 	 h a n d l e r   =   f n ;  
 	 	 }  
  
 	 	 i f   (   t y p e   = = =   " u n l o a d "   & &   n a m e   ! = =   " o n e "   )   {  
 	 	 	 t h i s . o n e (   t y p e ,   d a t a ,   f n   ) ;  
  
 	 	 }   e l s e   {  
 	 	 	 f o r   (   v a r   i   =   0 ,   l   =   t h i s . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 	 j Q u e r y . e v e n t . a d d (   t h i s [ i ] ,   t y p e ,   h a n d l e r ,   d a t a   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   t h i s ;  
 	 } ;  
 } ) ;  
  
 j Q u e r y . f n . e x t e n d ( {  
 	 u n b i n d :   f u n c t i o n (   t y p e ,   f n   )   {  
 	 	 / /   H a n d l e   o b j e c t   l i t e r a l s  
 	 	 i f   (   t y p e o f   t y p e   = = =   " o b j e c t "   & &   ! t y p e . p r e v e n t D e f a u l t   )   {  
 	 	 	 f o r   (   v a r   k e y   i n   t y p e   )   {  
 	 	 	 	 t h i s . u n b i n d ( k e y ,   t y p e [ k e y ] ) ;  
 	 	 	 }  
  
 	 	 }   e l s e   {  
 	 	 	 f o r   (   v a r   i   =   0 ,   l   =   t h i s . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 	 j Q u e r y . e v e n t . r e m o v e (   t h i s [ i ] ,   t y p e ,   f n   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   t h i s ;  
 	 } ,  
  
 	 d e l e g a t e :   f u n c t i o n (   s e l e c t o r ,   t y p e s ,   d a t a ,   f n   )   {  
 	 	 r e t u r n   t h i s . l i v e (   t y p e s ,   d a t a ,   f n ,   s e l e c t o r   ) ;  
 	 } ,  
  
 	 u n d e l e g a t e :   f u n c t i o n (   s e l e c t o r ,   t y p e s ,   f n   )   {  
 	 	 i f   (   a r g u m e n t s . l e n g t h   = = =   0   )   {  
 	 	 	 r e t u r n   t h i s . u n b i n d (   " l i v e "   ) ;  
  
 	 	 }   e l s e   {  
 	 	 	 r e t u r n   t h i s . d i e (   t y p e s ,   n u l l ,   f n ,   s e l e c t o r   ) ;  
 	 	 }  
 	 } ,  
  
 	 t r i g g e r :   f u n c t i o n (   t y p e ,   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 ( )   {  
 	 	 	 j Q u e r y . e v e n t . t r i g g e r (   t y p e ,   d a t a ,   t h i s   ) ;  
 	 	 } ) ;  
 	 } ,  
  
 	 t r i g g e r H a n d l e r :   f u n c t i o n (   t y p e ,   d a t a   )   {  
 	 	 i f   (   t h i s [ 0 ]   )   {  
 	 	 	 r e t u r n   j Q u e r y . e v e n t . t r i g g e r (   t y p e ,   d a t a ,   t h i s [ 0 ] ,   t r u e   ) ;  
 	 	 }  
 	 } ,  
  
 	 t o g g l e :   f u n c t i o n (   f n   )   {  
 	 	 / /   S a v e   r e f e r e n c e   t o   a r g u m e n t s   f o r   a c c e s s   i n   c l o s u r e  
 	 	 v a r   a r g s   =   a r g u m e n t s ,  
 	 	 	 g u i d   =   f n . g u i d   | |   j Q u e r y . g u i d + + ,  
 	 	 	 i   =   0 ,  
 	 	 	 t o g g l e r   =   f u n c t i o n (   e v e n t   )   {  
 	 	 	 	 / /   F i g u r e   o u t   w h i c h   f u n c t i o n   t o   e x e c u t e  
 	 	 	 	 v a r   l a s t T o g g l e   =   (   j Q u e r y . d a t a (   t h i s ,   " l a s t T o g g l e "   +   f n . g u i d   )   | |   0   )   %   i ;  
 	 	 	 	 j Q u e r y . d a t a (   t h i s ,   " l a s t T o g g l e "   +   f n . g u i d ,   l a s t T o g g l e   +   1   ) ;  
  
 	 	 	 	 / /   M a k e   s u r e   t h a t   c l i c k s   s t o p  
 	 	 	 	 e v e n t . p r e v e n t D e f a u l t ( ) ;  
  
 	 	 	 	 / /   a n d   e x e c u t e   t h e   f u n c t i o n  
 	 	 	 	 r e t u r n   a r g s [   l a s t T o g g l e   ] . a p p l y (   t h i s ,   a r g u m e n t s   )   | |   f a l s e ;  
 	 	 	 } ;  
  
 	 	 / /   l i n k   a l l   t h e   f u n c t i o n s ,   s o   a n y   o f   t h e m   c a n   u n b i n d   t h i s   c l i c k   h a n d l e r  
 	 	 t o g g l e r . g u i d   =   g u i d ;  
 	 	 w h i l e   (   i   <   a r g s . l e n g t h   )   {  
 	 	 	 a r g s [   i + +   ] . g u i d   =   g u i d ;  
 	 	 }  
  
 	 	 r e t u r n   t h i s . c l i c k (   t o g g l e r   ) ;  
 	 } ,  
  
 	 h o v e r :   f u n c t i o n (   f n O v e r ,   f n O u t   )   {  
 	 	 r e t u r n   t h i s . m o u s e e n t e r (   f n O v e r   ) . m o u s e l e a v e (   f n O u t   | |   f n O v e r   ) ;  
 	 }  
 } ) ;  
  
 v a r   l i v e M a p   =   {  
 	 f o c u s :   " f o c u s i n " ,  
 	 b l u r :   " f o c u s o u t " ,  
 	 m o u s e e n t e r :   " m o u s e o v e r " ,  
 	 m o u s e l e a v e :   " m o u s e o u t "  
 } ;  
  
 j Q u e r y . e a c h ( [ " l i v e " ,   " d i e " ] ,   f u n c t i o n (   i ,   n a m e   )   {  
 	 j Q u e r y . f n [   n a m e   ]   =   f u n c t i o n (   t y p e s ,   d a t a ,   f n ,   o r i g S e l e c t o r   / *   I n t e r n a l   U s e   O n l y   * /   )   {  
 	 	 v a r   t y p e ,   i   =   0 ,   m a t c h ,   n a m e s p a c e s ,   p r e T y p e ,  
 	 	 	 s e l e c t o r   =   o r i g S e l e c t o r   | |   t h i s . s e l e c t o r ,  
 	 	 	 c o n t e x t   =   o r i g S e l e c t o r   ?   t h i s   :   j Q u e r y (   t h i s . c o n t e x t   ) ;  
  
 	 	 i f   (   t y p e o f   t y p e s   = = =   " o b j e c t "   & &   ! t y p e s . p r e v e n t D e f a u l t   )   {  
 	 	 	 f o r   (   v a r   k e y   i n   t y p e s   )   {  
 	 	 	 	 c o n t e x t [   n a m e   ] (   k e y ,   d a t a ,   t y p e s [ k e y ] ,   s e l e c t o r   ) ;  
 	 	 	 }  
  
 	 	 	 r e t u r n   t h i s ;  
 	 	 }  
  
 	 	 i f   (   n a m e   = = =   " d i e "   & &   ! t y p e s   & &  
 	 	 	 	 	 o r i g S e l e c t o r   & &   o r i g S e l e c t o r . c h a r A t ( 0 )   = = =   " . "   )   {  
  
 	 	 	 c o n t e x t . u n b i n d (   o r i g S e l e c t o r   ) ;  
  
 	 	 	 r e t u r n   t h i s ;  
 	 	 }  
  
 	 	 i f   (   d a t a   = = =   f a l s e   | |   j Q u e r y . i s F u n c t i o n (   d a t a   )   )   {  
 	 	 	 f n   =   d a t a   | |   r e t u r n F a l s e ;  
 	 	 	 d a t a   =   u n d e f i n e d ;  
 	 	 }  
  
 	 	 t y p e s   =   ( t y p e s   | |   " " ) . s p l i t ( "   " ) ;  
  
 	 	 w h i l e   (   ( t y p e   =   t y p e s [   i + +   ] )   ! =   n u l l   )   {  
 	 	 	 m a t c h   =   r n a m e s p a c e s . e x e c (   t y p e   ) ;  
 	 	 	 n a m e s p a c e s   =   " " ;  
  
 	 	 	 i f   (   m a t c h   )     {  
 	 	 	 	 n a m e s p a c e s   =   m a t c h [ 0 ] ;  
 	 	 	 	 t y p e   =   t y p e . r e p l a c e (   r n a m e s p a c e s ,   " "   ) ;  
 	 	 	 }  
  
 	 	 	 i f   (   t y p e   = = =   " h o v e r "   )   {  
 	 	 	 	 t y p e s . p u s h (   " m o u s e e n t e r "   +   n a m e s p a c e s ,   " m o u s e l e a v e "   +   n a m e s p a c e s   ) ;  
 	 	 	 	 c o n t i n u e ;  
 	 	 	 }  
  
 	 	 	 p r e T y p e   =   t y p e ;  
  
 	 	 	 i f   (   l i v e M a p [   t y p e   ]   )   {  
 	 	 	 	 t y p e s . p u s h (   l i v e M a p [   t y p e   ]   +   n a m e s p a c e s   ) ;  
 	 	 	 	 t y p e   =   t y p e   +   n a m e s p a c e s ;  
  
 	 	 	 }   e l s e   {  
 	 	 	 	 t y p e   =   ( l i v e M a p [   t y p e   ]   | |   t y p e )   +   n a m e s p a c e s ;  
 	 	 	 }  
  
 	 	 	 i f   (   n a m e   = = =   " l i v e "   )   {  
 	 	 	 	 / /   b i n d   l i v e   h a n d l e r  
 	 	 	 	 f o r   (   v a r   j   =   0 ,   l   =   c o n t e x t . l e n g t h ;   j   <   l ;   j + +   )   {  
 	 	 	 	 	 j Q u e r y . e v e n t . a d d (   c o n t e x t [ j ] ,   " l i v e . "   +   l i v e C o n v e r t (   t y p e ,   s e l e c t o r   ) ,  
 	 	 	 	 	 	 {   d a t a :   d a t a ,   s e l e c t o r :   s e l e c t o r ,   h a n d l e r :   f n ,   o r i g T y p e :   t y p e ,   o r i g H a n d l e r :   f n ,   p r e T y p e :   p r e T y p e   }   ) ;  
 	 	 	 	 }  
  
 	 	 	 }   e l s e   {  
 	 	 	 	 / /   u n b i n d   l i v e   h a n d l e r  
 	 	 	 	 c o n t e x t . u n b i n d (   " l i v e . "   +   l i v e C o n v e r t (   t y p e ,   s e l e c t o r   ) ,   f n   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   t h i s ;  
 	 } ;  
 } ) ;  
  
 f u n c t i o n   l i v e H a n d l e r (   e v e n t   )   {  
 	 v a r   s t o p ,   m a x L e v e l ,   r e l a t e d ,   m a t c h ,   h a n d l e O b j ,   e l e m ,   j ,   i ,   l ,   d a t a ,   c l o s e ,   n a m e s p a c e ,   r e t ,  
 	 	 e l e m s   =   [ ] ,  
 	 	 s e l e c t o r s   =   [ ] ,  
 	 	 e v e n t s   =   j Q u e r y . _ d a t a (   t h i s ,   " e v e n t s "   ) ;  
  
 	 / /   M a k e   s u r e   w e   a v o i d   n o n - l e f t - c l i c k   b u b b l i n g   i n   F i r e f o x   ( # 3 8 6 1 )   a n d   d i s a b l e d   e l e m e n t s   i n   I E   ( # 6 9 1 1 )  
 	 i f   (   e v e n t . l i v e F i r e d   = = =   t h i s   | |   ! e v e n t s   | |   ! e v e n t s . l i v e   | |   e v e n t . t a r g e t . d i s a b l e d   | |   e v e n t . b u t t o n   & &   e v e n t . t y p e   = = =   " c l i c k "   )   {  
 	 	 r e t u r n ;  
 	 }  
  
 	 i f   (   e v e n t . n a m e s p a c e   )   {  
 	 	 n a m e s p a c e   =   n e w   R e g E x p ( " ( ^ | \ \ . ) "   +   e v e n t . n a m e s p a c e . s p l i t ( " . " ) . j o i n ( " \ \ . ( ? : . * \ \ . ) ? " )   +   " ( \ \ . | $ ) " ) ;  
 	 }  
  
 	 e v e n t . l i v e F i r e d   =   t h i s ;  
  
 	 v a r   l i v e   =   e v e n t s . l i v e . s l i c e ( 0 ) ;  
  
 	 f o r   (   j   =   0 ;   j   <   l i v e . l e n g t h ;   j + +   )   {  
 	 	 h a n d l e O b j   =   l i v e [ j ] ;  
  
 	 	 i f   (   h a n d l e O b j . o r i g T y p e . r e p l a c e (   r n a m e s p a c e s ,   " "   )   = = =   e v e n t . t y p e   )   {  
 	 	 	 s e l e c t o r s . p u s h (   h a n d l e O b j . s e l e c t o r   ) ;  
  
 	 	 }   e l s e   {  
 	 	 	 l i v e . s p l i c e (   j - - ,   1   ) ;  
 	 	 }  
 	 }  
  
 	 m a t c h   =   j Q u e r y (   e v e n t . t a r g e t   ) . c l o s e s t (   s e l e c t o r s ,   e v e n t . c u r r e n t T a r g e t   ) ;  
  
 	 f o r   (   i   =   0 ,   l   =   m a t c h . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 c l o s e   =   m a t c h [ i ] ;  
  
 	 	 f o r   (   j   =   0 ;   j   <   l i v e . l e n g t h ;   j + +   )   {  
 	 	 	 h a n d l e O b j   =   l i v e [ j ] ;  
  
 	 	 	 i f   (   c l o s e . s e l e c t o r   = = =   h a n d l e O b j . s e l e c t o r   & &   ( ! n a m e s p a c e   | |   n a m e s p a c e . t e s t (   h a n d l e O b j . n a m e s p a c e   ) )   & &   ! c l o s e . e l e m . d i s a b l e d   )   {  
 	 	 	 	 e l e m   =   c l o s e . e l e m ;  
 	 	 	 	 r e l a t e d   =   n u l l ;  
  
 	 	 	 	 / /   T h o s e   t w o   e v e n t s   r e q u i r e   a d d i t i o n a l   c h e c k i n g  
 	 	 	 	 i f   (   h a n d l e O b j . p r e T y p e   = = =   " m o u s e e n t e r "   | |   h a n d l e O b j . p r e T y p e   = = =   " m o u s e l e a v e "   )   {  
 	 	 	 	 	 e v e n t . t y p e   =   h a n d l e O b j . p r e T y p e ;  
 	 	 	 	 	 r e l a t e d   =   j Q u e r y (   e v e n t . r e l a t e d T a r g e t   ) . c l o s e s t (   h a n d l e O b j . s e l e c t o r   ) [ 0 ] ;  
  
 	 	 	 	 	 / /   M a k e   s u r e   n o t   t o   a c c i d e n t a l l y   m a t c h   a   c h i l d   e l e m e n t   w i t h   t h e   s a m e   s e l e c t o r  
 	 	 	 	 	 i f   (   r e l a t e d   & &   j Q u e r y . c o n t a i n s (   e l e m ,   r e l a t e d   )   )   {  
 	 	 	 	 	 	 r e l a t e d   =   e l e m ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   ! r e l a t e d   | |   r e l a t e d   ! = =   e l e m   )   {  
 	 	 	 	 	 e l e m s . p u s h ( {   e l e m :   e l e m ,   h a n d l e O b j :   h a n d l e O b j ,   l e v e l :   c l o s e . l e v e l   } ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 }  
  
 	 f o r   (   i   =   0 ,   l   =   e l e m s . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 m a t c h   =   e l e m s [ i ] ;  
  
 	 	 i f   (   m a x L e v e l   & &   m a t c h . l e v e l   >   m a x L e v e l   )   {  
 	 	 	 b r e a k ;  
 	 	 }  
  
 	 	 e v e n t . c u r r e n t T a r g e t   =   m a t c h . e l e m ;  
 	 	 e v e n t . d a t a   =   m a t c h . h a n d l e O b j . d a t a ;  
 	 	 e v e n t . h a n d l e O b j   =   m a t c h . h a n d l e O b j ;  
  
 	 	 r e t   =   m a t c h . h a n d l e O b j . o r i g H a n d l e r . a p p l y (   m a t c h . e l e m ,   a r g u m e n t s   ) ;  
  
 	 	 i f   (   r e t   = = =   f a l s e   | |   e v e n t . i s P r o p a g a t i o n S t o p p e d ( )   )   {  
 	 	 	 m a x L e v e l   =   m a t c h . l e v e l ;  
  
 	 	 	 i f   (   r e t   = = =   f a l s e   )   {  
 	 	 	 	 s t o p   =   f a l s e ;  
 	 	 	 }  
 	 	 	 i f   (   e v e n t . i s I m m e d i a t e P r o p a g a t i o n S t o p p e d ( )   )   {  
 	 	 	 	 b r e a k ;  
 	 	 	 }  
 	 	 }  
 	 }  
  
 	 r e t u r n   s t o p ;  
 }  
  
 f u n c t i o n   l i v e C o n v e r t (   t y p e ,   s e l e c t o r   )   {  
 	 r e t u r n   ( t y p e   & &   t y p e   ! = =   " * "   ?   t y p e   +   " . "   :   " " )   +   s e l e c t o r . r e p l a c e ( r p e r i o d ,   " ` " ) . r e p l a c e ( r s p a c e s ,   " & " ) ;  
 }  
  
 j Q u e r y . e a c h (   ( " b l u r   f o c u s   f o c u s i n   f o c u s o u t   l o a d   r e s i z e   s c r o l l   u n l o a d   c l i c k   d b l c l i c k   "   +  
 	 " m o u s e d o w n   m o u s e u p   m o u s e m o v e   m o u s e o v e r   m o u s e o u t   m o u s e e n t e r   m o u s e l e a v e   "   +  
 	 " c h a n g e   s e l e c t   s u b m i t   k e y d o w n   k e y p r e s s   k e y u p   e r r o r " ) . s p l i t ( "   " ) ,   f u n c t i o n (   i ,   n a m e   )   {  
  
 	 / /   H a n d l e   e v e n t   b i n d i n g  
 	 j Q u e r y . f n [   n a m e   ]   =   f u n c t i o n (   d a t a ,   f n   )   {  
 	 	 i f   (   f n   = =   n u l l   )   {  
 	 	 	 f n   =   d a t a ;  
 	 	 	 d a t a   =   n u l l ;  
 	 	 }  
  
 	 	 r e t u r n   a r g u m e n t s . l e n g t h   >   0   ?  
 	 	 	 t h i s . b i n d (   n a m e ,   d a t a ,   f n   )   :  
 	 	 	 t h i s . t r i g g e r (   n a m e   ) ;  
 	 } ;  
  
 	 i f   (   j Q u e r y . a t t r F n   )   {  
 	 	 j Q u e r y . a t t r F n [   n a m e   ]   =   t r u e ;  
 	 }  
 } ) ;  
  
  
  
 / * !  
   *   S i z z l e   C S S   S e l e c t o r   E n g i n e  
   *     C o p y r i g h t   2 0 1 1 ,   T h e   D o j o   F o u n d a t i o n  
   *     R e l e a s e d   u n d e r   t h e   M I T ,   B S D ,   a n d   G P L   L i c e n s e s .  
   *     M o r e   i n f o r m a t i o n :   h t t p : / / s i z z l e j s . c o m /  
   * /  
 ( f u n c t i o n ( ) {  
  
 v a r   c h u n k e r   =   / ( ( ? : \ ( ( ? : \ ( [ ^ ( ) ] + \ ) | [ ^ ( ) ] + ) + \ ) | \ [ ( ? : \ [ [ ^ \ [ \ ] ] * \ ] | [ ' " ] [ ^ ' " ] * [ ' " ] | [ ^ \ [ \ ] ' " ] + ) + \ ] | \ \ . | [ ^   > + ~ , ( \ [ \ \ ] + ) + | [ > + ~ ] ) ( \ s * , \ s * ) ? ( ( ? : . | \ r | \ n ) * ) / g ,  
 	 d o n e   =   0 ,  
 	 t o S t r i n g   =   O b j e c t . p r o t o t y p e . t o S t r i n g ,  
 	 h a s D u p l i c a t e   =   f a l s e ,  
 	 b a s e H a s D u p l i c a t e   =   t r u e ,  
 	 r B a c k s l a s h   =   / \ \ / g ,  
 	 r N o n W o r d   =   / \ W / ;  
  
 / /   H e r e   w e   c h e c k   i f   t h e   J a v a S c r i p t   e n g i n e   i s   u s i n g   s o m e   s o r t   o f  
 / /   o p t i m i z a t i o n   w h e r e   i t   d o e s   n o t   a l w a y s   c a l l   o u r   c o m p a r i s i o n  
 / /   f u n c t i o n .   I f   t h a t   i s   t h e   c a s e ,   d i s c a r d   t h e   h a s D u p l i c a t e   v a l u e .  
 / /       T h u s   f a r   t h a t   i n c l u d e s   G o o g l e   C h r o m e .  
 [ 0 ,   0 ] . s o r t ( f u n c t i o n ( )   {  
 	 b a s e H a s D u p l i c a t e   =   f a l s e ;  
 	 r e t u r n   0 ;  
 } ) ;  
  
 v a r   S i z z l e   =   f u n c t i o n (   s e l e c t o r ,   c o n t e x t ,   r e s u l t s ,   s e e d   )   {  
 	 r e s u l t s   =   r e s u l t s   | |   [ ] ;  
 	 c o n t e x t   =   c o n t e x t   | |   d o c u m e n t ;  
  
 	 v a r   o r i g C o n t e x t   =   c o n t e x t ;  
  
 	 i f   (   c o n t e x t . n o d e T y p e   ! = =   1   & &   c o n t e x t . n o d e T y p e   ! = =   9   )   {  
 	 	 r e t u r n   [ ] ;  
 	 }  
 	  
 	 i f   (   ! s e l e c t o r   | |   t y p e o f   s e l e c t o r   ! = =   " s t r i n g "   )   {  
 	 	 r e t u r n   r e s u l t s ;  
 	 }  
  
 	 v a r   m ,   s e t ,   c h e c k S e t ,   e x t r a ,   r e t ,   c u r ,   p o p ,   i ,  
 	 	 p r u n e   =   t r u e ,  
 	 	 c o n t e x t X M L   =   S i z z l e . i s X M L (   c o n t e x t   ) ,  
 	 	 p a r t s   =   [ ] ,  
 	 	 s o F a r   =   s e l e c t o r ;  
 	  
 	 / /   R e s e t   t h e   p o s i t i o n   o f   t h e   c h u n k e r   r e g e x p   ( s t a r t   f r o m   h e a d )  
 	 d o   {  
 	 	 c h u n k e r . e x e c (   " "   ) ;  
 	 	 m   =   c h u n k e r . e x e c (   s o F a r   ) ;  
  
 	 	 i f   (   m   )   {  
 	 	 	 s o F a r   =   m [ 3 ] ;  
 	 	  
 	 	 	 p a r t s . p u s h (   m [ 1 ]   ) ;  
 	 	  
 	 	 	 i f   (   m [ 2 ]   )   {  
 	 	 	 	 e x t r a   =   m [ 3 ] ;  
 	 	 	 	 b r e a k ;  
 	 	 	 }  
 	 	 }  
 	 }   w h i l e   (   m   ) ;  
  
 	 i f   (   p a r t s . l e n g t h   >   1   & &   o r i g P O S . e x e c (   s e l e c t o r   )   )   {  
  
 	 	 i f   (   p a r t s . l e n g t h   = = =   2   & &   E x p r . r e l a t i v e [   p a r t s [ 0 ]   ]   )   {  
 	 	 	 s e t   =   p o s P r o c e s s (   p a r t s [ 0 ]   +   p a r t s [ 1 ] ,   c o n t e x t   ) ;  
  
 	 	 }   e l s e   {  
 	 	 	 s e t   =   E x p r . r e l a t i v e [   p a r t s [ 0 ]   ]   ?  
 	 	 	 	 [   c o n t e x t   ]   :  
 	 	 	 	 S i z z l e (   p a r t s . s h i f t ( ) ,   c o n t e x t   ) ;  
  
 	 	 	 w h i l e   (   p a r t s . l e n g t h   )   {  
 	 	 	 	 s e l e c t o r   =   p a r t s . s h i f t ( ) ;  
  
 	 	 	 	 i f   (   E x p r . r e l a t i v e [   s e l e c t o r   ]   )   {  
 	 	 	 	 	 s e l e c t o r   + =   p a r t s . s h i f t ( ) ;  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 s e t   =   p o s P r o c e s s (   s e l e c t o r ,   s e t   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 }   e l s e   {  
 	 	 / /   T a k e   a   s h o r t c u t   a n d   s e t   t h e   c o n t e x t   i f   t h e   r o o t   s e l e c t o r   i s   a n   I D  
 	 	 / /   ( b u t   n o t   i f   i t ' l l   b e   f a s t e r   i f   t h e   i n n e r   s e l e c t o r   i s   a n   I D )  
 	 	 i f   (   ! s e e d   & &   p a r t s . l e n g t h   >   1   & &   c o n t e x t . n o d e T y p e   = = =   9   & &   ! c o n t e x t X M L   & &  
 	 	 	 	 E x p r . m a t c h . I D . t e s t ( p a r t s [ 0 ] )   & &   ! E x p r . m a t c h . I D . t e s t ( p a r t s [ p a r t s . l e n g t h   -   1 ] )   )   {  
  
 	 	 	 r e t   =   S i z z l e . f i n d (   p a r t s . s h i f t ( ) ,   c o n t e x t ,   c o n t e x t X M L   ) ;  
 	 	 	 c o n t e x t   =   r e t . e x p r   ?  
 	 	 	 	 S i z z l e . f i l t e r (   r e t . e x p r ,   r e t . s e t   ) [ 0 ]   :  
 	 	 	 	 r e t . s e t [ 0 ] ;  
 	 	 }  
  
 	 	 i f   (   c o n t e x t   )   {  
 	 	 	 r e t   =   s e e d   ?  
 	 	 	 	 {   e x p r :   p a r t s . p o p ( ) ,   s e t :   m a k e A r r a y ( s e e d )   }   :  
 	 	 	 	 S i z z l e . f i n d (   p a r t s . p o p ( ) ,   p a r t s . l e n g t h   = = =   1   & &   ( p a r t s [ 0 ]   = = =   " ~ "   | |   p a r t s [ 0 ]   = = =   " + " )   & &   c o n t e x t . p a r e n t N o d e   ?   c o n t e x t . p a r e n t N o d e   :   c o n t e x t ,   c o n t e x t X M L   ) ;  
  
 	 	 	 s e t   =   r e t . e x p r   ?  
 	 	 	 	 S i z z l e . f i l t e r (   r e t . e x p r ,   r e t . s e t   )   :  
 	 	 	 	 r e t . s e t ;  
  
 	 	 	 i f   (   p a r t s . l e n g t h   >   0   )   {  
 	 	 	 	 c h e c k S e t   =   m a k e A r r a y (   s e t   ) ;  
  
 	 	 	 }   e l s e   {  
 	 	 	 	 p r u n e   =   f a l s e ;  
 	 	 	 }  
  
 	 	 	 w h i l e   (   p a r t s . l e n g t h   )   {  
 	 	 	 	 c u r   =   p a r t s . p o p ( ) ;  
 	 	 	 	 p o p   =   c u r ;  
  
 	 	 	 	 i f   (   ! E x p r . r e l a t i v e [   c u r   ]   )   {  
 	 	 	 	 	 c u r   =   " " ;  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 p o p   =   p a r t s . p o p ( ) ;  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   p o p   = =   n u l l   )   {  
 	 	 	 	 	 p o p   =   c o n t e x t ;  
 	 	 	 	 }  
  
 	 	 	 	 E x p r . r e l a t i v e [   c u r   ] (   c h e c k S e t ,   p o p ,   c o n t e x t X M L   ) ;  
 	 	 	 }  
  
 	 	 }   e l s e   {  
 	 	 	 c h e c k S e t   =   p a r t s   =   [ ] ;  
 	 	 }  
 	 }  
  
 	 i f   (   ! c h e c k S e t   )   {  
 	 	 c h e c k S e t   =   s e t ;  
 	 }  
  
 	 i f   (   ! c h e c k S e t   )   {  
 	 	 S i z z l e . e r r o r (   c u r   | |   s e l e c t o r   ) ;  
 	 }  
  
 	 i f   (   t o S t r i n g . c a l l ( c h e c k S e t )   = = =   " [ o b j e c t   A r r a y ] "   )   {  
 	 	 i f   (   ! p r u n e   )   {  
 	 	 	 r e s u l t s . p u s h . a p p l y (   r e s u l t s ,   c h e c k S e t   ) ;  
  
 	 	 }   e l s e   i f   (   c o n t e x t   & &   c o n t e x t . n o d e T y p e   = = =   1   )   {  
 	 	 	 f o r   (   i   =   0 ;   c h e c k S e t [ i ]   ! =   n u l l ;   i + +   )   {  
 	 	 	 	 i f   (   c h e c k S e t [ i ]   & &   ( c h e c k S e t [ i ]   = = =   t r u e   | |   c h e c k S e t [ i ] . n o d e T y p e   = = =   1   & &   S i z z l e . c o n t a i n s ( c o n t e x t ,   c h e c k S e t [ i ] ) )   )   {  
 	 	 	 	 	 r e s u l t s . p u s h (   s e t [ i ]   ) ;  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 }   e l s e   {  
 	 	 	 f o r   (   i   =   0 ;   c h e c k S e t [ i ]   ! =   n u l l ;   i + +   )   {  
 	 	 	 	 i f   (   c h e c k S e t [ i ]   & &   c h e c k S e t [ i ] . n o d e T y p e   = = =   1   )   {  
 	 	 	 	 	 r e s u l t s . p u s h (   s e t [ i ]   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 }   e l s e   {  
 	 	 m a k e A r r a y (   c h e c k S e t ,   r e s u l t s   ) ;  
 	 }  
  
 	 i f   (   e x t r a   )   {  
 	 	 S i z z l e (   e x t r a ,   o r i g C o n t e x t ,   r e s u l t s ,   s e e d   ) ;  
 	 	 S i z z l e . u n i q u e S o r t (   r e s u l t s   ) ;  
 	 }  
  
 	 r e t u r n   r e s u l t s ;  
 } ;  
  
 S i z z l e . u n i q u e S o r t   =   f u n c t i o n (   r e s u l t s   )   {  
 	 i f   (   s o r t O r d e r   )   {  
 	 	 h a s D u p l i c a t e   =   b a s e H a s D u p l i c a t e ;  
 	 	 r e s u l t s . s o r t (   s o r t O r d e r   ) ;  
  
 	 	 i f   (   h a s D u p l i c a t e   )   {  
 	 	 	 f o r   (   v a r   i   =   1 ;   i   <   r e s u l t s . l e n g t h ;   i + +   )   {  
 	 	 	 	 i f   (   r e s u l t s [ i ]   = = =   r e s u l t s [   i   -   1   ]   )   {  
 	 	 	 	 	 r e s u l t s . s p l i c e (   i - - ,   1   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 }  
  
 	 r e t u r n   r e s u l t s ;  
 } ;  
  
 S i z z l e . m a t c h e s   =   f u n c t i o n (   e x p r ,   s e t   )   {  
 	 r e t u r n   S i z z l e (   e x p r ,   n u l l ,   n u l l ,   s e t   ) ;  
 } ;  
  
 S i z z l e . m a t c h e s S e l e c t o r   =   f u n c t i o n (   n o d e ,   e x p r   )   {  
 	 r e t u r n   S i z z l e (   e x p r ,   n u l l ,   n u l l ,   [ n o d e ]   ) . l e n g t h   >   0 ;  
 } ;  
  
 S i z z l e . f i n d   =   f u n c t i o n (   e x p r ,   c o n t e x t ,   i s X M L   )   {  
 	 v a r   s e t ;  
  
 	 i f   (   ! e x p r   )   {  
 	 	 r e t u r n   [ ] ;  
 	 }  
  
 	 f o r   (   v a r   i   =   0 ,   l   =   E x p r . o r d e r . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 v a r   m a t c h ,  
 	 	 	 t y p e   =   E x p r . o r d e r [ i ] ;  
 	 	  
 	 	 i f   (   ( m a t c h   =   E x p r . l e f t M a t c h [   t y p e   ] . e x e c (   e x p r   ) )   )   {  
 	 	 	 v a r   l e f t   =   m a t c h [ 1 ] ;  
 	 	 	 m a t c h . s p l i c e (   1 ,   1   ) ;  
  
 	 	 	 i f   (   l e f t . s u b s t r (   l e f t . l e n g t h   -   1   )   ! = =   " \ \ "   )   {  
 	 	 	 	 m a t c h [ 1 ]   =   ( m a t c h [ 1 ]   | |   " " ) . r e p l a c e (   r B a c k s l a s h ,   " "   ) ;  
 	 	 	 	 s e t   =   E x p r . f i n d [   t y p e   ] (   m a t c h ,   c o n t e x t ,   i s X M L   ) ;  
  
 	 	 	 	 i f   (   s e t   ! =   n u l l   )   {  
 	 	 	 	 	 e x p r   =   e x p r . r e p l a c e (   E x p r . m a t c h [   t y p e   ] ,   " "   ) ;  
 	 	 	 	 	 b r e a k ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 }  
  
 	 i f   (   ! s e t   )   {  
 	 	 s e t   =   t y p e o f   c o n t e x t . g e t E l e m e n t s B y T a g N a m e   ! = =   " u n d e f i n e d "   ?  
 	 	 	 c o n t e x t . g e t E l e m e n t s B y T a g N a m e (   " * "   )   :  
 	 	 	 [ ] ;  
 	 }  
  
 	 r e t u r n   {   s e t :   s e t ,   e x p r :   e x p r   } ;  
 } ;  
  
 S i z z l e . f i l t e r   =   f u n c t i o n (   e x p r ,   s e t ,   i n p l a c e ,   n o t   )   {  
 	 v a r   m a t c h ,   a n y F o u n d ,  
 	 	 o l d   =   e x p r ,  
 	 	 r e s u l t   =   [ ] ,  
 	 	 c u r L o o p   =   s e t ,  
 	 	 i s X M L F i l t e r   =   s e t   & &   s e t [ 0 ]   & &   S i z z l e . i s X M L (   s e t [ 0 ]   ) ;  
  
 	 w h i l e   (   e x p r   & &   s e t . l e n g t h   )   {  
 	 	 f o r   (   v a r   t y p e   i n   E x p r . f i l t e r   )   {  
 	 	 	 i f   (   ( m a t c h   =   E x p r . l e f t M a t c h [   t y p e   ] . e x e c (   e x p r   ) )   ! =   n u l l   & &   m a t c h [ 2 ]   )   {  
 	 	 	 	 v a r   f o u n d ,   i t e m ,  
 	 	 	 	 	 f i l t e r   =   E x p r . f i l t e r [   t y p e   ] ,  
 	 	 	 	 	 l e f t   =   m a t c h [ 1 ] ;  
  
 	 	 	 	 a n y F o u n d   =   f a l s e ;  
  
 	 	 	 	 m a t c h . s p l i c e ( 1 , 1 ) ;  
  
 	 	 	 	 i f   (   l e f t . s u b s t r (   l e f t . l e n g t h   -   1   )   = = =   " \ \ "   )   {  
 	 	 	 	 	 c o n t i n u e ;  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   c u r L o o p   = = =   r e s u l t   )   {  
 	 	 	 	 	 r e s u l t   =   [ ] ;  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   E x p r . p r e F i l t e r [   t y p e   ]   )   {  
 	 	 	 	 	 m a t c h   =   E x p r . p r e F i l t e r [   t y p e   ] (   m a t c h ,   c u r L o o p ,   i n p l a c e ,   r e s u l t ,   n o t ,   i s X M L F i l t e r   ) ;  
  
 	 	 	 	 	 i f   (   ! m a t c h   )   {  
 	 	 	 	 	 	 a n y F o u n d   =   f o u n d   =   t r u e ;  
  
 	 	 	 	 	 }   e l s e   i f   (   m a t c h   = = =   t r u e   )   {  
 	 	 	 	 	 	 c o n t i n u e ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   m a t c h   )   {  
 	 	 	 	 	 f o r   (   v a r   i   =   0 ;   ( i t e m   =   c u r L o o p [ i ] )   ! =   n u l l ;   i + +   )   {  
 	 	 	 	 	 	 i f   (   i t e m   )   {  
 	 	 	 	 	 	 	 f o u n d   =   f i l t e r (   i t e m ,   m a t c h ,   i ,   c u r L o o p   ) ;  
 	 	 	 	 	 	 	 v a r   p a s s   =   n o t   ^   ! ! f o u n d ;  
  
 	 	 	 	 	 	 	 i f   (   i n p l a c e   & &   f o u n d   ! =   n u l l   )   {  
 	 	 	 	 	 	 	 	 i f   (   p a s s   )   {  
 	 	 	 	 	 	 	 	 	 a n y F o u n d   =   t r u e ;  
  
 	 	 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 	 	 c u r L o o p [ i ]   =   f a l s e ;  
 	 	 	 	 	 	 	 	 }  
  
 	 	 	 	 	 	 	 }   e l s e   i f   (   p a s s   )   {  
 	 	 	 	 	 	 	 	 r e s u l t . p u s h (   i t e m   ) ;  
 	 	 	 	 	 	 	 	 a n y F o u n d   =   t r u e ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   f o u n d   ! = =   u n d e f i n e d   )   {  
 	 	 	 	 	 i f   (   ! i n p l a c e   )   {  
 	 	 	 	 	 	 c u r L o o p   =   r e s u l t ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 e x p r   =   e x p r . r e p l a c e (   E x p r . m a t c h [   t y p e   ] ,   " "   ) ;  
  
 	 	 	 	 	 i f   (   ! a n y F o u n d   )   {  
 	 	 	 	 	 	 r e t u r n   [ ] ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 b r e a k ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 / /   I m p r o p e r   e x p r e s s i o n  
 	 	 i f   (   e x p r   = = =   o l d   )   {  
 	 	 	 i f   (   a n y F o u n d   = =   n u l l   )   {  
 	 	 	 	 S i z z l e . e r r o r (   e x p r   ) ;  
  
 	 	 	 }   e l s e   {  
 	 	 	 	 b r e a k ;  
 	 	 	 }  
 	 	 }  
  
 	 	 o l d   =   e x p r ;  
 	 }  
  
 	 r e t u r n   c u r L o o p ;  
 } ;  
  
 S i z z l e . e r r o r   =   f u n c t i o n (   m s g   )   {  
 	 t h r o w   " S y n t a x   e r r o r ,   u n r e c o g n i z e d   e x p r e s s i o n :   "   +   m s g ;  
 } ;  
  
 v a r   E x p r   =   S i z z l e . s e l e c t o r s   =   {  
 	 o r d e r :   [   " I D " ,   " N A M E " ,   " T A G "   ] ,  
  
 	 m a t c h :   {  
 	 	 I D :   / # ( ( ? : [ \ w \ u 0 0 c 0 - \ u F F F F \ - ] | \ \ . ) + ) / ,  
 	 	 C L A S S :   / \ . ( ( ? : [ \ w \ u 0 0 c 0 - \ u F F F F \ - ] | \ \ . ) + ) / ,  
 	 	 N A M E :   / \ [ n a m e = [ ' " ] * ( ( ? : [ \ w \ u 0 0 c 0 - \ u F F F F \ - ] | \ \ . ) + ) [ ' " ] * \ ] / ,  
 	 	 A T T R :   / \ [ \ s * ( ( ? : [ \ w \ u 0 0 c 0 - \ u F F F F \ - ] | \ \ . ) + ) \ s * ( ? : ( \ S ? = ) \ s * ( ? : ( [ ' " ] ) ( . * ? ) \ 3 | ( # ? ( ? : [ \ w \ u 0 0 c 0 - \ u F F F F \ - ] | \ \ . ) * ) | ) | ) \ s * \ ] / ,  
 	 	 T A G :   / ^ ( ( ? : [ \ w \ u 0 0 c 0 - \ u F F F F \ * \ - ] | \ \ . ) + ) / ,  
 	 	 C H I L D :   / : ( o n l y | n t h | l a s t | f i r s t ) - c h i l d ( ? : \ ( \ s * ( e v e n | o d d | ( ? : [ + \ - ] ? \ d + | ( ? : [ + \ - ] ? \ d * ) ? n \ s * ( ? : [ + \ - ] \ s * \ d + ) ? ) ) \ s * \ ) ) ? / ,  
 	 	 P O S :   / : ( n t h | e q | g t | l t | f i r s t | l a s t | e v e n | o d d ) ( ? : \ ( ( \ d * ) \ ) ) ? ( ? = [ ^ \ - ] | $ ) / ,  
 	 	 P S E U D O :   / : ( ( ? : [ \ w \ u 0 0 c 0 - \ u F F F F \ - ] | \ \ . ) + ) ( ? : \ ( ( [ ' " ] ? ) ( ( ? : \ ( [ ^ \ ) ] + \ ) | [ ^ \ ( \ ) ] * ) + ) \ 2 \ ) ) ? /  
 	 } ,  
  
 	 l e f t M a t c h :   { } ,  
  
 	 a t t r M a p :   {  
 	 	 " c l a s s " :   " c l a s s N a m e " ,  
 	 	 " f o r " :   " h t m l F o r "  
 	 } ,  
  
 	 a t t r H a n d l e :   {  
 	 	 h r e f :   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   e l e m . g e t A t t r i b u t e (   " h r e f "   ) ;  
 	 	 } ,  
 	 	 t y p e :   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   e l e m . g e t A t t r i b u t e (   " t y p e "   ) ;  
 	 	 }  
 	 } ,  
  
 	 r e l a t i v e :   {  
 	 	 " + " :   f u n c t i o n ( c h e c k S e t ,   p a r t ) {  
 	 	 	 v a r   i s P a r t S t r   =   t y p e o f   p a r t   = = =   " s t r i n g " ,  
 	 	 	 	 i s T a g   =   i s P a r t S t r   & &   ! r N o n W o r d . t e s t (   p a r t   ) ,  
 	 	 	 	 i s P a r t S t r N o t T a g   =   i s P a r t S t r   & &   ! i s T a g ;  
  
 	 	 	 i f   (   i s T a g   )   {  
 	 	 	 	 p a r t   =   p a r t . t o L o w e r C a s e ( ) ;  
 	 	 	 }  
  
 	 	 	 f o r   (   v a r   i   =   0 ,   l   =   c h e c k S e t . l e n g t h ,   e l e m ;   i   <   l ;   i + +   )   {  
 	 	 	 	 i f   (   ( e l e m   =   c h e c k S e t [ i ] )   )   {  
 	 	 	 	 	 w h i l e   (   ( e l e m   =   e l e m . p r e v i o u s S i b l i n g )   & &   e l e m . n o d e T y p e   ! = =   1   )   { }  
  
 	 	 	 	 	 c h e c k S e t [ i ]   =   i s P a r t S t r N o t T a g   | |   e l e m   & &   e l e m . n o d e N a m e . t o L o w e r C a s e ( )   = = =   p a r t   ?  
 	 	 	 	 	 	 e l e m   | |   f a l s e   :  
 	 	 	 	 	 	 e l e m   = = =   p a r t ;  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 i f   (   i s P a r t S t r N o t T a g   )   {  
 	 	 	 	 S i z z l e . f i l t e r (   p a r t ,   c h e c k S e t ,   t r u e   ) ;  
 	 	 	 }  
 	 	 } ,  
  
 	 	 " > " :   f u n c t i o n (   c h e c k S e t ,   p a r t   )   {  
 	 	 	 v a r   e l e m ,  
 	 	 	 	 i s P a r t S t r   =   t y p e o f   p a r t   = = =   " s t r i n g " ,  
 	 	 	 	 i   =   0 ,  
 	 	 	 	 l   =   c h e c k S e t . l e n g t h ;  
  
 	 	 	 i f   (   i s P a r t S t r   & &   ! r N o n W o r d . t e s t (   p a r t   )   )   {  
 	 	 	 	 p a r t   =   p a r t . t o L o w e r C a s e ( ) ;  
  
 	 	 	 	 f o r   (   ;   i   <   l ;   i + +   )   {  
 	 	 	 	 	 e l e m   =   c h e c k S e t [ i ] ;  
  
 	 	 	 	 	 i f   (   e l e m   )   {  
 	 	 	 	 	 	 v a r   p a r e n t   =   e l e m . p a r e n t N o d e ;  
 	 	 	 	 	 	 c h e c k S e t [ i ]   =   p a r e n t . n o d e N a m e . t o L o w e r C a s e ( )   = = =   p a r t   ?   p a r e n t   :   f a l s e ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 }   e l s e   {  
 	 	 	 	 f o r   (   ;   i   <   l ;   i + +   )   {  
 	 	 	 	 	 e l e m   =   c h e c k S e t [ i ] ;  
  
 	 	 	 	 	 i f   (   e l e m   )   {  
 	 	 	 	 	 	 c h e c k S e t [ i ]   =   i s P a r t S t r   ?  
 	 	 	 	 	 	 	 e l e m . p a r e n t N o d e   :  
 	 	 	 	 	 	 	 e l e m . p a r e n t N o d e   = = =   p a r t ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   i s P a r t S t r   )   {  
 	 	 	 	 	 S i z z l e . f i l t e r (   p a r t ,   c h e c k S e t ,   t r u e   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 } ,  
  
 	 	 " " :   f u n c t i o n ( c h e c k S e t ,   p a r t ,   i s X M L ) {  
 	 	 	 v a r   n o d e C h e c k ,  
 	 	 	 	 d o n e N a m e   =   d o n e + + ,  
 	 	 	 	 c h e c k F n   =   d i r C h e c k ;  
  
 	 	 	 i f   (   t y p e o f   p a r t   = = =   " s t r i n g "   & &   ! r N o n W o r d . t e s t (   p a r t   )   )   {  
 	 	 	 	 p a r t   =   p a r t . t o L o w e r C a s e ( ) ;  
 	 	 	 	 n o d e C h e c k   =   p a r t ;  
 	 	 	 	 c h e c k F n   =   d i r N o d e C h e c k ;  
 	 	 	 }  
  
 	 	 	 c h e c k F n (   " p a r e n t N o d e " ,   p a r t ,   d o n e N a m e ,   c h e c k S e t ,   n o d e C h e c k ,   i s X M L   ) ;  
 	 	 } ,  
  
 	 	 " ~ " :   f u n c t i o n (   c h e c k S e t ,   p a r t ,   i s X M L   )   {  
 	 	 	 v a r   n o d e C h e c k ,  
 	 	 	 	 d o n e N a m e   =   d o n e + + ,  
 	 	 	 	 c h e c k F n   =   d i r C h e c k ;  
  
 	 	 	 i f   (   t y p e o f   p a r t   = = =   " s t r i n g "   & &   ! r N o n W o r d . t e s t (   p a r t   )   )   {  
 	 	 	 	 p a r t   =   p a r t . t o L o w e r C a s e ( ) ;  
 	 	 	 	 n o d e C h e c k   =   p a r t ;  
 	 	 	 	 c h e c k F n   =   d i r N o d e C h e c k ;  
 	 	 	 }  
  
 	 	 	 c h e c k F n (   " p r e v i o u s S i b l i n g " ,   p a r t ,   d o n e N a m e ,   c h e c k S e t ,   n o d e C h e c k ,   i s X M L   ) ;  
 	 	 }  
 	 } ,  
  
 	 f i n d :   {  
 	 	 I D :   f u n c t i o n (   m a t c h ,   c o n t e x t ,   i s X M L   )   {  
 	 	 	 i f   (   t y p e o f   c o n t e x t . g e t E l e m e n t B y I d   ! = =   " u n d e f i n e d "   & &   ! i s X M L   )   {  
 	 	 	 	 v a r   m   =   c o n t e x t . g e t E l e m e n t B y I d ( m a t c h [ 1 ] ) ;  
 	 	 	 	 / /   C h e c k   p a r e n t N o d e   t o   c a t c h   w h e n   B l a c k b e r r y   4 . 6   r e t u r n s  
 	 	 	 	 / /   n o d e s   t h a t   a r e   n o   l o n g e r   i n   t h e   d o c u m e n t   # 6 9 6 3  
 	 	 	 	 r e t u r n   m   & &   m . p a r e n t N o d e   ?   [ m ]   :   [ ] ;  
 	 	 	 }  
 	 	 } ,  
  
 	 	 N A M E :   f u n c t i o n (   m a t c h ,   c o n t e x t   )   {  
 	 	 	 i f   (   t y p e o f   c o n t e x t . g e t E l e m e n t s B y N a m e   ! = =   " u n d e f i n e d "   )   {  
 	 	 	 	 v a r   r e t   =   [ ] ,  
 	 	 	 	 	 r e s u l t s   =   c o n t e x t . g e t E l e m e n t s B y N a m e (   m a t c h [ 1 ]   ) ;  
  
 	 	 	 	 f o r   (   v a r   i   =   0 ,   l   =   r e s u l t s . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 	 	 i f   (   r e s u l t s [ i ] . g e t A t t r i b u t e ( " n a m e " )   = = =   m a t c h [ 1 ]   )   {  
 	 	 	 	 	 	 r e t . p u s h (   r e s u l t s [ i ]   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 r e t u r n   r e t . l e n g t h   = = =   0   ?   n u l l   :   r e t ;  
 	 	 	 }  
 	 	 } ,  
  
 	 	 T A G :   f u n c t i o n (   m a t c h ,   c o n t e x t   )   {  
 	 	 	 i f   (   t y p e o f   c o n t e x t . g e t E l e m e n t s B y T a g N a m e   ! = =   " u n d e f i n e d "   )   {  
 	 	 	 	 r e t u r n   c o n t e x t . g e t E l e m e n t s B y T a g N a m e (   m a t c h [ 1 ]   ) ;  
 	 	 	 }  
 	 	 }  
 	 } ,  
 	 p r e F i l t e r :   {  
 	 	 C L A S S :   f u n c t i o n (   m a t c h ,   c u r L o o p ,   i n p l a c e ,   r e s u l t ,   n o t ,   i s X M L   )   {  
 	 	 	 m a t c h   =   "   "   +   m a t c h [ 1 ] . r e p l a c e (   r B a c k s l a s h ,   " "   )   +   "   " ;  
  
 	 	 	 i f   (   i s X M L   )   {  
 	 	 	 	 r e t u r n   m a t c h ;  
 	 	 	 }  
  
 	 	 	 f o r   (   v a r   i   =   0 ,   e l e m ;   ( e l e m   =   c u r L o o p [ i ] )   ! =   n u l l ;   i + +   )   {  
 	 	 	 	 i f   (   e l e m   )   {  
 	 	 	 	 	 i f   (   n o t   ^   ( e l e m . c l a s s N a m e   & &   ( "   "   +   e l e m . c l a s s N a m e   +   "   " ) . r e p l a c e ( / [ \ t \ n \ r ] / g ,   "   " ) . i n d e x O f ( m a t c h )   > =   0 )   )   {  
 	 	 	 	 	 	 i f   (   ! i n p l a c e   )   {  
 	 	 	 	 	 	 	 r e s u l t . p u s h (   e l e m   ) ;  
 	 	 	 	 	 	 }  
  
 	 	 	 	 	 }   e l s e   i f   (   i n p l a c e   )   {  
 	 	 	 	 	 	 c u r L o o p [ i ]   =   f a l s e ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 } ,  
  
 	 	 I D :   f u n c t i o n (   m a t c h   )   {  
 	 	 	 r e t u r n   m a t c h [ 1 ] . r e p l a c e (   r B a c k s l a s h ,   " "   ) ;  
 	 	 } ,  
  
 	 	 T A G :   f u n c t i o n (   m a t c h ,   c u r L o o p   )   {  
 	 	 	 r e t u r n   m a t c h [ 1 ] . r e p l a c e (   r B a c k s l a s h ,   " "   ) . t o L o w e r C a s e ( ) ;  
 	 	 } ,  
  
 	 	 C H I L D :   f u n c t i o n (   m a t c h   )   {  
 	 	 	 i f   (   m a t c h [ 1 ]   = = =   " n t h "   )   {  
 	 	 	 	 i f   (   ! m a t c h [ 2 ]   )   {  
 	 	 	 	 	 S i z z l e . e r r o r (   m a t c h [ 0 ]   ) ;  
 	 	 	 	 }  
  
 	 	 	 	 m a t c h [ 2 ]   =   m a t c h [ 2 ] . r e p l a c e ( / ^ \ + | \ s * / g ,   ' ' ) ;  
  
 	 	 	 	 / /   p a r s e   e q u a t i o n s   l i k e   ' e v e n ' ,   ' o d d ' ,   ' 5 ' ,   ' 2 n ' ,   ' 3 n + 2 ' ,   ' 4 n - 1 ' ,   ' - n + 6 '  
 	 	 	 	 v a r   t e s t   =   / ( - ? ) ( \ d * ) ( ? : n ( [ + \ - ] ? \ d * ) ) ? / . e x e c (  
 	 	 	 	 	 m a t c h [ 2 ]   = = =   " e v e n "   & &   " 2 n "   | |   m a t c h [ 2 ]   = = =   " o d d "   & &   " 2 n + 1 "   | |  
 	 	 	 	 	 ! / \ D / . t e s t (   m a t c h [ 2 ]   )   & &   " 0 n + "   +   m a t c h [ 2 ]   | |   m a t c h [ 2 ] ) ;  
  
 	 	 	 	 / /   c a l c u l a t e   t h e   n u m b e r s   ( f i r s t ) n + ( l a s t )   i n c l u d i n g   i f   t h e y   a r e   n e g a t i v e  
 	 	 	 	 m a t c h [ 2 ]   =   ( t e s t [ 1 ]   +   ( t e s t [ 2 ]   | |   1 ) )   -   0 ;  
 	 	 	 	 m a t c h [ 3 ]   =   t e s t [ 3 ]   -   0 ;  
 	 	 	 }  
 	 	 	 e l s e   i f   (   m a t c h [ 2 ]   )   {  
 	 	 	 	 S i z z l e . e r r o r (   m a t c h [ 0 ]   ) ;  
 	 	 	 }  
  
 	 	 	 / /   T O D O :   M o v e   t o   n o r m a l   c a c h i n g   s y s t e m  
 	 	 	 m a t c h [ 0 ]   =   d o n e + + ;  
  
 	 	 	 r e t u r n   m a t c h ;  
 	 	 } ,  
  
 	 	 A T T R :   f u n c t i o n (   m a t c h ,   c u r L o o p ,   i n p l a c e ,   r e s u l t ,   n o t ,   i s X M L   )   {  
 	 	 	 v a r   n a m e   =   m a t c h [ 1 ]   =   m a t c h [ 1 ] . r e p l a c e (   r B a c k s l a s h ,   " "   ) ;  
 	 	 	  
 	 	 	 i f   (   ! i s X M L   & &   E x p r . a t t r M a p [ n a m e ]   )   {  
 	 	 	 	 m a t c h [ 1 ]   =   E x p r . a t t r M a p [ n a m e ] ;  
 	 	 	 }  
  
 	 	 	 / /   H a n d l e   i f   a n   u n - q u o t e d   v a l u e   w a s   u s e d  
 	 	 	 m a t c h [ 4 ]   =   (   m a t c h [ 4 ]   | |   m a t c h [ 5 ]   | |   " "   ) . r e p l a c e (   r B a c k s l a s h ,   " "   ) ;  
  
 	 	 	 i f   (   m a t c h [ 2 ]   = = =   " ~ = "   )   {  
 	 	 	 	 m a t c h [ 4 ]   =   "   "   +   m a t c h [ 4 ]   +   "   " ;  
 	 	 	 }  
  
 	 	 	 r e t u r n   m a t c h ;  
 	 	 } ,  
  
 	 	 P S E U D O :   f u n c t i o n (   m a t c h ,   c u r L o o p ,   i n p l a c e ,   r e s u l t ,   n o t   )   {  
 	 	 	 i f   (   m a t c h [ 1 ]   = = =   " n o t "   )   {  
 	 	 	 	 / /   I f   w e ' r e   d e a l i n g   w i t h   a   c o m p l e x   e x p r e s s i o n ,   o r   a   s i m p l e   o n e  
 	 	 	 	 i f   (   (   c h u n k e r . e x e c ( m a t c h [ 3 ] )   | |   " "   ) . l e n g t h   >   1   | |   / ^ \ w / . t e s t ( m a t c h [ 3 ] )   )   {  
 	 	 	 	 	 m a t c h [ 3 ]   =   S i z z l e ( m a t c h [ 3 ] ,   n u l l ,   n u l l ,   c u r L o o p ) ;  
  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 v a r   r e t   =   S i z z l e . f i l t e r ( m a t c h [ 3 ] ,   c u r L o o p ,   i n p l a c e ,   t r u e   ^   n o t ) ;  
  
 	 	 	 	 	 i f   (   ! i n p l a c e   )   {  
 	 	 	 	 	 	 r e s u l t . p u s h . a p p l y (   r e s u l t ,   r e t   ) ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 	 }  
  
 	 	 	 }   e l s e   i f   (   E x p r . m a t c h . P O S . t e s t (   m a t c h [ 0 ]   )   | |   E x p r . m a t c h . C H I L D . t e s t (   m a t c h [ 0 ]   )   )   {  
 	 	 	 	 r e t u r n   t r u e ;  
 	 	 	 }  
 	 	 	  
 	 	 	 r e t u r n   m a t c h ;  
 	 	 } ,  
  
 	 	 P O S :   f u n c t i o n (   m a t c h   )   {  
 	 	 	 m a t c h . u n s h i f t (   t r u e   ) ;  
  
 	 	 	 r e t u r n   m a t c h ;  
 	 	 }  
 	 } ,  
 	  
 	 f i l t e r s :   {  
 	 	 e n a b l e d :   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   e l e m . d i s a b l e d   = = =   f a l s e   & &   e l e m . t y p e   ! = =   " h i d d e n " ;  
 	 	 } ,  
  
 	 	 d i s a b l e d :   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   e l e m . d i s a b l e d   = = =   t r u e ;  
 	 	 } ,  
  
 	 	 c h e c k e d :   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   e l e m . c h e c k e d   = = =   t r u e ;  
 	 	 } ,  
 	 	  
 	 	 s e l e c t e d :   f u n c t i o n (   e l e m   )   {  
 	 	 	 / /   A c c e s s i n g   t h i s   p r o p e r t y   m a k e s   s e l e c t e d - b y - d e f a u l t  
 	 	 	 / /   o p t i o n s   i n   S a f a r i   w o r k   p r o p e r l y  
 	 	 	 i f   (   e l e m . p a r e n t N o d e   )   {  
 	 	 	 	 e l e m . p a r e n t N o d e . s e l e c t e d I n d e x ;  
 	 	 	 }  
 	 	 	  
 	 	 	 r e t u r n   e l e m . s e l e c t e d   = = =   t r u e ;  
 	 	 } ,  
  
 	 	 p a r e n t :   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   ! ! e l e m . f i r s t C h i l d ;  
 	 	 } ,  
  
 	 	 e m p t y :   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   ! e l e m . f i r s t C h i l d ;  
 	 	 } ,  
  
 	 	 h a s :   f u n c t i o n (   e l e m ,   i ,   m a t c h   )   {  
 	 	 	 r e t u r n   ! ! S i z z l e (   m a t c h [ 3 ] ,   e l e m   ) . l e n g t h ;  
 	 	 } ,  
  
 	 	 h e a d e r :   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   ( / h \ d / i ) . t e s t (   e l e m . n o d e N a m e   ) ;  
 	 	 } ,  
  
 	 	 t e x t :   f u n c t i o n (   e l e m   )   {  
 	 	 	 v a r   a t t r   =   e l e m . g e t A t t r i b u t e (   " t y p e "   ) ,   t y p e   =   e l e m . t y p e ;  
 	 	 	 / /   I E 6   a n d   7   w i l l   m a p   e l e m . t y p e   t o   ' t e x t '   f o r   n e w   H T M L 5   t y p e s   ( s e a r c h ,   e t c )    
 	 	 	 / /   u s e   g e t A t t r i b u t e   i n s t e a d   t o   t e s t   t h i s   c a s e  
 	 	 	 r e t u r n   e l e m . n o d e N a m e . t o L o w e r C a s e ( )   = = =   " i n p u t "   & &   " t e x t "   = = =   t y p e   & &   (   a t t r   = = =   t y p e   | |   a t t r   = = =   n u l l   ) ;  
 	 	 } ,  
  
 	 	 r a d i o :   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   e l e m . n o d e N a m e . t o L o w e r C a s e ( )   = = =   " i n p u t "   & &   " r a d i o "   = = =   e l e m . t y p e ;  
 	 	 } ,  
  
 	 	 c h e c k b o x :   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   e l e m . n o d e N a m e . t o L o w e r C a s e ( )   = = =   " i n p u t "   & &   " c h e c k b o x "   = = =   e l e m . t y p e ;  
 	 	 } ,  
  
 	 	 f i l e :   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   e l e m . n o d e N a m e . t o L o w e r C a s e ( )   = = =   " i n p u t "   & &   " f i l e "   = = =   e l e m . t y p e ;  
 	 	 } ,  
  
 	 	 p a s s w o r d :   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   e l e m . n o d e N a m e . t o L o w e r C a s e ( )   = = =   " i n p u t "   & &   " p a s s w o r d "   = = =   e l e m . t y p e ;  
 	 	 } ,  
  
 	 	 s u b m i t :   f u n c t i o n (   e l e m   )   {  
 	 	 	 v a r   n a m e   =   e l e m . n o d e N a m e . t o L o w e r C a s e ( ) ;  
 	 	 	 r e t u r n   ( n a m e   = = =   " i n p u t "   | |   n a m e   = = =   " b u t t o n " )   & &   " s u b m i t "   = = =   e l e m . t y p e ;  
 	 	 } ,  
  
 	 	 i m a g e :   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   e l e m . n o d e N a m e . t o L o w e r C a s e ( )   = = =   " i n p u t "   & &   " i m a g e "   = = =   e l e m . t y p e ;  
 	 	 } ,  
  
 	 	 r e s e t :   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   e l e m . n o d e N a m e . t o L o w e r C a s e ( )   = = =   " i n p u t "   & &   " r e s e t "   = = =   e l e m . t y p e ;  
 	 	 } ,  
  
 	 	 b u t t o n :   f u n c t i o n (   e l e m   )   {  
 	 	 	 v a r   n a m e   =   e l e m . n o d e N a m e . t o L o w e r C a s e ( ) ;  
 	 	 	 r e t u r n   n a m e   = = =   " i n p u t "   & &   " b u t t o n "   = = =   e l e m . t y p e   | |   n a m e   = = =   " b u t t o n " ;  
 	 	 } ,  
  
 	 	 i n p u t :   f u n c t i o n (   e l e m   )   {  
 	 	 	 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 / i ) . t e s t (   e l e m . n o d e N a m e   ) ;  
 	 	 } ,  
  
 	 	 f o c u s :   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   e l e m   = = =   e l e m . o w n e r D o c u m e n t . a c t i v e E l e m e n t ;  
 	 	 }  
 	 } ,  
 	 s e t F i l t e r s :   {  
 	 	 f i r s t :   f u n c t i o n (   e l e m ,   i   )   {  
 	 	 	 r e t u r n   i   = = =   0 ;  
 	 	 } ,  
  
 	 	 l a s t :   f u n c t i o n (   e l e m ,   i ,   m a t c h ,   a r r a y   )   {  
 	 	 	 r e t u r n   i   = = =   a r r a y . l e n g t h   -   1 ;  
 	 	 } ,  
  
 	 	 e v e n :   f u n c t i o n (   e l e m ,   i   )   {  
 	 	 	 r e t u r n   i   %   2   = = =   0 ;  
 	 	 } ,  
  
 	 	 o d d :   f u n c t i o n (   e l e m ,   i   )   {  
 	 	 	 r e t u r n   i   %   2   = = =   1 ;  
 	 	 } ,  
  
 	 	 l t :   f u n c t i o n (   e l e m ,   i ,   m a t c h   )   {  
 	 	 	 r e t u r n   i   <   m a t c h [ 3 ]   -   0 ;  
 	 	 } ,  
  
 	 	 g t :   f u n c t i o n (   e l e m ,   i ,   m a t c h   )   {  
 	 	 	 r e t u r n   i   >   m a t c h [ 3 ]   -   0 ;  
 	 	 } ,  
  
 	 	 n t h :   f u n c t i o n (   e l e m ,   i ,   m a t c h   )   {  
 	 	 	 r e t u r n   m a t c h [ 3 ]   -   0   = = =   i ;  
 	 	 } ,  
  
 	 	 e q :   f u n c t i o n (   e l e m ,   i ,   m a t c h   )   {  
 	 	 	 r e t u r n   m a t c h [ 3 ]   -   0   = = =   i ;  
 	 	 }  
 	 } ,  
 	 f i l t e r :   {  
 	 	 P S E U D O :   f u n c t i o n (   e l e m ,   m a t c h ,   i ,   a r r a y   )   {  
 	 	 	 v a r   n a m e   =   m a t c h [ 1 ] ,  
 	 	 	 	 f i l t e r   =   E x p r . f i l t e r s [   n a m e   ] ;  
  
 	 	 	 i f   (   f i l t e r   )   {  
 	 	 	 	 r e t u r n   f i l t e r (   e l e m ,   i ,   m a t c h ,   a r r a y   ) ;  
  
 	 	 	 }   e l s e   i f   (   n a m e   = = =   " c o n t a i n s "   )   {  
 	 	 	 	 r e t u r n   ( e l e m . t e x t C o n t e n t   | |   e l e m . i n n e r T e x t   | |   S i z z l e . g e t T e x t ( [   e l e m   ] )   | |   " " ) . i n d e x O f ( m a t c h [ 3 ] )   > =   0 ;  
  
 	 	 	 }   e l s e   i f   (   n a m e   = = =   " n o t "   )   {  
 	 	 	 	 v a r   n o t   =   m a t c h [ 3 ] ;  
  
 	 	 	 	 f o r   (   v a r   j   =   0 ,   l   =   n o t . l e n g t h ;   j   <   l ;   j + +   )   {  
 	 	 	 	 	 i f   (   n o t [ j ]   = = =   e l e m   )   {  
 	 	 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 r e t u r n   t r u e ;  
  
 	 	 	 }   e l s e   {  
 	 	 	 	 S i z z l e . e r r o r (   n a m e   ) ;  
 	 	 	 }  
 	 	 } ,  
  
 	 	 C H I L D :   f u n c t i o n (   e l e m ,   m a t c h   )   {  
 	 	 	 v a r   t y p e   =   m a t c h [ 1 ] ,  
 	 	 	 	 n o d e   =   e l e m ;  
  
 	 	 	 s w i t c h   (   t y p e   )   {  
 	 	 	 	 c a s e   " o n l y " :  
 	 	 	 	 c a s e   " f i r s t " :  
 	 	 	 	 	 w h i l e   (   ( n o d e   =   n o d e . p r e v i o u s S i b l i n g )   ) 	   {  
 	 	 	 	 	 	 i f   (   n o d e . n o d e T y p e   = = =   1   )   {    
 	 	 	 	 	 	 	 r e t u r n   f a l s e ;    
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
  
 	 	 	 	 	 i f   (   t y p e   = = =   " f i r s t "   )   {    
 	 	 	 	 	 	 r e t u r n   t r u e ;    
 	 	 	 	 	 }  
  
 	 	 	 	 	 n o d e   =   e l e m ;  
  
 	 	 	 	 c a s e   " l a s t " :  
 	 	 	 	 	 w h i l e   (   ( n o d e   =   n o d e . n e x t S i b l i n g )   ) 	   {  
 	 	 	 	 	 	 i f   (   n o d e . n o d e T y p e   = = =   1   )   {    
 	 	 	 	 	 	 	 r e t u r n   f a l s e ;    
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
  
 	 	 	 	 	 r e t u r n   t r u e ;  
  
 	 	 	 	 c a s e   " n t h " :  
 	 	 	 	 	 v a r   f i r s t   =   m a t c h [ 2 ] ,  
 	 	 	 	 	 	 l a s t   =   m a t c h [ 3 ] ;  
  
 	 	 	 	 	 i f   (   f i r s t   = = =   1   & &   l a s t   = = =   0   )   {  
 	 	 	 	 	 	 r e t u r n   t r u e ;  
 	 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 	 v a r   d o n e N a m e   =   m a t c h [ 0 ] ,  
 	 	 	 	 	 	 p a r e n t   =   e l e m . p a r e n t N o d e ;  
 	  
 	 	 	 	 	 i f   (   p a r e n t   & &   ( p a r e n t . s i z c a c h e   ! = =   d o n e N a m e   | |   ! e l e m . n o d e I n d e x )   )   {  
 	 	 	 	 	 	 v a r   c o u n t   =   0 ;  
 	 	 	 	 	 	  
 	 	 	 	 	 	 f o r   (   n o d e   =   p a r e n t . f i r s t C h i l d ;   n o d e ;   n o d e   =   n o d e . n e x t S i b l i n g   )   {  
 	 	 	 	 	 	 	 i f   (   n o d e . n o d e T y p e   = = =   1   )   {  
 	 	 	 	 	 	 	 	 n o d e . n o d e I n d e x   =   + + c o u n t ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }    
  
 	 	 	 	 	 	 p a r e n t . s i z c a c h e   =   d o n e N a m e ;  
 	 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 	 v a r   d i f f   =   e l e m . n o d e I n d e x   -   l a s t ;  
  
 	 	 	 	 	 i f   (   f i r s t   = = =   0   )   {  
 	 	 	 	 	 	 r e t u r n   d i f f   = = =   0 ;  
  
 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 r e t u r n   (   d i f f   %   f i r s t   = = =   0   & &   d i f f   /   f i r s t   > =   0   ) ;  
 	 	 	 	 	 }  
 	 	 	 }  
 	 	 } ,  
  
 	 	 I D :   f u n c t i o n (   e l e m ,   m a t c h   )   {  
 	 	 	 r e t u r n   e l e m . n o d e T y p e   = = =   1   & &   e l e m . g e t A t t r i b u t e ( " i d " )   = = =   m a t c h ;  
 	 	 } ,  
  
 	 	 T A G :   f u n c t i o n (   e l e m ,   m a t c h   )   {  
 	 	 	 r e t u r n   ( m a t c h   = = =   " * "   & &   e l e m . n o d e T y p e   = = =   1 )   | |   e l e m . n o d e N a m e . t o L o w e r C a s e ( )   = = =   m a t c h ;  
 	 	 } ,  
 	 	  
 	 	 C L A S S :   f u n c t i o n (   e l e m ,   m a t c h   )   {  
 	 	 	 r e t u r n   ( "   "   +   ( e l e m . c l a s s N a m e   | |   e l e m . g e t A t t r i b u t e ( " c l a s s " ) )   +   "   " )  
 	 	 	 	 . i n d e x O f (   m a t c h   )   >   - 1 ;  
 	 	 } ,  
  
 	 	 A T T R :   f u n c t i o n (   e l e m ,   m a t c h   )   {  
 	 	 	 v a r   n a m e   =   m a t c h [ 1 ] ,  
 	 	 	 	 r e s u l t   =   E x p r . a t t r H a n d l e [   n a m e   ]   ?  
 	 	 	 	 	 E x p r . a t t r H a n d l e [   n a m e   ] (   e l e m   )   :  
 	 	 	 	 	 e l e m [   n a m e   ]   ! =   n u l l   ?  
 	 	 	 	 	 	 e l e m [   n a m e   ]   :  
 	 	 	 	 	 	 e l e m . g e t A t t r i b u t e (   n a m e   ) ,  
 	 	 	 	 v a l u e   =   r e s u l t   +   " " ,  
 	 	 	 	 t y p e   =   m a t c h [ 2 ] ,  
 	 	 	 	 c h e c k   =   m a t c h [ 4 ] ;  
  
 	 	 	 r e t u r n   r e s u l t   = =   n u l l   ?  
 	 	 	 	 t y p e   = = =   " ! = "   :  
 	 	 	 	 t y p e   = = =   " = "   ?  
 	 	 	 	 v a l u e   = = =   c h e c k   :  
 	 	 	 	 t y p e   = = =   " * = "   ?  
 	 	 	 	 v a l u e . i n d e x O f ( c h e c k )   > =   0   :  
 	 	 	 	 t y p e   = = =   " ~ = "   ?  
 	 	 	 	 ( "   "   +   v a l u e   +   "   " ) . i n d e x O f ( c h e c k )   > =   0   :  
 	 	 	 	 ! c h e c k   ?  
 	 	 	 	 v a l u e   & &   r e s u l t   ! = =   f a l s e   :  
 	 	 	 	 t y p e   = = =   " ! = "   ?  
 	 	 	 	 v a l u e   ! = =   c h e c k   :  
 	 	 	 	 t y p e   = = =   " ^ = "   ?  
 	 	 	 	 v a l u e . i n d e x O f ( c h e c k )   = = =   0   :  
 	 	 	 	 t y p e   = = =   " $ = "   ?  
 	 	 	 	 v a l u e . s u b s t r ( v a l u e . l e n g t h   -   c h e c k . l e n g t h )   = = =   c h e c k   :  
 	 	 	 	 t y p e   = = =   " | = "   ?  
 	 	 	 	 v a l u e   = = =   c h e c k   | |   v a l u e . s u b s t r ( 0 ,   c h e c k . l e n g t h   +   1 )   = = =   c h e c k   +   " - "   :  
 	 	 	 	 f a l s e ;  
 	 	 } ,  
  
 	 	 P O S :   f u n c t i o n (   e l e m ,   m a t c h ,   i ,   a r r a y   )   {  
 	 	 	 v a r   n a m e   =   m a t c h [ 2 ] ,  
 	 	 	 	 f i l t e r   =   E x p r . s e t F i l t e r s [   n a m e   ] ;  
  
 	 	 	 i f   (   f i l t e r   )   {  
 	 	 	 	 r e t u r n   f i l t e r (   e l e m ,   i ,   m a t c h ,   a r r a y   ) ;  
 	 	 	 }  
 	 	 }  
 	 }  
 } ;  
  
 v a r   o r i g P O S   =   E x p r . m a t c h . P O S ,  
 	 f e s c a p e   =   f u n c t i o n ( a l l ,   n u m ) {  
 	 	 r e t u r n   " \ \ "   +   ( n u m   -   0   +   1 ) ;  
 	 } ;  
  
 f o r   (   v a r   t y p e   i n   E x p r . m a t c h   )   {  
 	 E x p r . m a t c h [   t y p e   ]   =   n e w   R e g E x p (   E x p r . m a t c h [   t y p e   ] . s o u r c e   +   ( / ( ? ! [ ^ \ [ ] * \ ] ) ( ? ! [ ^ \ ( ] * \ ) ) / . s o u r c e )   ) ;  
 	 E x p r . l e f t M a t c h [   t y p e   ]   =   n e w   R e g E x p (   / ( ^ ( ? : . | \ r | \ n ) * ? ) / . s o u r c e   +   E x p r . m a t c h [   t y p e   ] . s o u r c e . r e p l a c e ( / \ \ ( \ d + ) / g ,   f e s c a p e )   ) ;  
 }  
  
 v a r   m a k e A r r a y   =   f u n c t i o n (   a r r a y ,   r e s u l t s   )   {  
 	 a r r a y   =   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 r a y ,   0   ) ;  
  
 	 i f   (   r e s u l t s   )   {  
 	 	 r e s u l t s . p u s h . a p p l y (   r e s u l t s ,   a r r a y   ) ;  
 	 	 r e t u r n   r e s u l t s ;  
 	 }  
 	  
 	 r e t u r n   a r r a y ;  
 } ;  
  
 / /   P e r f o r m   a   s i m p l e   c h e c k   t o   d e t e r m i n e   i f   t h e   b r o w s e r   i s   c a p a b l e   o f  
 / /   c o n v e r t i n g   a   N o d e L i s t   t o   a n   a r r a y   u s i n g   b u i l t i n   m e t h o d s .  
 / /   A l s o   v e r i f i e s   t h a t   t h e   r e t u r n e d   a r r a y   h o l d s   D O M   n o d e s  
 / /   ( w h i c h   i s   n o t   t h e   c a s e   i n   t h e   B l a c k b e r r y   b r o w s e r )  
 t r y   {  
 	 A r r a y . p r o t o t y p e . s l i c e . c a l l (   d o c u m e n t . d o c u m e n t E l e m e n t . c h i l d N o d e s ,   0   ) [ 0 ] . n o d e T y p e ;  
  
 / /   P r o v i d e   a   f a l l b a c k   m e t h o d   i f   i t   d o e s   n o t   w o r k  
 }   c a t c h (   e   )   {  
 	 m a k e A r r a y   =   f u n c t i o n (   a r r a y ,   r e s u l t s   )   {  
 	 	 v a r   i   =   0 ,  
 	 	 	 r e t   =   r e s u l t s   | |   [ ] ;  
  
 	 	 i f   (   t o S t r i n g . c a l l ( a r r a y )   = = =   " [ o b j e c t   A r r a y ] "   )   {  
 	 	 	 A r r a y . p r o t o t y p e . p u s h . a p p l y (   r e t ,   a r r a y   ) ;  
  
 	 	 }   e l s e   {  
 	 	 	 i f   (   t y p e o f   a r r a y . l e n g t h   = = =   " n u m b e r "   )   {  
 	 	 	 	 f o r   (   v a r   l   =   a r r a y . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 	 	 r e t . p u s h (   a r r a y [ i ]   ) ;  
 	 	 	 	 }  
  
 	 	 	 }   e l s e   {  
 	 	 	 	 f o r   (   ;   a r r a y [ i ] ;   i + +   )   {  
 	 	 	 	 	 r e t . p u s h (   a r r a y [ i ]   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   r e t ;  
 	 } ;  
 }  
  
 v a r   s o r t O r d e r ,   s i b l i n g C h e c k ;  
  
 i f   (   d o c u m e n t . d o c u m e n t E l e 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   )   {  
 	 s o r t O r d e r   =   f u n c t i o n (   a ,   b   )   {  
 	 	 i f   (   a   = = =   b   )   {  
 	 	 	 h a s D u p l i c a t e   =   t r u e ;  
 	 	 	 r e t u r n   0 ;  
 	 	 }  
  
 	 	 i f   (   ! 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 . c o m p a r e D o c u m e n t P o s i t i o n   )   {  
 	 	 	 r e t u r 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   ?   - 1   :   1 ;  
 	 	 }  
  
 	 	 r e t u r 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 )   &   4   ?   - 1   :   1 ;  
 	 } ;  
  
 }   e l s e   {  
 	 s o r t O r d e r   =   f u n c t i o n (   a ,   b   )   {  
 	 	 v a r   a l ,   b l ,  
 	 	 	 a p   =   [ ] ,  
 	 	 	 b p   =   [ ] ,  
 	 	 	 a u p   =   a . p a r e n t N o d e ,  
 	 	 	 b u p   =   b . p a r e n t N o d e ,  
 	 	 	 c u r   =   a u p ;  
  
 	 	 / /   T h e   n o d e s   a r e   i d e n t i c a l ,   w e   c a n   e x i t   e a r l y  
 	 	 i f   (   a   = = =   b   )   {  
 	 	 	 h a s D u p l i c a t e   =   t r u e ;  
 	 	 	 r e t u r n   0 ;  
  
 	 	 / /   I f   t h e   n o d e s   a r e   s i b l i n g s   ( o r   i d e n t i c a l )   w e   c a n   d o   a   q u i c k   c h e c k  
 	 	 }   e l s e   i f   (   a u p   = = =   b u p   )   {  
 	 	 	 r e t u r n   s i b l i n g C h e c k (   a ,   b   ) ;  
  
 	 	 / /   I f   n o   p a r e n t s   w e r e   f o u n d   t h e n   t h e   n o d e s   a r e   d i s c o n n e c t e d  
 	 	 }   e l s e   i f   (   ! a u p   )   {  
 	 	 	 r e t u r n   - 1 ;  
  
 	 	 }   e l s e   i f   (   ! b u p   )   {  
 	 	 	 r e t u r n   1 ;  
 	 	 }  
  
 	 	 / /   O t h e r w i s e   t h e y ' r e   s o m e w h e r e   e l s e   i n   t h e   t r e e   s o   w e   n e e d  
 	 	 / /   t o   b u i l d   u p   a   f u l l   l i s t   o f   t h e   p a r e n t N o d e s   f o r   c o m p a r i s o n  
 	 	 w h i l e   (   c u r   )   {  
 	 	 	 a p . u n s h i f t (   c u r   ) ;  
 	 	 	 c u r   =   c u r . p a r e n t N o d e ;  
 	 	 }  
  
 	 	 c u r   =   b u p ;  
  
 	 	 w h i l e   (   c u r   )   {  
 	 	 	 b p . u n s h i f t (   c u r   ) ;  
 	 	 	 c u r   =   c u r . p a r e n t N o d e ;  
 	 	 }  
  
 	 	 a l   =   a p . l e n g t h ;  
 	 	 b l   =   b p . l e n g t h ;  
  
 	 	 / /   S t a r t   w a l k i n g   d o w n   t h e   t r e e   l o o k i n g   f o r   a   d i s c r e p a n c y  
 	 	 f o r   (   v a r   i   =   0 ;   i   <   a l   & &   i   <   b l ;   i + +   )   {  
 	 	 	 i f   (   a p [ i ]   ! = =   b p [ i ]   )   {  
 	 	 	 	 r e t u r n   s i b l i n g C h e c k (   a p [ i ] ,   b p [ i ]   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 / /   W e   e n d e d   s o m e p l a c e   u p   t h e   t r e e   s o   d o   a   s i b l i n g   c h e c k  
 	 	 r e t u r n   i   = = =   a l   ?  
 	 	 	 s i b l i n g C h e c k (   a ,   b p [ i ] ,   - 1   )   :  
 	 	 	 s i b l i n g C h e c k (   a p [ i ] ,   b ,   1   ) ;  
 	 } ;  
  
 	 s i b l i n g C h e c k   =   f u n c t i o n (   a ,   b ,   r e t   )   {  
 	 	 i f   (   a   = = =   b   )   {  
 	 	 	 r e t u r n   r e t ;  
 	 	 }  
  
 	 	 v a r   c u r   =   a . n e x t S i b l i n g ;  
  
 	 	 w h i l e   (   c u r   )   {  
 	 	 	 i f   (   c u r   = = =   b   )   {  
 	 	 	 	 r e t u r n   - 1 ;  
 	 	 	 }  
  
 	 	 	 c u r   =   c u r . n e x t S i b l i n g ;  
 	 	 }  
  
 	 	 r e t u r n   1 ;  
 	 } ;  
 }  
  
 / /   U t i l i t y   f u n c t i o n   f o r   r e t r e i v i n g   t h e   t e x t   v a l u e   o f   a n   a r r a y   o f   D O M   n o d e s  
 S i z z l e . g e t T e x t   =   f u n c t i o n (   e l e m s   )   {  
 	 v a r   r e t   =   " " ,   e l e m ;  
  
 	 f o r   (   v a r   i   =   0 ;   e l e m s [ i ] ;   i + +   )   {  
 	 	 e l e m   =   e l e m s [ i ] ;  
  
 	 	 / /   G e t   t h e   t e x t   f r o m   t e x t   n o d e s   a n d   C D A T A   n o d e s  
 	 	 i f   (   e l e m . n o d e T y p e   = = =   3   | |   e l e m . n o d e T y p e   = = =   4   )   {  
 	 	 	 r e t   + =   e l e m . n o d e V a l u e ;  
  
 	 	 / /   T r a v e r s e   e v e r y t h i n g   e l s e ,   e x c e p t   c o m m e n t   n o d e s  
 	 	 }   e l s e   i f   (   e l e m . n o d e T y p e   ! = =   8   )   {  
 	 	 	 r e t   + =   S i z z l e . g e t T e x t (   e l e m . c h i l d N o d e s   ) ;  
 	 	 }  
 	 }  
  
 	 r e t u r n   r e t ;  
 } ;  
  
 / /   C h e c k   t o   s e e   i f   t h e   b r o w s e r   r e t u r n s   e l e m e n t s   b y   n a m e   w h e n  
 / /   q u e r y i n g   b y   g e t E l e m e n t B y I d   ( a n d   p r o v i d e   a   w o r k a r o u n d )  
 ( f u n c t i o n ( ) {  
 	 / /   W e ' r e   g o i n g   t o   i n j e c t   a   f a k e   i n p u t   e l e m e n t   w i t h   a   s p e c i f i e d   n a m e  
 	 v a r   f o r m   =   d o c u m e n t . c r e a t e E l e m e n t ( " d i v " ) ,  
 	 	 i d   =   " s c r i p t "   +   ( n e w   D a t e ( ) ) . g e t T i m e ( ) ,  
 	 	 r o o t   =   d o c u m e n t . d o c u m e n t E l e m e n t ;  
  
 	 f o r m . i n n e r H T M L   =   " < a   n a m e = ' "   +   i d   +   " ' / > " ;  
  
 	 / /   I n j e c t   i t   i n t o   t h e   r o o t   e l e m e n t ,   c h e c k   i t s   s t a t u s ,   a n d   r e m o v e   i t   q u i c k l y  
 	 r o o t . i n s e r t B e f o r e (   f o r m ,   r o o t . f i r s t C h i l d   ) ;  
  
 	 / /   T h e   w o r k a r o u n d   h a s   t o   d o   a d d i t i o n a l   c h e c k s   a f t e r   a   g e t E l e m e n t B y I d  
 	 / /   W h i c h   s l o w s   t h i n g s   d o w n   f o r   o t h e r   b r o w s e r s   ( h e n c e   t h e   b r a n c h i n g )  
 	 i f   (   d o c u m e n t . g e t E l e m e n t B y I d (   i d   )   )   {  
 	 	 E x p r . f i n d . I D   =   f u n c t i o n (   m a t c h ,   c o n t e x t ,   i s X M L   )   {  
 	 	 	 i f   (   t y p e o f   c o n t e x t . g e t E l e m e n t B y I d   ! = =   " u n d e f i n e d "   & &   ! i s X M L   )   {  
 	 	 	 	 v a r   m   =   c o n t e x t . g e t E l e m e n t B y I d ( m a t c h [ 1 ] ) ;  
  
 	 	 	 	 r e t u r n   m   ?  
 	 	 	 	 	 m . i d   = = =   m a t c h [ 1 ]   | |   t y p e o f   m . g e t A t t r i b u t e N o d e   ! = =   " u n d e f i n e d "   & &   m . g e t A t t r i b u t e N o d e ( " i d " ) . n o d e V a l u e   = = =   m a t c h [ 1 ]   ?  
 	 	 	 	 	 	 [ m ]   :  
 	 	 	 	 	 	 u n d e f i n e d   :  
 	 	 	 	 	 [ ] ;  
 	 	 	 }  
 	 	 } ;  
  
 	 	 E x p r . f i l t e r . I D   =   f u n c t i o n (   e l e m ,   m a t c h   )   {  
 	 	 	 v a r   n o d e   =   t y p e o f   e l e m . g e t A t t r i b u t e N o d e   ! = =   " u n d e f i n e d "   & &   e l e m . g e t A t t r i b u t e N o d e ( " i d " ) ;  
  
 	 	 	 r e t u r n   e l e m . n o d e T y p e   = = =   1   & &   n o d e   & &   n o d e . n o d e V a l u e   = = =   m a t c h ;  
 	 	 } ;  
 	 }  
  
 	 r o o t . r e m o v e C h i l d (   f o r m   ) ;  
  
 	 / /   r e l e a s e   m e m o r y   i n   I E  
 	 r o o t   =   f o r m   =   n u l l ;  
 } ) ( ) ;  
  
 ( f u n c t i o n ( ) {  
 	 / /   C h e c k   t o   s e e   i f   t h e   b r o w s e r   r e t u r n s   o n l y   e l e m e n t s  
 	 / /   w h e n   d o i n g   g e t E l e m e n t s B y T a g N a m e ( " * " )  
  
 	 / /   C r e a t e   a   f a k e   e l e m e n t  
 	 v a r   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 " ) ;  
 	 d i v . a p p e n d C h i l d (   d o c u m e n t . c r e a t e C o m m e n t ( " " )   ) ;  
  
 	 / /   M a k e   s u r e   n o   c o m m e n t s   a r e   f o u n d  
 	 i f   (   d i v . g e t E l e m e n t s B y T a g N a m e ( " * " ) . l e n g t h   >   0   )   {  
 	 	 E x p r . f i n d . T A G   =   f u n c t i o n (   m a t c h ,   c o n t e x t   )   {  
 	 	 	 v a r   r e s u l t s   =   c o n t e x t . g e t E l e m e n t s B y T a g N a m e (   m a t c h [ 1 ]   ) ;  
  
 	 	 	 / /   F i l t e r   o u t   p o s s i b l e   c o m m e n t s  
 	 	 	 i f   (   m a t c h [ 1 ]   = = =   " * "   )   {  
 	 	 	 	 v a r   t m p   =   [ ] ;  
  
 	 	 	 	 f o r   (   v a r   i   =   0 ;   r e s u l t s [ i ] ;   i + +   )   {  
 	 	 	 	 	 i f   (   r e s u l t s [ i ] . n o d e T y p e   = = =   1   )   {  
 	 	 	 	 	 	 t m p . p u s h (   r e s u l t s [ i ]   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 r e s u l t s   =   t m p ;  
 	 	 	 }  
  
 	 	 	 r e t u r n   r e s u l t s ;  
 	 	 } ;  
 	 }  
  
 	 / /   C h e c k   t o   s e e   i f   a n   a t t r i b u t e   r e t u r n s   n o r m a l i z e d   h r e f   a t t r i b u t e s  
 	 d i v . i n n e r H T M L   =   " < a   h r e f = ' # ' > < / a > " ;  
  
 	 i f   (   d i v . f i r s t C h i l d   & &   t y p e o f   d i v . f i r s t C h i l d . g e t A t t r i b u t e   ! = =   " u n d e f i n e d "   & &  
 	 	 	 d i v . f i r s t C h i l d . g e t A t t r i b u t e ( " h r e f " )   ! = =   " # "   )   {  
  
 	 	 E x p r . a t t r H a n d l e . h r e f   =   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   e l e m . g e t A t t r i b u t e (   " h r e f " ,   2   ) ;  
 	 	 } ;  
 	 }  
  
 	 / /   r e l e a s e   m e m o r y   i n   I E  
 	 d i v   =   n u l l ;  
 } ) ( ) ;  
  
 i f   (   d o c u m e n t . q u e r y S e l e c t o r A l l   )   {  
 	 ( f u n c t i o n ( ) {  
 	 	 v a r   o l d S i z z l e   =   S i z z l e ,  
 	 	 	 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 " ) ,  
 	 	 	 i d   =   " _ _ s i z z l e _ _ " ;  
  
 	 	 d i v . i n n e r H T M L   =   " < p   c l a s s = ' T E S T ' > < / p > " ;  
  
 	 	 / /   S a f a r i   c a n ' t   h a n d l e   u p p e r c a s e   o r   u n i c o d e   c h a r a c t e r s   w h e n  
 	 	 / /   i n   q u i r k s   m o d e .  
 	 	 i f   (   d i v . q u e r y S e l e c t o r A l l   & &   d i v . q u e r y S e l e c t o r A l l ( " . T E S T " ) . l e n g t h   = = =   0   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
 	  
 	 	 S i z z l e   =   f u n c t i o n (   q u e r y ,   c o n t e x t ,   e x t r a ,   s e e d   )   {  
 	 	 	 c o n t e x t   =   c o n t e x t   | |   d o c u m e n t ;  
  
 	 	 	 / /   O n l y   u s e   q u e r y S e l e c t o r A l l   o n   n o n - X M L   d o c u m e n t s  
 	 	 	 / /   ( I D   s e l e c t o r s   d o n ' t   w o r k   i n   n o n - H T M L   d o c u m e n t s )  
 	 	 	 i f   (   ! s e e d   & &   ! S i z z l e . i s X M L ( c o n t e x t )   )   {  
 	 	 	 	 / /   S e e   i f   w e   f i n d   a   s e l e c t o r   t o   s p e e d   u p  
 	 	 	 	 v a r   m a t c h   =   / ^ ( \ w + $ ) | ^ \ . ( [ \ w \ - ] + $ ) | ^ # ( [ \ w \ - ] + $ ) / . e x e c (   q u e r y   ) ;  
 	 	 	 	  
 	 	 	 	 i f   (   m a t c h   & &   ( c o n t e x t . n o d e T y p e   = = =   1   | |   c o n t e x t . n o d e T y p e   = = =   9 )   )   {  
 	 	 	 	 	 / /   S p e e d - u p :   S i z z l e ( " T A G " )  
 	 	 	 	 	 i f   (   m a t c h [ 1 ]   )   {  
 	 	 	 	 	 	 r e t u r n   m a k e A r r a y (   c o n t e x t . g e t E l e m e n t s B y T a g N a m e (   q u e r y   ) ,   e x t r a   ) ;  
 	 	 	 	 	  
 	 	 	 	 	 / /   S p e e d - u p :   S i z z l e ( " . C L A S S " )  
 	 	 	 	 	 }   e l s e   i f   (   m a t c h [ 2 ]   & &   E x p r . f i n d . C L A S S   & &   c o n t e x t . g e t E l e m e n t s B y C l a s s N a m e   )   {  
 	 	 	 	 	 	 r e t u r n   m a k e A r r a y (   c o n t e x t . g e t E l e m e n t s B y C l a s s N a m e (   m a t c h [ 2 ]   ) ,   e x t r a   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   (   c o n t e x t . n o d e T y p e   = = =   9   )   {  
 	 	 	 	 	 / /   S p e e d - u p :   S i z z l e ( " b o d y " )  
 	 	 	 	 	 / /   T h e   b o d y   e l e m e n t   o n l y   e x i s t s   o n c e ,   o p t i m i z e   f i n d i n g   i t  
 	 	 	 	 	 i f   (   q u e r y   = = =   " b o d y "   & &   c o n t e x t . b o d y   )   {  
 	 	 	 	 	 	 r e t u r n   m a k e A r r a y (   [   c o n t e x t . b o d y   ] ,   e x t r a   ) ;  
 	 	 	 	 	 	  
 	 	 	 	 	 / /   S p e e d - u p :   S i z z l e ( " # I D " )  
 	 	 	 	 	 }   e l s e   i f   (   m a t c h   & &   m a t c h [ 3 ]   )   {  
 	 	 	 	 	 	 v a r   e l e m   =   c o n t e x t . g e t E l e m e n t B y I d (   m a t c h [ 3 ]   ) ;  
  
 	 	 	 	 	 	 / /   C h e c k   p a r e n t N o d e   t o   c a t c h   w h e n   B l a c k b e r r y   4 . 6   r e t u r n s  
 	 	 	 	 	 	 / /   n o d e s   t h a t   a r e   n o   l o n g e r   i n   t h e   d o c u m e n t   # 6 9 6 3  
 	 	 	 	 	 	 i f   (   e l e m   & &   e l e m . p a r e n t N o d e   )   {  
 	 	 	 	 	 	 	 / /   H a n d l e   t h e   c a s e   w h e r e   I E   a n d   O p e r a   r e t u r n   i t e m s  
 	 	 	 	 	 	 	 / /   b y   n a m e   i n s t e a d   o f   I D  
 	 	 	 	 	 	 	 i f   (   e l e m . i d   = = =   m a t c h [ 3 ]   )   {  
 	 	 	 	 	 	 	 	 r e t u r n   m a k e A r r a y (   [   e l e m   ] ,   e x t r a   ) ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	  
 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 r e t u r n   m a k e A r r a y (   [ ] ,   e x t r a   ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 	 t r y   {  
 	 	 	 	 	 	 r e t u r n   m a k e A r r a y (   c o n t e x t . q u e r y S e l e c t o r A l l ( q u e r y ) ,   e x t r a   ) ;  
 	 	 	 	 	 }   c a t c h ( q s a E r r o r )   { }  
  
 	 	 	 	 / /   q S A   w o r k s   s t r a n g e l y   o n   E l e m e n t - r o o t e d   q u e r i e s  
 	 	 	 	 / /   W e   c a n   w o r k   a r o u n d   t h i s   b y   s p e c i f y i n g   a n   e x t r a   I D   o n   t h e   r o o t  
 	 	 	 	 / /   a n d   w o r k i n g   u p   f r o m   t h e r e   ( T h a n k s   t o   A n d r e w   D u p o n t   f o r   t h e   t e c h n i q u e )  
 	 	 	 	 / /   I E   8   d o e s n ' t   w o r k   o n   o b j e c t   e l e m e n t s  
 	 	 	 	 }   e l s e   i f   (   c o n t e x t . n o d e T y p e   = = =   1   & &   c o n t e x t . n o d e N a m e . t o L o w e r C a s e ( )   ! = =   " o b j e c t "   )   {  
 	 	 	 	 	 v a r   o l d C o n t e x t   =   c o n t e x t ,  
 	 	 	 	 	 	 o l d   =   c o n t e x t . g e t A t t r i b u t e (   " i d "   ) ,  
 	 	 	 	 	 	 n i d   =   o l d   | |   i d ,  
 	 	 	 	 	 	 h a s P a r e n t   =   c o n t e x t . p a r e n t N o d e ,  
 	 	 	 	 	 	 r e l a t i v e H i e r a r c h y S e l e c t o r   =   / ^ \ s * [ + ~ ] / . t e s t (   q u e r y   ) ;  
  
 	 	 	 	 	 i f   (   ! o l d   )   {  
 	 	 	 	 	 	 c o n t e x t . s e t A t t r i b u t e (   " i d " ,   n i d   ) ;  
 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 n i d   =   n i d . r e p l a c e (   / ' / g ,   " \ \ $ & "   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 i f   (   r e l a t i v e H i e r a r c h y S e l e c t o r   & &   h a s P a r e n t   )   {  
 	 	 	 	 	 	 c o n t e x t   =   c o n t e x t . p a r e n t N o d e ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 t r y   {  
 	 	 	 	 	 	 i f   (   ! r e l a t i v e H i e r a r c h y S e l e c t o r   | |   h a s P a r e n t   )   {  
 	 	 	 	 	 	 	 r e t u r n   m a k e A r r a y (   c o n t e x t . q u e r y S e l e c t o r A l l (   " [ i d = ' "   +   n i d   +   " ' ]   "   +   q u e r y   ) ,   e x t r a   ) ;  
 	 	 	 	 	 	 }  
  
 	 	 	 	 	 }   c a t c h ( p s e u d o E r r o r )   {  
 	 	 	 	 	 }   f i n a l l y   {  
 	 	 	 	 	 	 i f   (   ! o l d   )   {  
 	 	 	 	 	 	 	 o l d C o n t e x t . r e m o v e A t t r i b u t e (   " i d "   ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
 	 	  
 	 	 	 r e t u r n   o l d S i z z l e ( q u e r y ,   c o n t e x t ,   e x t r a ,   s e e d ) ;  
 	 	 } ;  
  
 	 	 f o r   (   v a r   p r o p   i n   o l d S i z z l e   )   {  
 	 	 	 S i z z l e [   p r o p   ]   =   o l d S i z z l e [   p r o p   ] ;  
 	 	 }  
  
 	 	 / /   r e l e a s e   m e m o r y   i n   I E  
 	 	 d i v   =   n u l l ;  
 	 } ) ( ) ;  
 }  
  
 ( f u n c t i o n ( ) {  
 	 v a r   h t m l   =   d o c u m e n t . d o c u m e n t E l e m e n t ,  
 	 	 m a t c h e s   =   h t m l . m a t c h e s S e l e c t o r   | |   h t m l . m o z M a t c h e s S e l e c t o r   | |   h t m l . w e b k i t M a t c h e s S e l e c t o r   | |   h t m l . m s M a t c h e s S e l e c t o r ;  
  
 	 i f   (   m a t c h e s   )   {  
 	 	 / /   C h e c k   t o   s e e   i f   i t ' s   p o s s i b l e   t o   d o   m a t c h e s S e l e c t o r  
 	 	 / /   o n   a   d i s c o n n e c t e d   n o d e   ( I E   9   f a i l s   t h i s )  
 	 	 v a r   d i s c o n n e c t e d M a t c h   =   ! m a t c h e s . c a l l (   d o c u m e n t . c r e a t e E l e m e n t (   " d i v "   ) ,   " d i v "   ) ,  
 	 	 	 p s e u d o W o r k s   =   f a l s e ;  
  
 	 	 t r y   {  
 	 	 	 / /   T h i s   s h o u l d   f a i l   w i t h   a n   e x c e p t i o n  
 	 	 	 / /   G e c k o   d o e s   n o t   e r r o r ,   r e t u r n s   f a l s e   i n s t e a d  
 	 	 	 m a t c h e s . c a l l (   d o c u m e n t . d o c u m e n t E l e m e n t ,   " [ t e s t ! = ' ' ] : s i z z l e "   ) ;  
 	  
 	 	 }   c a t c h (   p s e u d o E r r o r   )   {  
 	 	 	 p s e u d o W o r k s   =   t r u e ;  
 	 	 }  
  
 	 	 S i z z l e . m a t c h e s S e l e c t o r   =   f u n c t i o n (   n o d e ,   e x p r   )   {  
 	 	 	 / /   M a k e   s u r e   t h a t   a t t r i b u t e   s e l e c t o r s   a r e   q u o t e d  
 	 	 	 e x p r   =   e x p r . r e p l a c e ( / \ = \ s * ( [ ^ ' " \ ] ] * ) \ s * \ ] / g ,   " = ' $ 1 ' ] " ) ;  
  
 	 	 	 i f   (   ! S i z z l e . i s X M L (   n o d e   )   )   {  
 	 	 	 	 t r y   {    
 	 	 	 	 	 i f   (   p s e u d o W o r k s   | |   ! E x p r . m a t c h . P S E U D O . t e s t (   e x p r   )   & &   ! / ! = / . t e s t (   e x p r   )   )   {  
 	 	 	 	 	 	 v a r   r e t   =   m a t c h e s . c a l l (   n o d e ,   e x p r   ) ;  
  
 	 	 	 	 	 	 / /   I E   9 ' s   m a t c h e s S e l e c t o r   r e t u r n s   f a l s e   o n   d i s c o n n e c t e d   n o d e s  
 	 	 	 	 	 	 i f   (   r e t   | |   ! d i s c o n n e c t e d M a t c h   | |  
 	 	 	 	 	 	 	 	 / /   A s   w e l l ,   d i s c o n n e c t e d   n o d e s   a r e   s a i d   t o   b e   i n   a   d o c u m e n t  
 	 	 	 	 	 	 	 	 / /   f r a g m e n t   i n   I E   9 ,   s o   c h e c k   f o r   t h a t  
 	 	 	 	 	 	 	 	 n o d e . d o c u m e n t   & &   n o d e . d o c u m e n t . n o d e T y p e   ! = =   1 1   )   {  
 	 	 	 	 	 	 	 r e t u r n   r e t ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 }   c a t c h ( e )   { }  
 	 	 	 }  
  
 	 	 	 r e t u r n   S i z z l e ( e x p r ,   n u l l ,   n u l l ,   [ n o d e ] ) . l e n g t h   >   0 ;  
 	 	 } ;  
 	 }  
 } ) ( ) ;  
  
 ( f u n c t i o n ( ) {  
 	 v a r   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 " ) ;  
  
 	 d i v . i n n e r H T M L   =   " < d i v   c l a s s = ' t e s t   e ' > < / d i v > < d i v   c l a s s = ' t e s t ' > < / d i v > " ;  
  
 	 / /   O p e r a   c a n ' t   f i n d   a   s e c o n d   c l a s s n a m e   ( i n   9 . 6 )  
 	 / /   A l s o ,   m a k e   s u r e   t h a t   g e t E l e m e n t s B y C l a s s N a m e   a c t u a l l y   e x i s t s  
 	 i f   (   ! d i v . g e t E l e m e n t s B y C l a s s N a m e   | |   d i v . g e t E l e m e n t s B y C l a s s N a m e ( " e " ) . l e n g t h   = = =   0   )   {  
 	 	 r e t u r n ;  
 	 }  
  
 	 / /   S a f a r i   c a c h e s   c l a s s   a t t r i b u t e s ,   d o e s n ' t   c a t c h   c h a n g e s   ( i n   3 . 2 )  
 	 d i v . l a s t C h i l d . c l a s s N a m e   =   " e " ;  
  
 	 i f   (   d i v . g e t E l e m e n t s B y C l a s s N a m e ( " e " ) . l e n g t h   = = =   1   )   {  
 	 	 r e t u r n ;  
 	 }  
 	  
 	 E x p r . o r d e r . s p l i c e ( 1 ,   0 ,   " C L A S S " ) ;  
 	 E x p r . f i n d . C L A S S   =   f u n c t i o n (   m a t c h ,   c o n t e x t ,   i s X M L   )   {  
 	 	 i f   (   t y p e o f   c o n t e x t . g e t E l e m e n t s B y C l a s s N a m e   ! = =   " u n d e f i n e d "   & &   ! i s X M L   )   {  
 	 	 	 r e t u r n   c o n t e x t . g e t E l e m e n t s B y C l a s s N a m e ( m a t c h [ 1 ] ) ;  
 	 	 }  
 	 } ;  
  
 	 / /   r e l e a s e   m e m o r y   i n   I E  
 	 d i v   =   n u l l ;  
 } ) ( ) ;  
  
 f u n c t i o n   d i r N o d e C h e c k (   d i r ,   c u r ,   d o n e N a m e ,   c h e c k S e t ,   n o d e C h e c k ,   i s X M L   )   {  
 	 f o r   (   v a r   i   =   0 ,   l   =   c h e c k S e t . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 v a r   e l e m   =   c h e c k S e t [ i ] ;  
  
 	 	 i f   (   e l e m   )   {  
 	 	 	 v a r   m a t c h   =   f a l s e ;  
  
 	 	 	 e l e m   =   e l e m [ d i r ] ;  
  
 	 	 	 w h i l e   (   e l e m   )   {  
 	 	 	 	 i f   (   e l e m . s i z c a c h e   = = =   d o n e N a m e   )   {  
 	 	 	 	 	 m a t c h   =   c h e c k S e t [ e l e m . s i z s e t ] ;  
 	 	 	 	 	 b r e a k ;  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   e l e m . n o d e T y p e   = = =   1   & &   ! i s X M L   ) {  
 	 	 	 	 	 e l e m . s i z c a c h e   =   d o n e N a m e ;  
 	 	 	 	 	 e l e m . s i z s e t   =   i ;  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   e l e m . n o d e N a m e . t o L o w e r C a s e ( )   = = =   c u r   )   {  
 	 	 	 	 	 m a t c h   =   e l e m ;  
 	 	 	 	 	 b r e a k ;  
 	 	 	 	 }  
  
 	 	 	 	 e l e m   =   e l e m [ d i r ] ;  
 	 	 	 }  
  
 	 	 	 c h e c k S e t [ i ]   =   m a t c h ;  
 	 	 }  
 	 }  
 }  
  
 f u n c t i o n   d i r C h e c k (   d i r ,   c u r ,   d o n e N a m e ,   c h e c k S e t ,   n o d e C h e c k ,   i s X M L   )   {  
 	 f o r   (   v a r   i   =   0 ,   l   =   c h e c k S e t . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 v a r   e l e m   =   c h e c k S e t [ i ] ;  
  
 	 	 i f   (   e l e m   )   {  
 	 	 	 v a r   m a t c h   =   f a l s e ;  
 	 	 	  
 	 	 	 e l e m   =   e l e m [ d i r ] ;  
  
 	 	 	 w h i l e   (   e l e m   )   {  
 	 	 	 	 i f   (   e l e m . s i z c a c h e   = = =   d o n e N a m e   )   {  
 	 	 	 	 	 m a t c h   =   c h e c k S e t [ e l e m . s i z s e t ] ;  
 	 	 	 	 	 b r e a k ;  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   e l e m . n o d e T y p e   = = =   1   )   {  
 	 	 	 	 	 i f   (   ! i s X M L   )   {  
 	 	 	 	 	 	 e l e m . s i z c a c h e   =   d o n e N a m e ;  
 	 	 	 	 	 	 e l e m . s i z s e t   =   i ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 i f   (   t y p e o f   c u r   ! = =   " s t r i n g "   )   {  
 	 	 	 	 	 	 i f   (   e l e m   = = =   c u r   )   {  
 	 	 	 	 	 	 	 m a t c h   =   t r u e ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 }  
  
 	 	 	 	 	 }   e l s e   i f   (   S i z z l e . f i l t e r (   c u r ,   [ e l e m ]   ) . l e n g t h   >   0   )   {  
 	 	 	 	 	 	 m a t c h   =   e l e m ;  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 e l e m   =   e l e m [ d i r ] ;  
 	 	 	 }  
  
 	 	 	 c h e c k S e t [ i ]   =   m a t c h ;  
 	 	 }  
 	 }  
 }  
  
 i f   (   d o c u m e n t . d o c u m e n t E l e m e n t . c o n t a i n s   )   {  
 	 S i z z l e . c o n t a i n s   =   f u n c t i o n (   a ,   b   )   {  
 	 	 r e t u r n   a   ! = =   b   & &   ( a . c o n t a i n s   ?   a . c o n t a i n s ( b )   :   t r u e ) ;  
 	 } ;  
  
 }   e l s e   i f   (   d o c u m e n t . d o c u m e n t E l e 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   )   {  
 	 S i z z l e . c o n t a i n s   =   f u n c t i o n (   a ,   b   )   {  
 	 	 r e t u r 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 ) ;  
 	 } ;  
  
 }   e l s e   {  
 	 S i z z l e . c o n t a i n s   =   f u n c t i o n ( )   {  
 	 	 r e t u r n   f a l s e ;  
 	 } ;  
 }  
  
 S i z z l e . i s X M L   =   f u n c t i o n (   e l e m   )   {  
 	 / /   d o c u m e n t E l e m e n t   i s   v e r i f i e d   f o r   c a s e s   w h e r e   i t   d o e s n ' t   y e t   e x i s t  
 	 / /   ( s u c h   a s   l o a d i n g   i f r a m e s   i n   I E   -   # 4 8 3 3 )    
 	 v a r   d o c u m e n t E l e m e n t   =   ( e l e m   ?   e l e m . o w n e r D o c u m e n t   | |   e l e m   :   0 ) . d o c u m e n t E l e m e n t ;  
  
 	 r e t u r n   d o c u m e n t E l e m e n t   ?   d o c u m e n t E l e m e n t . n o d e N a m e   ! = =   " H T M L "   :   f a l s e ;  
 } ;  
  
 v a r   p o s P r o c e s s   =   f u n c t i o n (   s e l e c t o r ,   c o n t e x t   )   {  
 	 v a r   m a t c h ,  
 	 	 t m p S e t   =   [ ] ,  
 	 	 l a t e r   =   " " ,  
 	 	 r o o t   =   c o n t e x t . n o d e T y p e   ?   [ c o n t e x t ]   :   c o n t e x t ;  
  
 	 / /   P o s i t i o n   s e l e c t o r s   m u s t   b e   d o n e   a f t e r   t h e   f i l t e r  
 	 / /   A n d   s o   m u s t   : n o t ( p o s i t i o n a l )   s o   w e   m o v e   a l l   P S E U D O s   t o   t h e   e n d  
 	 w h i l e   (   ( m a t c h   =   E x p r . m a t c h . P S E U D O . e x e c (   s e l e c t o r   ) )   )   {  
 	 	 l a t e r   + =   m a t c h [ 0 ] ;  
 	 	 s e l e c t o r   =   s e l e c t o r . r e p l a c e (   E x p r . m a t c h . P S E U D O ,   " "   ) ;  
 	 }  
  
 	 s e l e c t o r   =   E x p r . r e l a t i v e [ s e l e c t o r ]   ?   s e l e c t o r   +   " * "   :   s e l e c t o r ;  
  
 	 f o r   (   v a r   i   =   0 ,   l   =   r o o t . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 S i z z l e (   s e l e c t o r ,   r o o t [ i ] ,   t m p S e t   ) ;  
 	 }  
  
 	 r e t u r n   S i z z l e . f i l t e r (   l a t e r ,   t m p S e t   ) ;  
 } ;  
  
 / /   E X P O S E  
 j Q u e r y . f i n d   =   S i z z l e ;  
 j Q u e r y . e x p r   =   S i z z l e . s e l e c t o r s ;  
 j Q u e r y . e x p r [ " : " ]   =   j Q u e r y . e x p r . f i l t e r s ;  
 j Q u e r y . u n i q u e   =   S i z z l e . u n i q u e S o r t ;  
 j Q u e r y . t e x t   =   S i z z l e . g e t T e x t ;  
 j Q u e r y . i s X M L D o c   =   S i z z l e . i s X M L ;  
 j Q u e r y . c o n t a i n s   =   S i z z l e . c o n t a i n s ;  
  
  
 } ) ( ) ;  
  
  
 v a r   r u n t i l   =   / U n t i l $ / ,  
 	 r p a r e n t s p r e v   =   / ^ ( ? : p a r e n t s | p r e v U n t i l | p r e v A l l ) / ,  
 	 / /   N o t e :   T h i s   R e g E x p   s h o u l d   b e   i m p r o v e d ,   o r   l i k e l y   p u l l e d   f r o m   S i z z l e  
 	 r m u l t i s e l e c t o r   =   / , / ,  
 	 i s S i m p l e   =   / ^ . [ ^ : # \ [ \ . , ] * $ / ,  
 	 s l i c e   =   A r r a y . p r o t o t y p e . s l i c e ,  
 	 P O S   =   j Q u e r y . e x p r . m a t c h . P O S ,  
 	 / /   m e t h o d s   g u a r a n t e e d   t o   p r o d u c e   a   u n i q u e   s e t   w h e n   s t a r t i n g   f r o m   a   u n i q u e   s e t  
 	 g u a r a n t e e d U n i q u e   =   {  
 	 	 c h i l d r e n :   t r u e ,  
 	 	 c o n t e n t s :   t r u e ,  
 	 	 n e x t :   t r u e ,  
 	 	 p r e v :   t r u e  
 	 } ;  
  
 j Q u e r y . f n . e x t e n d ( {  
 	 f i n d :   f u n c t i o n (   s e l e c t o r   )   {  
 	 	 v a r   s e l f   =   t h i s ,  
 	 	 	 i ,   l ;  
  
 	 	 i f   (   t y p e o f   s e l e c t o r   ! = =   " s t r i n g "   )   {  
 	 	 	 r e t u r n   j Q u e r y (   s e l e c t o r   ) . f i l t e r ( f u n c t i o n ( )   {  
 	 	 	 	 f o r   (   i   =   0 ,   l   =   s e l f . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 	 	 i f   (   j Q u e r y . c o n t a i n s (   s e l f [   i   ] ,   t h i s   )   )   {  
 	 	 	 	 	 	 r e t u r n   t r u e ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 } ) ;  
 	 	 }  
  
 	 	 v a r   r e t   =   t h i s . p u s h S t a c k (   " " ,   " f i n d " ,   s e l e c t o r   ) ,  
 	 	 	 l e n g t h ,   n ,   r ;  
  
 	 	 f o r   (   i   =   0 ,   l   =   t h i s . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 l e n g t h   =   r e t . l e n g t h ;  
 	 	 	 j Q u e r y . f i n d (   s e l e c t o r ,   t h i s [ i ] ,   r e t   ) ;  
  
 	 	 	 i f   (   i   >   0   )   {  
 	 	 	 	 / /   M a k e   s u r e   t h a t   t h e   r e s u l t s   a r e   u n i q u e  
 	 	 	 	 f o r   (   n   =   l e n g t h ;   n   <   r e t . l e n g t h ;   n + +   )   {  
 	 	 	 	 	 f o r   (   r   =   0 ;   r   <   l e n g t h ;   r + +   )   {  
 	 	 	 	 	 	 i f   (   r e t [ r ]   = = =   r e t [ n ]   )   {  
 	 	 	 	 	 	 	 r e t . s p l i c e ( n - - ,   1 ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   r e t ;  
 	 } ,  
  
 	 h a s :   f u n c t i o n (   t a r g e t   )   {  
 	 	 v a r   t a r g e t s   =   j Q u e r y (   t a r g e t   ) ;  
 	 	 r e t u r n   t h i s . f i l t e r ( f u n c t i o n ( )   {  
 	 	 	 f o r   (   v a r   i   =   0 ,   l   =   t a r g e t s . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 	 i f   (   j Q u e r y . c o n t a i n s (   t h i s ,   t a r g e t s [ i ]   )   )   {  
 	 	 	 	 	 r e t u r n   t r u e ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 } ) ;  
 	 } ,  
  
 	 n o t :   f u n c t i o n (   s e l e c t o r   )   {  
 	 	 r e t u r n   t h i s . p u s h S t a c k (   w i n n o w ( t h i s ,   s e l e c t o r ,   f a l s e ) ,   " n o t " ,   s e l e c t o r ) ;  
 	 } ,  
  
 	 f i l t e r :   f u n c t i o n (   s e l e c t o r   )   {  
 	 	 r e t u r n   t h i s . p u s h S t a c k (   w i n n o w ( t h i s ,   s e l e c t o r ,   t r u e ) ,   " f i l t e r " ,   s e l e c t o r   ) ;  
 	 } ,  
  
 	 i s :   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   = = =   " s t r i n g "   ?  
 	 	 	 j Q u e r y . f i l t e r (   s e l e c t o r ,   t h i s   ) . l e n g t h   >   0   :  
 	 	 	 t h i s . f i l t e r (   s e l e c t o r   ) . l e n g t h   >   0   ) ;  
 	 } ,  
  
 	 c l o s e s t :   f u n c t i o n (   s e l e c t o r s ,   c o n t e x t   )   {  
 	 	 v a r   r e t   =   [ ] ,   i ,   l ,   c u r   =   t h i s [ 0 ] ;  
 	 	  
 	 	 / /   A r r a y  
 	 	 i f   (   j Q u e r y . i s A r r a y (   s e l e c t o r s   )   )   {  
 	 	 	 v a r   m a t c h ,   s e l e c t o r ,  
 	 	 	 	 m a t c h e s   =   { } ,  
 	 	 	 	 l e v e l   =   1 ;  
  
 	 	 	 i f   (   c u r   & &   s e l e c t o r s . l e n g t h   )   {  
 	 	 	 	 f o r   (   i   =   0 ,   l   =   s e l e c t o r s . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 	 	 s e l e c t o r   =   s e l e c t o r s [ i ] ;  
  
 	 	 	 	 	 i f   (   ! m a t c h e s [   s e l e c t o r   ]   )   {  
 	 	 	 	 	 	 m a t c h e s [   s e l e c t o r   ]   =   P O S . t e s t (   s e l e c t o r   )   ?  
 	 	 	 	 	 	 	 j Q u e r y (   s e l e c t o r ,   c o n t e x t   | |   t h i s . c o n t e x t   )   :  
 	 	 	 	 	 	 	 s e l e c t o r ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 w h i l e   (   c u r   & &   c u r . o w n e r D o c u m e n t   & &   c u r   ! = =   c o n t e x t   )   {  
 	 	 	 	 	 f o r   (   s e l e c t o r   i n   m a t c h e s   )   {  
 	 	 	 	 	 	 m a t c h   =   m a t c h e s [   s e l e c t o r   ] ;  
  
 	 	 	 	 	 	 i f   (   m a t c h . j q u e r y   ?   m a t c h . i n d e x (   c u r   )   >   - 1   :   j Q u e r y (   c u r   ) . i s (   m a t c h   )   )   {  
 	 	 	 	 	 	 	 r e t . p u s h ( {   s e l e c t o r :   s e l e c t o r ,   e l e m :   c u r ,   l e v e l :   l e v e l   } ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
  
 	 	 	 	 	 c u r   =   c u r . p a r e n t N o d e ;  
 	 	 	 	 	 l e v e l + + ;  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 r e t u r n   r e t ;  
 	 	 }  
  
 	 	 / /   S t r i n g  
 	 	 v a r   p o s   =   P O S . t e s t (   s e l e c t o r s   )   | |   t y p e o f   s e l e c t o r s   ! = =   " s t r i n g "   ?  
 	 	 	 	 j Q u e r y (   s e l e c t o r s ,   c o n t e x t   | |   t h i s . c o n t e x t   )   :  
 	 	 	 	 0 ;  
  
 	 	 f o r   (   i   =   0 ,   l   =   t h i s . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 c u r   =   t h i s [ i ] ;  
  
 	 	 	 w h i l e   (   c u r   )   {  
 	 	 	 	 i f   (   p o s   ?   p o s . i n d e x ( c u r )   >   - 1   :   j Q u e r y . f i n d . m a t c h e s S e l e c t o r ( c u r ,   s e l e c t o r s )   )   {  
 	 	 	 	 	 r e t . p u s h (   c u r   ) ;  
 	 	 	 	 	 b r e a k ;  
  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 c u r   =   c u r . p a r e n t N o d e ;  
 	 	 	 	 	 i f   (   ! c u r   | |   ! c u r . o w n e r D o c u m e n t   | |   c u r   = = =   c o n t e x t   | |   c u r . n o d e T y p e   = = =   1 1   )   {  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t   =   r e t . l e n g t h   >   1   ?   j Q u e r y . u n i q u e (   r e t   )   :   r e t ;  
  
 	 	 r e t u r n   t h i s . p u s h S t a c k (   r e t ,   " c l o s e s t " ,   s e l e c t o r s   ) ;  
 	 } ,  
  
 	 / /   D e t e r m i n e   t h e   p o s i t i o n   o f   a n   e l e m e n t   w i t h i n  
 	 / /   t h e   m a t c h e d   s e t   o f   e l e m e n t s  
 	 i n d e x :   f u n c t i o n (   e l e m   )   {  
 	 	 i f   (   ! e l e m   | |   t y p e o f   e l e m   = = =   " s t r i n g "   )   {  
 	 	 	 r e t u r n   j Q u e r y . i n A r r a y (   t h i s [ 0 ] ,  
 	 	 	 	 / /   I f   i t   r e c e i v e s   a   s t r i n g ,   t h e   s e l e c t o r   i s   u s e d  
 	 	 	 	 / /   I f   i t   r e c e i v e s   n o t h i n g ,   t h e   s i b l i n g s   a r e   u s e d  
 	 	 	 	 e l e m   ?   j Q u e r y (   e l e m   )   :   t h i s . p a r e n t ( ) . c h i l d r e n ( )   ) ;  
 	 	 }  
 	 	 / /   L o c a t e   t h e   p o s i t i o n   o f   t h e   d e s i r e d   e l e m e n t  
 	 	 r e t u r n   j Q u e r y . i n A r r a y (  
 	 	 	 / /   I f   i t   r e c e i v e s   a   j Q u e r y   o b j e c t ,   t h e   f i r s t   e l e m e n t   i s   u s e d  
 	 	 	 e l e m . j q u e r y   ?   e l e m [ 0 ]   :   e l e m ,   t h i s   ) ;  
 	 } ,  
  
 	 a d d :   f u n c t i o n (   s e l e c t o r ,   c o n t e x t   )   {  
 	 	 v a r   s e t   =   t y p e o f   s e l e c t o r   = = =   " s t r i n g "   ?  
 	 	 	 	 j Q u e r y (   s e l e c t o r ,   c o n t e x t   )   :  
 	 	 	 	 j Q u e r y . m a k e A r r a y (   s e l e c t o r   & &   s e l e c t o r . n o d e T y p e   ?   [   s e l e c t o r   ]   :   s e l e c t o r   ) ,  
 	 	 	 a l l   =   j Q u e r y . m e r g e (   t h i s . g e t ( ) ,   s e t   ) ;  
  
 	 	 r e t u r n   t h i s . p u s h S t a c k (   i s D i s c o n n e c t e d (   s e t [ 0 ]   )   | |   i s D i s c o n n e c t e d (   a l l [ 0 ]   )   ?  
 	 	 	 a l l   :  
 	 	 	 j Q u e r y . u n i q u e (   a l l   )   ) ;  
 	 } ,  
  
 	 a n d S e l f :   f u n c t i o n ( )   {  
 	 	 r e t u r n   t h i s . a d d (   t h i s . p r e v O b j e c t   ) ;  
 	 }  
 } ) ;  
  
 / /   A   p a i n f u l l y   s i m p l e   c h e c k   t o   s e e   i f   a n   e l e m e n t   i s   d i s c o n n e c t e d  
 / /   f r o m   a   d o c u m e n t   ( s h o u l d   b e   i m p r o v e d ,   w h e r e   f e a s i b l e ) .  
 f u n c t i o n   i s D i s c o n n e c t e d (   n o d e   )   {  
 	 r e t u r n   ! n o d e   | |   ! n o d e . p a r e n t N o d e   | |   n o d e . p a r e n t N o d e . n o d e T y p e   = = =   1 1 ;  
 }  
  
 j Q u e r y . e a c h ( {  
 	 p a r e n t :   f u n c t i o n (   e l e m   )   {  
 	 	 v a r   p a r e n t   =   e l e m . p a r e n t N o d e ;  
 	 	 r e t u r n   p a r e n t   & &   p a r e n t . n o d e T y p e   ! = =   1 1   ?   p a r e n t   :   n u l l ;  
 	 } ,  
 	 p a r e n t s :   f u n c t i o n (   e l e m   )   {  
 	 	 r e t u r n   j Q u e r y . d i r (   e l e m ,   " p a r e n t N o d e "   ) ;  
 	 } ,  
 	 p a r e n t s U n t i l :   f u n c t i o n (   e l e m ,   i ,   u n t i l   )   {  
 	 	 r e t u r n   j Q u e r y . d i r (   e l e m ,   " p a r e n t N o d e " ,   u n t i l   ) ;  
 	 } ,  
 	 n e x t :   f u n c t i o n (   e l e m   )   {  
 	 	 r e t u r n   j Q u e r y . n t h (   e l e m ,   2 ,   " n e x t S i b l i n g "   ) ;  
 	 } ,  
 	 p r e v :   f u n c t i o n (   e l e m   )   {  
 	 	 r e t u r n   j Q u e r y . n t h (   e l e m ,   2 ,   " p r e v i o u s S i b l i n g "   ) ;  
 	 } ,  
 	 n e x t A l l :   f u n c t i o n (   e l e m   )   {  
 	 	 r e t u r n   j Q u e r y . d i r (   e l e m ,   " n e x t S i b l i n g "   ) ;  
 	 } ,  
 	 p r e v A l l :   f u n c t i o n (   e l e m   )   {  
 	 	 r e t u r n   j Q u e r y . d i r (   e l e m ,   " p r e v i o u s S i b l i n g "   ) ;  
 	 } ,  
 	 n e x t U n t i l :   f u n c t i o n (   e l e m ,   i ,   u n t i l   )   {  
 	 	 r e t u r n   j Q u e r y . d i r (   e l e m ,   " n e x t S i b l i n g " ,   u n t i l   ) ;  
 	 } ,  
 	 p r e v U n t i l :   f u n c t i o n (   e l e m ,   i ,   u n t i l   )   {  
 	 	 r e t u r n   j Q u e r y . d i r (   e l e m ,   " p r e v i o u s S i b l i n g " ,   u n t i l   ) ;  
 	 } ,  
 	 s i b l i n g s :   f u n c t i o n (   e l e m   )   {  
 	 	 r e t u r n   j Q u e r y . s i b l i n g (   e l e m . p a r e n t N o d e . f i r s t C h i l d ,   e l e m   ) ;  
 	 } ,  
 	 c h i l d r e n :   f u n c t i o n (   e l e m   )   {  
 	 	 r e t u r n   j Q u e r y . s i b l i n g (   e l e m . f i r s t C h i l d   ) ;  
 	 } ,  
 	 c o n t e n t s :   f u n c t i o n (   e l e m   )   {  
 	 	 r e t u r n   j Q u e r y . n o d e N a m e (   e l e m ,   " i f r a m e "   )   ?  
 	 	 	 e l e m . c o n t e n t D o c u m e n t   | |   e l e m . c o n t e n t W i n d o w . d o c u m e n t   :  
 	 	 	 j Q u e r y . m a k e A r r a y (   e l e m . c h i l d N o d e s   ) ;  
 	 }  
 } ,   f u n c t i o n (   n a m e ,   f n   )   {  
 	 j Q u e r y . f n [   n a m e   ]   =   f u n c t i o n (   u n t i l ,   s e l e c t o r   )   {  
 	 	 v a r   r e t   =   j Q u e r y . m a p (   t h i s ,   f n ,   u n t i l   ) ,  
 	 	 	 / /   T h e   v a r i a b l e   ' a r g s '   w a s   i n t r o d u c e d   i n  
 	 	 	 / /   h t t p s : / / g i t h u b . c o m / j q u e r y / j q u e r y / c o m m i t / 5 2 a 0 2 3 8  
 	 	 	 / /   t o   w o r k   a r o u n d   a   b u g   i n   C h r o m e   1 0   ( D e v )   a n d   s h o u l d   b e   r e m o v e d   w h e n   t h e   b u g   i s   f i x e d .  
 	 	 	 / /   h t t p : / / c o d e . g o o g l e . c o m / p / v 8 / i s s u e s / d e t a i l ? i d = 1 0 5 0  
 	 	 	 a r g s   =   s l i c e . c a l l ( a r g u m e n t s ) ;  
  
 	 	 i f   (   ! r u n t i l . t e s t (   n a m e   )   )   {  
 	 	 	 s e l e c t o r   =   u n t i l ;  
 	 	 }  
  
 	 	 i f   (   s e l e c t o r   & &   t y p e o f   s e l e c t o r   = = =   " s t r i n g "   )   {  
 	 	 	 r e t   =   j Q u e r y . f i l t e r (   s e l e c t o r ,   r e t   ) ;  
 	 	 }  
  
 	 	 r e t   =   t h i s . l e n g t h   >   1   & &   ! g u a r a n t e e d U n i q u e [   n a m e   ]   ?   j Q u e r y . u n i q u e (   r e t   )   :   r e t ;  
  
 	 	 i f   (   ( t h i s . l e n g t h   >   1   | |   r m u l t i s e l e c t o r . t e s t (   s e l e c t o r   ) )   & &   r p a r e n t s p r e v . t e s t (   n a m e   )   )   {  
 	 	 	 r e t   =   r e t . r e v e r s e ( ) ;  
 	 	 }  
  
 	 	 r e t u r n   t h i s . p u s h S t a c k (   r e t ,   n a m e ,   a r g s . j o i n ( " , " )   ) ;  
 	 } ;  
 } ) ;  
  
 j Q u e r y . e x t e n d ( {  
 	 f i l t e r :   f u n c t i o n (   e x p r ,   e l e m s ,   n o t   )   {  
 	 	 i f   (   n o t   )   {  
 	 	 	 e x p r   =   " : n o t ( "   +   e x p r   +   " ) " ;  
 	 	 }  
  
 	 	 r e t u r n   e l e m s . l e n g t h   = = =   1   ?  
 	 	 	 j Q u e r y . f i n d . m a t c h e s S e l e c t o r ( e l e m s [ 0 ] ,   e x p r )   ?   [   e l e m s [ 0 ]   ]   :   [ ]   :  
 	 	 	 j Q u e r y . f i n d . m a t c h e s ( e x p r ,   e l e m s ) ;  
 	 } ,  
  
 	 d i r :   f u n c t i o n (   e l e m ,   d i r ,   u n t i l   )   {  
 	 	 v a r   m a t c h e d   =   [ ] ,  
 	 	 	 c u r   =   e l e m [   d i r   ] ;  
  
 	 	 w h i l e   (   c u r   & &   c u r . n o d e T y p e   ! = =   9   & &   ( u n t i l   = = =   u n d e f i n e d   | |   c u r . n o d e T y p e   ! = =   1   | |   ! j Q u e r y (   c u r   ) . i s (   u n t i l   ) )   )   {  
 	 	 	 i f   (   c u r . n o d e T y p e   = = =   1   )   {  
 	 	 	 	 m a t c h e d . p u s h (   c u r   ) ;  
 	 	 	 }  
 	 	 	 c u r   =   c u r [ d i r ] ;  
 	 	 }  
 	 	 r e t u r n   m a t c h e d ;  
 	 } ,  
  
 	 n t h :   f u n c t i o n (   c u r ,   r e s u l t ,   d i r ,   e l e m   )   {  
 	 	 r e s u l t   =   r e s u l t   | |   1 ;  
 	 	 v a r   n u m   =   0 ;  
  
 	 	 f o r   (   ;   c u r ;   c u r   =   c u r [ d i r ]   )   {  
 	 	 	 i f   (   c u r . n o d e T y p e   = = =   1   & &   + + n u m   = = =   r e s u l t   )   {  
 	 	 	 	 b r e a k ;  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   c u r ;  
 	 } ,  
  
 	 s i b l i n g :   f u n c t i o n (   n ,   e l e m   )   {  
 	 	 v a r   r   =   [ ] ;  
  
 	 	 f o r   (   ;   n ;   n   =   n . n e x t S i b l i n g   )   {  
 	 	 	 i f   (   n . n o d e T y p e   = = =   1   & &   n   ! = =   e l e m   )   {  
 	 	 	 	 r . p u s h (   n   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   r ;  
 	 }  
 } ) ;  
  
 / /   I m p l e m e n t   t h e   i d e n t i c a l   f u n c t i o n a l i t y   f o r   f i l t e r   a n d   n o t  
 f u n c t i o n   w i n n o w (   e l e m e n t s ,   q u a l i f i e r ,   k e e p   )   {  
  
 	 / /   C a n ' t   p a s s   n u l l   o r   u n d e f i n e d   t o   i n d e x O f   i n   F i r e f o x   4  
 	 / /   S e t   t o   0   t o   s k i p   s t r i n g   c h e c k  
 	 q u a l i f i e r   =   q u a l i f i e r   | |   0 ;  
  
 	 i f   (   j Q u e r y . i s F u n c t i o n (   q u a l i f i e r   )   )   {  
 	 	 r e t u r n   j Q u e r y . g r e p ( e l e m e n t s ,   f u n c t i o n (   e l e m ,   i   )   {  
 	 	 	 v a r   r e t V a l   =   ! ! q u a l i f i e r . c a l l (   e l e m ,   i ,   e l e m   ) ;  
 	 	 	 r e t u r n   r e t V a l   = = =   k e e p ;  
 	 	 } ) ;  
  
 	 }   e l s e   i f   (   q u a l i f i e r . n o d e T y p e   )   {  
 	 	 r e t u r n   j Q u e r y . g r e p ( e l e m e n t s ,   f u n c t i o n (   e l e m ,   i   )   {  
 	 	 	 r e t u r n   ( e l e m   = = =   q u a l i f i e r )   = = =   k e e p ;  
 	 	 } ) ;  
  
 	 }   e l s e   i f   (   t y p e o f   q u a l i f i e r   = = =   " s t r i n g "   )   {  
 	 	 v a r   f i l t e r e d   =   j Q u e r y . g r e p ( e l e m e n t s ,   f u n c t i o n (   e l e m   )   {  
 	 	 	 r e t u r n   e l e m . n o d e T y p e   = = =   1 ;  
 	 	 } ) ;  
  
 	 	 i f   (   i s S i m p l e . t e s t (   q u a l i f i e r   )   )   {  
 	 	 	 r e t u r n   j Q u e r y . f i l t e r ( q u a l i f i e r ,   f i l t e r e d ,   ! k e e p ) ;  
 	 	 }   e l s e   {  
 	 	 	 q u a l i f i e r   =   j Q u e r y . f i l t e r (   q u a l i f i e r ,   f i l t e r e d   ) ;  
 	 	 }  
 	 }  
  
 	 r e t u r n   j Q u e r y . g r e p ( e l e m e n t s ,   f u n c t i o n (   e l e m ,   i   )   {  
 	 	 r e t u r n   ( j Q u e r y . i n A r r a y (   e l e m ,   q u a l i f i e r   )   > =   0 )   = = =   k e e p ;  
 	 } ) ;  
 }  
  
  
  
  
 v a r   r i n l i n e j Q u e r y   =   /   j Q u e r y \ d + = " ( ? : \ d + | n u l l ) " / g ,  
 	 r l e a d i n g W h i t e s p a c e   =   / ^ \ s + / ,  
 	 r x h t m l T a g   =   / < ( ? ! a r e a | b r | c o l | e m b e d | h r | i m g | i n p u t | l i n k | m e t a | p a r a m ) ( ( [ \ w : ] + ) [ ^ > ] * ) \ / > / i g ,  
 	 r t a g N a m e   =   / < ( [ \ w : ] + ) / ,  
 	 r t b o d y   =   / < t b o d y / i ,  
 	 r h t m l   =   / < | & # ? \ w + ; / ,  
 	 r n o c a c h e   =   / < ( ? : s c r i p t | o b j e c t | e m b e d | o p t i o n | s t y l e ) / i ,  
 	 / /   c h e c k e d = " c h e c k e d "   o r   c h e c k e d  
 	 r c h e c k e d   =   / c h e c k e d \ s * ( ? : [ ^ = ] | = \ s * . c h e c k e d . ) / i ,  
 	 r s c r i p t T y p e   =   / \ / ( j a v a | e c m a ) s c r i p t / i ,  
 	 w r a p M a p   =   {  
 	 	 o p t i o n :   [   1 ,   " < s e l e c t   m u l t i p l e = ' m u l t i p l e ' > " ,   " < / s e l e c t > "   ] ,  
 	 	 l e g e n d :   [   1 ,   " < f i e l d s e t > " ,   " < / f i e l d s e t > "   ] ,  
 	 	 t h e a d :   [   1 ,   " < t a b l e > " ,   " < / t a b l e > "   ] ,  
 	 	 t r :   [   2 ,   " < t a b l e > < t b o d y > " ,   " < / t b o d y > < / t a b l e > "   ] ,  
 	 	 t d :   [   3 ,   " < t a b l e > < t b o d y > < t r > " ,   " < / t r > < / t b o d y > < / t a b l e > "   ] ,  
 	 	 c o l :   [   2 ,   " < t a b l e > < t b o d y > < / t b o d y > < c o l g r o u p > " ,   " < / c o l g r o u p > < / t a b l e > "   ] ,  
 	 	 a r e a :   [   1 ,   " < m a p > " ,   " < / m a p > "   ] ,  
 	 	 _ d e f a u l t :   [   0 ,   " " ,   " "   ]  
 	 } ;  
  
 w r a p M a p . o p t g r o u p   =   w r a p M a p . o p t i o n ;  
 w r a p M a p . t b o d y   =   w r a p M a p . t f o o t   =   w r a p M a p . c o l g r o u p   =   w r a p M a p . c a p t i o n   =   w r a p M a p . t h e a d ;  
 w r a p M a p . t h   =   w r a p M a p . t d ;  
  
 / /   I E   c a n ' t   s e r i a l i z e   < l i n k >   a n d   < s c r i p t >   t a g s   n o r m a l l y  
 i f   (   ! j Q u e r y . s u p p o r t . h t m l S e r i a l i z e   )   {  
 	 w r a p M a p . _ d e f a u l t   =   [   1 ,   " d i v < d i v > " ,   " < / d i v > "   ] ;  
 }  
  
 j Q u e r y . f n . e x t e n d ( {  
 	 t e x t :   f u n c t i o n (   t e x t   )   {  
 	 	 i f   (   j Q u e r y . i s F u n c t i o n ( t e x t )   )   {  
 	 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( i )   {  
 	 	 	 	 v a r   s e l f   =   j Q u e r y (   t h i s   ) ;  
  
 	 	 	 	 s e l f . t e x t (   t e x t . c a l l ( t h i s ,   i ,   s e l f . t e x t ( ) )   ) ;  
 	 	 	 } ) ;  
 	 	 }  
  
 	 	 i f   (   t y p e o f   t e x t   ! = =   " o b j e c t "   & &   t e x t   ! = =   u n d e f i n e d   )   {  
 	 	 	 r e t u r n   t h i s . e m p t y ( ) . a p p e n d (   ( t h i s [ 0 ]   & &   t h i s [ 0 ] . o w n e r D o c u m e n t   | |   d o c u m e n t ) . c r e a t e T e x t N o d e (   t e x t   )   ) ;  
 	 	 }  
  
 	 	 r e t u r n   j Q u e r y . t e x t (   t h i s   ) ;  
 	 } ,  
  
 	 w r a p A l l :   f u n c t i o n (   h t m l   )   {  
 	 	 i f   (   j Q u e r y . i s F u n c t i o n (   h t m l   )   )   {  
 	 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( i )   {  
 	 	 	 	 j Q u e r y ( t h i s ) . w r a p A l l (   h t m l . c a l l ( t h i s ,   i )   ) ;  
 	 	 	 } ) ;  
 	 	 }  
  
 	 	 i f   (   t h i s [ 0 ]   )   {  
 	 	 	 / /   T h e   e l e m e n t s   t o   w r a p   t h e   t a r g e t   a r o u n d  
 	 	 	 v a r   w r a p   =   j Q u e r y (   h t m l ,   t h i s [ 0 ] . o w n e r D o c u m e n t   ) . e q ( 0 ) . c l o n e ( t r u e ) ;  
  
 	 	 	 i f   (   t h i s [ 0 ] . p a r e n t N o d e   )   {  
 	 	 	 	 w r a p . i n s e r t B e f o r e (   t h i s [ 0 ]   ) ;  
 	 	 	 }  
  
 	 	 	 w r a p . m a p ( f u n c t i o n ( )   {  
 	 	 	 	 v a r   e l e m   =   t h i s ;  
  
 	 	 	 	 w h i l e   (   e l e m . f i r s t C h i l d   & &   e l e m . f i r s t C h i l d . n o d e T y p e   = = =   1   )   {  
 	 	 	 	 	 e l e m   =   e l e m . f i r s t C h i l d ;  
 	 	 	 	 }  
  
 	 	 	 	 r e t u r n   e l e m ;  
 	 	 	 } ) . a p p e n d (   t h i s   ) ;  
 	 	 }  
  
 	 	 r e t u r n   t h i s ;  
 	 } ,  
  
 	 w r a p I n n e r :   f u n c t i o n (   h t m l   )   {  
 	 	 i f   (   j Q u e r y . i s F u n c t i o n (   h t m l   )   )   {  
 	 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( i )   {  
 	 	 	 	 j Q u e r y ( t h i s ) . w r a p I n n e r (   h t m l . c a l l ( t h i s ,   i )   ) ;  
 	 	 	 } ) ;  
 	 	 }  
  
 	 	 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   s e l f   =   j Q u e r y (   t h i s   ) ,  
 	 	 	 	 c o n t e n t s   =   s e l f . c o n t e n t s ( ) ;  
  
 	 	 	 i f   (   c o n t e n t s . l e n g t h   )   {  
 	 	 	 	 c o n t e n t s . w r a p A l l (   h t m l   ) ;  
  
 	 	 	 }   e l s e   {  
 	 	 	 	 s e l f . a p p e n d (   h t m l   ) ;  
 	 	 	 }  
 	 	 } ) ;  
 	 } ,  
  
 	 w r a p :   f u n c t i o n (   h t m l   )   {  
 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( )   {  
 	 	 	 j Q u e r y (   t h i s   ) . w r a p A l l (   h t m l   ) ;  
 	 	 } ) ;  
 	 } ,  
  
 	 u n w r a p :   f u n c t i o n ( )   {  
 	 	 r e t u r n   t h i s . p a r e n t ( ) . e a c h ( f u n c t i o n ( )   {  
 	 	 	 i f   (   ! j Q u e r y . n o d e N a m e (   t h i s ,   " b o d y "   )   )   {  
 	 	 	 	 j Q u e r y (   t h i s   ) . r e p l a c e W i t h (   t h i s . c h i l d N o d e s   ) ;  
 	 	 	 }  
 	 	 } ) . e n d ( ) ;  
 	 } ,  
  
 	 a p p e n d :   f u n c t i o n ( )   {  
 	 	 r e t u r n   t h i s . d o m M a n i p ( a r g u m e n t s ,   t r u e ,   f u n c t i o n (   e l e m   )   {  
 	 	 	 i f   (   t h i s . n o d e T y p e   = = =   1   )   {  
 	 	 	 	 t h i s . a p p e n d C h i l d (   e l e m   ) ;  
 	 	 	 }  
 	 	 } ) ;  
 	 } ,  
  
 	 p r e p e n d :   f u n c t i o n ( )   {  
 	 	 r e t u r n   t h i s . d o m M a n i p ( a r g u m e n t s ,   t r u e ,   f u n c t i o n (   e l e m   )   {  
 	 	 	 i f   (   t h i s . n o d e T y p e   = = =   1   )   {  
 	 	 	 	 t h i s . i n s e r t B e f o r e (   e l e m ,   t h i s . f i r s t C h i l d   ) ;  
 	 	 	 }  
 	 	 } ) ;  
 	 } ,  
  
 	 b e f o r e :   f u n c t i o n ( )   {  
 	 	 i f   (   t h i s [ 0 ]   & &   t h i s [ 0 ] . p a r e n t N o d e   )   {  
 	 	 	 r e t u r n   t h i s . d o m M a n i p ( a r g u m e n t s ,   f a l s e ,   f u n c t i o n (   e l e m   )   {  
 	 	 	 	 t h i s . p a r e n t N o d e . i n s e r t B e f o r e (   e l e m ,   t h i s   ) ;  
 	 	 	 } ) ;  
 	 	 }   e l s e   i f   (   a r g u m e n t s . l e n g t h   )   {  
 	 	 	 v a r   s e t   =   j Q u e r y ( a r g u m e n t s [ 0 ] ) ;  
 	 	 	 s e t . p u s h . a p p l y (   s e t ,   t h i s . t o A r r a y ( )   ) ;  
 	 	 	 r e t u r n   t h i s . p u s h S t a c k (   s e t ,   " b e f o r e " ,   a r g u m e n t s   ) ;  
 	 	 }  
 	 } ,  
  
 	 a f t e r :   f u n c t i o n ( )   {  
 	 	 i f   (   t h i s [ 0 ]   & &   t h i s [ 0 ] . p a r e n t N o d e   )   {  
 	 	 	 r e t u r n   t h i s . d o m M a n i p ( a r g u m e n t s ,   f a l s e ,   f u n c t i o n (   e l e m   )   {  
 	 	 	 	 t h i s . p a r e n t N o d e . i n s e r t B e f o r e (   e l e m ,   t h i s . n e x t S i b l i n g   ) ;  
 	 	 	 } ) ;  
 	 	 }   e l s e   i f   (   a r g u m e n t s . l e n g t h   )   {  
 	 	 	 v a r   s e t   =   t h i s . p u s h S t a c k (   t h i s ,   " a f t e r " ,   a r g u m e n t s   ) ;  
 	 	 	 s e t . p u s h . a p p l y (   s e t ,   j Q u e r y ( a r g u m e n t s [ 0 ] ) . t o A r r a y ( )   ) ;  
 	 	 	 r e t u r n   s e t ;  
 	 	 }  
 	 } ,  
  
 	 / /   k e e p D a t a   i s   f o r   i n t e r n a l   u s e   o n l y - - d o   n o t   d o c u m e n t  
 	 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   )   {  
 	 	 f o r   (   v a r   i   =   0 ,   e l e m ;   ( e l e m   =   t h i s [ i ] )   ! =   n u l l ;   i + +   )   {  
 	 	 	 i f   (   ! s e l e c t o r   | |   j Q u e r y . f i l t e r (   s e l e c t o r ,   [   e l e m   ]   ) . l e n g t h   )   {  
 	 	 	 	 i f   (   ! k e e p D a t a   & &   e l e m . n o d e T y p e   = = =   1   )   {  
 	 	 	 	 	 j Q u e r y . c l e a n D a t a (   e l e m . g e t E l e m e n t s B y T a g N a m e ( " * " )   ) ;  
 	 	 	 	 	 j Q u e r y . c l e a n D a t a (   [   e l e m   ]   ) ;  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   e l e m . p a r e n t N o d e   )   {  
 	 	 	 	 	 e l e m . p a r e n t N o d e . r e m o v e C h i l d (   e l e m   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   t h i s ;  
 	 } ,  
  
 	 e m p t y :   f u n c t i o n ( )   {  
 	 	 f o r   (   v a r   i   =   0 ,   e l e m ;   ( e l e m   =   t h i s [ i ] )   ! =   n u l l ;   i + +   )   {  
 	 	 	 / /   R e m o v e   e l e m e n t   n o d e s   a n d   p r e v e n t   m e m o r y   l e a k s  
 	 	 	 i f   (   e l e m . n o d e T y p e   = = =   1   )   {  
 	 	 	 	 j Q u e r y . c l e a n D a t a (   e l e m . g e t E l e m e n t s B y T a g N a m e ( " * " )   ) ;  
 	 	 	 }  
  
 	 	 	 / /   R e m o v e   a n y   r e m a i n i n g   n o d e s  
 	 	 	 w h i l e   (   e l e m . f i r s t C h i l d   )   {  
 	 	 	 	 e l e m . r e m o v e C h i l d (   e l e m . f i r s t C h i l d   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   t h i s ;  
 	 } ,  
  
 	 c l o n e :   f u n c t i o n (   d a t a A n d E v e n t s ,   d e e p D a t a A n d E v e n t s   )   {  
 	 	 d a t a A n d E v e n t s   =   d a t a A n d E v e n t s   = =   n u l l   ?   f a l s e   :   d a t a A n d E v e n t s ;  
 	 	 d e e p D a t a A n d E v e n t s   =   d e e p D a t a A n d E v e n t s   = =   n u l l   ?   d a t a A n d E v e n t s   :   d e e p D a t a A n d E v e n t s ;  
  
 	 	 r e t u r n   t h i s . m a p (   f u n c t i o n   ( )   {  
 	 	 	 r e t u r n   j Q u e r y . c l o n e (   t h i s ,   d a t a A n d E v e n t s ,   d e e p D a t a A n d E v e n t s   ) ;  
 	 	 } ) ;  
 	 } ,  
  
 	 h t m l :   f u n c t i o n (   v a l u e   )   {  
 	 	 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 [ 0 ]   & &   t h i s [ 0 ] . n o d e T y p e   = = =   1   ?  
 	 	 	 	 t h i s [ 0 ] . i n n e r H T M L . r e p l a c e ( r i n l i n e j Q u e r y ,   " " )   :  
 	 	 	 	 n u l l ;  
  
 	 	 / /   S e e   i f   w e   c a n   t a k e   a   s h o r t c u t   a n d   j u s t   u s e   i n n e r H T M L  
 	 	 }   e l s e   i f   (   t y p e o f   v a l u e   = = =   " s t r i n g "   & &   ! r n o c a c h e . t e s t (   v a l u e   )   & &  
 	 	 	 ( j Q u e r y . s u p p o r t . l e a d i n g W h i t e s p a c e   | |   ! r l e a d i n g W h i t e s p a c e . t e s t (   v a l u e   ) )   & &  
 	 	 	 ! w r a p M a p [   ( r t a g N a m e . e x e c (   v a l u e   )   | |   [ " " ,   " " ] ) [ 1 ] . t o L o w e r C a s e ( )   ]   )   {  
  
 	 	 	 v a l u e   =   v a l u e . r e p l a c e ( r x h t m l T a g ,   " < $ 1 > < / $ 2 > " ) ;  
  
 	 	 	 t r y   {  
 	 	 	 	 f o r   (   v a r   i   =   0 ,   l   =   t h i s . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 	 	 / /   R e m o v e   e l e m e n t   n o d e s   a n d   p r e v e n t   m e m o r y   l e a k s  
 	 	 	 	 	 i f   (   t h i s [ i ] . n o d e T y p e   = = =   1   )   {  
 	 	 	 	 	 	 j Q u e r y . c l e a n D a t a (   t h i s [ i ] . g e t E l e m e n t s B y T a g N a m e ( " * " )   ) ;  
 	 	 	 	 	 	 t h i s [ i ] . i n n e r H T M L   =   v a l u e ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 / /   I f   u s i n g   i n n e r H T M L   t h r o w s   a n   e x c e p t i o n ,   u s e   t h e   f a l l b a c k   m e t h o d  
 	 	 	 }   c a t c h ( e )   {  
 	 	 	 	 t h i s . e m p t y ( ) . a p p e n d (   v a l u e   ) ;  
 	 	 	 }  
  
 	 	 }   e l s e   i f   (   j Q u e r y . i s F u n c t i o n (   v a l u e   )   )   {  
 	 	 	 t h i s . e a c h ( f u n c t i o n ( i ) {  
 	 	 	 	 v a r   s e l f   =   j Q u e r y (   t h i s   ) ;  
  
 	 	 	 	 s e l f . h t m l (   v a l u e . c a l l ( t h i s ,   i ,   s e l f . h t m l ( ) )   ) ;  
 	 	 	 } ) ;  
  
 	 	 }   e l s e   {  
 	 	 	 t h i s . e m p t y ( ) . a p p e n d (   v a l u e   ) ;  
 	 	 }  
  
 	 	 r e t u r n   t h i s ;  
 	 } ,  
  
 	 r e p l a c e W i t h :   f u n c t i o n (   v a l u e   )   {  
 	 	 i f   (   t h i s [ 0 ]   & &   t h i s [ 0 ] . p a r e n t N o d e   )   {  
 	 	 	 / /   M a k e   s u r e   t h a t   t h e   e l e m e n t s   a r e   r e m o v e d   f r o m   t h e   D O M   b e f o r e   t h e y   a r e   i n s e r t e d  
 	 	 	 / /   t h i s   c a n   h e l p   f i x   r e p l a c i n g   a   p a r e n t   w i t h   c h i l d   e l e m e n t s  
 	 	 	 i f   (   j Q u e r y . i s F u n c t i o n (   v a l u e   )   )   {  
 	 	 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( i )   {  
 	 	 	 	 	 v a r   s e l f   =   j Q u e r y ( t h i s ) ,   o l d   =   s e l f . h t m l ( ) ;  
 	 	 	 	 	 s e l f . r e p l a c e W i t h (   v a l u e . c a l l (   t h i s ,   i ,   o l d   )   ) ;  
 	 	 	 	 } ) ;  
 	 	 	 }  
  
 	 	 	 i f   (   t y p e o f   v a l u e   ! = =   " s t r i n g "   )   {  
 	 	 	 	 v a l u e   =   j Q u e r y (   v a l u e   ) . d e t a c h ( ) ;  
 	 	 	 }  
  
 	 	 	 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   n e x t   =   t h i s . n e x t S i b l i n g ,  
 	 	 	 	 	 p a r e n t   =   t h i s . p a r e n t N o d e ;  
  
 	 	 	 	 j Q u e r y (   t h i s   ) . r e m o v e ( ) ;  
  
 	 	 	 	 i f   (   n e x t   )   {  
 	 	 	 	 	 j Q u e r y ( n e x t ) . b e f o r e (   v a l u e   ) ;  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 j Q u e r y ( p a r e n t ) . a p p e n d (   v a l u e   ) ;  
 	 	 	 	 }  
 	 	 	 } ) ;  
 	 	 }   e l s e   {  
 	 	 	 r e t u r n   t h i s . l e n g t h   ?  
 	 	 	 	 t h i s . p u s h S t a c k (   j Q u e r y ( j Q u e r y . i s F u n c t i o n ( v a l u e )   ?   v a l u e ( )   :   v a l u e ) ,   " r e p l a c e W i t h " ,   v a l u e   )   :  
 	 	 	 	 t h i s ;  
 	 	 }  
 	 } ,  
  
 	 d e t a c h :   f u n c t i o n (   s e l e c t o r   )   {  
 	 	 r e t u r n   t h i s . r e m o v e (   s e l e c t o r ,   t r u e   ) ;  
 	 } ,  
  
 	 d o m M a n i p :   f u n c t i o n (   a r g s ,   t a b l e ,   c a l l b a c k   )   {  
 	 	 v a r   r e s u l t s ,   f i r s t ,   f r a g m e n t ,   p a r e n t ,  
 	 	 	 v a l u e   =   a r g s [ 0 ] ,  
 	 	 	 s c r i p t s   =   [ ] ;  
  
 	 	 / /   W e   c a n ' t   c l o n e N o d e   f r a g m e n t s   t h a t   c o n t a i n   c h e c k e d ,   i n   W e b K i t  
 	 	 i f   (   ! j Q u e r y . s u p p o r t . c h e c k C l o n e   & &   a r g u m e n t s . l e n g t h   = = =   3   & &   t y p e o f   v a l u e   = = =   " s t r i n g "   & &   r c h e c k e d . t e s t (   v a l u e   )   )   {  
 	 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( )   {  
 	 	 	 	 j Q u e r y ( t h i s ) . d o m M a n i p (   a r g s ,   t a b l e ,   c a l l b a c k ,   t r u e   ) ;  
 	 	 	 } ) ;  
 	 	 }  
  
 	 	 i f   (   j Q u e r y . i s F u n c t i o n ( v a l u e )   )   {  
 	 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( i )   {  
 	 	 	 	 v a r   s e l f   =   j Q u e r y ( t h i s ) ;  
 	 	 	 	 a r g s [ 0 ]   =   v a l u e . c a l l ( t h i s ,   i ,   t a b l e   ?   s e l f . h t m l ( )   :   u n d e f i n e d ) ;  
 	 	 	 	 s e l f . d o m M a n i p (   a r g s ,   t a b l e ,   c a l l b a c k   ) ;  
 	 	 	 } ) ;  
 	 	 }  
  
 	 	 i f   (   t h i s [ 0 ]   )   {  
 	 	 	 p a r e n t   =   v a l u e   & &   v a l u e . p a r e n t N o d e ;  
  
 	 	 	 / /   I f   w e ' r e   i n   a   f r a g m e n t ,   j u s t   u s e   t h a t   i n s t e a d   o f   b u i l d i n g   a   n e w   o n e  
 	 	 	 i f   (   j Q u e r y . s u p p o r t . p a r e n t N o d e   & &   p a r e n t   & &   p a r e n t . n o d e T y p e   = = =   1 1   & &   p a r e n t . c h i l d N o d e s . l e n g t h   = = =   t h i s . l e n g t h   )   {  
 	 	 	 	 r e s u l t s   =   {   f r a g m e n t :   p a r e n t   } ;  
  
 	 	 	 }   e l s e   {  
 	 	 	 	 r e s u l t s   =   j Q u e r y . b u i l d F r a g m e n t (   a r g s ,   t h i s ,   s c r i p t s   ) ;  
 	 	 	 }  
  
 	 	 	 f r a g m e n t   =   r e s u l t s . f r a g m e n t ;  
  
 	 	 	 i f   (   f r a g m e n t . c h i l d N o d e s . l e n g t h   = = =   1   )   {  
 	 	 	 	 f i r s t   =   f r a g m e n t   =   f r a g m e n t . f i r s t C h i l d ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 f i r s t   =   f r a g m e n t . f i r s t C h i l d ;  
 	 	 	 }  
  
 	 	 	 i f   (   f i r s t   )   {  
 	 	 	 	 t a b l e   =   t a b l e   & &   j Q u e r y . n o d e N a m e (   f i r s t ,   " t r "   ) ;  
  
 	 	 	 	 f o r   (   v a r   i   =   0 ,   l   =   t h i s . l e n g t h ,   l a s t I n d e x   =   l   -   1 ;   i   <   l ;   i + +   )   {  
 	 	 	 	 	 c a l l b a c k . c a l l (  
 	 	 	 	 	 	 t a b l e   ?  
 	 	 	 	 	 	 	 r o o t ( t h i s [ i ] ,   f i r s t )   :  
 	 	 	 	 	 	 	 t h i s [ i ] ,  
 	 	 	 	 	 	 / /   M a k e   s u r e   t h a t   w e   d o   n o t   l e a k   m e m o r y   b y   i n a d v e r t e n t l y   d i s c a r d i n g  
 	 	 	 	 	 	 / /   t h e   o r i g i n a l   f r a g m e n t   ( w h i c h   m i g h t   h a v e   a t t a c h e d   d a t a )   i n s t e a d   o f  
 	 	 	 	 	 	 / /   u s i n g   i t ;   i n   a d d i t i o n ,   u s e   t h e   o r i g i n a l   f r a g m e n t   o b j e c t   f o r   t h e   l a s t  
 	 	 	 	 	 	 / /   i t e m   i n s t e a d   o f   f i r s t   b e c a u s e   i t   c a n   e n d   u p   b e i n g   e m p t i e d   i n c o r r e c t l y  
 	 	 	 	 	 	 / /   i n   c e r t a i n   s i t u a t i o n s   ( B u g   # 8 0 7 0 ) .  
 	 	 	 	 	 	 / /   F r a g m e n t s   f r o m   t h e   f r a g m e n t   c a c h e   m u s t   a l w a y s   b e   c l o n e d   a n d   n e v e r   u s e d  
 	 	 	 	 	 	 / /   i n   p l a c e .  
 	 	 	 	 	 	 r e s u l t s . c a c h e a b l e   | |   ( l   >   1   & &   i   <   l a s t I n d e x )   ?  
 	 	 	 	 	 	 	 j Q u e r y . c l o n e (   f r a g m e n t ,   t r u e ,   t r u e   )   :  
 	 	 	 	 	 	 	 f r a g m e n t  
 	 	 	 	 	 ) ;  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 i f   (   s c r i p t s . l e n g t h   )   {  
 	 	 	 	 j Q u e r y . e a c h (   s c r i p t s ,   e v a l S c r i p t   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   t h i s ;  
 	 }  
 } ) ;  
  
 f u n c t i o n   r o o t (   e l e m ,   c u r   )   {  
 	 r e t u r n   j Q u e r y . n o d e N a m e ( e l e m ,   " t a b l e " )   ?  
 	 	 ( e l e m . g e t E l e m e n t s B y T a g N a m e ( " t b o d y " ) [ 0 ]   | |  
 	 	 e l e m . a p p e n d C h i l d ( e l e m . o w n e r D o c u m e n t . c r e a t e E l e m e n t ( " t b o d y " ) ) )   :  
 	 	 e l e m ;  
 }  
  
 f u n c t i o n   c l o n e C o p y E v e n t (   s r c ,   d e s t   )   {  
  
 	 i f   (   d e s t . n o d e T y p e   ! = =   1   | |   ! j Q u e r y . h a s D a t a (   s r c   )   )   {  
 	 	 r e t u r n ;  
 	 }  
  
 	 v a r   i n t e r n a l K e y   =   j Q u e r y . e x p a n d o ,  
 	 	 o l d D a t a   =   j Q u e r y . d a t a (   s r c   ) ,  
 	 	 c u r D a t a   =   j Q u e r y . d a t a (   d e s t ,   o l d D a t a   ) ;  
  
 	 / /   S w i t c h   t o   u s e   t h e   i n t e r n a l   d a t a   o b j e c t ,   i f   i t   e x i s t s ,   f o r   t h e   n e x t  
 	 / /   s t a g e   o f   d a t a   c o p y i n g  
 	 i f   (   ( o l d D a t a   =   o l d D a t a [   i n t e r n a l K e y   ] )   )   {  
 	 	 v a r   e v e n t s   =   o l d D a t a . e v e n t s ;  
 	 	 	 	 c u r D a t a   =   c u r D a t a [   i n t e r n a l K e y   ]   =   j Q u e r y . e x t e n d ( { } ,   o l d D a t a ) ;  
  
 	 	 i f   (   e v e n t s   )   {  
 	 	 	 d e l e t e   c u r D a t a . h a n d l e ;  
 	 	 	 c u r D a t a . e v e n t s   =   { } ;  
  
 	 	 	 f o r   (   v a r   t y p e   i n   e v e n t s   )   {  
 	 	 	 	 f o r   (   v a r   i   =   0 ,   l   =   e v e n t s [   t y p e   ] . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 	 	 j Q u e r y . e v e n t . a d d (   d e s t ,   t y p e   +   (   e v e n t s [   t y p e   ] [   i   ] . n a m e s p a c e   ?   " . "   :   " "   )   +   e v e n t s [   t y p e   ] [   i   ] . n a m e s p a c e ,   e v e n t s [   t y p e   ] [   i   ] ,   e v e n t s [   t y p e   ] [   i   ] . d a t a   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 }  
 }  
  
 f u n c t i o n   c l o n e F i x A t t r i b u t e s (   s r c ,   d e s t   )   {  
 	 v a r   n o d e N a m e ;  
  
 	 / /   W e   d o   n o t   n e e d   t o   d o   a n y t h i n g   f o r   n o n - E l e m e n t s  
 	 i f   (   d e s t . n o d e T y p e   ! = =   1   )   {  
 	 	 r e t u r n ;  
 	 }  
  
 	 / /   c l e a r A t t r i b u t e s   r e m o v e s   t h e   a t t r i b u t e s ,   w h i c h   w e   d o n ' t   w a n t ,  
 	 / /   b u t   a l s o   r e m o v e s   t h e   a t t a c h E v e n t   e v e n t s ,   w h i c h   w e   * d o *   w a n t  
 	 i f   (   d e s t . c l e a r A t t r i b u t e s   )   {  
 	 	 d e s t . c l e a r A t t r i b u t e s ( ) ;  
 	 }  
  
 	 / /   m e r g e A t t r i b u t e s ,   i n   c o n t r a s t ,   o n l y   m e r g e s   b a c k   o n   t h e  
 	 / /   o r i g i n a l   a t t r i b u t e s ,   n o t   t h e   e v e n t s  
 	 i f   (   d e s t . m e r g e A t t r i b u t e s   )   {  
 	 	 d e s t . m e r g e A t t r i b u t e s (   s r c   ) ;  
 	 }  
  
 	 n o d e N a m e   =   d e s t . n o d e N a m e . t o L o w e r C a s e ( ) ;  
  
 	 / /   I E 6 - 8   f a i l   t o   c l o n e   c h i l d r e n   i n s i d e   o b j e c t   e l e m e n t s   t h a t   u s e  
 	 / /   t h e   p r o p r i e t a r y   c l a s s i d   a t t r i b u t e   v a l u e   ( r a t h e r   t h a n   t h e   t y p e  
 	 / /   a t t r i b u t e )   t o   i d e n t i f y   t h e   t y p e   o f   c o n t e n t   t o   d i s p l a y  
 	 i f   (   n o d e N a m e   = = =   " o b j e c t "   )   {  
 	 	 d e s t . o u t e r H T M L   =   s r c . o u t e r H T M L ;  
  
 	 }   e l s e   i f   (   n o d e N a m e   = = =   " i n p u t "   & &   ( s r c . t y p e   = = =   " c h e c k b o x "   | |   s r c . t y p e   = = =   " r a d i o " )   )   {  
 	 	 / /   I E 6 - 8   f a i l s   t o   p e r s i s t   t h e   c h e c k e d   s t a t e   o f   a   c l o n e d   c h e c k b o x  
 	 	 / /   o r   r a d i o   b u t t o n .   W o r s e ,   I E 6 - 7   f a i l   t o   g i v e   t h e   c l o n e d   e l e m e n t  
 	 	 / /   a   c h e c k e d   a p p e a r a n c e   i f   t h e   d e f a u l t C h e c k e d   v a l u e   i s n ' t   a l s o   s e t  
 	 	 i f   (   s r c . c h e c k e d   )   {  
 	 	 	 d e s t . d e f a u l t C h e c k e d   =   d e s t . c h e c k e d   =   s r c . c h e c k e d ;  
 	 	 }  
  
 	 	 / /   I E 6 - 7   g e t   c o n f u s e d   a n d   e n d   u p   s e t t i n g   t h e   v a l u e   o f   a   c l o n e d  
 	 	 / /   c h e c k b o x / r a d i o   b u t t o n   t o   a n   e m p t y   s t r i n g   i n s t e a d   o f   " o n "  
 	 	 i f   (   d e s t . v a l u e   ! = =   s r c . v a l u e   )   {  
 	 	 	 d e s t . v a l u e   =   s r c . v a l u e ;  
 	 	 }  
  
 	 / /   I E 6 - 8   f a i l s   t o   r e t u r n   t h e   s e l e c t e d   o p t i o n   t o   t h e   d e f a u l t   s e l e c t e d  
 	 / /   s t a t e   w h e n   c l o n i n g   o p t i o n s  
 	 }   e l s e   i f   (   n o d e N a m e   = = =   " o p t i o n "   )   {  
 	 	 d e s t . s e l e c t e d   =   s r c . d e f a u l t S e l e c t e d ;  
  
 	 / /   I E 6 - 8   f a i l s   t o   s e t   t h e   d e f a u l t V a l u e   t o   t h e   c o r r e c t   v a l u e   w h e n  
 	 / /   c l o n i n g   o t h e r   t y p e s   o f   i n p u t   f i e l d s  
 	 }   e l s e   i f   (   n o d e N a m e   = = =   " i n p u t "   | |   n o d e N a m e   = = =   " t e x t a r e a "   )   {  
 	 	 d e s t . d e f a u l t V a l u e   =   s r c . d e f a u l t V a l u e ;  
 	 }  
  
 	 / /   E v e n t   d a t a   g e t s   r e f e r e n c e d   i n s t e a d   o f   c o p i e d   i f   t h e   e x p a n d o  
 	 / /   g e t s   c o p i e d   t o o  
 	 d e s t . r e m o v e A t t r i b u t e (   j Q u e r y . e x p a n d o   ) ;  
 }  
  
 j Q u e r y . b u i l d F r a g m e n t   =   f u n c t i o n (   a r g s ,   n o d e s ,   s c r i p t s   )   {  
 	 v a r   f r a g m e n t ,   c a c h e a b l e ,   c a c h e r e s u l t s ,  
 	 	 d o c   =   ( n o d e s   & &   n o d e s [ 0 ]   ?   n o d e s [ 0 ] . o w n e r D o c u m e n t   | |   n o d e s [ 0 ]   :   d o c u m e n t ) ;  
  
 	 / /   O n l y   c a c h e   " s m a l l "   ( 1 / 2   K B )   H T M L   s t r i n g s   t h a t   a r e   a s s o c i a t e d   w i t h   t h e   m a i n   d o c u m e n t  
 	 / /   C l o n i n g   o p t i o n s   l o s e s   t h e   s e l e c t e d   s t a t e ,   s o   d o n ' t   c a c h e   t h e m  
 	 / /   I E   6   d o e s n ' t   l i k e   i t   w h e n   y o u   p u t   < o b j e c t >   o r   < e m b e d >   e l e m e n t s   i n   a   f r a g m e n t  
 	 / /   A l s o ,   W e b K i t   d o e s   n o t   c l o n e   ' c h e c k e d '   a t t r i b u t e s   o n   c l o n e N o d e ,   s o   d o n ' t   c a c h e  
 	 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 "   & &   a r g s [ 0 ] . l e n g t h   <   5 1 2   & &   d o c   = = =   d o c u m e n t   & &  
 	 	 a r g s [ 0 ] . c h a r A t ( 0 )   = = =   " < "   & &   ! r n o c a c h e . t e s t (   a r g s [ 0 ]   )   & &   ( j Q u e r y . s u p p o r t . c h e c k C l o n e   | |   ! r c h e c k e d . t e s t (   a r g s [ 0 ]   ) )   )   {  
  
 	 	 c a c h e a b l e   =   t r u e ;  
  
 	 	 c a c h e r e s u l t s   =   j Q u e r y . f r a g m e n t s [   a r g s [ 0 ]   ] ;  
 	 	 i f   (   c a c h e r e s u l t s   & &   c a c h e r e s u l t s   ! = =   1   )   {  
 	 	 	 f r a g m e n t   =   c a c h e r e s u l t s ;  
 	 	 }  
 	 }  
  
 	 i f   (   ! f r a g m e n t   )   {  
 	 	 f r a g m e n t   =   d o c . c r e a t e D o c u m e n t F r a g m e n t ( ) ;  
 	 	 j Q u e r y . c l e a n (   a r g s ,   d o c ,   f r a g m e n t ,   s c r i p t s   ) ;  
 	 }  
  
 	 i f   (   c a c h e a b l e   )   {  
 	 	 j Q u e r y . f r a g m e n t s [   a r g s [ 0 ]   ]   =   c a c h e r e s u l t s   ?   f r a g m e n t   :   1 ;  
 	 }  
  
 	 r e t u r n   {   f r a g m e n t :   f r a g m e n t ,   c a c h e a b l e :   c a c h e a b l e   } ;  
 } ;  
  
 j Q u e r y . f r a g m e n t s   =   { } ;  
  
 j Q u e r y . e a c h ( {  
 	 a p p e n d T o :   " a p p e n d " ,  
 	 p r e p e n d T o :   " p r e p e n d " ,  
 	 i n s e r t B e f o r e :   " b e f o r e " ,  
 	 i n s e r t A f t e r :   " a f t e r " ,  
 	 r e p l a c e A l l :   " r e p l a c e W i t h "  
 } ,   f u n c t i o n (   n a m e ,   o r i g i n a l   )   {  
 	 j Q u e r y . f n [   n a m e   ]   =   f u n c t i o n (   s e l e c t o r   )   {  
 	 	 v a r   r e t   =   [ ] ,  
 	 	 	 i n s e r t   =   j Q u e r y (   s e l e c t o r   ) ,  
 	 	 	 p a r e n t   =   t h i s . l e n g t h   = = =   1   & &   t h i s [ 0 ] . p a r e n t N o d e ;  
  
 	 	 i f   (   p a r e n t   & &   p a r e n t . n o d e T y p e   = = =   1 1   & &   p a r e n t . c h i l d N o d e s . l e n g t h   = = =   1   & &   i n s e r t . l e n g t h   = = =   1   )   {  
 	 	 	 i n s e r t [   o r i g i n a l   ] (   t h i s [ 0 ]   ) ;  
 	 	 	 r e t u r n   t h i s ;  
  
 	 	 }   e l s e   {  
 	 	 	 f o r   (   v a r   i   =   0 ,   l   =   i n s e r t . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 	 v a r   e l e m s   =   ( i   >   0   ?   t h i s . c l o n e ( t r u e )   :   t h i s ) . g e t ( ) ;  
 	 	 	 	 j Q u e r y (   i n s e r t [ i ]   ) [   o r i g i n a l   ] (   e l e m s   ) ;  
 	 	 	 	 r e t   =   r e t . c o n c a t (   e l e m s   ) ;  
 	 	 	 }  
  
 	 	 	 r e t u r n   t h i s . p u s h S t a c k (   r e t ,   n a m e ,   i n s e r t . s e l e c t o r   ) ;  
 	 	 }  
 	 } ;  
 } ) ;  
  
 f u n c t i o n   g e t A l l (   e l e m   )   {  
 	 i f   (   " g e t E l e m e n t s B y T a g N a m e "   i n   e l e m   )   {  
 	 	 r e t u r n   e l e m . g e t E l e m e n t s B y T a g N a m e (   " * "   ) ;  
 	  
 	 }   e l s e   i f   (   " q u e r y S e l e c t o r A l l "   i n   e l e m   )   {  
 	 	 r e t u r n   e l e m . q u e r y S e l e c t o r A l l (   " * "   ) ;  
  
 	 }   e l s e   {  
 	 	 r e t u r n   [ ] ;  
 	 }  
 }  
  
 / /   U s e d   i n   c l e a n ,   f i x e s   t h e   d e f a u l t C h e c k e d   p r o p e r t y  
 f u n c t i o n   f i x D e f a u l t C h e c k e d (   e l e m   )   {  
 	 i f   (   e l e m . t y p e   = = =   " c h e c k b o x "   | |   e l e m . t y p e   = = =   " r a d i o "   )   {  
 	 	 e l e m . d e f a u l t C h e c k e d   =   e l e m . c h e c k e d ;  
 	 }  
 }  
 / /   F i n d s   a l l   i n p u t s   a n d   p a s s e s   t h e m   t o   f i x D e f a u l t C h e c k e d  
 f u n c t i o n   f i n d I n p u t s (   e l e m   )   {  
 	 i f   (   j Q u e r y . n o d e N a m e (   e l e m ,   " i n p u t "   )   )   {  
 	 	 f i x D e f a u l t C h e c k e d (   e l e m   ) ;  
 	 }   e l s e   i f   (   e l e m . g e t E l e m e n t s B y T a g N a m e   )   {  
 	 	 j Q u e r y . g r e p (   e l e m . g e t E l e m e n t s B y T a g N a m e ( " i n p u t " ) ,   f i x D e f a u l t C h e c k e d   ) ;  
 	 }  
 }  
  
 j Q u e r y . e x t e n d ( {  
 	 c l o n e :   f u n c t i o n (   e l e m ,   d a t a A n d E v e n t s ,   d e e p D a t a A n d E v e n t s   )   {  
 	 	 v a r   c l o n e   =   e l e m . c l o n e N o d e ( t r u e ) ,  
 	 	 	 	 s r c E l e m e n t s ,  
 	 	 	 	 d e s t E l e m e n t s ,  
 	 	 	 	 i ;  
  
 	 	 i f   (   ( ! j Q u e r y . s u p p o r t . n o C l o n e E v e n t   | |   ! j Q u e r y . s u p p o r t . n o C l o n e C h e c k e d )   & &  
 	 	 	 	 ( e l e m . n o d e T y p e   = = =   1   | |   e l e m . n o d e T y p e   = = =   1 1 )   & &   ! j Q u e r y . i s X M L D o c ( e l e m )   )   {  
 	 	 	 / /   I E   c o p i e s   e v e n t s   b o u n d   v i a   a t t a c h E v e n t   w h e n   u s i n g   c l o n e N o d e .  
 	 	 	 / /   C a l l i n g   d e t a c h E v e n t   o n   t h e   c l o n e   w i l l   a l s o   r e m o v e   t h e   e v e n t s  
 	 	 	 / /   f r o m   t h e   o r i g i n a l .   I n   o r d e r   t o   g e t   a r o u n d   t h i s ,   w e   u s e   s o m e  
 	 	 	 / /   p r o p r i e t a r y   m e t h o d s   t o   c l e a r   t h e   e v e n t s .   T h a n k s   t o   M o o T o o l s  
 	 	 	 / /   g u y s   f o r   t h i s   h o t n e s s .  
  
 	 	 	 c l o n e F i x A t t r i b u t e s (   e l e m ,   c l o n e   ) ;  
  
 	 	 	 / /   U s i n g   S i z z l e   h e r e   i s   c r a z y   s l o w ,   s o   w e   u s e   g e t E l e m e n t s B y T a g N a m e  
 	 	 	 / /   i n s t e a d  
 	 	 	 s r c E l e m e n t s   =   g e t A l l (   e l e m   ) ;  
 	 	 	 d e s t E l e m e n t s   =   g e t A l l (   c l o n e   ) ;  
  
 	 	 	 / /   W e i r d   i t e r a t i o n   b e c a u s e   I E   w i l l   r e p l a c e   t h e   l e n g t h   p r o p e r t y  
 	 	 	 / /   w i t h   a n   e l e m e n t   i f   y o u   a r e   c l o n i n g   t h e   b o d y   a n d   o n e   o f   t h e  
 	 	 	 / /   e l e m e n t s   o n   t h e   p a g e   h a s   a   n a m e   o r   i d   o f   " l e n g t h "  
 	 	 	 f o r   (   i   =   0 ;   s r c E l e m e n t s [ i ] ;   + + i   )   {  
 	 	 	 	 c l o n e F i x A t t r i b u t e s (   s r c E l e m e n t s [ i ] ,   d e s t E l e m e n t s [ i ]   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 / /   C o p y   t h e   e v e n t s   f r o m   t h e   o r i g i n a l   t o   t h e   c l o n e  
 	 	 i f   (   d a t a A n d E v e n t s   )   {  
 	 	 	 c l o n e C o p y E v e n t (   e l e m ,   c l o n e   ) ;  
  
 	 	 	 i f   (   d e e p D a t a A n d E v e n t s   )   {  
 	 	 	 	 s r c E l e m e n t s   =   g e t A l l (   e l e m   ) ;  
 	 	 	 	 d e s t E l e m e n t s   =   g e t A l l (   c l o n e   ) ;  
  
 	 	 	 	 f o r   (   i   =   0 ;   s r c E l e m e n t s [ i ] ;   + + i   )   {  
 	 	 	 	 	 c l o n e C o p y E v e n t (   s r c E l e m e n t s [ i ] ,   d e s t E l e m e n t s [ i ]   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 / /   R e t u r n   t h e   c l o n e d   s e t  
 	 	 r e t u r n   c l o n e ;  
 	 } ,  
  
 	 c l e a n :   f u n c t i o n (   e l e m s ,   c o n t e x t ,   f r a g m e n t ,   s c r i p t s   )   {  
 	 	 v a r   c h e c k S c r i p t T y p e ;  
  
 	 	 c o n t e x t   =   c o n t e x t   | |   d o c u m e n t ;  
  
 	 	 / /   ! c o n t e x t . c r e a t e E l e m e n t   f a i l s   i n   I E   w i t h   a n   e r r o r   b u t   r e t u r n s   t y p e o f   ' o b j e c t '  
 	 	 i f   (   t y p e o f   c o n t e x t . c r e a t e E l e m e n t   = = =   " u n d e f i n e d "   )   {  
 	 	 	 c o n t e x t   =   c o n t e x t . o w n e r D o c u m e n t   | |   c o n t e x t [ 0 ]   & &   c o n t e x t [ 0 ] . o w n e r D o c u m e n t   | |   d o c u m e n t ;  
 	 	 }  
  
 	 	 v a r   r e t   =   [ ] ;  
  
 	 	 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 + +   )   {  
 	 	 	 i f   (   t y p e o f   e l e m   = = =   " n u m b e r "   )   {  
 	 	 	 	 e l e m   + =   " " ;  
 	 	 	 }  
  
 	 	 	 i f   (   ! e l e m   )   {  
 	 	 	 	 c o n t i n u e ;  
 	 	 	 }  
  
 	 	 	 / /   C o n v e r t   h t m l   s t r i n g   i n t o   D O M   n o d e s  
 	 	 	 i f   (   t y p e o f   e l e m   = = =   " s t r i n g "   )   {  
 	 	 	 	 i f   (   ! r h t m l . t e s t (   e l e m   )   )   {  
 	 	 	 	 	 e l e m   =   c o n t e x t . c r e a t e T e x t N o d e (   e l e m   ) ;  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 / /   F i x   " X H T M L " - s t y l e   t a g s   i n   a l l   b r o w s e r s  
 	 	 	 	 	 e l e m   =   e l e m . r e p l a c e ( r x h t m l T a g ,   " < $ 1 > < / $ 2 > " ) ;  
  
 	 	 	 	 	 / /   T r i m   w h i t e s p a c e ,   o t h e r w i s e   i n d e x O f   w o n ' t   w o r k   a s   e x p e c t e d  
 	 	 	 	 	 v a r   t a g   =   ( r t a g N a m e . e x e c (   e l e m   )   | |   [ " " ,   " " ] ) [ 1 ] . t o L o w e r C a s e ( ) ,  
 	 	 	 	 	 	 w r a p   =   w r a p M a p [   t a g   ]   | |   w r a p M a p . _ d e f a u l t ,  
 	 	 	 	 	 	 d e p t h   =   w r a p [ 0 ] ,  
 	 	 	 	 	 	 d i v   =   c o n t e x t . c r e a t e E l e m e n t ( " d i v " ) ;  
  
 	 	 	 	 	 / /   G o   t o   h t m l   a n d   b a c k ,   t h e n   p e e l   o f f   e x t r a   w r a p p e r s  
 	 	 	 	 	 d i v . i n n e r H T M L   =   w r a p [ 1 ]   +   e l e m   +   w r a p [ 2 ] ;  
  
 	 	 	 	 	 / /   M o v e   t o   t h e   r i g h t   d e p t h  
 	 	 	 	 	 w h i l e   (   d e p t h - -   )   {  
 	 	 	 	 	 	 d i v   =   d i v . l a s t C h i l d ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 / /   R e m o v e   I E ' s   a u t o i n s e r t e d   < t b o d y >   f r o m   t a b l e   f r a g m e n t s  
 	 	 	 	 	 i f   (   ! j Q u e r y . s u p p o r t . t b o d y   )   {  
  
 	 	 	 	 	 	 / /   S t r i n g   w a s   a   < t a b l e > ,   * m a y *   h a v e   s p u r i o u s   < t b o d y >  
 	 	 	 	 	 	 v a r   h a s B o d y   =   r t b o d y . t e s t ( e l e m ) ,  
 	 	 	 	 	 	 	 t b o d y   =   t a g   = = =   " t a b l e "   & &   ! h a s B o d y   ?  
 	 	 	 	 	 	 	 	 d i v . f i r s t C h i l d   & &   d i v . f i r s t C h i l d . c h i l d N o d e s   :  
  
 	 	 	 	 	 	 	 	 / /   S t r i n g   w a s   a   b a r e   < t h e a d >   o r   < t f o o t >  
 	 	 	 	 	 	 	 	 w r a p [ 1 ]   = = =   " < t a b l e > "   & &   ! h a s B o d y   ?  
 	 	 	 	 	 	 	 	 	 d i v . c h i l d N o d e s   :  
 	 	 	 	 	 	 	 	 	 [ ] ;  
  
 	 	 	 	 	 	 f o r   (   v a r   j   =   t b o d y . l e n g t h   -   1 ;   j   > =   0   ;   - - j   )   {  
 	 	 	 	 	 	 	 i f   (   j Q u e r y . n o d e N a m e (   t b o d y [   j   ] ,   " t b o d y "   )   & &   ! t b o d y [   j   ] . c h i l d N o d e s . l e n g t h   )   {  
 	 	 	 	 	 	 	 	 t b o d y [   j   ] . p a r e n t N o d e . r e m o v e C h i l d (   t b o d y [   j   ]   ) ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
  
 	 	 	 	 	 / /   I E   c o m p l e t e l y   k i l l s   l e a d i n g   w h i t e s p a c e   w h e n   i n n e r H T M L   i s   u s e d  
 	 	 	 	 	 i f   (   ! j Q u e r y . s u p p o r t . l e a d i n g W h i t e s p a c e   & &   r l e a d i n g W h i t e s p a c e . t e s t (   e l e m   )   )   {  
 	 	 	 	 	 	 d i v . i n s e r t B e f o r e (   c o n t e x t . c r e a t e T e x t N o d e (   r l e a d i n g W h i t e s p a c e . e x e c ( e l e m ) [ 0 ]   ) ,   d i v . f i r s t C h i l d   ) ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 e l e m   =   d i v . c h i l d N o d e s ;  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 / /   R e s e t s   d e f a u l t C h e c k e d   f o r   a n y   r a d i o s   a n d   c h e c k b o x e s  
 	 	 	 / /   a b o u t   t o   b e   a p p e n d e d   t o   t h e   D O M   i n   I E   6 / 7   ( # 8 0 6 0 )  
 	 	 	 v a r   l e n ;  
 	 	 	 i f   (   ! j Q u e r y . s u p p o r t . a p p e n d C h e c k e d   )   {  
 	 	 	 	 i f   (   e l e m [ 0 ]   & &   t y p e o f   ( l e n   =   e l e m . l e n g t h )   = = =   " n u m b e r "   )   {  
 	 	 	 	 	 f o r   (   i   =   0 ;   i   <   l e n ;   i + +   )   {  
 	 	 	 	 	 	 f i n d I n p u t s (   e l e m [ i ]   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 f i n d I n p u t s (   e l e m   ) ;  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 i f   (   e l e m . n o d e T y p e   )   {  
 	 	 	 	 r e t . p u s h (   e l e m   ) ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 r e t   =   j Q u e r y . m e r g e (   r e t ,   e l e m   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 i f   (   f r a g m e n t   )   {  
 	 	 	 c h e c k S c r i p t T y p e   =   f u n c t i o n (   e l e m   )   {  
 	 	 	 	 r e t u r n   ! e l e m . t y p e   | |   r s c r i p t T y p e . t e s t (   e l e m . t y p e   ) ;  
 	 	 	 } ;  
 	 	 	 f o r   (   i   =   0 ;   r e t [ i ] ;   i + +   )   {  
 	 	 	 	 i f   (   s c r i p t s   & &   j Q u e r y . n o d e N a m e (   r e t [ i ] ,   " s c r i p t "   )   & &   ( ! r e t [ i ] . t y p e   | |   r e t [ i ] . t y p e . t o L o w e r C a s e ( )   = = =   " t e x t / j a v a s c r i p t " )   )   {  
 	 	 	 	 	 s c r i p t s . p u s h (   r e t [ i ] . p a r e n t N o d e   ?   r e t [ i ] . p a r e n t N o d e . r e m o v e C h i l d (   r e t [ i ]   )   :   r e t [ i ]   ) ;  
  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 i f   (   r e t [ i ] . n o d e T y p e   = = =   1   )   {  
 	 	 	 	 	 	 v a r   j s T a g s   =   j Q u e r y . g r e p (   r e t [ i ] . g e t E l e m e n t s B y T a g N a m e (   " s c r i p t "   ) ,   c h e c k S c r i p t T y p e   ) ;  
  
 	 	 	 	 	 	 r e t . s p l i c e . a p p l y (   r e t ,   [ i   +   1 ,   0 ] . c o n c a t (   j s T a g s   )   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 f r a g m e n t . a p p e n d C h i l d (   r e t [ i ]   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   r e t ;  
 	 } ,  
  
 	 c l e a n D a t a :   f u n c t i o n (   e l e m s   )   {  
 	 	 v a r   d a t a ,   i d ,   c a c h e   =   j Q u e r y . c a c h e ,   i n t e r n a l K e y   =   j Q u e r y . e x p a n d o ,   s p e c i a l   =   j Q u e r y . e v e n t . s p e c i a l ,  
 	 	 	 d e l e t e E x p a n d o   =   j Q u e r y . s u p p o r t . d e l e t e E x p a n d o ;  
  
 	 	 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 + +   )   {  
 	 	 	 i f   (   e l e m . n o d e N a m e   & &   j Q u e r y . n o D a t a [ e l e m . n o d e N a m e . t o L o w e r C a s e ( ) ]   )   {  
 	 	 	 	 c o n t i n u e ;  
 	 	 	 }  
  
 	 	 	 i d   =   e l e m [   j Q u e r y . e x p a n d o   ] ;  
  
 	 	 	 i f   (   i d   )   {  
 	 	 	 	 d a t a   =   c a c h e [   i d   ]   & &   c a c h e [   i d   ] [   i n t e r n a l K e y   ] ;  
  
 	 	 	 	 i f   (   d a t a   & &   d a t a . e v e n t s   )   {  
 	 	 	 	 	 f o r   (   v a r   t y p e   i n   d a t a . e v e n t s   )   {  
 	 	 	 	 	 	 i f   (   s p e c i a l [   t y p e   ]   )   {  
 	 	 	 	 	 	 	 j Q u e r y . e v e n t . r e m o v e (   e l e m ,   t y p e   ) ;  
  
 	 	 	 	 	 	 / /   T h i s   i s   a   s h o r t c u t   t o   a v o i d   j Q u e r y . e v e n t . r e m o v e ' s   o v e r h e a d  
 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 j Q u e r y . r e m o v e E v e n t (   e l e m ,   t y p e ,   d a t a . h a n d l e   ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
  
 	 	 	 	 	 / /   N u l l   t h e   D O M   r e f e r e n c e   t o   a v o i d   I E 6 / 7 / 8   l e a k   ( # 7 0 5 4 )  
 	 	 	 	 	 i f   (   d a t a . h a n d l e   )   {  
 	 	 	 	 	 	 d a t a . h a n d l e . e l e m   =   n u l l ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   d e l e t e E x p a n d o   )   {  
 	 	 	 	 	 d e l e t e   e l e m [   j Q u e r y . e x p a n d o   ] ;  
  
 	 	 	 	 }   e l s e   i f   (   e l e m . r e m o v e A t t r i b u t e   )   {  
 	 	 	 	 	 e l e m . r e m o v e A t t r i b u t e (   j Q u e r y . e x p a n d o   ) ;  
 	 	 	 	 }  
  
 	 	 	 	 d e l e t e   c a c h e [   i d   ] ;  
 	 	 	 }  
 	 	 }  
 	 }  
 } ) ;  
  
 f u n c t i o n   e v a l S c r i p t (   i ,   e l e m   )   {  
 	 i f   (   e l e m . s r c   )   {  
 	 	 j Q u e r y . a j a x ( {  
 	 	 	 u r l :   e l e m . s r c ,  
 	 	 	 a s y n c :   f a l s e ,  
 	 	 	 d a t a T y p e :   " s c r i p t "  
 	 	 } ) ;  
 	 }   e l s e   {  
 	 	 j Q u e r y . g l o b a l E v a l (   e l e m . t e x t   | |   e l e m . t e x t C o n t e n t   | |   e l e m . i n n e r H T M L   | |   " "   ) ;  
 	 }  
  
 	 i f   (   e l e m . p a r e n t N o d e   )   {  
 	 	 e l e m . p a r e n t N o d e . r e m o v e C h i l d (   e l e m   ) ;  
 	 }  
 }  
  
  
  
  
 v a r   r a l p h a   =   / a l p h a \ ( [ ^ ) ] * \ ) / i ,  
 	 r o p a c i t y   =   / o p a c i t y = ( [ ^ ) ] * ) / ,  
 	 r d a s h A l p h a   =   / - ( [ a - z ] ) / i g ,  
 	 / /   f i x e d   f o r   I E 9 ,   s e e   # 8 3 4 6  
 	 r u p p e r   =   / ( [ A - Z ] | ^ m s ) / g ,  
 	 r n u m p x   =   / ^ - ? \ d + ( ? : p x ) ? $ / i ,  
 	 r n u m   =   / ^ - ? \ d / ,  
 	 r r e l N u m   =   / ^ [ + \ - ] = / ,  
 	 r r e l N u m F i l t e r   =   / [ ^ + \ - \ . \ d e ] + / g ,  
  
 	 c s s S h o w   =   {   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 :   " h i d d e n " ,   d i s p l a y :   " b l o c k "   } ,  
 	 c s s W i d t h   =   [   " L e f t " ,   " R i g h t "   ] ,  
 	 c s s H e i g h t   =   [   " T o p " ,   " B o t t o m "   ] ,  
 	 c u r C S S ,  
  
 	 g e t C o m p u t e d S t y l e ,  
 	 c u r r e n t S t y l e ,  
  
 	 f c a m e l C a s e   =   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 ( ) ;  
 	 } ;  
  
 j Q u e r y . f n . c s s   =   f u n c t i o n (   n a m e ,   v a l u e   )   {  
 	 / /   S e t t i n g   ' u n d e f i n e d '   i s   a   n o - o p  
 	 i f   (   a r g u m e n t s . l e n g t h   = = =   2   & &   v a l u e   = = =   u n d e f i n e d   )   {  
 	 	 r e t u r n   t h i s ;  
 	 }  
  
 	 r e t u r n   j Q u e r y . a c c e s s (   t h i s ,   n a m e ,   v a l u e ,   t r u e ,   f u n c t i o n (   e l e m ,   n a m 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   ?  
 	 	 	 j Q u e r y . s t y l e (   e l e m ,   n a m e ,   v a l u e   )   :  
 	 	 	 j Q u e r y . c s s (   e l e m ,   n a m e   ) ;  
 	 } ) ;  
 } ;  
  
 j Q u e r y . e x t e n d ( {  
 	 / /   A d d   i n   s t y l e   p r o p e r t y   h o o k s   f o r   o v e r r i d i n g   t h e   d e f a u l t  
 	 / /   b e h a v i o r   o f   g e t t i n g   a n d   s e t t i n g   a   s t y l e   p r o p e r t y  
 	 c s s H o o k s :   {  
 	 	 o p a c i t y :   {  
 	 	 	 g e t :   f u n c t i o n (   e l e m ,   c o m p u t e d   )   {  
 	 	 	 	 i f   (   c o m p u t e d   )   {  
 	 	 	 	 	 / /   W e   s h o u l d   a l w a y s   g e t   a   n u m b e r   b a c k   f r o m   o p a c i t y  
 	 	 	 	 	 v a r   r e t   =   c u r C S S (   e l e m ,   " o p a c i t y " ,   " o p a c i t y "   ) ;  
 	 	 	 	 	 r e t u r n   r e t   = = =   " "   ?   " 1 "   :   r e t ;  
  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 r e t u r n   e l e m . s t y l e . o p a c i t y ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 } ,  
  
 	 / /   E x c l u d e   t h e   f o l l o w i n g   c s s   p r o p e r t i e s   t o   a d d   p x  
 	 c s s N u m b e r :   {  
 	 	 " z I n d e x " :   t r u e ,  
 	 	 " f o n t W e i g h t " :   t r u e ,  
 	 	 " o p a c i t y " :   t r u e ,  
 	 	 " z o o m " :   t r u e ,  
 	 	 " l i n e H e i g h t " :   t r u e ,  
 	 	 " w i d o w s " :   t r u e ,  
 	 	 " o r p h a n s " :   t r u e  
 	 } ,  
  
 	 / /   A d d   i n   p r o p e r t i e s   w h o s e   n a m e s   y o u   w i s h   t o   f i x   b e f o r e  
 	 / /   s e t t i n g   o r   g e t t i n g   t h e   v a l u e  
 	 c s s P r o p s :   {  
 	 	 / /   n o r m a l i z e   f l o a t   c s s   p r o p e r t y  
 	 	 " f l o a t " :   j Q u e r y . s u p p o r t . c s s F l o a t   ?   " c s s F l o a t "   :   " s t y l e F l o a t "  
 	 } ,  
  
 	 / /   G e t   a n d   s e t   t h e   s t y l e   p r o p e r t y   o n   a   D O M   N o d e  
 	 s t y l e :   f u n c t i o n (   e l e m ,   n a m e ,   v a l u e ,   e x t r a   )   {  
 	 	 / /   D o n ' t   s e t   s t y l e s   o n   t e x t   a n d   c o m m e n t   n o d e s  
 	 	 i f   (   ! e l e m   | |   e l e m . n o d e T y p e   = = =   3   | |   e l e m . n o d e T y p e   = = =   8   | |   ! e l e m . s t y l e   )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
  
 	 	 / /   M a k e   s u r e   t h a t   w e ' r e   w o r k i n g   w i t h   t h e   r i g h t   n a m e  
 	 	 v a r   r e t ,   t y p e ,   o r i g N a m e   =   j Q u e r y . c a m e l C a s e (   n a m e   ) ,  
 	 	 	 s t y l e   =   e l e m . s t y l e ,   h o o k s   =   j Q u e r y . c s s H o o k s [   o r i g N a m e   ] ;  
  
 	 	 n a m e   =   j Q u e r y . c s s P r o p s [   o r i g N a m e   ]   | |   o r i g N a m e ;  
  
 	 	 / /   C h e c k   i f   w e ' r e   s e t t i n g   a   v a l u e  
 	 	 i f   (   v a l u e   ! = =   u n d e f i n e d   )   {  
 	 	 	 t y p e   =   t y p e o f   v a l u e ;  
  
 	 	 	 / /   M a k e   s u r e   t h a t   N a N   a n d   n u l l   v a l u e s   a r e n ' t   s e t .   S e e :   # 7 1 1 6  
 	 	 	 i f   (   t y p e   = = =   " n u m b e r "   & &   i s N a N (   v a l u e   )   | |   v a l u e   = =   n u l l   )   {  
 	 	 	 	 r e t u r n ;  
 	 	 	 }  
  
 	 	 	 / /   c o n v e r t   r e l a t i v e   n u m b e r   s t r i n g s   ( + =   o r   - = )   t o   r e l a t i v e   n u m b e r s .   # 7 3 4 5  
 	 	 	 i f   (   t y p e   = = =   " s t r i n g "   & &   r r e l N u m . t e s t (   v a l u e   )   )   {  
 	 	 	 	 v a l u e   =   + v a l u e . r e p l a c e (   r r e l N u m F i l t e r ,   " "   )   +   p a r s e F l o a t (   j Q u e r y . c s s (   e l e m ,   n a m e   )   ) ;  
 	 	 	 }  
  
 	 	 	 / /   I f   a   n u m b e r   w a s   p a s s e d   i n ,   a d d   ' p x '   t o   t h e   ( e x c e p t   f o r   c e r t a i n   C S S   p r o p e r t i e s )  
 	 	 	 i f   (   t y p e   = = =   " n u m b e r "   & &   ! j Q u e r y . c s s N u m b e r [   o r i g N a m e   ]   )   {  
 	 	 	 	 v a l u e   + =   " p x " ;  
 	 	 	 }  
  
 	 	 	 / /   I f   a   h o o k   w a s   p r o v i d e d ,   u s e   t h a t   v a l u e ,   o t h e r w i s e   j u s t   s e t   t h e   s p e c i f i e d   v a l u e  
 	 	 	 i f   (   ! h o o k s   | |   ! ( " s e t "   i n   h o o k s )   | |   ( v a l u e   =   h o o k s . s e t (   e l e m ,   v a l u e   ) )   ! = =   u n d e f i n e d   )   {  
 	 	 	 	 / /   W r a p p e d   t o   p r e v e n t   I E   f r o m   t h r o w i n g   e r r o r s   w h e n   ' i n v a l i d '   v a l u e s   a r e   p r o v i d e d  
 	 	 	 	 / /   F i x e s   b u g   # 5 5 0 9  
 	 	 	 	 t r y   {  
 	 	 	 	 	 s t y l e [   n a m e   ]   =   v a l u e ;  
 	 	 	 	 }   c a t c h ( e )   { }  
 	 	 	 }  
  
 	 	 }   e l s e   {  
 	 	 	 / /   I f   a   h o o k   w a s   p r o v i d e d   g e t   t h e   n o n - c o m p u t e d   v a l u e   f r o m   t h e r e  
 	 	 	 i f   (   h o o k s   & &   " g e t "   i n   h o o k s   & &   ( r e t   =   h o o k s . g e t (   e l e m ,   f a l s e ,   e x t r a   ) )   ! = =   u n d e f i n e d   )   {  
 	 	 	 	 r e t u r n   r e t ;  
 	 	 	 }  
  
 	 	 	 / /   O t h e r w i s e   j u s t   g e t   t h e   v a l u e   f r o m   t h e   s t y l e   o b j e c t  
 	 	 	 r e t u r n   s t y l e [   n a m e   ] ;  
 	 	 }  
 	 } ,  
  
 	 c s s :   f u n c t i o n (   e l e m ,   n a m e ,   e x t r a   )   {  
 	 	 v a r   r e t ,   h o o k s ;  
  
 	 	 / /   M a k e   s u r e   t h a t   w e ' r e   w o r k i n g   w i t h   t h e   r i g h t   n a m e  
 	 	 n a m e   =   j Q u e r y . c a m e l C a s e (   n a m e   ) ;  
 	 	 h o o k s   =   j Q u e r y . c s s H o o k s [   n a m e   ] ;  
 	 	 n a m e   =   j Q u e r y . c s s P r o p s [   n a m e   ]   | |   n a m e ;  
  
 	 	 / /   c s s F l o a t   n e e d s   a   s p e c i a l   t r e a t m e n t  
 	 	 i f   (   n a m e   = = =   " c s s F l o a t "   )   {  
 	 	 	 n a m e   =   " f l o a t " ;  
 	 	 }  
  
 	 	 / /   I f   a   h o o k   w a s   p r o v i d e d   g e t   t h e   c o m p u t e d   v a l u e   f r o m   t h e r e  
 	 	 i f   (   h o o k s   & &   " g e t "   i n   h o o k s   & &   ( r e t   =   h o o k s . g e t (   e l e m ,   t r u e ,   e x t r a   ) )   ! = =   u n d e f i n e d   )   {  
 	 	 	 r e t u r n   r e t ;  
  
 	 	 / /   O t h e r w i s e ,   i f   a   w a y   t o   g e t   t h e   c o m p u t e d   v a l u e   e x i s t s ,   u s e   t h a t  
 	 	 }   e l s e   i f   (   c u r C S S   )   {  
 	 	 	 r e t u r n   c u r C S S (   e l e m ,   n a m e   ) ;  
 	 	 }  
 	 } ,  
  
 	 / /   A   m e t h o d   f o r   q u i c k l y   s w a p p i n g   i n / o u t   C S S   p r o p e r t i e s   t o   g e t   c o r r e c t   c a l c u l a t i o n s  
 	 s w a p :   f u n c t i o n (   e l e m ,   o p t i o n s ,   c a l l b a c k   )   {  
 	 	 v a r   o l d   =   { } ;  
  
 	 	 / /   R e m e m b e r   t h e   o l d   v a l u e s ,   a n d   i n s e r t   t h e   n e w   o n e s  
 	 	 f o r   (   v a r   n a m e   i n   o p t i o n s   )   {  
 	 	 	 o l d [   n a m e   ]   =   e l e m . s t y l e [   n a m e   ] ;  
 	 	 	 e l e m . s t y l e [   n a m e   ]   =   o p t i o n s [   n a m e   ] ;  
 	 	 }  
  
 	 	 c a l l b a c k . c a l l (   e l e m   ) ;  
  
 	 	 / /   R e v e r t   t h e   o l d   v a l u e s  
 	 	 f o r   (   n a m e   i n   o p t i o n s   )   {  
 	 	 	 e l e m . s t y l e [   n a m e   ]   =   o l d [   n a m e   ] ;  
 	 	 }  
 	 } ,  
  
 	 c a m e l C a s e :   f u n c t i o n (   s t r i n g   )   {  
 	 	 r e t u r n   s t r i n g . r e p l a c e (   r d a s h A l p h a ,   f c a m e l C a s e   ) ;  
 	 }  
 } ) ;  
  
 / /   D E P R E C A T E D ,   U s e   j Q u e r y . c s s ( )   i n s t e a d  
 j Q u e r y . c u r C S S   =   j Q u e r y . c s s ;  
  
 j Q u e r y . e a c h ( [ " h e i g h t " ,   " w i d t h " ] ,   f u n c t i o n (   i ,   n a m e   )   {  
 	 j Q u e r y . c s s H o o k s [   n a m e   ]   =   {  
 	 	 g e t :   f u n c t i o n (   e l e m ,   c o m p u t e d ,   e x t r a   )   {  
 	 	 	 v a r   v a l ;  
  
 	 	 	 i f   (   c o m p u t e d   )   {  
 	 	 	 	 i f   (   e l e m . o f f s e t W i d t h   ! = =   0   )   {  
 	 	 	 	 	 v a l   =   g e t W H (   e l e m ,   n a m e ,   e x t r a   ) ;  
  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 j Q u e r y . s w a p (   e l e m ,   c s s S h o w ,   f u n c t i o n ( )   {  
 	 	 	 	 	 	 v a l   =   g e t W H (   e l e m ,   n a m e ,   e x t r a   ) ;  
 	 	 	 	 	 } ) ;  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   v a l   < =   0   )   {  
 	 	 	 	 	 v a l   =   c u r C S S (   e l e m ,   n a m e ,   n a m e   ) ;  
  
 	 	 	 	 	 i f   (   v a l   = = =   " 0 p x "   & &   c u r r e n t S t y l e   )   {  
 	 	 	 	 	 	 v a l   =   c u r r e n t S t y l e (   e l e m ,   n a m e ,   n a m e   ) ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 i f   (   v a l   ! =   n u l l   )   {  
 	 	 	 	 	 	 / /   S h o u l d   r e t u r n   " a u t o "   i n s t e a d   o f   0 ,   u s e   0   f o r  
 	 	 	 	 	 	 / /   t e m p o r a r y   b a c k w a r d s - c o m p a t  
 	 	 	 	 	 	 r e t u r n   v a l   = = =   " "   | |   v a l   = = =   " a u t o "   ?   " 0 p x "   :   v a l ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   v a l   <   0   | |   v a l   = =   n u l l   )   {  
 	 	 	 	 	 v a l   =   e l e m . s t y l e [   n a m e   ] ;  
  
 	 	 	 	 	 / /   S h o u l d   r e t u r n   " a u t o "   i n s t e a d   o f   0 ,   u s e   0   f o r  
 	 	 	 	 	 / /   t e m p o r a r y   b a c k w a r d s - c o m p a t  
 	 	 	 	 	 r e t u r n   v a l   = = =   " "   | |   v a l   = = =   " a u t o "   ?   " 0 p x "   :   v a l ;  
 	 	 	 	 }  
  
 	 	 	 	 r e t u r n   t y p e o f   v a l   = = =   " s t r i n g "   ?   v a l   :   v a l   +   " p x " ;  
 	 	 	 }  
 	 	 } ,  
  
 	 	 s e t :   f u n c t i o n (   e l e m ,   v a l u e   )   {  
 	 	 	 i f   (   r n u m p x . t e s t (   v a l u e   )   )   {  
 	 	 	 	 / /   i g n o r e   n e g a t i v e   w i d t h   a n d   h e i g h t   v a l u e s   # 1 5 9 9  
 	 	 	 	 v a l u e   =   p a r s e F l o a t ( v a l u e ) ;  
  
 	 	 	 	 i f   (   v a l u e   > =   0   )   {  
 	 	 	 	 	 r e t u r n   v a l u e   +   " p x " ;  
 	 	 	 	 }  
  
 	 	 	 }   e l s e   {  
 	 	 	 	 r e t u r n   v a l u e ;  
 	 	 	 }  
 	 	 }  
 	 } ;  
 } ) ;  
  
 i f   (   ! j Q u e r y . s u p p o r t . o p a c i t y   )   {  
 	 j Q u e r y . c s s H o o k s . o p a c i t y   =   {  
 	 	 g e t :   f u n c t i o n (   e l e m ,   c o m p u t e d   )   {  
 	 	 	 / /   I E   u s e s   f i l t e r s   f o r   o p a c i t y  
 	 	 	 r e t u r n   r o p a c i t y . t e s t (   ( c o m p u t e d   & &   e l e m . c u r r e n t S t y l e   ?   e l e m . c u r r e n t S t y l e . f i l t e r   :   e l e m . s t y l e . f i l t e r )   | |   " "   )   ?  
 	 	 	 	 (   p a r s e F l o a t (   R e g E x p . $ 1   )   /   1 0 0   )   +   " "   :  
 	 	 	 	 c o m p u t e d   ?   " 1 "   :   " " ;  
 	 	 } ,  
  
 	 	 s e t :   f u n c t i o n (   e l e m ,   v a l u e   )   {  
 	 	 	 v a r   s t y l e   =   e l e m . s t y l e ,  
 	 	 	 	 c u r r e n t S t y l e   =   e l e m . c u r r e n t S t y l e ;  
  
 	 	 	 / /   I E   h a s   t r o u b l e   w i t h   o p a c i t y   i f   i t   d o e s   n o t   h a v e   l a y o u t  
 	 	 	 / /   F o r c e   i t   b y   s e t t i n g   t h e   z o o m   l e v e l  
 	 	 	 s t y l e . z o o m   =   1 ;  
  
 	 	 	 / /   S e t   t h e   a l p h a   f i l t e r   t o   s e t   t h e   o p a c i t y  
 	 	 	 v a r   o p a c i t y   =   j Q u e r y . i s N a N (   v a l u e   )   ?  
 	 	 	 	 " "   :  
 	 	 	 	 " a l p h a ( o p a c i t y = "   +   v a l u e   *   1 0 0   +   " ) " ,  
 	 	 	 	 f i l t e r   =   c u r r e n t S t y l e   & &   c u r r e n t S t y l e . f i l t e r   | |   s t y l e . f i l t e r   | |   " " ;  
  
 	 	 	 s t y l e . f i l t e r   =   r a l p h a . t e s t (   f i l t e r   )   ?  
 	 	 	 	 f i l t e r . r e p l a c e (   r a l p h a ,   o p a c i t y   )   :  
 	 	 	 	 f i l t e r   +   "   "   +   o p a c i t y ;  
 	 	 }  
 	 } ;  
 }  
  
 j Q u e r y ( f u n c t i o n ( )   {  
 	 / /   T h i s   h o o k   c a n n o t   b e   a d d e d   u n t i l   D O M   r e a d y   b e c a u s e   t h e   s u p p o r t   t e s t  
 	 / /   f o r   i t   i s   n o t   r u n   u n t i l   a f t e r   D O M   r e a d y  
 	 i f   (   ! j Q u e r y . s u p p o r t . r e l i a b l e M a r g i n R i g h t   )   {  
 	 	 j Q u e r y . c s s H o o k s . m a r g i n R i g h t   =   {  
 	 	 	 g e t :   f u n c t i o n (   e l e m ,   c o m p u t e d   )   {  
 	 	 	 	 / /   W e b K i t   B u g   1 3 3 4 3   -   g e t C o m p u t e d S t y l e   r e t u r n s   w r o n g   v a l u e   f o r   m a r g i n - r i g h t  
 	 	 	 	 / /   W o r k   a r o u n d   b y   t e m p o r a r i l y   s e t t i n g   e l e m e n t   d i s p l a y   t o   i n l i n e - b l o c k  
 	 	 	 	 v a r   r e t ;  
 	 	 	 	 j Q u e r y . s w a p (   e l e m ,   {   " d i s p l a y " :   " i n l i n e - b l o c k "   } ,   f u n c t i o n ( )   {  
 	 	 	 	 	 i f   (   c o m p u t e d   )   {  
 	 	 	 	 	 	 r e t   =   c u r C S S (   e l e m ,   " m a r g i n - r i g h t " ,   " m a r g i n R i g h t "   ) ;  
 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 r e t   =   e l e m . s t y l e . m a r g i n R i g h t ;  
 	 	 	 	 	 }  
 	 	 	 	 } ) ;  
 	 	 	 	 r e t u r n   r e t ;  
 	 	 	 }  
 	 	 } ;  
 	 }  
 } ) ;  
  
 i f   (   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   )   {  
 	 g e t C o m p u t e d S t y l e   =   f u n c t i o n (   e l e m ,   n a m e   )   {  
 	 	 v a r   r e t ,   d e f a u l t V i e w ,   c o m p u t e d S t y l e ;  
  
 	 	 n a m e   =   n a m e . r e p l a c e (   r u p p e r ,   " - $ 1 "   ) . t o L o w e r C a s e ( ) ;  
  
 	 	 i f   (   ! ( d e f a u l t V i e w   =   e l e m . o w n e r D o c u m e n t . d e f a u l t V i e w )   )   {  
 	 	 	 r e t u r n   u n d e f i n e d ;  
 	 	 }  
  
 	 	 i f   (   ( c o m p u t e d S t y l e   =   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 (   e l e m ,   n u l l   ) )   )   {  
 	 	 	 r e t   =   c o m p u t e d S t y l e . g e t P r o p e r t y V a l u e (   n a m e   ) ;  
 	 	 	 i f   (   r e t   = = =   " "   & &   ! j Q u e r y . c o n t a i n s (   e l e m . o w n e r D o c u m e n t . d o c u m e n t E l e m e n t ,   e l e m   )   )   {  
 	 	 	 	 r e t   =   j Q u e r y . s t y l e (   e l e m ,   n a m e   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   r e t ;  
 	 } ;  
 }  
  
 i f   (   d o c u m e n t . d o c u m e n t E l e m e n t . c u r r e n t S t y l e   )   {  
 	 c u r r e n t S t y l e   =   f u n c t i o n (   e l e m ,   n a m e   )   {  
 	 	 v a r   l e f t ,  
 	 	 	 r e t   =   e l e m . c u r r e n t S t y l e   & &   e l e m . c u r r e n t S t y l e [   n a m e   ] ,  
 	 	 	 r s L e f t   =   e l e m . r u n t i m e S t y l e   & &   e l e m . r u n t i m e S t y l e [   n a m e   ] ,  
 	 	 	 s t y l e   =   e l e m . s t y l e ;  
  
 	 	 / /   F r o m   t h e   a w e s o m e   h a c k   b y   D e a n   E d w a r d s  
 	 	 / /   h t t p : / / e r i k . e a e . n e t / a r c h i v e s / 2 0 0 7 / 0 7 / 2 7 / 1 8 . 5 4 . 1 5 / # c o m m e n t - 1 0 2 2 9 1  
  
 	 	 / /   I f   w e ' r e   n o t   d e a l i n g   w i t h   a   r e g u l a r   p i x e l   n u m b e r  
 	 	 / /   b u t   a   n u m b e r   t h a t   h a s   a   w e i r d   e n d i n g ,   w e   n e e d   t o   c o n v e r t   i t   t o   p i x e l s  
 	 	 i f   (   ! r n u m p x . t e s t (   r e t   )   & &   r n u m . t e s t (   r e t   )   )   {  
 	 	 	 / /   R e m e m b e r   t h e   o r i g i n a l   v a l u e s  
 	 	 	 l e f t   =   s t y l e . l e f t ;  
  
 	 	 	 / /   P u t   i n   t h e   n e w   v a l u e s   t o   g e t   a   c o m p u t e d   v a l u e   o u t  
 	 	 	 i f   (   r s L e f t   )   {  
 	 	 	 	 e l e m . r u n t i m e S t y l e . l e f t   =   e l e m . c u r r e n t S t y l e . l e f t ;  
 	 	 	 }  
 	 	 	 s t y l e . l e f t   =   n a m e   = = =   " f o n t S i z e "   ?   " 1 e m "   :   ( r e t   | |   0 ) ;  
 	 	 	 r e t   =   s t y l e . p i x e l L e f t   +   " p x " ;  
  
 	 	 	 / /   R e v e r t   t h e   c h a n g e d   v a l u e s  
 	 	 	 s t y l e . l e f t   =   l e f t ;  
 	 	 	 i f   (   r s L e f t   )   {  
 	 	 	 	 e l e m . r u n t i m e S t y l e . l e f t   =   r s L e f t ;  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   r e t   = = =   " "   ?   " a u t o "   :   r e t ;  
 	 } ;  
 }  
  
 c u r C S S   =   g e t C o m p u t e d S t y l e   | |   c u r r e n t S t y l e ;  
  
 f u n c t i o n   g e t W H (   e l e m ,   n a m e ,   e x t r a   )   {  
 	 v a r   w h i c h   =   n a m e   = = =   " w i d t h "   ?   c s s W i d t h   :   c s s H e i g h t ,  
 	 	 v a l   =   n a m e   = = =   " w i d t h "   ?   e l e m . o f f s e t W i d t h   :   e l e m . o f f s e t H e i g h t ;  
  
 	 i f   (   e x t r a   = = =   " b o r d e r "   )   {  
 	 	 r e t u r n   v a l ;  
 	 }  
  
 	 j Q u e r y . e a c h (   w h i c h ,   f u n c t i o n ( )   {  
 	 	 i f   (   ! e x t r a   )   {  
 	 	 	 v a l   - =   p a r s e F l o a t ( j Q u e r y . c s s (   e l e m ,   " p a d d i n g "   +   t h i s   ) )   | |   0 ;  
 	 	 }  
  
 	 	 i f   (   e x t r a   = = =   " m a r g i n "   )   {  
 	 	 	 v a l   + =   p a r s e F l o a t ( j Q u e r y . c s s (   e l e m ,   " m a r g i n "   +   t h i s   ) )   | |   0 ;  
  
 	 	 }   e l s e   {  
 	 	 	 v a l   - =   p a r s e F l o a t ( j Q u e r y . c s s (   e l e m ,   " b o r d e r "   +   t h i s   +   " W i d t h "   ) )   | |   0 ;  
 	 	 }  
 	 } ) ;  
  
 	 r e t u r n   v a l ;  
 }  
  
 i f   (   j Q u e r y . e x p r   & &   j Q u e r y . e x p r . f i l t e r s   )   {  
 	 j Q u e r y . e x p r . f i l t e r s . h i d d e n   =   f u n c t i o n (   e l e m   )   {  
 	 	 v a r   w i d t h   =   e l e m . o f f s e t W i d t h ,  
 	 	 	 h e i g h t   =   e l e m . o f f s e t H e i g h t ;  
  
 	 	 r e t u r n   ( w i d t h   = = =   0   & &   h e i g h t   = = =   0 )   | |   ( ! j Q u e r y . s u p p o r t . r e l i a b l e H i d d e n O f f s e t s   & &   ( e l e m . s t y l e . d i s p l a y   | |   j Q u e r y . c s s (   e l e m ,   " d i s p l a y "   ) )   = = =   " n o n e " ) ;  
 	 } ;  
  
 	 j Q u e r y . e x p r . f i l t e r s . v i s i b l e   =   f u n c t i o n (   e l e m   )   {  
 	 	 r e t u r n   ! j Q u e r y . e x p r . f i l t e r s . h i d d e n (   e l e m   ) ;  
 	 } ;  
 }  
  
  
  
  
 v a r   r 2 0   =   / % 2 0 / g ,  
 	 r b r a c k e t   =   / \ [ \ ] $ / ,  
 	 r C R L F   =   / \ r ? \ n / g ,  
 	 r h a s h   =   / # . * $ / ,  
 	 r h e a d e r s   =   / ^ ( . * ? ) : [   \ t ] * ( [ ^ \ r \ n ] * ) \ r ? $ / m g ,   / /   I E   l e a v e s   a n   \ r   c h a r a c t e r   a t   E O L  
 	 r i n p u t   =   / ^ ( ? : c o l o r | d a t e | d a t e t i m e | e m a i l | h i d d e n | m o n t h | n u m b e r | p a s s w o r d | r a n g e | s e a r c h | t e l | t e x t | t i m e | u r l | w e e k ) $ / i ,  
 	 / /   # 7 6 5 3 ,   # 8 1 2 5 ,   # 8 1 5 2 :   l o c a l   p r o t o c o l   d e t e c t i o n  
 	 r l o c a l P r o t o c o l   =   / ^ ( ? : a b o u t | a p p | a p p \ - s t o r a g e | . + \ - e x t e n s i o n | f i l e | w i d g e t ) : $ / ,  
 	 r n o C o n t e n t   =   / ^ ( ? : G E T | H E A D ) $ / ,  
 	 r p r o t o c o l   =   / ^ \ / \ / / ,  
 	 r q u e r y   =   / \ ? / ,  
 	 r s c r i p t   =   / < s c r i p t \ b [ ^ < ] * ( ? : ( ? ! < \ / s c r i p t > ) < [ ^ < ] * ) * < \ / s c r i p t > / g i ,  
 	 r s e l e c t T e x t a r e a   =   / ^ ( ? : s e l e c t | t e x t a r e a ) / i ,  
 	 r s p a c e s A j a x   =   / \ s + / ,  
 	 r t s   =   / ( [ ? & ] ) _ = [ ^ & ] * / ,  
 	 r u r l   =   / ^ ( [ \ w \ + \ . \ - ] + : ) ( ? : \ / \ / ( [ ^ \ / ? # : ] * ) ( ? : : ( \ d + ) ) ? ) ? / ,  
  
 	 / /   K e e p   a   c o p y   o f   t h e   o l d   l o a d   m e t h o d  
 	 _ l o a d   =   j Q u e r y . f n . l o a d ,  
  
 	 / *   P r e f i l t e r s  
 	   *   1 )   T h e y   a r e   u s e f u l   t o   i n t r o d u c e   c u s t o m   d a t a T y p e s   ( s e e   a j a x / j s o n p . j s   f o r   a n   e x a m p l e )  
 	   *   2 )   T h e s e   a r e   c a l l e d :  
 	   *         -   B E F O R E   a s k i n g   f o r   a   t r a n s p o r t  
 	   *         -   A F T E R   p a r a m   s e r i a l i z a t i o n   ( s . d a t a   i s   a   s t r i n g   i f   s . p r o c e s s D a t a   i s   t r u e )  
 	   *   3 )   k e y   i s   t h e   d a t a T y p e  
 	   *   4 )   t h e   c a t c h a l l   s y m b o l   " * "   c a n   b e   u s e d  
 	   *   5 )   e x e c u t i o n   w i l l   s t a r t   w i t h   t r a n s p o r t   d a t a T y p e   a n d   T H E N   c o n t i n u e   d o w n   t o   " * "   i f   n e e d e d  
 	   * /  
 	 p r e f i l t e r s   =   { } ,  
  
 	 / *   T r a n s p o r t s   b i n d i n g s  
 	   *   1 )   k e y   i s   t h e   d a t a T y p e  
 	   *   2 )   t h e   c a t c h a l l   s y m b o l   " * "   c a n   b e   u s e d  
 	   *   3 )   s e l e c t i o n   w i l l   s t a r t   w i t h   t r a n s p o r t   d a t a T y p e   a n d   T H E N   g o   t o   " * "   i f   n e e d e d  
 	   * /  
 	 t r a n s p o r t s   =   { } ,  
  
 	 / /   D o c u m e n t   l o c a t i o n  
 	 a j a x L o c a t i o n ,  
  
 	 / /   D o c u m e n t   l o c a t i o n   s e g m e n t s  
 	 a j a x L o c P a r t s ;  
  
 / /   # 8 1 3 8 ,   I E   m a y   t h r o w   a n   e x c e p t i o n   w h e n   a c c e s s i n g  
 / /   a   f i e l d   f r o m   w i n d o w . l o c a t i o n   i f   d o c u m e n t . d o m a i n   h a s   b e e n   s e t  
 t r y   {  
 	 a j a x L o c a t i o n   =   l o c a t i o n . h r e f ;  
 }   c a t c h (   e   )   {  
 	 / /   U s e   t h e   h r e f   a t t r i b u t e   o f   a n   A   e l e m e n t  
 	 / /   s i n c e   I E   w i l l   m o d i f y   i t   g i v e n   d o c u m e n t . l o c a t i o n  
 	 a j a x L o c a t i o n   =   d o c u m e n t . c r e a t e E l e m e n t (   " a "   ) ;  
 	 a j a x L o c a t i o n . h r e f   =   " " ;  
 	 a j a x L o c a t i o n   =   a j a x L o c a t i o n . h r e f ;  
 }  
  
 / /   S e g m e n t   l o c a t i o n   i n t o   p a r t s  
 a j a x L o c P a r t s   =   r u r l . e x e c (   a j a x L o c a t i o n . t o L o w e r C a s e ( )   )   | |   [ ] ;  
  
 / /   B a s e   " c o n s t r u c t o r "   f o r   j Q u e r y . a j a x P r e f i l t e r   a n d   j Q u e r y . a j a x T r a n s p o r t  
 f u n c t i o n   a d d T o P r e f i l t e r s O r T r a n s p o r t s (   s t r u c t u r e   )   {  
  
 	 / /   d a t a T y p e E x p r e s s i o n   i s   o p t i o n a l   a n d   d e f a u l t s   t o   " * "  
 	 r e t u r n   f u n c t i o n (   d a t a T y p e E x p r e s s i o n ,   f u n c   )   {  
  
 	 	 i f   (   t y p e o f   d a t a T y p e E x p r e s s i o n   ! = =   " s t r i n g "   )   {  
 	 	 	 f u n c   =   d a t a T y p e E x p r e s s i o n ;  
 	 	 	 d a t a T y p e E x p r e s s i o n   =   " * " ;  
 	 	 }  
  
 	 	 i f   (   j Q u e r y . i s F u n c t i o n (   f u n c   )   )   {  
 	 	 	 v a r   d a t a T y p e s   =   d a t a T y p e E x p r e s s i o n . t o L o w e r C a s e ( ) . s p l i t (   r s p a c e s A j a x   ) ,  
 	 	 	 	 i   =   0 ,  
 	 	 	 	 l e n g t h   =   d a t a T y p e s . l e n g t h ,  
 	 	 	 	 d a t a T y p e ,  
 	 	 	 	 l i s t ,  
 	 	 	 	 p l a c e B e f o r e ;  
  
 	 	 	 / /   F o r   e a c h   d a t a T y p e   i n   t h e   d a t a T y p e E x p r e s s i o n  
 	 	 	 f o r ( ;   i   <   l e n g t h ;   i + +   )   {  
 	 	 	 	 d a t a T y p e   =   d a t a T y p e s [   i   ] ;  
 	 	 	 	 / /   W e   c o n t r o l   i f   w e ' r e   a s k e d   t o   a d d   b e f o r e  
 	 	 	 	 / /   a n y   e x i s t i n g   e l e m e n t  
 	 	 	 	 p l a c e B e f o r e   =   / ^ \ + / . t e s t (   d a t a T y p e   ) ;  
 	 	 	 	 i f   (   p l a c e B e f o r e   )   {  
 	 	 	 	 	 d a t a T y p e   =   d a t a T y p e . s u b s t r (   1   )   | |   " * " ;  
 	 	 	 	 }  
 	 	 	 	 l i s t   =   s t r u c t u r e [   d a t a T y p e   ]   =   s t r u c t u r e [   d a t a T y p e   ]   | |   [ ] ;  
 	 	 	 	 / /   t h e n   w e   a d d   t o   t h e   s t r u c t u r e   a c c o r d i n g l y  
 	 	 	 	 l i s t [   p l a c e B e f o r e   ?   " u n s h i f t "   :   " p u s h "   ] (   f u n c   ) ;  
 	 	 	 }  
 	 	 }  
 	 } ;  
 }  
  
 / /   B a s e   i n s p e c t i o n   f u n c t i o n   f o r   p r e f i l t e r s   a n d   t r a n s p o r t s  
 f u n c t i o n   i n s p e c t P r e f i l t e r s O r T r a n s p o r t s (   s t r u c t u r e ,   o p t i o n s ,   o r i g i n a l O p t i o n s ,   j q X H R ,  
 	 	 d a t a T y p e   / *   i n t e r n a l   * / ,   i n s p e c t e d   / *   i n t e r n a l   * /   )   {  
  
 	 d a t a T y p e   =   d a t a T y p e   | |   o p t i o n s . d a t a T y p e s [   0   ] ;  
 	 i n s p e c t e d   =   i n s p e c t e d   | |   { } ;  
  
 	 i n s p e c t e d [   d a t a T y p e   ]   =   t r u e ;  
  
 	 v a r   l i s t   =   s t r u c t u r e [   d a t a T y p e   ] ,  
 	 	 i   =   0 ,  
 	 	 l e n g t h   =   l i s t   ?   l i s t . l e n g t h   :   0 ,  
 	 	 e x e c u t e O n l y   =   (   s t r u c t u r e   = = =   p r e f i l t e r s   ) ,  
 	 	 s e l e c t i o n ;  
  
 	 f o r ( ;   i   <   l e n g t h   & &   (   e x e c u t e O n l y   | |   ! s e l e c t i o n   ) ;   i + +   )   {  
 	 	 s e l e c t i o n   =   l i s t [   i   ] (   o p t i o n s ,   o r i g i n a l O p t i o n s ,   j q X H R   ) ;  
 	 	 / /   I f   w e   g o t   r e d i r e c t e d   t o   a n o t h e r   d a t a T y p e  
 	 	 / /   w e   t r y   t h e r e   i f   e x e c u t i n g   o n l y   a n d   n o t   d o n e   a l r e a d y  
 	 	 i f   (   t y p e o f   s e l e c t i o n   = = =   " s t r i n g "   )   {  
 	 	 	 i f   (   ! e x e c u t e O n l y   | |   i n s p e c t e d [   s e l e c t i o n   ]   )   {  
 	 	 	 	 s e l e c t i o n   =   u n d e f i n e d ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 o p t i o n s . d a t a T y p e s . u n s h i f t (   s e l e c t i o n   ) ;  
 	 	 	 	 s e l e c t i o n   =   i n s p e c t P r e f i l t e r s O r T r a n s p o r t s (  
 	 	 	 	 	 	 s t r u c t u r e ,   o p t i o n s ,   o r i g i n a l O p t i o n s ,   j q X H R ,   s e l e c t i o n ,   i n s p e c t e d   ) ;  
 	 	 	 }  
 	 	 }  
 	 }  
 	 / /   I f   w e ' r e   o n l y   e x e c u t i n g   o r   n o t h i n g   w a s   s e l e c t e d  
 	 / /   w e   t r y   t h e   c a t c h a l l   d a t a T y p e   i f   n o t   d o n e   a l r e a d y  
 	 i f   (   (   e x e c u t e O n l y   | |   ! s e l e c t i o n   )   & &   ! i n s p e c t e d [   " * "   ]   )   {  
 	 	 s e l e c t i o n   =   i n s p e c t P r e f i l t e r s O r T r a n s p o r t s (  
 	 	 	 	 s t r u c t u r e ,   o p t i o n s ,   o r i g i n a l O p t i o n s ,   j q X H R ,   " * " ,   i n s p e c t e d   ) ;  
 	 }  
 	 / /   u n n e c e s s a r y   w h e n   o n l y   e x e c u t i n g   ( p r e f i l t e r s )  
 	 / /   b u t   i t ' l l   b e   i g n o r e d   b y   t h e   c a l l e r   i n   t h a t   c a s e  
 	 r e t u r n   s e l e c t i o n ;  
 }  
  
 j Q u e r y . f n . e x t e n d ( {  
 	 l o a d :   f u n c t i o n (   u r l ,   p a r a m s ,   c a l l b a c k   )   {  
 	 	 i f   (   t y p e o f   u r l   ! = =   " s t r i n g "   & &   _ l o a d   )   {  
 	 	 	 r e t u r n   _ l o a d . a p p l y (   t h i s ,   a r g u m e n t s   ) ;  
  
 	 	 / /   D o n ' t   d o   a   r e q u e s t   i f   n o   e l e m e n t s   a r e   b e i n g   r e q u e s t e d  
 	 	 }   e l s e   i f   (   ! t h i s . l e n g t h   )   {  
 	 	 	 r e t u r n   t h i s ;  
 	 	 }  
  
 	 	 v a r   o f f   =   u r l . i n d e x O f (   "   "   ) ;  
 	 	 i f   (   o f f   > =   0   )   {  
 	 	 	 v a r   s e l e c t o r   =   u r l . s l i c e (   o f f ,   u r l . l e n g t h   ) ;  
 	 	 	 u r l   =   u r l . s l i c e (   0 ,   o f f   ) ;  
 	 	 }  
  
 	 	 / /   D e f a u l t   t o   a   G E T   r e q u e s t  
 	 	 v a r   t y p e   =   " G E T " ;  
  
 	 	 / /   I f   t h e   s e c o n d   p a r a m e t e r   w a s   p r o v i d e d  
 	 	 i f   (   p a r a m s   )   {  
 	 	 	 / /   I f   i t ' s   a   f u n c t i o n  
 	 	 	 i f   (   j Q u e r y . i s F u n c t i o n (   p a r a m s   )   )   {  
 	 	 	 	 / /   W e   a s s u m e   t h a t   i t ' s   t h e   c a l l b a c k  
 	 	 	 	 c a l l b a c k   =   p a r a m s ;  
 	 	 	 	 p a r a m s   =   u n d e f i n e d ;  
  
 	 	 	 / /   O t h e r w i s e ,   b u i l d   a   p a r a m   s t r i n g  
 	 	 	 }   e l s e   i f   (   t y p e o f   p a r a m s   = = =   " o b j e c t "   )   {  
 	 	 	 	 p a r a m s   =   j Q u e r y . p a r a m (   p a r a m s ,   j Q u e r y . a j a x S e t t i n g s . t r a d i t i o n a l   ) ;  
 	 	 	 	 t y p e   =   " P O S T " ;  
 	 	 	 }  
 	 	 }  
  
 	 	 v a r   s e l f   =   t h i s ;  
  
 	 	 / /   R e q u e s t   t h e   r e m o t e   d o c u m e n t  
 	 	 j Q u e r y . a j a x ( {  
 	 	 	 u r l :   u r l ,  
 	 	 	 t y p e :   t y p e ,  
 	 	 	 d a t a T y p e :   " h t m l " ,  
 	 	 	 d a t a :   p a r a m s ,  
 	 	 	 / /   C o m p l e t e   c a l l b a c k   ( r e s p o n s e T e x t   i s   u s e d   i n t e r n a l l y )  
 	 	 	 c o m p l e t e :   f u n c t i o n (   j q X H R ,   s t a t u s ,   r e s p o n s e T e x t   )   {  
 	 	 	 	 / /   S t o r e   t h e   r e s p o n s e   a s   s p e c i f i e d   b y   t h e   j q X H R   o b j e c t  
 	 	 	 	 r e s p o n s e T e x t   =   j q X H R . r e s p o n s e T e x t ;  
 	 	 	 	 / /   I f   s u c c e s s f u l ,   i n j e c t   t h e   H T M L   i n t o   a l l   t h e   m a t c h e d   e l e m e n t s  
 	 	 	 	 i f   (   j q X H R . i s R e s o l v e d ( )   )   {  
 	 	 	 	 	 / /   # 4 8 2 5 :   G e t   t h e   a c t u a l   r e s p o n s e   i n   c a s e  
 	 	 	 	 	 / /   a   d a t a F i l t e r   i s   p r e s e n t   i n   a j a x S e t t i n g s  
 	 	 	 	 	 j q X H R . d o n e ( f u n c t i o n (   r   )   {  
 	 	 	 	 	 	 r e s p o n s e T e x t   =   r ;  
 	 	 	 	 	 } ) ;  
 	 	 	 	 	 / /   S e e   i f   a   s e l e c t o r   w a s   s p e c i f i e d  
 	 	 	 	 	 s e l f . h t m l (   s e l e c t o r   ?  
 	 	 	 	 	 	 / /   C r e a t e   a   d u m m y   d i v   t o   h o l d   t h e   r e s u l t s  
 	 	 	 	 	 	 j Q u e r y ( " < d i v > " )  
 	 	 	 	 	 	 	 / /   i n j e c t   t h e   c o n t e n t s   o f   t h e   d o c u m e n t   i n ,   r e m o v i n g   t h e   s c r i p t s  
 	 	 	 	 	 	 	 / /   t o   a v o i d   a n y   ' P e r m i s s i o n   D e n i e d '   e r r o r s   i n   I E  
 	 	 	 	 	 	 	 . a p p e n d ( r e s p o n s e T e x t . r e p l a c e ( r s c r i p t ,   " " ) )  
  
 	 	 	 	 	 	 	 / /   L o c a t e   t h e   s p e c i f i e d   e l e m e n t s  
 	 	 	 	 	 	 	 . f i n d ( s e l e c t o r )   :  
  
 	 	 	 	 	 	 / /   I f   n o t ,   j u s t   i n j e c t   t h e   f u l l   r e s u l t  
 	 	 	 	 	 	 r e s p o n s e T e x t   ) ;  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   c a l l b a c k   )   {  
 	 	 	 	 	 s e l f . e a c h (   c a l l b a c k ,   [   r e s p o n s e T e x t ,   s t a t u s ,   j q X H R   ]   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 } ) ;  
  
 	 	 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 ( )   {  
 	 	 r e t u r n   j Q u e r y . p a r a m (   t h i s . s e r i a l i z e A r r a y ( )   ) ;  
 	 } ,  
  
 	 s e r i a l i z e A r r a y :   f u n c t i o n ( )   {  
 	 	 r e t u r n   t h i s . m a p ( 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 s   ?   j Q u e r y . m a k e A r r a y (   t h i s . e l e m e n t s   )   :   t h i s ;  
 	 	 } )  
 	 	 . f i l t e r ( f u n c t i o n ( ) {  
 	 	 	 r e t u r n   t h i s . n a m e   & &   ! t h i s . d i s a b l e d   & &  
 	 	 	 	 (   t h i s . c h e c k e d   | |   r s e l e c t T e x t a r e a . t e s t (   t h i s . n o d e N a m e   )   | |  
 	 	 	 	 	 r i n p u t . t e s t (   t h i s . t y p e   )   ) ;  
 	 	 } )  
 	 	 . m a p ( f u n c t i o n (   i ,   e l e m   ) {  
 	 	 	 v a r   v a l   =   j Q u e r y (   t h i s   ) . v a l ( ) ;  
  
 	 	 	 r e t u r n   v a l   = =   n u l l   ?  
 	 	 	 	 n u l l   :  
 	 	 	 	 j Q u e r y . i s A r r a y (   v a l   )   ?  
 	 	 	 	 	 j Q u e r y . m a p (   v a l ,   f u n c t i o n (   v a l ,   i   ) {  
 	 	 	 	 	 	 r e t u r n   {   n a m e :   e l e m . n a m e ,   v a l u e :   v a l . r e p l a c e (   r C R L F ,   " \ r \ n "   )   } ;  
 	 	 	 	 	 } )   :  
 	 	 	 	 	 {   n a m e :   e l e m . n a m e ,   v a l u e :   v a l . r e p l a c e (   r C R L F ,   " \ r \ n "   )   } ;  
 	 	 } ) . g e t ( ) ;  
 	 }  
 } ) ;  
  
 / /   A t t a c h   a   b u n c h   o f   f u n c t i o n s   f o r   h a n d l i n g   c o m m o n   A J A X   e v e n t s  
 j Q u e r y . e a c h (   " a j a x S t a r t   a j a x S t o p   a j a x C o m p l e t e   a j a x E r r o r   a j a x S u c c e s s   a j a x S e n d " . s p l i t (   "   "   ) ,   f u n c t i o n (   i ,   o   ) {  
 	 j Q u e r y . f n [   o   ]   =   f u n c t i o n (   f   ) {  
 	 	 r e t u r n   t h i s . b i n d (   o ,   f   ) ;  
 	 } ;  
 } ) ;  
  
 j Q u e r y . e a c h (   [   " g e t " ,   " p o s t "   ] ,   f u n c t i o n (   i ,   m e t h o d   )   {  
 	 j Q u e r y [   m e t h o d   ]   =   f u n c t i o n (   u r l ,   d a t a ,   c a l l b a c k ,   t y p e   )   {  
 	 	 / /   s h i f t   a r g u m e n t s   i f   d a t a   a r g u m e n t   w a s   o m i t t e d  
 	 	 i f   (   j Q u e r y . i s F u n c t i o n (   d a t a   )   )   {  
 	 	 	 t y p e   =   t y p e   | |   c a l l b a c k ;  
 	 	 	 c a l l b a c k   =   d a t a ;  
 	 	 	 d a t a   =   u n d e f i n e d ;  
 	 	 }  
  
 	 	 r e t u r n   j Q u e r y . a j a x ( {  
 	 	 	 t y p e :   m e t h o d ,  
 	 	 	 u r l :   u r l ,  
 	 	 	 d a t a :   d a t a ,  
 	 	 	 s u c c e s s :   c a l l b a c k ,  
 	 	 	 d a t a T y p e :   t y p e  
 	 	 } ) ;  
 	 } ;  
 } ) ;  
  
 j Q u e r y . e x t e n d ( {  
  
 	 g e t S c r i p t :   f u n c t i o n (   u r l ,   c a l l b a c k   )   {  
 	 	 r e t u r n   j Q u e r y . g e t (   u r l ,   u n d e f i n e d ,   c a l l b a c k ,   " s c r i p t "   ) ;  
 	 } ,  
  
 	 g e t J S O N :   f u n c t i o n (   u r l ,   d a t a ,   c a l l b a c k   )   {  
 	 	 r e t u r n   j Q u e r y . g e t (   u r l ,   d a t a ,   c a l l b a c k ,   " j s o n "   ) ;  
 	 } ,  
  
 	 / /   C r e a t e s   a   f u l l   f l e d g e d   s e t t i n g s   o b j e c t   i n t o   t a r g e t  
 	 / /   w i t h   b o t h   a j a x S e t t i n g s   a n d   s e t t i n g s   f i e l d s .  
 	 / /   I f   t a r g e t   i s   o m i t t e d ,   w r i t e s   i n t o   a j a x S e t t i n g s .  
 	 a j a x S e t u p :   f u n c t i o n   (   t a r g e t ,   s e t t i n g s   )   {  
 	 	 i f   (   ! s e t t i n g s   )   {  
 	 	 	 / /   O n l y   o n e   p a r a m e t e r ,   w e   e x t e n d   a j a x S e t t i n g s  
 	 	 	 s e t t i n g s   =   t a r g e t ;  
 	 	 	 t a r g e t   =   j Q u e r y . e x t e n d (   t r u e ,   j Q u e r y . a j a x S e t t i n g s ,   s e t t i n g s   ) ;  
 	 	 }   e l s e   {  
 	 	 	 / /   t a r g e t   w a s   p r o v i d e d ,   w e   e x t e n d   i n t o   i t  
 	 	 	 j Q u e r y . e x t e n d (   t r u e ,   t a r g e t ,   j Q u e r y . a j a x S e t t i n g s ,   s e t t i n g s   ) ;  
 	 	 }  
 	 	 / /   F l a t t e n   f i e l d s   w e   d o n ' t   w a n t   d e e p   e x t e n d e d  
 	 	 f o r (   v a r   f i e l d   i n   {   c o n t e x t :   1 ,   u r l :   1   }   )   {  
 	 	 	 i f   (   f i e l d   i n   s e t t i n g s   )   {  
 	 	 	 	 t a r g e t [   f i e l d   ]   =   s e t t i n g s [   f i e l d   ] ;  
 	 	 	 }   e l s e   i f (   f i e l d   i n   j Q u e r y . a j a x S e t t i n g s   )   {  
 	 	 	 	 t a r g e t [   f i e l d   ]   =   j Q u e r y . a j a x S e t t i n g s [   f i e l d   ] ;  
 	 	 	 }  
 	 	 }  
 	 	 r e t u r n   t a r g e t ;  
 	 } ,  
  
 	 a j a x S e t t i n g s :   {  
 	 	 u r l :   a j a x L o c a t i o n ,  
 	 	 i s L o c a l :   r l o c a l P r o t o c o l . t e s t (   a j a x L o c P a r t s [   1   ]   ) ,  
 	 	 g l o b a l :   t r u e ,  
 	 	 t y p e :   " G E T " ,  
 	 	 c o n t e n t T y p e :   " a p p l i c a t i o n / x - w w w - f o r m - u r l e n c o d e d " ,  
 	 	 p r o c e s s D a t a :   t r u e ,  
 	 	 a s y n c :   t r u e ,  
 	 	 / *  
 	 	 t i m e o u t :   0 ,  
 	 	 d a t a :   n u l l ,  
 	 	 d a t a T y p e :   n u l l ,  
 	 	 u s e r n a m e :   n u l l ,  
 	 	 p a s s w o r d :   n u l l ,  
 	 	 c a c h e :   n u l l ,  
 	 	 t r a d i t i o n a l :   f a l s e ,  
 	 	 h e a d e r s :   { } ,  
 	 	 * /  
  
 	 	 a c c e p t s :   {  
 	 	 	 x m l :   " a p p l i c a t i o n / x m l ,   t e x t / x m l " ,  
 	 	 	 h t m l :   " t e x t / h t m l " ,  
 	 	 	 t e x t :   " t e x t / p l a i n " ,  
 	 	 	 j s o n :   " a p p l i c a t i o n / j s o n ,   t e x t / j a v a s c r i p t " ,  
 	 	 	 " * " :   " * / * "  
 	 	 } ,  
  
 	 	 c o n t e n t s :   {  
 	 	 	 x m l :   / x m l / ,  
 	 	 	 h t m l :   / h t m l / ,  
 	 	 	 j s o n :   / j s o n /  
 	 	 } ,  
  
 	 	 r e s p o n s e F i e l d s :   {  
 	 	 	 x m l :   " r e s p o n s e X M L " ,  
 	 	 	 t e x t :   " r e s p o n s e T e x t "  
 	 	 } ,  
  
 	 	 / /   L i s t   o f   d a t a   c o n v e r t e r s  
 	 	 / /   1 )   k e y   f o r m a t   i s   " s o u r c e _ t y p e   d e s t i n a t i o n _ t y p e "   ( a   s i n g l e   s p a c e   i n - b e t w e e n )  
 	 	 / /   2 )   t h e   c a t c h a l l   s y m b o l   " * "   c a n   b e   u s e d   f o r   s o u r c e _ t y p e  
 	 	 c o n v e r t e r s :   {  
  
 	 	 	 / /   C o n v e r t   a n y t h i n g   t o   t e x t  
 	 	 	 " *   t e x t " :   w i n d o w . S t r i n g ,  
  
 	 	 	 / /   T e x t   t o   h t m l   ( t r u e   =   n o   t r a n s f o r m a t i o n )  
 	 	 	 " t e x t   h t m l " :   t r u e ,  
  
 	 	 	 / /   E v a l u a t e   t e x t   a s   a   j s o n   e x p r e s s i o n  
 	 	 	 " t e x t   j s o n " :   j Q u e r y . p a r s e J S O N ,  
  
 	 	 	 / /   P a r s e   t e x t   a s   x m l  
 	 	 	 " t e x t   x m l " :   j Q u e r y . p a r s e X M L  
 	 	 }  
 	 } ,  
  
 	 a j a x P r e f i l t e r :   a d d T o P r e f i l t e r s O r T r a n s p o r t s (   p r e f i l t e r s   ) ,  
 	 a j a x T r a n s p o r t :   a d d T o P r e f i l t e r s O r T r a n s p o r t s (   t r a n s p o r t s   ) ,  
  
 	 / /   M a i n   m e t h o d  
 	 a j a x :   f u n c t i o n (   u r l ,   o p t i o n s   )   {  
  
 	 	 / /   I f   u r l   i s   a n   o b j e c t ,   s i m u l a t e   p r e - 1 . 5   s i g n a t u r e  
 	 	 i f   (   t y p e o f   u r l   = = =   " o b j e c t "   )   {  
 	 	 	 o p t i o n s   =   u r l ;  
 	 	 	 u r l   =   u n d e f i n e d ;  
 	 	 }  
  
 	 	 / /   F o r c e   o p t i o n s   t o   b e   a n   o b j e c t  
 	 	 o p t i o n s   =   o p t i o n s   | |   { } ;  
  
 	 	 v a r   / /   C r e a t e   t h e   f i n a l   o p t i o n s   o b j e c t  
 	 	 	 s   =   j Q u e r y . a j a x S e t u p (   { } ,   o p t i o n s   ) ,  
 	 	 	 / /   C a l l b a c k s   c o n t e x t  
 	 	 	 c a l l b a c k C o n t e x t   =   s . c o n t e x t   | |   s ,  
 	 	 	 / /   C o n t e x t   f o r   g l o b a l   e v e n t s  
 	 	 	 / /   I t ' s   t h e   c a l l b a c k C o n t e x t   i f   o n e   w a s   p r o v i d e d   i n   t h e   o p t i o n s  
 	 	 	 / /   a n d   i f   i t ' s   a   D O M   n o d e   o r   a   j Q u e r y   c o l l e c t i o n  
 	 	 	 g l o b a l E v e n t C o n t e x t   =   c a l l b a c k C o n t e x t   ! = =   s   & &  
 	 	 	 	 (   c a l l b a c k C o n t e x t . n o d e T y p e   | |   c a l l b a c k C o n t e x t   i n s t a n c e o f   j Q u e r y   )   ?  
 	 	 	 	 	 	 j Q u e r y (   c a l l b a c k C o n t e x t   )   :   j Q u e r y . e v e n t ,  
 	 	 	 / /   D e f e r r e d s  
 	 	 	 d e f e r r e d   =   j Q u e r y . D e f e r r e d ( ) ,  
 	 	 	 c o m p l e t e D e f e r r e d   =   j Q u e r y . _ D e f e r r e d ( ) ,  
 	 	 	 / /   S t a t u s - d e p e n d e n t   c a l l b a c k s  
 	 	 	 s t a t u s C o d e   =   s . s t a t u s C o d e   | |   { } ,  
 	 	 	 / /   i f M o d i f i e d   k e y  
 	 	 	 i f M o d i f i e d K e y ,  
 	 	 	 / /   H e a d e r s   ( t h e y   a r e   s e n t   a l l   a t   o n c e )  
 	 	 	 r e q u e s t H e a d e r s   =   { } ,  
 	 	 	 r e q u e s t H e a d e r s N a m e s   =   { } ,  
 	 	 	 / /   R e s p o n s e   h e a d e r s  
 	 	 	 r e s p o n s e H e a d e r s S t r i n g ,  
 	 	 	 r e s p o n s e H e a d e r s ,  
 	 	 	 / /   t r a n s p o r t  
 	 	 	 t r a n s p o r t ,  
 	 	 	 / /   t i m e o u t   h a n d l e  
 	 	 	 t i m e o u t T i m e r ,  
 	 	 	 / /   C r o s s - d o m a i n   d e t e c t i o n   v a r s  
 	 	 	 p a r t s ,  
 	 	 	 / /   T h e   j q X H R   s t a t e  
 	 	 	 s t a t e   =   0 ,  
 	 	 	 / /   T o   k n o w   i f   g l o b a l   e v e n t s   a r e   t o   b e   d i s p a t c h e d  
 	 	 	 f i r e G l o b a l s ,  
 	 	 	 / /   L o o p   v a r i a b l e  
 	 	 	 i ,  
 	 	 	 / /   F a k e   x h r  
 	 	 	 j q X H R   =   {  
  
 	 	 	 	 r e a d y S t a t e :   0 ,  
  
 	 	 	 	 / /   C a c h e s   t h e   h e a d e r  
 	 	 	 	 s e t R e q u e s t H e a d e r :   f u n c t i o n (   n a m e ,   v a l u e   )   {  
 	 	 	 	 	 i f   (   ! s t a t e   )   {  
 	 	 	 	 	 	 v a r   l n a m e   =   n a m e . t o L o w e r C a s e ( ) ;  
 	 	 	 	 	 	 n a m e   =   r e q u e s t H e a d e r s N a m e s [   l n a m e   ]   =   r e q u e s t H e a d e r s N a m e s [   l n a m e   ]   | |   n a m e ;  
 	 	 	 	 	 	 r e q u e s t H e a d e r s [   n a m e   ]   =   v a l u e ;  
 	 	 	 	 	 }  
 	 	 	 	 	 r e t u r n   t h i s ;  
 	 	 	 	 } ,  
  
 	 	 	 	 / /   R a w   s t r i n g  
 	 	 	 	 g e t A l l R e s p o n s e H e a d e r s :   f u n c t i o n ( )   {  
 	 	 	 	 	 r e t u r n   s t a t e   = = =   2   ?   r e s p o n s e H e a d e r s S t r i n g   :   n u l l ;  
 	 	 	 	 } ,  
  
 	 	 	 	 / /   B u i l d s   h e a d e r s   h a s h t a b l e   i f   n e e d e d  
 	 	 	 	 g e t R e s p o n s e H e a d e r :   f u n c t i o n (   k e y   )   {  
 	 	 	 	 	 v a r   m a t c h ;  
 	 	 	 	 	 i f   (   s t a t e   = = =   2   )   {  
 	 	 	 	 	 	 i f   (   ! r e s p o n s e H e a d e r s   )   {  
 	 	 	 	 	 	 	 r e s p o n s e H e a d e r s   =   { } ;  
 	 	 	 	 	 	 	 w h i l e (   (   m a t c h   =   r h e a d e r s . e x e c (   r e s p o n s e H e a d e r s S t r i n g   )   )   )   {  
 	 	 	 	 	 	 	 	 r e s p o n s e H e a d e r s [   m a t c h [ 1 ] . t o L o w e r C a s e ( )   ]   =   m a t c h [   2   ] ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 m a t c h   =   r e s p o n s e H e a d e r s [   k e y . t o L o w e r C a s e ( )   ] ;  
 	 	 	 	 	 }  
 	 	 	 	 	 r e t u r n   m a t c h   = = =   u n d e f i n e d   ?   n u l l   :   m a t c h ;  
 	 	 	 	 } ,  
  
 	 	 	 	 / /   O v e r r i d e s   r e s p o n s e   c o n t e n t - t y p e   h e a d e r  
 	 	 	 	 o v e r r i d e M i m e T y p e :   f u n c t i o n (   t y p e   )   {  
 	 	 	 	 	 i f   (   ! s t a t e   )   {  
 	 	 	 	 	 	 s . m i m e T y p e   =   t y p e ;  
 	 	 	 	 	 }  
 	 	 	 	 	 r e t u r n   t h i s ;  
 	 	 	 	 } ,  
  
 	 	 	 	 / /   C a n c e l   t h e   r e q u e s t  
 	 	 	 	 a b o r t :   f u n c t i o n (   s t a t u s T e x t   )   {  
 	 	 	 	 	 s t a t u s T e x t   =   s t a t u s T e x t   | |   " a b o r t " ;  
 	 	 	 	 	 i f   (   t r a n s p o r t   )   {  
 	 	 	 	 	 	 t r a n s p o r t . a b o r t (   s t a t u s T e x t   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 d o n e (   0 ,   s t a t u s T e x t   ) ;  
 	 	 	 	 	 r e t u r n   t h i s ;  
 	 	 	 	 }  
 	 	 	 } ;  
  
 	 	 / /   C a l l b a c k   f o r   w h e n   e v e r y t h i n g   i s   d o n e  
 	 	 / /   I t   i s   d e f i n e d   h e r e   b e c a u s e   j s l i n t   c o m p l a i n s   i f   i t   i s   d e c l a r e d  
 	 	 / /   a t   t h e   e n d   o f   t h e   f u n c t i o n   ( w h i c h   w o u l d   b e   m o r e   l o g i c a l   a n d   r e a d a b l e )  
 	 	 f u n c t i o n   d o n e (   s t a t u s ,   s t a t u s T e x t ,   r e s p o n s e s ,   h e a d e r s   )   {  
  
 	 	 	 / /   C a l l e d   o n c e  
 	 	 	 i f   (   s t a t e   = = =   2   )   {  
 	 	 	 	 r e t u r n ;  
 	 	 	 }  
  
 	 	 	 / /   S t a t e   i s   " d o n e "   n o w  
 	 	 	 s t a t e   =   2 ;  
  
 	 	 	 / /   C l e a r   t i m e o u t   i f   i t   e x i s t s  
 	 	 	 i f   (   t i m e o u t T i m e r   )   {  
 	 	 	 	 c l e a r T i m e o u t (   t i m e o u t T i m e r   ) ;  
 	 	 	 }  
  
 	 	 	 / /   D e r e f e r e n c e   t r a n s p o r t   f o r   e a r l y   g a r b a g e   c o l l e c t i o n  
 	 	 	 / /   ( n o   m a t t e r   h o w   l o n g   t h e   j q X H R   o b j e c t   w i l l   b e   u s e d )  
 	 	 	 t r a n s p o r t   =   u n d e f i n e d ;  
  
 	 	 	 / /   C a c h e   r e s p o n s e   h e a d e r s  
 	 	 	 r e s p o n s e H e a d e r s S t r i n g   =   h e a d e r s   | |   " " ;  
  
 	 	 	 / /   S e t   r e a d y S t a t e  
 	 	 	 j q X H R . r e a d y S t a t e   =   s t a t u s   ?   4   :   0 ;  
  
 	 	 	 v a r   i s S u c c e s s ,  
 	 	 	 	 s u c c e s s ,  
 	 	 	 	 e r r o r ,  
 	 	 	 	 r e s p o n s e   =   r e s p o n s e s   ?   a j a x H a n d l e R e s p o n s e s (   s ,   j q X H R ,   r e s p o n s e s   )   :   u n d e f i n e d ,  
 	 	 	 	 l a s t M o d i f i e d ,  
 	 	 	 	 e t a g ;  
  
 	 	 	 / /   I f   s u c c e s s f u l ,   h a n d l e   t y p e   c h a i n i n g  
 	 	 	 i f   (   s t a t u s   > =   2 0 0   & &   s t a t u s   <   3 0 0   | |   s t a t u s   = = =   3 0 4   )   {  
  
 	 	 	 	 / /   S e t   t h e   I f - M o d i f i e d - S i n c e   a n d / o r   I f - N o n e - M a t c h   h e a d e r ,   i f   i n   i f M o d i f i e d   m o d e .  
 	 	 	 	 i f   (   s . i f M o d i f i e d   )   {  
  
 	 	 	 	 	 i f   (   (   l a s t M o d i f i e d   =   j q X H R . g e t R e s p o n s e H e a d e r (   " L a s t - M o d i f i e d "   )   )   )   {  
 	 	 	 	 	 	 j Q u e r y . l a s t M o d i f i e d [   i f M o d i f i e d K e y   ]   =   l a s t M o d i f i e d ;  
 	 	 	 	 	 }  
 	 	 	 	 	 i f   (   (   e t a g   =   j q X H R . g e t R e s p o n s e H e a d e r (   " E t a g "   )   )   )   {  
 	 	 	 	 	 	 j Q u e r y . e t a g [   i f M o d i f i e d K e y   ]   =   e t a g ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 / /   I f   n o t   m o d i f i e d  
 	 	 	 	 i f   (   s t a t u s   = = =   3 0 4   )   {  
  
 	 	 	 	 	 s t a t u s T e x t   =   " n o t m o d i f i e d " ;  
 	 	 	 	 	 i s S u c c e s s   =   t r u e ;  
  
 	 	 	 	 / /   I f   w e   h a v e   d a t a  
 	 	 	 	 }   e l s e   {  
  
 	 	 	 	 	 t r y   {  
 	 	 	 	 	 	 s u c c e s s   =   a j a x C o n v e r t (   s ,   r e s p o n s e   ) ;  
 	 	 	 	 	 	 s t a t u s T e x t   =   " s u c c e s s " ;  
 	 	 	 	 	 	 i s S u c c e s s   =   t r u e ;  
 	 	 	 	 	 }   c a t c h ( e )   {  
 	 	 	 	 	 	 / /   W e   h a v e   a   p a r s e r e r r o r  
 	 	 	 	 	 	 s t a t u s T e x t   =   " p a r s e r e r r o r " ;  
 	 	 	 	 	 	 e r r o r   =   e ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }   e l s e   {  
 	 	 	 	 / /   W e   e x t r a c t   e r r o r   f r o m   s t a t u s T e x t  
 	 	 	 	 / /   t h e n   n o r m a l i z e   s t a t u s T e x t   a n d   s t a t u s   f o r   n o n - a b o r t s  
 	 	 	 	 e r r o r   =   s t a t u s T e x t ;  
 	 	 	 	 i f (   ! s t a t u s T e x t   | |   s t a t u s   )   {  
 	 	 	 	 	 s t a t u s T e x t   =   " e r r o r " ;  
 	 	 	 	 	 i f   (   s t a t u s   <   0   )   {  
 	 	 	 	 	 	 s t a t u s   =   0 ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 / /   S e t   d a t a   f o r   t h e   f a k e   x h r   o b j e c t  
 	 	 	 j q X H R . s t a t u s   =   s t a t u s ;  
 	 	 	 j q X H R . s t a t u s T e x t   =   s t a t u s T e x t ;  
  
 	 	 	 / /   S u c c e s s / E r r o r  
 	 	 	 i f   (   i s S u c c e s s   )   {  
 	 	 	 	 d e f e r r e d . r e s o l v e W i t h (   c a l l b a c k C o n t e x t ,   [   s u c c e s s ,   s t a t u s T e x t ,   j q X H R   ]   ) ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 d e f e r r e d . r e j e c t W i t h (   c a l l b a c k C o n t e x t ,   [   j q X H R ,   s t a t u s T e x t ,   e r r o r   ]   ) ;  
 	 	 	 }  
  
 	 	 	 / /   S t a t u s - d e p e n d e n t   c a l l b a c k s  
 	 	 	 j q X H R . s t a t u s C o d e (   s t a t u s C o d e   ) ;  
 	 	 	 s t a t u s C o d e   =   u n d e f i n e d ;  
  
 	 	 	 i f   (   f i r e G l o b a l s   )   {  
 	 	 	 	 g l o b a l E v e n t C o n t e x t . t r i g g e r (   " a j a x "   +   (   i s S u c c e s s   ?   " S u c c e s s "   :   " E r r o r "   ) ,  
 	 	 	 	 	 	 [   j q X H R ,   s ,   i s S u c c e s s   ?   s u c c e s s   :   e r r o r   ]   ) ;  
 	 	 	 }  
  
 	 	 	 / /   C o m p l e t e  
 	 	 	 c o m p l e t e D e f e r r e d . r e s o l v e W i t h (   c a l l b a c k C o n t e x t ,   [   j q X H R ,   s t a t u s T e x t   ]   ) ;  
  
 	 	 	 i f   (   f i r e G l o b a l s   )   {  
 	 	 	 	 g l o b a l E v e n t C o n t e x t . t r i g g e r (   " a j a x C o m p l e t e " ,   [   j q X H R ,   s ]   ) ;  
 	 	 	 	 / /   H a n d l e   t h e   g l o b a l   A J A X   c o u n t e r  
 	 	 	 	 i f   (   ! (   - - j Q u e r y . a c t i v e   )   )   {  
 	 	 	 	 	 j Q u e r y . e v e n t . t r i g g e r (   " a j a x S t o p "   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 / /   A t t a c h   d e f e r r e d s  
 	 	 d e f e r r e d . p r o m i s e (   j q X H R   ) ;  
 	 	 j q X H R . s u c c e s s   =   j q X H R . d o n e ;  
 	 	 j q X H R . e r r o r   =   j q X H R . f a i l ;  
 	 	 j q X H R . c o m p l e t e   =   c o m p l e t e D e f e r r e d . d o n e ;  
  
 	 	 / /   S t a t u s - d e p e n d e n t   c a l l b a c k s  
 	 	 j q X H R . s t a t u s C o d e   =   f u n c t i o n (   m a p   )   {  
 	 	 	 i f   (   m a p   )   {  
 	 	 	 	 v a r   t m p ;  
 	 	 	 	 i f   (   s t a t e   <   2   )   {  
 	 	 	 	 	 f o r (   t m p   i n   m a p   )   {  
 	 	 	 	 	 	 s t a t u s C o d e [   t m p   ]   =   [   s t a t u s C o d e [ t m p ] ,   m a p [ t m p ]   ] ;  
 	 	 	 	 	 }  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 t m p   =   m a p [   j q X H R . s t a t u s   ] ;  
 	 	 	 	 	 j q X H R . t h e n (   t m p ,   t m p   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 	 r e t u r n   t h i s ;  
 	 	 } ;  
  
 	 	 / /   R e m o v e   h a s h   c h a r a c t e r   ( # 7 5 3 1 :   a n d   s t r i n g   p r o m o t i o n )  
 	 	 / /   A d d   p r o t o c o l   i f   n o t   p r o v i d e d   ( # 5 8 6 6 :   I E 7   i s s u e   w i t h   p r o t o c o l - l e s s   u r l s )  
 	 	 / /   W e   a l s o   u s e   t h e   u r l   p a r a m e t e r   i f   a v a i l a b l e  
 	 	 s . u r l   =   (   (   u r l   | |   s . u r l   )   +   " "   ) . r e p l a c e (   r h a s h ,   " "   ) . r e p l a c e (   r p r o t o c o l ,   a j a x L o c P a r t s [   1   ]   +   " / / "   ) ;  
  
 	 	 / /   E x t r a c t   d a t a T y p e s   l i s t  
 	 	 s . d a t a T y p e s   =   j Q u e r y . t r i m (   s . d a t a T y p e   | |   " * "   ) . t o L o w e r C a s e ( ) . s p l i t (   r s p a c e s A j a x   ) ;  
  
 	 	 / /   D e t e r m i n e   i f   a   c r o s s - d o m a i n   r e q u e s t   i s   i n   o r d e r  
 	 	 i f   (   s . c r o s s D o m a i n   = =   n u l l   )   {  
 	 	 	 p a r t s   =   r u r l . e x e c (   s . u r l . t o L o w e r C a s e ( )   ) ;  
 	 	 	 s . c r o s s D o m a i n   =   ! ! (   p a r t s   & &  
 	 	 	 	 (   p a r t s [   1   ]   ! =   a j a x L o c P a r t s [   1   ]   | |   p a r t s [   2   ]   ! =   a j a x L o c P a r t s [   2   ]   | |  
 	 	 	 	 	 (   p a r t s [   3   ]   | |   (   p a r t s [   1   ]   = = =   " h t t p : "   ?   8 0   :   4 4 3   )   )   ! =  
 	 	 	 	 	 	 (   a j a x L o c P a r t s [   3   ]   | |   (   a j a x L o c P a r t s [   1   ]   = = =   " h t t p : "   ?   8 0   :   4 4 3   )   )   )  
 	 	 	 ) ;  
 	 	 }  
  
 	 	 / /   C o n v e r t   d a t a   i f   n o t   a l r e a d y   a   s t r i n g  
 	 	 i f   (   s . d a t a   & &   s . p r o c e s s D a t a   & &   t y p e o f   s . d a t a   ! = =   " s t r i n g "   )   {  
 	 	 	 s . d a t a   =   j Q u e r y . p a r a m (   s . d a t a ,   s . t r a d i t i o n a l   ) ;  
 	 	 }  
  
 	 	 / /   A p p l y   p r e f i l t e r s  
 	 	 i n s p e c t P r e f i l t e r s O r T r a n s p o r t s (   p r e f i l t e r s ,   s ,   o p t i o n s ,   j q X H R   ) ;  
  
 	 	 / /   I f   r e q u e s t   w a s   a b o r t e d   i n s i d e   a   p r e f i l e r ,   s t o p   t h e r e  
 	 	 i f   (   s t a t e   = = =   2   )   {  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
  
 	 	 / /   W e   c a n   f i r e   g l o b a l   e v e n t s   a s   o f   n o w   i f   a s k e d   t o  
 	 	 f i r e G l o b a l s   =   s . g l o b a l ;  
  
 	 	 / /   U p p e r c a s e   t h e   t y p e  
 	 	 s . t y p e   =   s . t y p e . t o U p p e r C a s e ( ) ;  
  
 	 	 / /   D e t e r m i n e   i f   r e q u e s t   h a s   c o n t e n t  
 	 	 s . h a s C o n t e n t   =   ! r n o C o n t e n t . t e s t (   s . t y p e   ) ;  
  
 	 	 / /   W a t c h   f o r   a   n e w   s e t   o f   r e q u e s t s  
 	 	 i f   (   f i r e G l o b a l s   & &   j Q u e r y . a c t i v e + +   = = =   0   )   {  
 	 	 	 j Q u e r y . e v e n t . t r i g g e r (   " a j a x S t a r t "   ) ;  
 	 	 }  
  
 	 	 / /   M o r e   o p t i o n s   h a n d l i n g   f o r   r e q u e s t s   w i t h   n o   c o n t e n t  
 	 	 i f   (   ! s . h a s C o n t e n t   )   {  
  
 	 	 	 / /   I f   d a t a   i s   a v a i l a b l e ,   a p p e n d   d a t a   t o   u r l  
 	 	 	 i f   (   s . d a t a   )   {  
 	 	 	 	 s . u r l   + =   (   r q u e r y . t e s t (   s . u r l   )   ?   " & "   :   " ? "   )   +   s . d a t a ;  
 	 	 	 }  
  
 	 	 	 / /   G e t   i f M o d i f i e d K e y   b e f o r e   a d d i n g   t h e   a n t i - c a c h e   p a r a m e t e r  
 	 	 	 i f M o d i f i e d K e y   =   s . u r l ;  
  
 	 	 	 / /   A d d   a n t i - c a c h e   i n   u r l   i f   n e e d e d  
 	 	 	 i f   (   s . c a c h e   = = =   f a l s e   )   {  
  
 	 	 	 	 v a r   t s   =   j Q u e r y . n o w ( ) ,  
 	 	 	 	 	 / /   t r y   r e p l a c i n g   _ =   i f   i t   i s   t h e r e  
 	 	 	 	 	 r e t   =   s . u r l . r e p l a c e (   r t s ,   " $ 1 _ = "   +   t s   ) ;  
  
 	 	 	 	 / /   i f   n o t h i n g   w a s   r e p l a c e d ,   a d d   t i m e s t a m p   t o   t h e   e n d  
 	 	 	 	 s . u r l   =   r e t   +   (   ( r e t   = = =   s . u r l   )   ?   (   r q u e r y . t e s t (   s . u r l   )   ?   " & "   :   " ? "   )   +   " _ = "   +   t s   :   " "   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 / /   S e t   t h e   c o r r e c t   h e a d e r ,   i f   d a t a   i s   b e i n g   s e n t  
 	 	 i f   (   s . d a t a   & &   s . h a s C o n t e n t   & &   s . c o n t e n t T y p e   ! = =   f a l s e   | |   o p t i o n s . c o n t e n t T y p e   )   {  
 	 	 	 j q X H R . s e t R e q u e s t H e a d e r (   " C o n t e n t - T y p e " ,   s . c o n t e n t T y p e   ) ;  
 	 	 }  
  
 	 	 / /   S e t   t h e   I f - M o d i f i e d - S i n c e   a n d / o r   I f - N o n e - M a t c h   h e a d e r ,   i f   i n   i f M o d i f i e d   m o d e .  
 	 	 i f   (   s . i f M o d i f i e d   )   {  
 	 	 	 i f M o d i f i e d K e y   =   i f M o d i f i e d K e y   | |   s . u r l ;  
 	 	 	 i f   (   j Q u e r y . l a s t M o d i f i e d [   i f M o d i f i e d K e y   ]   )   {  
 	 	 	 	 j q X H R . s e t R e q u e s t H e a d e r (   " I f - M o d i f i e d - S i n c e " ,   j Q u e r y . l a s t M o d i f i e d [   i f M o d i f i e d K e y   ]   ) ;  
 	 	 	 }  
 	 	 	 i f   (   j Q u e r y . e t a g [   i f M o d i f i e d K e y   ]   )   {  
 	 	 	 	 j q X H R . s e t R e q u e s t H e a d e r (   " I f - N o n e - M a t c h " ,   j Q u e r y . e t a g [   i f M o d i f i e d K e y   ]   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 / /   S e t   t h e   A c c e p t s   h e a d e r   f o r   t h e   s e r v e r ,   d e p e n d i n g   o n   t h e   d a t a T y p e  
 	 	 j q X H R . s e t R e q u e s t H e a d e r (  
 	 	 	 " A c c e p t " ,  
 	 	 	 s . d a t a T y p e s [   0   ]   & &   s . a c c e p t s [   s . d a t a T y p e s [ 0 ]   ]   ?  
 	 	 	 	 s . a c c e p t s [   s . d a t a T y p e s [ 0 ]   ]   +   (   s . d a t a T y p e s [   0   ]   ! = =   " * "   ?   " ,   * / * ;   q = 0 . 0 1 "   :   " "   )   :  
 	 	 	 	 s . a c c e p t s [   " * "   ]  
 	 	 ) ;  
  
 	 	 / /   C h e c k   f o r   h e a d e r s   o p t i o n  
 	 	 f o r   (   i   i n   s . h e a d e r s   )   {  
 	 	 	 j q X H R . s e t R e q u e s t H e a d e r (   i ,   s . h e a d e r s [   i   ]   ) ;  
 	 	 }  
  
 	 	 / /   A l l o w   c u s t o m   h e a d e r s / m i m e t y p e s   a n d   e a r l y   a b o r t  
 	 	 i f   (   s . b e f o r e S e n d   & &   (   s . b e f o r e S e n d . c a l l (   c a l l b a c k C o n t e x t ,   j q X H R ,   s   )   = = =   f a l s e   | |   s t a t e   = = =   2   )   )   {  
 	 	 	 	 / /   A b o r t   i f   n o t   d o n e   a l r e a d y  
 	 	 	 	 j q X H R . a b o r t ( ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
  
 	 	 }  
  
 	 	 / /   I n s t a l l   c a l l b a c k s   o n   d e f e r r e d s  
 	 	 f o r   (   i   i n   {   s u c c e s s :   1 ,   e r r o r :   1 ,   c o m p l e t e :   1   }   )   {  
 	 	 	 j q X H R [   i   ] (   s [   i   ]   ) ;  
 	 	 }  
  
 	 	 / /   G e t   t r a n s p o r t  
 	 	 t r a n s p o r t   =   i n s p e c t P r e f i l t e r s O r T r a n s p o r t s (   t r a n s p o r t s ,   s ,   o p t i o n s ,   j q X H R   ) ;  
  
 	 	 / /   I f   n o   t r a n s p o r t ,   w e   a u t o - a b o r t  
 	 	 i f   (   ! t r a n s p o r t   )   {  
 	 	 	 d o n e (   - 1 ,   " N o   T r a n s p o r t "   ) ;  
 	 	 }   e l s e   {  
 	 	 	 j q X H R . r e a d y S t a t e   =   1 ;  
 	 	 	 / /   S e n d   g l o b a l   e v e n t  
 	 	 	 i f   (   f i r e G l o b a l s   )   {  
 	 	 	 	 g l o b a l E v e n t C o n t e x t . t r i g g e r (   " a j a x S e n d " ,   [   j q X H R ,   s   ]   ) ;  
 	 	 	 }  
 	 	 	 / /   T i m e o u t  
 	 	 	 i f   (   s . a s y n c   & &   s . t i m e o u t   >   0   )   {  
 	 	 	 	 t i m e o u t T i m e r   =   s e t T i m e o u t (   f u n c t i o n ( ) {  
 	 	 	 	 	 j q X H R . a b o r t (   " t i m e o u t "   ) ;  
 	 	 	 	 } ,   s . t i m e o u t   ) ;  
 	 	 	 }  
  
 	 	 	 t r y   {  
 	 	 	 	 s t a t e   =   1 ;  
 	 	 	 	 t r a n s p o r t . s e n d (   r e q u e s t H e a d e r s ,   d o n e   ) ;  
 	 	 	 }   c a t c h   ( e )   {  
 	 	 	 	 / /   P r o p a g a t e   e x c e p t i o n   a s   e r r o r   i f   n o t   d o n e  
 	 	 	 	 i f   (   s t a t u s   <   2   )   {  
 	 	 	 	 	 d o n e (   - 1 ,   e   ) ;  
 	 	 	 	 / /   S i m p l y   r e t h r o w   o t h e r w i s e  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 j Q u e r y . e r r o r (   e   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 r e t u r n   j q X H R ;  
 	 } ,  
  
 	 / /   S e r i a l i z e   a n   a r r a y   o f   f o r m   e l e m e n t s   o r   a   s e t   o f  
 	 / /   k e y / v a l u e s   i n t o   a   q u e r y   s t r i n g  
 	 p a r a m :   f u n c t i o n (   a ,   t r a d i t i o n a l   )   {  
 	 	 v a r   s   =   [ ] ,  
 	 	 	 a d d   =   f u n c t i o n (   k e y ,   v a l u e   )   {  
 	 	 	 	 / /   I f   v a l u e   i s   a   f u n c t i o n ,   i n v o k e   i t   a n d   r e t u r n   i t s   v a l u e  
 	 	 	 	 v a l u e   =   j Q u e r y . i s F u n c t i o n (   v a l u e   )   ?   v a l u e ( )   :   v a l u e ;  
 	 	 	 	 s [   s . l e n g t h   ]   =   e n c o d e U R I C o m p o n e n t (   k e y   )   +   " = "   +   e n c o d e U R I C o m p o n e n t (   v a l u e   ) ;  
 	 	 	 } ;  
  
 	 	 / /   S e t   t r a d i t i o n a l   t o   t r u e   f o r   j Q u e r y   < =   1 . 3 . 2   b e h a v i o r .  
 	 	 i f   (   t r a d i t i o n a l   = = =   u n d e f i n e d   )   {  
 	 	 	 t r a d i t i o n a l   =   j Q u e r y . a j a x S e t t i n g s . t r a d i t i o n a l ;  
 	 	 }  
  
 	 	 / /   I f   a n   a r r a y   w a s   p a s s e d   i n ,   a s s u m e   t h a t   i t   i s   a n   a r r a y   o f   f o r m   e l e m e n t s .  
 	 	 i f   (   j Q u e r y . i s A r r a y (   a   )   | |   (   a . j q u e r y   & &   ! j Q u e r y . i s P l a i n O b j e c t (   a   )   )   )   {  
 	 	 	 / /   S e r i a l i z e   t h e   f o r m   e l e m e n t s  
 	 	 	 j Q u e r y . e a c h (   a ,   f u n c t i o n ( )   {  
 	 	 	 	 a d d (   t h i s . n a m e ,   t h i s . v a l u e   ) ;  
 	 	 	 } ) ;  
  
 	 	 }   e l s e   {  
 	 	 	 / /   I f   t r a d i t i o n a l ,   e n c o d e   t h e   " o l d "   w a y   ( t h e   w a y   1 . 3 . 2   o r   o l d e r  
 	 	 	 / /   d i d   i t ) ,   o t h e r w i s e   e n c o d e   p a r a m s   r e c u r s i v e l y .  
 	 	 	 f o r   (   v a r   p r e f i x   i n   a   )   {  
 	 	 	 	 b u i l d P a r a m s (   p r e f i x ,   a [   p r e f i x   ] ,   t r a d i t i o n a l ,   a d d   ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 / /   R e t u r n   t h e   r e s u l t i n g   s e r i a l i z a t i o n  
 	 	 r e t u r n   s . j o i n (   " & "   ) . r e p l a c e (   r 2 0 ,   " + "   ) ;  
 	 }  
 } ) ;  
  
 f u n c t i o n   b u i l d P a r a m s (   p r e f i x ,   o b j ,   t r a d i t i o n a l ,   a d d   )   {  
 	 i f   (   j Q u e r y . i s A r r a y (   o b j   )   )   {  
 	 	 / /   S e r i a l i z e   a r r a y   i t e m .  
 	 	 j Q u e r y . e a c h (   o b j ,   f u n c t i o n (   i ,   v   )   {  
 	 	 	 i f   (   t r a d i t i o n a l   | |   r b r a c k e t . t e s t (   p r e f i x   )   )   {  
 	 	 	 	 / /   T r e a t   e a c h   a r r a y   i t e m   a s   a   s c a l a r .  
 	 	 	 	 a d d (   p r e f i x ,   v   ) ;  
  
 	 	 	 }   e l s e   {  
 	 	 	 	 / /   I f   a r r a y   i t e m   i s   n o n - s c a l a r   ( a r r a y   o r   o b j e c t ) ,   e n c o d e   i t s  
 	 	 	 	 / /   n u m e r i c   i n d e x   t o   r e s o l v e   d e s e r i a l i z a t i o n   a m b i g u i t y   i s s u e s .  
 	 	 	 	 / /   N o t e   t h a t   r a c k   ( a s   o f   1 . 0 . 0 )   c a n ' t   c u r r e n t l y   d e s e r i a l i z e  
 	 	 	 	 / /   n e s t e d   a r r a y s   p r o p e r l y ,   a n d   a t t e m p t i n g   t o   d o   s o   m a y   c a u s e  
 	 	 	 	 / /   a   s e r v e r   e r r o r .   P o s s i b l e   f i x e s   a r e   t o   m o d i f y   r a c k ' s  
 	 	 	 	 / /   d e s e r i a l i z a t i o n   a l g o r i t h m   o r   t o   p r o v i d e   a n   o p t i o n   o r   f l a g  
 	 	 	 	 / /   t o   f o r c e   a r r a y   s e r i a l i z a t i o n   t o   b e   s h a l l o w .  
 	 	 	 	 b u i l d P a r a m s (   p r e f i x   +   " [ "   +   (   t y p e o f   v   = = =   " o b j e c t "   | |   j Q u e r y . i s A r r a y ( v )   ?   i   :   " "   )   +   " ] " ,   v ,   t r a d i t i o n a l ,   a d d   ) ;  
 	 	 	 }  
 	 	 } ) ;  
  
 	 }   e l s e   i f   (   ! t r a d i t i o n a l   & &   o b j   ! =   n u l l   & &   t y p e o f   o b j   = = =   " o b j e c t "   )   {  
 	 	 / /   S e r i a l i z e   o b j e c t   i t e m .  
 	 	 f o r   (   v a r   n a m e   i n   o b j   )   {  
 	 	 	 b u i l d P a r a m s (   p r e f i x   +   " [ "   +   n a m e   +   " ] " ,   o b j [   n a m e   ] ,   t r a d i t i o n a l ,   a d d   ) ;  
 	 	 }  
  
 	 }   e l s e   {  
 	 	 / /   S e r i a l i z e   s c a l a r   i t e m .  
 	 	 a d d (   p r e f i x ,   o b j   ) ;  
 	 }  
 }  
  
 / /   T h i s   i s   s t i l l   o n   t h e   j Q u e r y   o b j e c t . . .   f o r   n o w  
 / /   W a n t   t o   m o v e   t h i s   t o   j Q u e r y . a j a x   s o m e   d a y  
 j Q u e r y . e x t e n d ( {  
  
 	 / /   C o u n t e r   f o r   h o l d i n g   t h e   n u m b e r   o f   a c t i v e   q u e r i e s  
 	 a c t i v e :   0 ,  
  
 	 / /   L a s t - M o d i f i e d   h e a d e r   c a c h e   f o r   n e x t   r e q u e s t  
 	 l a s t M o d i f i e d :   { } ,  
 	 e t a g :   { }  
  
 } ) ;  
  
 / *   H a n d l e s   r e s p o n s e s   t o   a n   a j a x   r e q u e s t :  
   *   -   s e t s   a l l   r e s p o n s e X X X   f i e l d s   a c c o r d i n g l y  
   *   -   f i n d s   t h e   r i g h t   d a t a T y p e   ( m e d i a t e s   b e t w e e n   c o n t e n t - t y p e   a n d   e x p e c t e d   d a t a T y p e )  
   *   -   r e t u r n s   t h e   c o r r e s p o n d i n g   r e s p o n s e  
   * /  
 f u n c t i o n   a j a x H a n d l e R e s p o n s e s (   s ,   j q X H R ,   r e s p o n s e s   )   {  
  
 	 v a r   c o n t e n t s   =   s . c o n t e n t s ,  
 	 	 d a t a T y p e s   =   s . d a t a T y p e s ,  
 	 	 r e s p o n s e F i e l d s   =   s . r e s p o n s e F i e l d s ,  
 	 	 c t ,  
 	 	 t y p e ,  
 	 	 f i n a l D a t a T y p e ,  
 	 	 f i r s t D a t a T y p e ;  
  
 	 / /   F i l l   r e s p o n s e X X X   f i e l d s  
 	 f o r (   t y p e   i n   r e s p o n s e F i e l d s   )   {  
 	 	 i f   (   t y p e   i n   r e s p o n s e s   )   {  
 	 	 	 j q X H R [   r e s p o n s e F i e l d s [ t y p e ]   ]   =   r e s p o n s e s [   t y p e   ] ;  
 	 	 }  
 	 }  
  
 	 / /   R e m o v e   a u t o   d a t a T y p e   a n d   g e t   c o n t e n t - t y p e   i n   t h e   p r o c e s s  
 	 w h i l e (   d a t a T y p e s [   0   ]   = = =   " * "   )   {  
 	 	 d a t a T y p e s . s h i f t ( ) ;  
 	 	 i f   (   c t   = = =   u n d e f i n e d   )   {  
 	 	 	 c t   =   s . m i m e T y p e   | |   j q X H R . g e t R e s p o n s e H e a d e r (   " c o n t e n t - t y p e "   ) ;  
 	 	 }  
 	 }  
  
 	 / /   C h e c k   i f   w e ' r e   d e a l i n g   w i t h   a   k n o w n   c o n t e n t - t y p e  
 	 i f   (   c t   )   {  
 	 	 f o r   (   t y p e   i n   c o n t e n t s   )   {  
 	 	 	 i f   (   c o n t e n t s [   t y p e   ]   & &   c o n t e n t s [   t y p e   ] . t e s t (   c t   )   )   {  
 	 	 	 	 d a t a T y p e s . u n s h i f t (   t y p e   ) ;  
 	 	 	 	 b r e a k ;  
 	 	 	 }  
 	 	 }  
 	 }  
  
 	 / /   C h e c k   t o   s e e   i f   w e   h a v e   a   r e s p o n s e   f o r   t h e   e x p e c t e d   d a t a T y p e  
 	 i f   (   d a t a T y p e s [   0   ]   i n   r e s p o n s e s   )   {  
 	 	 f i n a l D a t a T y p e   =   d a t a T y p e s [   0   ] ;  
 	 }   e l s e   {  
 	 	 / /   T r y   c o n v e r t i b l e   d a t a T y p e s  
 	 	 f o r   (   t y p e   i n   r e s p o n s e s   )   {  
 	 	 	 i f   (   ! d a t a T y p e s [   0   ]   | |   s . c o n v e r t e r s [   t y p e   +   "   "   +   d a t a T y p e s [ 0 ]   ]   )   {  
 	 	 	 	 f i n a l D a t a T y p e   =   t y p e ;  
 	 	 	 	 b r e a k ;  
 	 	 	 }  
 	 	 	 i f   (   ! f i r s t D a t a T y p e   )   {  
 	 	 	 	 f i r s t D a t a T y p e   =   t y p e ;  
 	 	 	 }  
 	 	 }  
 	 	 / /   O r   j u s t   u s e   f i r s t   o n e  
 	 	 f i n a l D a t a T y p e   =   f i n a l D a t a T y p e   | |   f i r s t D a t a T y p e ;  
 	 }  
  
 	 / /   I f   w e   f o u n d   a   d a t a T y p e  
 	 / /   W e   a d d   t h e   d a t a T y p e   t o   t h e   l i s t   i f   n e e d e d  
 	 / /   a n d   r e t u r n   t h e   c o r r e s p o n d i n g   r e s p o n s e  
 	 i f   (   f i n a l D a t a T y p e   )   {  
 	 	 i f   (   f i n a l D a t a T y p e   ! = =   d a t a T y p e s [   0   ]   )   {  
 	 	 	 d a t a T y p e s . u n s h i f t (   f i n a l D a t a T y p e   ) ;  
 	 	 }  
 	 	 r e t u r n   r e s p o n s e s [   f i n a l D a t a T y p e   ] ;  
 	 }  
 }  
  
 / /   C h a i n   c o n v e r s i o n s   g i v e n   t h e   r e q u e s t   a n d   t h e   o r i g i n a l   r e s p o n s e  
 f u n c t i o n   a j a x C o n v e r t (   s ,   r e s p o n s e   )   {  
  
 	 / /   A p p l y   t h e   d a t a F i l t e r   i f   p r o v i d e d  
 	 i f   (   s . d a t a F i l t e r   )   {  
 	 	 r e s p o n s e   =   s . d a t a F i l t e r (   r e s p o n s e ,   s . d a t a T y p e   ) ;  
 	 }  
  
 	 v a r   d a t a T y p e s   =   s . d a t a T y p e s ,  
 	 	 c o n v e r t e r s   =   { } ,  
 	 	 i ,  
 	 	 k e y ,  
 	 	 l e n g t h   =   d a t a T y p e s . l e n g t h ,  
 	 	 t m p ,  
 	 	 / /   C u r r e n t   a n d   p r e v i o u s   d a t a T y p e s  
 	 	 c u r r e n t   =   d a t a T y p e s [   0   ] ,  
 	 	 p r e v ,  
 	 	 / /   C o n v e r s i o n   e x p r e s s i o n  
 	 	 c o n v e r s i o n ,  
 	 	 / /   C o n v e r s i o n   f u n c t i o n  
 	 	 c o n v ,  
 	 	 / /   C o n v e r s i o n   f u n c t i o n s   ( t r a n s i t i v e   c o n v e r s i o n )  
 	 	 c o n v 1 ,  
 	 	 c o n v 2 ;  
  
 	 / /   F o r   e a c h   d a t a T y p e   i n   t h e   c h a i n  
 	 f o r (   i   =   1 ;   i   <   l e n g t h ;   i + +   )   {  
  
 	 	 / /   C r e a t e   c o n v e r t e r s   m a p  
 	 	 / /   w i t h   l o w e r c a s e d   k e y s  
 	 	 i f   (   i   = = =   1   )   {  
 	 	 	 f o r (   k e y   i n   s . c o n v e r t e r s   )   {  
 	 	 	 	 i f (   t y p e o f   k e y   = = =   " s t r i n g "   )   {  
 	 	 	 	 	 c o n v e r t e r s [   k e y . t o L o w e r C a s e ( )   ]   =   s . c o n v e r t e r s [   k e y   ] ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 / /   G e t   t h e   d a t a T y p e s  
 	 	 p r e v   =   c u r r e n t ;  
 	 	 c u r r e n t   =   d a t a T y p e s [   i   ] ;  
  
 	 	 / /   I f   c u r r e n t   i s   a u t o   d a t a T y p e ,   u p d a t e   i t   t o   p r e v  
 	 	 i f (   c u r r e n t   = = =   " * "   )   {  
 	 	 	 c u r r e n t   =   p r e v ;  
 	 	 / /   I f   n o   a u t o   a n d   d a t a T y p e s   a r e   a c t u a l l y   d i f f e r e n t  
 	 	 }   e l s e   i f   (   p r e v   ! = =   " * "   & &   p r e v   ! = =   c u r r e n t   )   {  
  
 	 	 	 / /   G e t   t h e   c o n v e r t e r  
 	 	 	 c o n v e r s i o n   =   p r e v   +   "   "   +   c u r r e n t ;  
 	 	 	 c o n v   =   c o n v e r t e r s [   c o n v e r s i o n   ]   | |   c o n v e r t e r s [   " *   "   +   c u r r e n t   ] ;  
  
 	 	 	 / /   I f   t h e r e   i s   n o   d i r e c t   c o n v e r t e r ,   s e a r c h   t r a n s i t i v e l y  
 	 	 	 i f   (   ! c o n v   )   {  
 	 	 	 	 c o n v 2   =   u n d e f i n e d ;  
 	 	 	 	 f o r (   c o n v 1   i n   c o n v e r t e r s   )   {  
 	 	 	 	 	 t m p   =   c o n v 1 . s p l i t (   "   "   ) ;  
 	 	 	 	 	 i f   (   t m p [   0   ]   = = =   p r e v   | |   t m p [   0   ]   = = =   " * "   )   {  
 	 	 	 	 	 	 c o n v 2   =   c o n v e r t e r s [   t m p [ 1 ]   +   "   "   +   c u r r e n t   ] ;  
 	 	 	 	 	 	 i f   (   c o n v 2   )   {  
 	 	 	 	 	 	 	 c o n v 1   =   c o n v e r t e r s [   c o n v 1   ] ;  
 	 	 	 	 	 	 	 i f   (   c o n v 1   = = =   t r u e   )   {  
 	 	 	 	 	 	 	 	 c o n v   =   c o n v 2 ;  
 	 	 	 	 	 	 	 }   e l s e   i f   (   c o n v 2   = = =   t r u e   )   {  
 	 	 	 	 	 	 	 	 c o n v   =   c o n v 1 ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 	 / /   I f   w e   f o u n d   n o   c o n v e r t e r ,   d i s p a t c h   a n   e r r o r  
 	 	 	 i f   (   ! (   c o n v   | |   c o n v 2   )   )   {  
 	 	 	 	 j Q u e r y . e r r o r (   " N o   c o n v e r s i o n   f r o m   "   +   c o n v e r s i o n . r e p l a c e ( "   " , "   t o   " )   ) ;  
 	 	 	 }  
 	 	 	 / /   I f   f o u n d   c o n v e r t e r   i s   n o t   a n   e q u i v a l e n c e  
 	 	 	 i f   (   c o n v   ! = =   t r u e   )   {  
 	 	 	 	 / /   C o n v e r t   w i t h   1   o r   2   c o n v e r t e r s   a c c o r d i n g l y  
 	 	 	 	 r e s p o n s e   =   c o n v   ?   c o n v (   r e s p o n s e   )   :   c o n v 2 (   c o n v 1 ( r e s p o n s e )   ) ;  
 	 	 	 }  
 	 	 }  
 	 }  
 	 r e t u r n   r e s p o n s e ;  
 }  
  
  
  
  
 v a r   j s c   =   j Q u e r y . n o w ( ) ,  
 	 j s r e   =   / ( \ = ) \ ? ( & | $ ) | \ ? \ ? / i ;  
  
 / /   D e f a u l t   j s o n p   s e t t i n g s  
 j Q u e r y . a j a x S e t u p ( {  
 	 j s o n p :   " c a l l b a c k " ,  
 	 j s o n p C a l l b a c k :   f u n c t i o n ( )   {  
 	 	 r e t u r n   j Q u e r y . e x p a n d o   +   " _ "   +   (   j s c + +   ) ;  
 	 }  
 } ) ;  
  
 / /   D e t e c t ,   n o r m a l i z e   o p t i o n s   a n d   i n s t a l l   c a l l b a c k s   f o r   j s o n p   r e q u e s t s  
 j Q u e r y . a j a x P r e f i l t e r (   " j s o n   j s o n p " ,   f u n c t i o n (   s ,   o r i g i n a l S e t t i n g s ,   j q X H R   )   {  
  
 	 v a r   i n s p e c t D a t a   =   s . c o n t e n t T y p e   = = =   " a p p l i c a t i o n / x - w w w - f o r m - u r l e n c o d e d "   & &  
 	 	 (   t y p e o f   s . d a t a   = = =   " s t r i n g "   ) ;  
  
 	 i f   (   s . d a t a T y p e s [   0   ]   = = =   " j s o n p "   | |  
 	 	 s . j s o n p   ! = =   f a l s e   & &   (   j s r e . t e s t (   s . u r l   )   | |  
 	 	 	 	 i n s p e c t D a t a   & &   j s r e . t e s t (   s . d a t a   )   )   )   {  
  
 	 	 v a r   r e s p o n s e C o n t a i n e r ,  
 	 	 	 j s o n p C a l l b a c k   =   s . j s o n p C a l l b a c k   =  
 	 	 	 	 j Q u e r y . i s F u n c t i o n (   s . j s o n p C a l l b a c k   )   ?   s . j s o n p C a l l b a c k ( )   :   s . j s o n p C a l l b a c k ,  
 	 	 	 p r e v i o u s   =   w i n d o w [   j s o n p C a l l b a c k   ] ,  
 	 	 	 u r l   =   s . u r l ,  
 	 	 	 d a t a   =   s . d a t a ,  
 	 	 	 r e p l a c e   =   " $ 1 "   +   j s o n p C a l l b a c k   +   " $ 2 " ;  
  
 	 	 i f   (   s . j s o n p   ! = =   f a l s e   )   {  
 	 	 	 u r l   =   u r l . r e p l a c e (   j s r e ,   r e p l a c e   ) ;  
 	 	 	 i f   (   s . u r l   = = =   u r l   )   {  
 	 	 	 	 i f   (   i n s p e c t D a t a   )   {  
 	 	 	 	 	 d a t a   =   d a t a . r e p l a c e (   j s r e ,   r e p l a c e   ) ;  
 	 	 	 	 }  
 	 	 	 	 i f   (   s . d a t a   = = =   d a t a   )   {  
 	 	 	 	 	 / /   A d d   c a l l b a c k   m a n u a l l y  
 	 	 	 	 	 u r l   + =   ( / \ ? / . t e s t (   u r l   )   ?   " & "   :   " ? " )   +   s . j s o n p   +   " = "   +   j s o n p C a l l b a c k ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
  
 	 	 s . u r l   =   u r l ;  
 	 	 s . d a t a   =   d a t a ;  
  
 	 	 / /   I n s t a l l   c a l l b a c k  
 	 	 w i n d o w [   j s o n p C a l l b a c k   ]   =   f u n c t i o n (   r e s p o n s e   )   {  
 	 	 	 r e s p o n s e C o n t a i n e r   =   [   r e s p o n s e   ] ;  
 	 	 } ;  
  
 	 	 / /   C l e a n - u p   f u n c t i o n  
 	 	 j q X H R . a l w a y s ( f u n c t i o n ( )   {  
 	 	 	 / /   S e t   c a l l b a c k   b a c k   t o   p r e v i o u s   v a l u e  
 	 	 	 w i n d o w [   j s o n p C a l l b a c k   ]   =   p r e v i o u s ;  
 	 	 	 / /   C a l l   i f   i t   w a s   a   f u n c t i o n   a n d   w e   h a v e   a   r e s p o n s e  
 	 	 	 i f   (   r e s p o n s e C o n t a i n e r   & &   j Q u e r y . i s F u n c t i o n (   p r e v i o u s   )   )   {  
 	 	 	 	 w i n d o w [   j s o n p C a l l b a c k   ] (   r e s p o n s e C o n t a i n e r [   0   ]   ) ;  
 	 	 	 }  
 	 	 } ) ;  
  
 	 	 / /   U s e   d a t a   c o n v e r t e r   t o   r e t r i e v e   j s o n   a f t e r   s c r i p t   e x e c u t i o n  
 	 	 s . c o n v e r t e r s [ " s c r i p t   j s o n " ]   =   f u n c t i o n ( )   {  
 	 	 	 i f   (   ! r e s p o n s e C o n t a i n e r   )   {  
 	 	 	 	 j Q u e r y . e r r o r (   j s o n p C a l l b a c k   +   "   w a s   n o t   c a l l e d "   ) ;  
 	 	 	 }  
 	 	 	 r e t u r n   r e s p o n s e C o n t a i n e r [   0   ] ;  
 	 	 } ;  
  
 	 	 / /   f o r c e   j s o n   d a t a T y p e  
 	 	 s . d a t a T y p e s [   0   ]   =   " j s o n " ;  
  
 	 	 / /   D e l e g a t e   t o   s c r i p t  
 	 	 r e t u r n   " s c r i p t " ;  
 	 }  
 } ) ;  
  
  
  
  
 / /   I n s t a l l   s c r i p t   d a t a T y p e  
 j Q u e r y . a j a x S e t u p ( {  
 	 a c c e p t s :   {  
 	 	 s c r i p t :   " t e x t / j a v a s c r i p t ,   a p p l i c a t i o n / j a v a s c r i p t ,   a p p l i c a t i o n / e c m a s c r i p t ,   a p p l i c a t i o n / x - e c m a s c r i p t "  
 	 } ,  
 	 c o n t e n t s :   {  
 	 	 s c r i p t :   / j a v a s c r i p t | e c m a s c r i p t /  
 	 } ,  
 	 c o n v e r t e r s :   {  
 	 	 " t e x t   s c r i p t " :   f u n c t i o n (   t e x t   )   {  
 	 	 	 j Q u e r y . g l o b a l E v a l (   t e x t   ) ;  
 	 	 	 r e t u r n   t e x t ;  
 	 	 }  
 	 }  
 } ) ;  
  
 / /   H a n d l e   c a c h e ' s   s p e c i a l   c a s e   a n d   g l o b a l  
 j Q u e r y . a j a x P r e f i l t e r (   " s c r i p t " ,   f u n c t i o n (   s   )   {  
 	 i f   (   s . c a c h e   = = =   u n d e f i n e d   )   {  
 	 	 s . c a c h e   =   f a l s e ;  
 	 }  
 	 i f   (   s . c r o s s D o m a i n   )   {  
 	 	 s . t y p e   =   " G E T " ;  
 	 	 s . g l o b a l   =   f a l s e ;  
 	 }  
 } ) ;  
  
 / /   B i n d   s c r i p t   t a g   h a c k   t r a n s p o r t  
 j Q u e r y . a j a x T r a n s p o r t (   " s c r i p t " ,   f u n c t i o n ( s )   {  
  
 	 / /   T h i s   t r a n s p o r t   o n l y   d e a l s   w i t h   c r o s s   d o m a i n   r e q u e s t s  
 	 i f   (   s . c r o s s D o m a i n   )   {  
  
 	 	 v a r   s c r i p t ,  
 	 	 	 h e a d   =   d o c u m e n t . h e a d   | |   d o c u m e n t . g e t E l e m e n t s B y T a g N a m e (   " h e a d "   ) [ 0 ]   | |   d o c u m e n t . d o c u m e n t E l e m e n t ;  
  
 	 	 r e t u r n   {  
  
 	 	 	 s e n d :   f u n c t i o n (   _ ,   c a l l b a c k   )   {  
  
 	 	 	 	 s c r i p t   =   d o c u m e n t . c r e a t e E l e m e n t (   " s c r i p t "   ) ;  
  
 	 	 	 	 s c r i p t . a s y n c   =   " a s y n c " ;  
  
 	 	 	 	 i f   (   s . s c r i p t C h a r s e t   )   {  
 	 	 	 	 	 s c r i p t . c h a r s e t   =   s . s c r i p t C h a r s e t ;  
 	 	 	 	 }  
  
 	 	 	 	 s c r i p t . s r c   =   s . u r l ;  
  
 	 	 	 	 / /   A t t a c h   h a n d l e r s   f o r   a l l   b r o w s e r s  
 	 	 	 	 s c r i p t . o n l o a d   =   s c r i p t . o n r e a d y s t a t e c h a n g e   =   f u n c t i o n (   _ ,   i s A b o r t   )   {  
  
 	 	 	 	 	 i f   (   i s A b o r t   | |   ! s c r i p t . r e a d y S t a t e   | |   / l o a d e d | c o m p l e t e / . t e s t (   s c r i p t . r e a d y S t a t e   )   )   {  
  
 	 	 	 	 	 	 / /   H a n d l e   m e m o r y   l e a k   i n   I E  
 	 	 	 	 	 	 s c r i p t . o n l o a d   =   s c r i p t . o n r e a d y s t a t e c h a n g e   =   n u l l ;  
  
 	 	 	 	 	 	 / /   R e m o v e   t h e   s c r i p t  
 	 	 	 	 	 	 i f   (   h e a d   & &   s c r i p t . p a r e n t N o d e   )   {  
 	 	 	 	 	 	 	 h e a d . r e m o v e C h i l d (   s c r i p t   ) ;  
 	 	 	 	 	 	 }  
  
 	 	 	 	 	 	 / /   D e r e f e r e n c e   t h e   s c r i p t  
 	 	 	 	 	 	 s c r i p t   =   u n d e f i n e d ;  
  
 	 	 	 	 	 	 / /   C a l l b a c k   i f   n o t   a b o r t  
 	 	 	 	 	 	 i f   (   ! i s A b o r t   )   {  
 	 	 	 	 	 	 	 c a l l b a c k (   2 0 0 ,   " s u c c e s s "   ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 } ;  
 	 	 	 	 / /   U s e   i n s e r t B e f o r e   i n s t e a d   o f   a p p e n d C h i l d     t o   c i r c u m v e n t   a n   I E 6   b u g .  
 	 	 	 	 / /   T h i s   a r i s e s   w h e n   a   b a s e   n o d e   i s   u s e d   ( # 2 7 0 9   a n d   # 4 3 7 8 ) .  
 	 	 	 	 h e a d . i n s e r t B e f o r e (   s c r i p t ,   h e a d . f i r s t C h i l d   ) ;  
 	 	 	 } ,  
  
 	 	 	 a b o r t :   f u n c t i o n ( )   {  
 	 	 	 	 i f   (   s c r i p t   )   {  
 	 	 	 	 	 s c r i p t . o n l o a d (   0 ,   1   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 } ;  
 	 }  
 } ) ;  
  
  
  
  
 v a r   / /   # 5 2 8 0 :   I n t e r n e t   E x p l o r e r   w i l l   k e e p   c o n n e c t i o n s   a l i v e   i f   w e   d o n ' t   a b o r t   o n   u n l o a d  
 	 x h r O n U n l o a d A b o r t   =   w i n d o w . A c t i v e X O b j e c t   ?   f u n c t i o n ( )   {  
 	 	 / /   A b o r t   a l l   p e n d i n g   r e q u e s t s  
 	 	 f o r   (   v a r   k e y   i n   x h r C a l l b a c k s   )   {  
 	 	 	 x h r C a l l b a c k s [   k e y   ] (   0 ,   1   ) ;  
 	 	 }  
 	 }   :   f a l s e ,  
 	 x h r I d   =   0 ,  
 	 x h r C a l l b a c k s ;  
  
 / /   F u n c t i o n s   t o   c r e a t e   x h r s  
 f u n c t i o n   c r e a t e S t a n d a r d X H R ( )   {  
 	 t r y   {  
 	 	 r e t u r n   n e w   w i n d o w . X M L H t t p R e q u e s t ( ) ;  
 	 }   c a t c h (   e   )   { }  
 }  
  
 f u n c t i o n   c r e a t e A c t i v e X H R ( )   {  
 	 t r y   {  
 	 	 r e t u r n   n e w   w i n d o w . A c t i v e X O b j e c t (   " M i c r o s o f t . X M L H T T P "   ) ;  
 	 }   c a t c h (   e   )   { }  
 }  
  
 / /   C r e a t e   t h e   r e q u e s t   o b j e c t  
 / /   ( T h i s   i s   s t i l l   a t t a c h e d   t o   a j a x S e t t i n g s   f o r   b a c k w a r d   c o m p a t i b i l i t y )  
 j Q u e r y . a j a x S e t t i n g s . x h r   =   w i n d o w . A c t i v e X O b j e c t   ?  
 	 / *   M i c r o s o f t   f a i l e d   t o   p r o p e r l y  
 	   *   i m p l e m e n t   t h e   X M L H t t p R e q u e s t   i n   I E 7   ( c a n ' t   r e q u e s t   l o c a l   f i l e s ) ,  
 	   *   s o   w e   u s e   t h e   A c t i v e X O b j e c t   w h e n   i t   i s   a v a i l a b l e  
 	   *   A d d i t i o n a l l y   X M L H t t p R e q u e s t   c a n   b e   d i s a b l e d   i n   I E 7 / I E 8   s o  
 	   *   w e   n e e d   a   f a l l b a c k .  
 	   * /  
 	 f u n c t i o n ( )   {  
 	 	 r e t u r n   ! t h i s . i s L o c a l   & &   c r e a t e S t a n d a r d X H R ( )   | |   c r e a t e A c t i v e X H R ( ) ;  
 	 }   :  
 	 / /   F o r   a l l   o t h e r   b r o w s e r s ,   u s e   t h e   s t a n d a r d   X M L H t t p R e q u e s t   o b j e c t  
 	 c r e a t e S t a n d a r d X H R ;  
  
 / /   D e t e r m i n e   s u p p o r t   p r o p e r t i e s  
 ( f u n c t i o n (   x h r   )   {  
 	 j Q u e r y . e x t e n d (   j Q u e r y . s u p p o r t ,   {  
 	 	 a j a x :   ! ! x h r ,  
 	 	 c o r s :   ! ! x h r   & &   (   " w i t h C r e d e n t i a l s "   i n   x h r   )  
 	 } ) ;  
 } ) (   j Q u e r y . a j a x S e t t i n g s . x h r ( )   ) ;  
  
 / /   C r e a t e   t r a n s p o r t   i f   t h e   b r o w s e r   c a n   p r o v i d e   a n   x h r  
 i f   (   j Q u e r y . s u p p o r t . a j a x   )   {  
  
 	 j Q u e r y . a j a x T r a n s p o r t ( f u n c t i o n (   s   )   {  
 	 	 / /   C r o s s   d o m a i n   o n l y   a l l o w e d   i f   s u p p o r t e d   t h r o u g h   X M L H t t p R e q u e s t  
 	 	 i f   (   ! s . c r o s s D o m a i n   | |   j Q u e r y . s u p p o r t . c o r s   )   {  
  
 	 	 	 v a r   c a l l b a c k ;  
  
 	 	 	 r e t u r n   {  
 	 	 	 	 s e n d :   f u n c t i o n (   h e a d e r s ,   c o m p l e t e   )   {  
  
 	 	 	 	 	 / /   G e t   a   n e w   x h r  
 	 	 	 	 	 v a r   x h r   =   s . x h r ( ) ,  
 	 	 	 	 	 	 h a n d l e ,  
 	 	 	 	 	 	 i ;  
  
 	 	 	 	 	 / /   O p e n   t h e   s o c k e t  
 	 	 	 	 	 / /   P a s s i n g   n u l l   u s e r n a m e ,   g e n e r a t e s   a   l o g i n   p o p u p   o n   O p e r a   ( # 2 8 6 5 )  
 	 	 	 	 	 i f   (   s . u s e r n a m e   )   {  
 	 	 	 	 	 	 x h r . o p e n (   s . t y p e ,   s . u r l ,   s . a s y n c ,   s . u s e r n a m e ,   s . p a s s w o r d   ) ;  
 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 x h r . o p e n (   s . t y p e ,   s . u r l ,   s . a s y n c   ) ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 / /   A p p l y   c u s t o m   f i e l d s   i f   p r o v i d e d  
 	 	 	 	 	 i f   (   s . x h r F i e l d s   )   {  
 	 	 	 	 	 	 f o r   (   i   i n   s . x h r F i e l d s   )   {  
 	 	 	 	 	 	 	 x h r [   i   ]   =   s . x h r F i e l d s [   i   ] ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
  
 	 	 	 	 	 / /   O v e r r i d e   m i m e   t y p e   i f   n e e d e d  
 	 	 	 	 	 i f   (   s . m i m e T y p e   & &   x h r . o v e r r i d e M i m e T y p e   )   {  
 	 	 	 	 	 	 x h r . o v e r r i d e M i m e T y p e (   s . m i m e T y p e   ) ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 / /   X - R e q u e s t e d - W i t h   h e a d e r  
 	 	 	 	 	 / /   F o r   c r o s s - d o m a i n   r e q u e s t s ,   s e e i n g   a s   c o n d i t i o n s   f o r   a   p r e f l i g h t   a r e  
 	 	 	 	 	 / /   a k i n   t o   a   j i g s a w   p u z z l e ,   w e   s i m p l y   n e v e r   s e t   i t   t o   b e   s u r e .  
 	 	 	 	 	 / /   ( i t   c a n   a l w a y s   b e   s e t   o n   a   p e r - r e q u e s t   b a s i s   o r   e v e n   u s i n g   a j a x S e t u p )  
 	 	 	 	 	 / /   F o r   s a m e - d o m a i n   r e q u e s t s ,   w o n ' t   c h a n g e   h e a d e r   i f   a l r e a d y   p r o v i d e d .  
 	 	 	 	 	 i f   (   ! s . c r o s s D o m a i n   & &   ! h e a d e r s [ " X - R e q u e s t e d - W i t h " ]   )   {  
 	 	 	 	 	 	 h e a d e r s [   " X - R e q u e s t e d - W i t h "   ]   =   " X M L H t t p R e q u e s t " ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 / /   N e e d   a n   e x t r a   t r y / c a t c h   f o r   c r o s s   d o m a i n   r e q u e s t s   i n   F i r e f o x   3  
 	 	 	 	 	 t r y   {  
 	 	 	 	 	 	 f o r   (   i   i n   h e a d e r s   )   {  
 	 	 	 	 	 	 	 x h r . s e t R e q u e s t H e a d e r (   i ,   h e a d e r s [   i   ]   ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }   c a t c h (   _   )   { }  
  
 	 	 	 	 	 / /   D o   s e n d   t h e   r e q u e s t  
 	 	 	 	 	 / /   T h i s   m a y   r a i s e   a n   e x c e p t i o n   w h i c h   i s   a c t u a l l y  
 	 	 	 	 	 / /   h a n d l e d   i n   j Q u e r y . a j a x   ( s o   n o   t r y / c a t c h   h e r e )  
 	 	 	 	 	 x h r . s e n d (   (   s . h a s C o n t e n t   & &   s . d a t a   )   | |   n u l l   ) ;  
  
 	 	 	 	 	 / /   L i s t e n e r  
 	 	 	 	 	 c a l l b a c k   =   f u n c t i o n (   _ ,   i s A b o r t   )   {  
  
 	 	 	 	 	 	 v a r   s t a t u s ,  
 	 	 	 	 	 	 	 s t a t u s T e x t ,  
 	 	 	 	 	 	 	 r e s p o n s e H e a d e r s ,  
 	 	 	 	 	 	 	 r e s p o n s e s ,  
 	 	 	 	 	 	 	 x m l ;  
  
 	 	 	 	 	 	 / /   F i r e f o x   t h r o w s   e x c e p t i o n s   w h e n   a c c e s s i n g   p r o p e r t i e s  
 	 	 	 	 	 	 / /   o f   a n   x h r   w h e n   a   n e t w o r k   e r r o r   o c c u r e d  
 	 	 	 	 	 	 / /   h t t p : / / h e l p f u l . k n o b s - d i a l s . c o m / i n d e x . p h p / C o m p o n e n t _ r e t u r n e d _ f a i l u r e _ c o d e : _ 0 x 8 0 0 4 0 1 1 1 _ ( N S _ E R R O R _ N O T _ A V A I L A B L E )  
 	 	 	 	 	 	 t r y   {  
  
 	 	 	 	 	 	 	 / /   W a s   n e v e r   c a l l e d   a n d   i s   a b o r t e d   o r   c o m p l e t e  
 	 	 	 	 	 	 	 i f   (   c a l l b a c k   & &   (   i s A b o r t   | |   x h r . r e a d y S t a t e   = = =   4   )   )   {  
  
 	 	 	 	 	 	 	 	 / /   O n l y   c a l l e d   o n c e  
 	 	 	 	 	 	 	 	 c a l l b a c k   =   u n d e f i n e d ;  
  
 	 	 	 	 	 	 	 	 / /   D o   n o t   k e e p   a s   a c t i v e   a n y m o r e  
 	 	 	 	 	 	 	 	 i f   (   h a n d l e   )   {  
 	 	 	 	 	 	 	 	 	 x h r . o n r e a d y s t a t e c h a n g e   =   j Q u e r y . n o o p ;  
 	 	 	 	 	 	 	 	 	 i f   (   x h r O n U n l o a d A b o r t   )   {  
 	 	 	 	 	 	 	 	 	 	 d e l e t e   x h r C a l l b a c k s [   h a n d l e   ] ;  
 	 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 	 }  
  
 	 	 	 	 	 	 	 	 / /   I f   i t ' s   a n   a b o r t  
 	 	 	 	 	 	 	 	 i f   (   i s A b o r t   )   {  
 	 	 	 	 	 	 	 	 	 / /   A b o r t   i t   m a n u a l l y   i f   n e e d e d  
 	 	 	 	 	 	 	 	 	 i f   (   x h r . r e a d y S t a t e   ! = =   4   )   {  
 	 	 	 	 	 	 	 	 	 	 x h r . a b o r t ( ) ;  
 	 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 	 	 s t a t u s   =   x h r . s t a t u s ;  
 	 	 	 	 	 	 	 	 	 r e s p o n s e H e a d e r s   =   x h r . g e t A l l R e s p o n s e H e a d e r s ( ) ;  
 	 	 	 	 	 	 	 	 	 r e s p o n s e s   =   { } ;  
 	 	 	 	 	 	 	 	 	 x m l   =   x h r . r e s p o n s e X M L ;  
  
 	 	 	 	 	 	 	 	 	 / /   C o n s t r u c t   r e s p o n s e   l i s t  
 	 	 	 	 	 	 	 	 	 i f   (   x m l   & &   x m l . d o c u m e n t E l e m e n t   / *   # 4 9 5 8   * /   )   {  
 	 	 	 	 	 	 	 	 	 	 r e s p o n s e s . x m l   =   x m l ;  
 	 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 	 	 r e s p o n s e s . t e x t   =   x h r . r e s p o n s e T e x t ;  
  
 	 	 	 	 	 	 	 	 	 / /   F i r e f o x   t h r o w s   a n   e x c e p t i o n   w h e n   a c c e s s i n g  
 	 	 	 	 	 	 	 	 	 / /   s t a t u s T e x t   f o r   f a u l t y   c r o s s - d o m a i n   r e q u e s t s  
 	 	 	 	 	 	 	 	 	 t r y   {  
 	 	 	 	 	 	 	 	 	 	 s t a t u s T e x t   =   x h r . s t a t u s T e x t ;  
 	 	 	 	 	 	 	 	 	 }   c a t c h (   e   )   {  
 	 	 	 	 	 	 	 	 	 	 / /   W e   n o r m a l i z e   w i t h   W e b k i t   g i v i n g   a n   e m p t y   s t a t u s T e x t  
 	 	 	 	 	 	 	 	 	 	 s t a t u s T e x t   =   " " ;  
 	 	 	 	 	 	 	 	 	 }  
  
 	 	 	 	 	 	 	 	 	 / /   F i l t e r   s t a t u s   f o r   n o n   s t a n d a r d   b e h a v i o r s  
  
 	 	 	 	 	 	 	 	 	 / /   I f   t h e   r e q u e s t   i s   l o c a l   a n d   w e   h a v e   d a t a :   a s s u m e   a   s u c c e s s  
 	 	 	 	 	 	 	 	 	 / /   ( s u c c e s s   w i t h   n o   d a t a   w o n ' t   g e t   n o t i f i e d ,   t h a t ' s   t h e   b e s t   w e  
 	 	 	 	 	 	 	 	 	 / /   c a n   d o   g i v e n   c u r r e n t   i m p l e m e n t a t i o n s )  
 	 	 	 	 	 	 	 	 	 i f   (   ! s t a t u s   & &   s . i s L o c a l   & &   ! s . c r o s s D o m a i n   )   {  
 	 	 	 	 	 	 	 	 	 	 s t a t u s   =   r e s p o n s e s . t e x t   ?   2 0 0   :   4 0 4 ;  
 	 	 	 	 	 	 	 	 	 / /   I E   -   # 1 4 5 0 :   s o m e t i m e s   r e t u r n s   1 2 2 3   w h e n   i t   s h o u l d   b e   2 0 4  
 	 	 	 	 	 	 	 	 	 }   e l s e   i f   (   s t a t u s   = = =   1 2 2 3   )   {  
 	 	 	 	 	 	 	 	 	 	 s t a t u s   =   2 0 4 ;  
 	 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }   c a t c h (   f i r e f o x A c c e s s E x c e p t i o n   )   {  
 	 	 	 	 	 	 	 i f   (   ! i s A b o r t   )   {  
 	 	 	 	 	 	 	 	 c o m p l e t e (   - 1 ,   f i r e f o x A c c e s s E x c e p t i o n   ) ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }  
  
 	 	 	 	 	 	 / /   C a l l   c o m p l e t e   i f   n e e d e d  
 	 	 	 	 	 	 i f   (   r e s p o n s e s   )   {  
 	 	 	 	 	 	 	 c o m p l e t e (   s t a t u s ,   s t a t u s T e x t ,   r e s p o n s e s ,   r e s p o n s e H e a d e r s   ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 } ;  
  
 	 	 	 	 	 / /   i f   w e ' r e   i n   s y n c   m o d e   o r   i t ' s   i n   c a c h e  
 	 	 	 	 	 / /   a n d   h a s   b e e n   r e t r i e v e d   d i r e c t l y   ( I E 6   &   I E 7 )  
 	 	 	 	 	 / /   w e   n e e d   t o   m a n u a l l y   f i r e   t h e   c a l l b a c k  
 	 	 	 	 	 i f   (   ! s . a s y n c   | |   x h r . r e a d y S t a t e   = = =   4   )   {  
 	 	 	 	 	 	 c a l l b a c k ( ) ;  
 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 h a n d l e   =   + + x h r I d ;  
 	 	 	 	 	 	 i f   (   x h r O n U n l o a d A b o r t   )   {  
 	 	 	 	 	 	 	 / /   C r e a t e   t h e   a c t i v e   x h r s   c a l l b a c k s   l i s t   i f   n e e d e d  
 	 	 	 	 	 	 	 / /   a n d   a t t a c h   t h e   u n l o a d   h a n d l e r  
 	 	 	 	 	 	 	 i f   (   ! x h r C a l l b a c k s   )   {  
 	 	 	 	 	 	 	 	 x h r C a l l b a c k s   =   { } ;  
 	 	 	 	 	 	 	 	 j Q u e r y (   w i n d o w   ) . u n l o a d (   x h r O n U n l o a d A b o r t   ) ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 / /   A d d   t o   l i s t   o f   a c t i v e   x h r s   c a l l b a c k s  
 	 	 	 	 	 	 	 x h r C a l l b a c k s [   h a n d l e   ]   =   c a l l b a c k ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 x h r . o n r e a d y s t a t e c h a n g e   =   c a l l b a c k ;  
 	 	 	 	 	 }  
 	 	 	 	 } ,  
  
 	 	 	 	 a b o r t :   f u n c t i o n ( )   {  
 	 	 	 	 	 i f   (   c a l l b a c k   )   {  
 	 	 	 	 	 	 c a l l b a c k ( 0 , 1 ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 } ;  
 	 	 }  
 	 } ) ;  
 }  
  
  
  
  
 v a r   e l e m d i s p l a y   =   { } ,  
 	 i f r a m e ,   i f r a m e D o c ,  
 	 r f x t y p e s   =   / ^ ( ? : t o g g l e | s h o w | h i d e ) $ / ,  
 	 r f x n u m   =   / ^ ( [ + \ - ] = ) ? ( [ \ d + . \ - ] + ) ( [ a - z % ] * ) $ / i ,  
 	 t i m e r I d ,  
 	 f x A t t r s   =   [  
 	 	 / /   h e i g h t   a n i m a t i o n s  
 	 	 [   " h e i g h t " ,   " m a r g i n T o p " ,   " m a r g i n B o t t o m " ,   " p a d d i n g T o p " ,   " p a d d i n g B o t t o m "   ] ,  
 	 	 / /   w i d t h   a n i m a t i o n s  
 	 	 [   " w i d t h " ,   " m a r g i n L e f t " ,   " m a r g i n R i g h t " ,   " p a d d i n g L e f t " ,   " p a d d i n g R i g h t "   ] ,  
 	 	 / /   o p a c i t y   a n i m a t i o n s  
 	 	 [   " o p a c i t y "   ]  
 	 ] ,  
 	 f x N o w ,  
 	 r e q u e s t A n i m a t i o n F r a m e   =   w i n d o w . w e b k i t R e q u e s t A n i m a t i o n F r a m e   | |  
 	         w i n d o w . m o z R e q u e s t A n i m a t i o n F r a m e   | |  
 	         w i n d o w . o R e q u e s t A n i m a t i o n F r a m e ;  
  
 j Q u e r y . f n . e x t e n d ( {  
 	 s h o w :   f u n c t i o n (   s p e e d ,   e a s i n g ,   c a l l b a c k   )   {  
 	 	 v a r   e l e m ,   d i s p l a y ;  
  
 	 	 i f   (   s p e e d   | |   s p e e d   = = =   0   )   {  
 	 	 	 r e t u r n   t h i s . a n i m a t e (   g e n F x ( " s h o w " ,   3 ) ,   s p e e d ,   e a s i n g ,   c a l l b a c k ) ;  
  
 	 	 }   e l s e   {  
 	 	 	 f o r   (   v a r   i   =   0 ,   j   =   t h i s . l e n g t h ;   i   <   j ;   i + +   )   {  
 	 	 	 	 e l e m   =   t h i s [ i ] ;  
  
 	 	 	 	 i f   (   e l e m . s t y l e   )   {  
 	 	 	 	 	 d i s p l a y   =   e l e m . s t y l e . d i s p l a y ;  
  
 	 	 	 	 	 / /   R e s e t   t h e   i n l i n e   d i s p l a y   o f   t h i s   e l e m e n t   t o   l e a r n   i f   i t   i s  
 	 	 	 	 	 / /   b e i n g   h i d d e n   b y   c a s c a d e d   r u l e s   o r   n o t  
 	 	 	 	 	 i f   (   ! j Q u e r y . _ d a t a ( e l e m ,   " o l d d i s p l a y " )   & &   d i s p l a y   = = =   " n o n e "   )   {  
 	 	 	 	 	 	 d i s p l a y   =   e l e m . s t y l e . d i s p l a y   =   " " ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 / /   S e t   e l e m e n t s   w h i c h   h a v e   b e e n   o v e r r i d d e n   w i t h   d i s p l a y :   n o n e  
 	 	 	 	 	 / /   i n   a   s t y l e s h e e t   t o   w h a t e v e r   t h e   d e f a u l t   b r o w s e r   s t y l e   i s  
 	 	 	 	 	 / /   f o r   s u c h   a n   e l e m e n t  
 	 	 	 	 	 i f   (   d i s p l a y   = = =   " "   & &   j Q u e r y . c s s (   e l e m ,   " d i s p l a y "   )   = = =   " n o n e "   )   {  
 	 	 	 	 	 	 j Q u e r y . _ d a t a ( e l e m ,   " o l d d i s p l a y " ,   d e f a u l t D i s p l a y ( e l e m . n o d e N a m e ) ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 / /   S e t   t h e   d i s p l a y   o f   m o s t   o f   t h e   e l e m e n t s   i n   a   s e c o n d   l o o p  
 	 	 	 / /   t o   a v o i d   t h e   c o n s t a n t   r e f l o w  
 	 	 	 f o r   (   i   =   0 ;   i   <   j ;   i + +   )   {  
 	 	 	 	 e l e m   =   t h i s [ i ] ;  
  
 	 	 	 	 i f   (   e l e m . s t y l e   )   {  
 	 	 	 	 	 d i s p l a y   =   e l e m . s t y l e . d i s p l a y ;  
  
 	 	 	 	 	 i f   (   d i s p l a y   = = =   " "   | |   d i s p l a y   = = =   " n o n e "   )   {  
 	 	 	 	 	 	 e l e m . s t y l e . d i s p l a y   =   j Q u e r y . _ d a t a ( e l e m ,   " o l d d i s p l a y " )   | |   " " ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 r e t u r n   t h i s ;  
 	 	 }  
 	 } ,  
  
 	 h i d e :   f u n c t i o n (   s p e e d ,   e a s i n g ,   c a l l b a c k   )   {  
 	 	 i f   (   s p e e d   | |   s p e e d   = = =   0   )   {  
 	 	 	 r e t u r n   t h i s . a n i m a t e (   g e n F x ( " h i d e " ,   3 ) ,   s p e e d ,   e a s i n g ,   c a l l b a c k ) ;  
  
 	 	 }   e l s e   {  
 	 	 	 f o r   (   v a r   i   =   0 ,   j   =   t h i s . l e n g t h ;   i   <   j ;   i + +   )   {  
 	 	 	 	 i f   (   t h i s [ i ] . s t y l e   )   {  
 	 	 	 	 	 v a r   d i s p l a y   =   j Q u e r y . c s s (   t h i s [ i ] ,   " d i s p l a y "   ) ;  
  
 	 	 	 	 	 i f   (   d i s p l a y   ! = =   " n o n e "   & &   ! j Q u e r y . _ d a t a (   t h i s [ i ] ,   " o l d d i s p l a y "   )   )   {  
 	 	 	 	 	 	 j Q u e r y . _ d a t a (   t h i s [ i ] ,   " o l d d i s p l a y " ,   d i s p l a y   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 / /   S e t   t h e   d i s p l a y   o f   t h e   e l e m e n t s   i n   a   s e c o n d   l o o p  
 	 	 	 / /   t o   a v o i d   t h e   c o n s t a n t   r e f l o w  
 	 	 	 f o r   (   i   =   0 ;   i   <   j ;   i + +   )   {  
 	 	 	 	 i f   (   t h i s [ i ] . s t y l e   )   {  
 	 	 	 	 	 t h i s [ i ] . s t y l e . d i s p l a y   =   " n o n e " ;  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 r e t u r n   t h i s ;  
 	 	 }  
 	 } ,  
  
 	 / /   S a v e   t h e   o l d   t o g g l e   f u n c t i o n  
 	 _ t o g g l e :   j Q u e r y . f n . t o g g l e ,  
  
 	 t o g g l e :   f u n c t i o n (   f n ,   f n 2 ,   c a l l b a c k   )   {  
 	 	 v a r   b o o l   =   t y p e o f   f n   = = =   " b o o l e a n " ;  
  
 	 	 i f   (   j Q u e r y . i s F u n c t i o n ( f n )   & &   j Q u e r y . i s F u n c t i o n ( f n 2 )   )   {  
 	 	 	 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   i f   (   f n   = =   n u l l   | |   b o o l   )   {  
 	 	 	 t h i s . e a c h ( f u n c t i o n ( )   {  
 	 	 	 	 v a r   s t a t e   =   b o o l   ?   f n   :   j Q u e r y ( t h i s ) . i s ( " : h i d d e n " ) ;  
 	 	 	 	 j Q u e r y ( t h i s ) [   s t a t e   ?   " s h o w "   :   " h i d e "   ] ( ) ;  
 	 	 	 } ) ;  
  
 	 	 }   e l s e   {  
 	 	 	 t h i s . a n i m a t e ( g e n F x ( " t o g g l e " ,   3 ) ,   f n ,   f n 2 ,   c a l l b a c k ) ;  
 	 	 }  
  
 	 	 r e t u r n   t h i s ;  
 	 } ,  
  
 	 f a d e T o :   f u n c t i o n (   s p e e d ,   t o ,   e a s i n g ,   c a l l b a c k   )   {  
 	 	 r e t u r n   t h i s . f i l t e r ( " : h i d d e n " ) . c s s ( " o p a c i t y " ,   0 ) . s h o w ( ) . e n d ( )  
 	 	 	 	 	 . a n i m a t e ( { o p a c i t y :   t o } ,   s p e e d ,   e a s i n g ,   c a l l b a c k ) ;  
 	 } ,  
  
 	 a n i m a t e :   f u n c t i o n (   p r o p ,   s p e e d ,   e a s i n g ,   c a l l b a c k   )   {  
 	 	 v a r   o p t a l l   =   j Q u e r y . s p e e d ( s p e e d ,   e a s i n g ,   c a l l b a c k ) ;  
  
 	 	 i f   (   j Q u e r y . i s E m p t y O b j e c t (   p r o p   )   )   {  
 	 	 	 r e t u r n   t h i s . e a c h (   o p t a l l . c o m p l e t e ,   [   f a l s e   ]   ) ;  
 	 	 }  
  
 	 	 r e t u r n   t h i s [   o p t a l l . q u e u e   = = =   f a l s e   ?   " e a c h "   :   " q u e u e "   ] ( f u n c t i o n ( )   {  
 	 	 	 / /   X X X   ' t h i s '   d o e s   n o t   a l w a y s   h a v e   a   n o d e N a m e   w h e n   r u n n i n g   t h e  
 	 	 	 / /   t e s t   s u i t e  
  
 	 	 	 i f   (   o p t a l l . q u e u e   = = =   f a l s e   )   {  
 	 	 	 	 j Q u e r y . _ m a r k (   t h i s   ) ;  
 	 	 	 }  
  
 	 	 	 v a r   o p t   =   j Q u e r y . e x t e n d ( { } ,   o p t a l l ) ,  
 	 	 	 	 i s E l e m e n t   =   t h i s . n o d e T y p e   = = =   1 ,  
 	 	 	 	 h i d d e n   =   i s E l e m e n t   & &   j Q u e r y ( t h i s ) . i s ( " : h i d d e n " ) ,  
 	 	 	 	 n a m e ,   v a l ,   p ,  
 	 	 	 	 d i s p l a y ,   e ,  
 	 	 	 	 p a r t s ,   s t a r t ,   e n d ,   u n i t ;  
  
 	 	 	 / /   w i l l   s t o r e   p e r   p r o p e r t y   e a s i n g   a n d   b e   u s e d   t o   d e t e r m i n e   w h e n   a n   a n i m a t i o n   i s   c o m p l e t e  
 	 	 	 o p t . a n i m a t e d P r o p e r t i e s   =   { } ;  
  
 	 	 	 f o r   (   p   i n   p r o p   )   {  
  
 	 	 	 	 / /   p r o p e r t y   n a m e   n o r m a l i z a t i o n  
 	 	 	 	 n a m e   =   j Q u e r y . c a m e l C a s e (   p   ) ;  
 	 	 	 	 i f   (   p   ! = =   n a m e   )   {  
 	 	 	 	 	 p r o p [   n a m e   ]   =   p r o p [   p   ] ;  
 	 	 	 	 	 d e l e t e   p r o p [   p   ] ;  
 	 	 	 	 }  
  
 	 	 	 	 v a l   =   p r o p [ n a m e ] ;  
  
 	 	 	 	 i f   (   v a l   = = =   " h i d e "   & &   h i d d e n   | |   v a l   = = =   " s h o w "   & &   ! h i d d e n   )   {  
 	 	 	 	 	 r e t u r n   o p t . c o m p l e t e . c a l l ( t h i s ) ;  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   i s E l e m e n t   & &   (   n a m e   = = =   " h e i g h t "   | |   n a m e   = = =   " w i d t h "   )   )   {  
 	 	 	 	 	 / /   M a k e   s u r e   t h a t   n o t h i n g   s n e a k s   o u t  
 	 	 	 	 	 / /   R e c o r d   a l l   3   o v e r f l o w   a t t r i b u t e s   b e c a u s e   I E   d o e s   n o t  
 	 	 	 	 	 / /   c h a n g e   t h e   o v e r f l o w   a t t r i b u t e   w h e n   o v e r f l o w X   a n d  
 	 	 	 	 	 / /   o v e r f l o w Y   a r e   s e t   t o   t h e   s a m e   v a l u e  
 	 	 	 	 	 o p t . o v e r f l o w   =   [   t h i s . s t y l e . o v e r f l o w ,   t h i s . s t y l e . o v e r f l o w X ,   t h i s . s t y l e . o v e r f l o w Y   ] ;  
  
 	 	 	 	 	 / /   S e t   d i s p l a y   p r o p e r t y   t o   i n l i n e - b l o c k   f o r   h e i g h t / w i d t h  
 	 	 	 	 	 / /   a n i m a t i o n s   o n   i n l i n e   e l e m e n t s   t h a t   a r e   h a v i n g   w i d t h / h e i g h t  
 	 	 	 	 	 / /   a n i m a t e d  
 	 	 	 	 	 i f   (   j Q u e r y . c s s (   t h i s ,   " d i s p l a y "   )   = = =   " i n l i n e "   & &  
 	 	 	 	 	 	 	 j Q u e r y . c s s (   t h i s ,   " f l o a t "   )   = = =   " n o n e "   )   {  
 	 	 	 	 	 	 i f   (   ! j Q u e r y . s u p p o r t . i n l i n e B l o c k N e e d s L a y o u t   )   {  
 	 	 	 	 	 	 	 t h i s . s t y l e . d i s p l a y   =   " i n l i n e - b l o c k " ;  
  
 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 d i s p l a y   =   d e f a u l t D i s p l a y ( t h i s . n o d e N a m e ) ;  
  
 	 	 	 	 	 	 	 / /   i n l i n e - l e v e l   e l e m e n t s   a c c e p t   i n l i n e - b l o c k ;  
 	 	 	 	 	 	 	 / /   b l o c k - l e v e l   e l e m e n t s   n e e d   t o   b e   i n l i n e   w i t h   l a y o u t  
 	 	 	 	 	 	 	 i f   (   d i s p l a y   = = =   " i n l i n e "   )   {  
 	 	 	 	 	 	 	 	 t h i s . s t y l e . d i s p l a y   =   " i n l i n e - b l o c k " ;  
  
 	 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 	 t h i s . s t y l e . d i s p l a y   =   " i n l i n e " ;  
 	 	 	 	 	 	 	 	 t h i s . s t y l e . z o o m   =   1 ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 / /   e a s i n g   r e s o l u t i o n :   p e r   p r o p e r t y   >   o p t . s p e c i a l E a s i n g   >   o p t . e a s i n g   >   ' s w i n g '   ( d e f a u l t )  
 	 	 	 	 o p t . a n i m a t e d P r o p e r t i e s [ n a m e ]   =   j Q u e r y . i s A r r a y (   v a l   )   ?  
 	 	 	 	 	 v a l [ 1 ] :  
 	 	 	 	 	 o p t . s p e c i a l E a s i n g   & &   o p t . s p e c i a l E a s i n g [ n a m e ]   | |   o p t . e a s i n g   | |   ' s w i n g ' ;  
 	 	 	 }  
  
 	 	 	 i f   (   o p t . o v e r f l o w   ! =   n u l l   )   {  
 	 	 	 	 t h i s . s t y l e . o v e r f l o w   =   " h i d d e n " ;  
 	 	 	 }  
  
 	 	 	 f o r   (   p   i n   p r o p   )   {  
 	 	 	 	 e   =   n e w   j Q u e r y . f x (   t h i s ,   o p t ,   p   ) ;  
  
 	 	 	 	 v a l   =   p r o p [ p ] ;  
  
 	 	 	 	 i f   (   r f x t y p e s . t e s t ( v a l )   )   {  
 	 	 	 	 	 e [   v a l   = = =   " t o g g l e "   ?   h i d d e n   ?   " s h o w "   :   " h i d e "   :   v a l   ] ( ) ;  
  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 p a r t s   =   r f x n u m . e x e c ( v a l ) ;  
 	 	 	 	 	 s t a r t   =   e . c u r ( ) ;  
  
 	 	 	 	 	 i f   (   p a r t s   )   {  
 	 	 	 	 	 	 e n d   =   p a r s e F l o a t (   p a r t s [ 2 ]   ) ;  
 	 	 	 	 	 	 u n i t   =   p a r t s [ 3 ]   | |   (   j Q u e r y . c s s N u m b e r [   n a m e   ]   ?   " "   :   " p x "   ) ;  
  
 	 	 	 	 	 	 / /   W e   n e e d   t o   c o m p u t e   s t a r t i n g   v a l u e  
 	 	 	 	 	 	 i f   (   u n i t   ! = =   " p x "   )   {  
 	 	 	 	 	 	 	 j Q u e r y . s t y l e (   t h i s ,   p ,   ( e n d   | |   1 )   +   u n i t ) ;  
 	 	 	 	 	 	 	 s t a r t   =   ( ( e n d   | |   1 )   /   e . c u r ( ) )   *   s t a r t ;  
 	 	 	 	 	 	 	 j Q u e r y . s t y l e (   t h i s ,   p ,   s t a r t   +   u n i t ) ;  
 	 	 	 	 	 	 }  
  
 	 	 	 	 	 	 / /   I f   a   + = / - =   t o k e n   w a s   p r o v i d e d ,   w e ' r e   d o i n g   a   r e l a t i v e   a n i m a t i o n  
 	 	 	 	 	 	 i f   (   p a r t s [ 1 ]   )   {  
 	 	 	 	 	 	 	 e n d   =   ( ( p a r t s [ 1 ]   = = =   " - = "   ?   - 1   :   1 )   *   e n d )   +   s t a r t ;  
 	 	 	 	 	 	 }  
  
 	 	 	 	 	 	 e . c u s t o m (   s t a r t ,   e n d ,   u n i t   ) ;  
  
 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 e . c u s t o m (   s t a r t ,   v a l ,   " "   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 / /   F o r   J S   s t r i c t   c o m p l i a n c e  
 	 	 	 r e t u r n   t r u e ;  
 	 	 } ) ;  
 	 } ,  
  
 	 s t o p :   f u n c t i o n (   c l e a r Q u e u e ,   g o t o E n d   )   {  
 	 	 i f   (   c l e a r Q u e u e   )   {  
 	 	 	 t h i s . q u e u e ( [ ] ) ;  
 	 	 }  
  
 	 	 t h i s . e a c h ( f u n c t i o n ( )   {  
 	 	 	 v a r   t i m e r s   =   j Q u e r y . t i m e r s ,  
 	 	 	 	 i   =   t i m e r s . l e n g t h ;  
 	 	 	 / /   c l e a r   m a r k e r   c o u n t e r s   i f   w e   k n o w   t h e y   w o n ' t   b e  
 	 	 	 i f   (   ! g o t o E n d   )   {  
 	 	 	 	 j Q u e r y . _ u n m a r k (   t r u e ,   t h i s   ) ;  
 	 	 	 }  
 	 	 	 / /   g o   i n   r e v e r s e   o r d e r   s o   a n y t h i n g   a d d e d   t o   t h e   q u e u e   d u r i n g   t h e   l o o p   i s   i g n o r e d  
 	 	 	 w h i l e   (   i - -   )   {  
 	 	 	 	 i f   (   t i m e r s [ i ] . e l e m   = = =   t h i s   )   {  
 	 	 	 	 	 i f   ( g o t o E n d )   {  
 	 	 	 	 	 	 / /   f o r c e   t h e   n e x t   s t e p   t o   b e   t h e   l a s t  
 	 	 	 	 	 	 t i m e r s [ i ] ( t r u e ) ;  
 	 	 	 	 	 }  
  
 	 	 	 	 	 t i m e r s . s p l i c e ( i ,   1 ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 } ) ;  
  
 	 	 / /   s t a r t   t h e   n e x t   i n   t h e   q u e u e   i f   t h e   l a s t   s t e p   w a s n ' t   f o r c e d  
 	 	 i f   (   ! g o t o E n d   )   {  
 	 	 	 t h i s . d e q u e u e ( ) ;  
 	 	 }  
  
 	 	 r e t u r n   t h i s ;  
 	 }  
  
 } ) ;  
  
 / /   A n i m a t i o n s   c r e a t e d   s y n c h r o n o u s l y   w i l l   r u n   s y n c h r o n o u s l y  
 f u n c t i o n   c r e a t e F x N o w ( )   {  
 	 s e t T i m e o u t (   c l e a r F x N o w ,   0   ) ;  
 	 r e t u r n   (   f x N o w   =   j Q u e r y . n o w ( )   ) ;  
 }  
  
 f u n c t i o n   c l e a r F x N o w ( )   {  
 	 f x N o w   =   u n d e f i n e d ;  
 }  
  
 / /   G e n e r a t e   p a r a m e t e r s   t o   c r e a t e   a   s t a n d a r d   a n i m a t i o n  
 f u n c t i o n   g e n F x (   t y p e ,   n u m   )   {  
 	 v a r   o b j   =   { } ;  
  
 	 j Q u e r y . e a c h (   f x A t t r s . c o n c a t . a p p l y ( [ ] ,   f x A t t r s . s l i c e ( 0 , n u m ) ) ,   f u n c t i o n ( )   {  
 	 	 o b j [   t h i s   ]   =   t y p e ;  
 	 } ) ;  
  
 	 r e t u r n   o b j ;  
 }  
  
 / /   G e n e r a t e   s h o r t c u t s   f o r   c u s t o m   a n i m a t i o n s  
 j Q u e r y . e a c h ( {  
 	 s l i d e D o w n :   g e n F x ( " s h o w " ,   1 ) ,  
 	 s l i d e U p :   g e n F x ( " h i d e " ,   1 ) ,  
 	 s l i d e T o g g l e :   g e n F x ( " t o g g l e " ,   1 ) ,  
 	 f a d e I n :   {   o p a c i t y :   " s h o w "   } ,  
 	 f a d e O u t :   {   o p a c i t y :   " h i d e "   } ,  
 	 f a d e T o g g l e :   {   o p a c i t y :   " t o g g l e "   }  
 } ,   f u n c t i o n (   n a m e ,   p r o p s   )   {  
 	 j Q u e r y . f n [   n a m e   ]   =   f u n c t i o n (   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   t h i s . a n i m a t e (   p r o p s ,   s p e e d ,   e a s i n g ,   c a l l b a c k   ) ;  
 	 } ;  
 } ) ;  
  
 j Q u e r y . e x t e n d ( {  
 	 s p e e d :   f u n c t i o n (   s p e e d ,   e a s i n g ,   f n   )   {  
 	 	 v a r   o p t   =   s p e e d   & &   t y p e o f   s p e e d   = = =   " o b j e c t "   ?   j Q u e r y . e x t e n d ( { } ,   s p e e d )   :   {  
 	 	 	 c o m p l e t e :   f n   | |   ! f n   & &   e a s i n g   | |  
 	 	 	 	 j Q u e r y . i s F u n c t i o n (   s p e e d   )   & &   s p e e d ,  
 	 	 	 d u r a t i o n :   s p e e d ,  
 	 	 	 e a s i n g :   f n   & &   e a s i n g   | |   e a s i n g   & &   ! j Q u e r y . i s F u n c t i o n ( e a s i n g )   & &   e a s i n g  
 	 	 } ;  
  
 	 	 o p t . d u r a t i o n   =   j Q u e r y . f x . o f f   ?   0   :   t y p e o f   o p t . d u r a t i o n   = = =   " n u m b e r "   ?   o p t . d u r a t i o n   :  
 	 	 	 o p t . d u r a t i o n   i n   j Q u e r y . f x . s p e e d s   ?   j Q u e r y . f x . s p e e d s [ o p t . d u r a t i o n ]   :   j Q u e r y . f x . s p e e d s . _ d e f a u l t ;  
  
 	 	 / /   Q u e u e i n g  
 	 	 o p t . o l d   =   o p t . c o m p l e t e ;  
 	 	 o p t . c o m p l e t e   =   f u n c t i o n (   n o U n m a r k   )   {  
 	 	 	 i f   (   o p t . q u e u e   ! = =   f a l s e   )   {  
 	 	 	 	 j Q u e r y . d e q u e u e (   t h i s   ) ;  
 	 	 	 }   e l s e   i f   (   n o U n m a r k   ! = =   f a l s e   )   {  
 	 	 	 	 j Q u e r y . _ u n m a r k (   t h i s   ) ;  
 	 	 	 }  
  
 	 	 	 i f   (   j Q u e r y . i s F u n c t i o n (   o p t . o l d   )   )   {  
 	 	 	 	 o p t . o l d . c a l l (   t h i s   ) ;  
 	 	 	 }  
 	 	 } ;  
  
 	 	 r e t u r n   o p t ;  
 	 } ,  
  
 	 e a s i n g :   {  
 	 	 l i n e a r :   f u n c t i o n (   p ,   n ,   f i r s t N u m ,   d i f f   )   {  
 	 	 	 r e t u r n   f i r s t N u m   +   d i f f   *   p ;  
 	 	 } ,  
 	 	 s w i n g :   f u n c t i o n (   p ,   n ,   f i r s t N u m ,   d i f f   )   {  
 	 	 	 r e t u r n   ( ( - M a t h . c o s ( p * M a t h . P I ) / 2 )   +   0 . 5 )   *   d i f f   +   f i r s t N u m ;  
 	 	 }  
 	 } ,  
  
 	 t i m e r s :   [ ] ,  
  
 	 f x :   f u n c t i o n (   e l e m ,   o p t i o n s ,   p r o p   )   {  
 	 	 t h i s . o p t i o n s   =   o p t i o n s ;  
 	 	 t h i s . e l e m   =   e l e m ;  
 	 	 t h i s . p r o p   =   p r o p ;  
  
 	 	 o p t i o n s . o r i g   =   o p t i o n s . o r i g   | |   { } ;  
 	 }  
  
 } ) ;  
  
 j Q u e r y . f x . p r o t o t y p e   =   {  
 	 / /   S i m p l e   f u n c t i o n   f o r   s e t t i n g   a   s t y l e   v a l u e  
 	 u p d a t e :   f u n c t i o n ( )   {  
 	 	 i f   (   t h i s . o p t i o n s . s t e p   )   {  
 	 	 	 t h i s . o p t i o n s . s t e p . c a l l (   t h i s . e l e m ,   t h i s . n o w ,   t h i s   ) ;  
 	 	 }  
  
 	 	 ( j Q u e r y . f x . s t e p [ t h i s . p r o p ]   | |   j Q u e r y . f x . s t e p . _ d e f a u l t ) (   t h i s   ) ;  
 	 } ,  
  
 	 / /   G e t   t h e   c u r r e n t   s i z e  
 	 c u r :   f u n c t i o n ( )   {  
 	 	 i f   (   t h i s . e l e m [ t h i s . p r o p ]   ! =   n u l l   & &   ( ! t h i s . e l e m . s t y l e   | |   t h i s . e l e m . s t y l e [ t h i s . p r o p ]   = =   n u l l )   )   {  
 	 	 	 r e t u r n   t h i s . e l e m [   t h i s . p r o p   ] ;  
 	 	 }  
  
 	 	 v a r   p a r s e d ,  
 	 	 	 r   =   j Q u e r y . c s s (   t h i s . e l e m ,   t h i s . p r o p   ) ;  
 	 	 / /   E m p t y   s t r i n g s ,   n u l l ,   u n d e f i n e d   a n d   " a u t o "   a r e   c o n v e r t e d   t o   0 ,  
 	 	 / /   c o m p l e x   v a l u e s   s u c h   a s   " r o t a t e ( 1 r a d ) "   a r e   r e t u r n e d   a s   i s ,  
 	 	 / /   s i m p l e   v a l u e s   s u c h   a s   " 1 0 p x "   a r e   p a r s e d   t o   F l o a t .  
 	 	 r e t u r n   i s N a N (   p a r s e d   =   p a r s e F l o a t (   r   )   )   ?   ! r   | |   r   = = =   " a u t o "   ?   0   :   r   :   p a r s e d ;  
 	 } ,  
  
 	 / /   S t a r t   a n   a n i m a t i o n   f r o m   o n e   n u m b e r   t o   a n o t h e r  
 	 c u s t o m :   f u n c t i o n (   f r o m ,   t o ,   u n i t   )   {  
 	 	 v a r   s e l f   =   t h i s ,  
 	 	 	 f x   =   j Q u e r y . f x ,  
 	 	 	 r a f ;  
  
 	 	 t h i s . s t a r t T i m e   =   f x N o w   | |   c r e a t e F x N o w ( ) ;  
 	 	 t h i s . s t a r t   =   f r o m ;  
 	 	 t h i s . e n d   =   t o ;  
 	 	 t h i s . u n i t   =   u n i t   | |   t h i s . u n i t   | |   (   j Q u e r y . c s s N u m b e r [   t h i s . p r o p   ]   ?   " "   :   " p x "   ) ;  
 	 	 t h i s . n o w   =   t h i s . s t a r t ;  
 	 	 t h i s . p o s   =   t h i s . s t a t e   =   0 ;  
  
 	 	 f u n c t i o n   t (   g o t o E n d   )   {  
 	 	 	 r e t u r n   s e l f . s t e p ( g o t o E n d ) ;  
 	 	 }  
  
 	 	 t . e l e m   =   t h i s . e l e m ;  
  
 	 	 i f   (   t ( )   & &   j Q u e r y . t i m e r s . p u s h ( t )   & &   ! t i m e r I d   )   {  
 	 	 	 / /   U s e   r e q u e s t A n i m a t i o n F r a m e   i n s t e a d   o f   s e t I n t e r v a l   i f   a v a i l a b l e  
 	 	 	 i f   (   r e q u e s t A n i m a t i o n F r a m e   )   {  
 	 	 	 	 t i m e r I d   =   1 ;  
 	 	 	 	 r a f   =   f u n c t i o n ( )   {  
 	 	 	 	 	 / /   W h e n   t i m e r I d   g e t s   s e t   t o   n u l l   a t   a n y   p o i n t ,   t h i s   s t o p s  
 	 	 	 	 	 i f   (   t i m e r I d   )   {  
 	 	 	 	 	 	 r e q u e s t A n i m a t i o n F r a m e (   r a f   ) ;  
 	 	 	 	 	 	 f x . t i c k ( ) ;  
 	 	 	 	 	 }  
 	 	 	 	 } ;  
 	 	 	 	 r e q u e s t A n i m a t i o n F r a m e (   r a f   ) ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 t i m e r I d   =   s e t I n t e r v a l (   f x . t i c k ,   f x . i n t e r v a l   ) ;  
 	 	 	 }  
 	 	 }  
 	 } ,  
  
 	 / /   S i m p l e   ' s h o w '   f u n c t i o n  
 	 s h o w :   f u n c t i o n ( )   {  
 	 	 / /   R e m e m b e r   w h e r e   w e   s t a r t e d ,   s o   t h a t   w e   c a n   g o   b a c k   t o   i t   l a t e r  
 	 	 t h i s . o p t i o n s . o r i g [ t h i s . p r o p ]   =   j Q u e r y . s t y l e (   t h i s . e l e m ,   t h i s . p r o p   ) ;  
 	 	 t h i s . o p t i o n s . s h o w   =   t r u e ;  
  
 	 	 / /   B e g i n   t h e   a n i m a t i o n  
 	 	 / /   M a k e   s u r e   t h a t   w e   s t a r t   a t   a   s m a l l   w i d t h / h e i g h t   t o   a v o i d   a n y  
 	 	 / /   f l a s h   o f   c o n t e n t  
 	 	 t h i s . c u s t o m ( t h i s . p r o p   = = =   " w i d t h "   | |   t h i s . p r o p   = = =   " h e i g h t "   ?   1   :   0 ,   t h i s . c u r ( ) ) ;  
  
 	 	 / /   S t a r t   b y   s h o w i n g   t h e   e l e m e n t  
 	 	 j Q u e r y (   t h i s . e l e m   ) . s h o w ( ) ;  
 	 } ,  
  
 	 / /   S i m p l e   ' h i d e '   f u n c t i o n  
 	 h i d e :   f u n c t i o n ( )   {  
 	 	 / /   R e m e m b e r   w h e r e   w e   s t a r t e d ,   s o   t h a t   w e   c a n   g o   b a c k   t o   i t   l a t e r  
 	 	 t h i s . o p t i o n s . o r i g [ t h i s . p r o p ]   =   j Q u e r y . s t y l e (   t h i s . e l e m ,   t h i s . p r o p   ) ;  
 	 	 t h i s . o p t i o n s . h i d e   =   t r u e ;  
  
 	 	 / /   B e g i n   t h e   a n i m a t i o n  
 	 	 t h i s . c u s t o m ( t h i s . c u r ( ) ,   0 ) ;  
 	 } ,  
  
 	 / /   E a c h   s t e p   o f   a n   a n i m a t i o n  
 	 s t e p :   f u n c t i o n (   g o t o E n d   )   {  
 	 	 v a r   t   =   f x N o w   | |   c r e a t e F x N o w ( ) ,  
 	 	 	 d o n e   =   t r u e ,  
 	 	 	 e l e m   =   t h i s . e l e m ,  
 	 	 	 o p t i o n s   =   t h i s . o p t i o n s ,  
 	 	 	 i ,   n ;  
  
 	 	 i f   (   g o t o E n d   | |   t   > =   o p t i o n s . d u r a t i o n   +   t h i s . s t a r t T i m e   )   {  
 	 	 	 t h i s . n o w   =   t h i s . e n d ;  
 	 	 	 t h i s . p o s   =   t h i s . s t a t e   =   1 ;  
 	 	 	 t h i s . u p d a t e ( ) ;  
  
 	 	 	 o p t i o n s . a n i m a t e d P r o p e r t i e s [   t h i s . p r o p   ]   =   t r u e ;  
  
 	 	 	 f o r   (   i   i n   o p t i o n s . a n i m a t e d P r o p e r t i e s   )   {  
 	 	 	 	 i f   (   o p t i o n s . a n i m a t e d P r o p e r t i e s [ i ]   ! = =   t r u e   )   {  
 	 	 	 	 	 d o n e   =   f a l s e ;  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 i f   (   d o n e   )   {  
 	 	 	 	 / /   R e s e t   t h e   o v e r f l o w  
 	 	 	 	 i f   (   o p t i o n s . o v e r f l o w   ! =   n u l l   & &   ! j Q u e r y . s u p p o r t . s h r i n k W r a p B l o c k s   )   {  
  
 	 	 	 	 	 j Q u e r y . e a c h (   [   " " ,   " X " ,   " Y "   ] ,   f u n c t i o n   ( i n d e x ,   v a l u e )   {  
 	 	 	 	 	 	 e l e m . s t y l e [   " o v e r f l o w "   +   v a l u e   ]   =   o p t i o n s . o v e r f l o w [ i n d e x ] ;  
 	 	 	 	 	 } ) ;  
 	 	 	 	 }  
  
 	 	 	 	 / /   H i d e   t h e   e l e m e n t   i f   t h e   " h i d e "   o p e r a t i o n   w a s   d o n e  
 	 	 	 	 i f   (   o p t i o n s . h i d e   )   {  
 	 	 	 	 	 j Q u e r y ( e l e m ) . h i d e ( ) ;  
 	 	 	 	 }  
  
 	 	 	 	 / /   R e s e t   t h e   p r o p e r t i e s ,   i f   t h e   i t e m   h a s   b e e n   h i d d e n   o r   s h o w n  
 	 	 	 	 i f   (   o p t i o n s . h i d e   | |   o p t i o n s . s h o w   )   {  
 	 	 	 	 	 f o r   (   v a r   p   i n   o p t i o n s . a n i m a t e d P r o p e r t i e s   )   {  
 	 	 	 	 	 	 j Q u e r y . s t y l e (   e l e m ,   p ,   o p t i o n s . o r i g [ p ]   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 / /   E x e c u t e   t h e   c o m p l e t e   f u n c t i o n  
 	 	 	 	 o p t i o n s . c o m p l e t e . c a l l (   e l e m   ) ;  
 	 	 	 }  
  
 	 	 	 r e t u r n   f a l s e ;  
  
 	 	 }   e l s e   {  
 	 	 	 / /   c l a s s i c a l   e a s i n g   c a n n o t   b e   u s e d   w i t h   a n   I n f i n i t y   d u r a t i o n  
 	 	 	 i f   (   o p t i o n s . d u r a t i o n   = =   I n f i n i t y   )   {  
 	 	 	 	 t h i s . n o w   =   t ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 n   =   t   -   t h i s . s t a r t T i m e ;  
  
 	 	 	 	 t h i s . s t a t e   =   n   /   o p t i o n s . d u r a t i o n ;  
 	 	 	 	 / /   P e r f o r m   t h e   e a s i n g   f u n c t i o n ,   d e f a u l t s   t o   s w i n g  
 	 	 	 	 t h i s . p o s   =   j Q u e r y . e a s i n g [ o p t i o n s . a n i m a t e d P r o p e r t i e s [ t h i s . p r o p ] ] ( t h i s . s t a t e ,   n ,   0 ,   1 ,   o p t i o n s . d u r a t i o n ) ;  
 	 	 	 	 t h i s . n o w   =   t h i s . s t a r t   +   ( ( t h i s . e n d   -   t h i s . s t a r t )   *   t h i s . p o s ) ;  
 	 	 	 }  
 	 	 	 / /   P e r f o r m   t h e   n e x t   s t e p   o f   t h e   a n i m a t i o n  
 	 	 	 t h i s . u p d a t e ( ) ;  
 	 	 }  
  
 	 	 r e t u r n   t r u e ;  
 	 }  
 } ;  
  
 j Q u e r y . e x t e n d (   j Q u e r y . f x ,   {  
 	 t i c k :   f u n c t i o n ( )   {  
 	 	 v a r   t i m e r s   =   j Q u e r y . t i m e r s ,  
 	 	 	 i   =   t i m e r s . l e n g t h ;  
 	 	 w h i l e   (   i - -   )   {  
 	 	 	 i f   (   ! t i m e r s [ i ] ( )   )   {  
 	 	 	 	 t i m e r s . s p l i c e ( i ,   1 ) ;  
 	 	 	 }  
 	 	 }  
  
 	 	 i f   (   ! t i m e r s . l e n g t h   )   {  
 	 	 	 j Q u e r y . f x . s t o p ( ) ;  
 	 	 }  
 	 } ,  
  
 	 i n t e r v a l :   1 3 ,  
  
 	 s t o p :   f u n c t i o n ( )   {  
 	 	 c l e a r I n t e r v a l (   t i m e r I d   ) ;  
 	 	 t i m e r I d   =   n u l l ;  
 	 } ,  
  
 	 s p e e d s :   {  
 	 	 s l o w :   6 0 0 ,  
 	 	 f a s t :   2 0 0 ,  
 	 	 / /   D e f a u l t   s p e e d  
 	 	 _ d e f a u l t :   4 0 0  
 	 } ,  
  
 	 s t e p :   {  
 	 	 o p a c i t y :   f u n c t i o n (   f x   )   {  
 	 	 	 j Q u e r y . s t y l e (   f x . e l e m ,   " o p a c i t y " ,   f x . n o w   ) ;  
 	 	 } ,  
  
 	 	 _ d e f a u l t :   f u n c t i o n (   f x   )   {  
 	 	 	 i f   (   f x . e l e m . s t y l e   & &   f x . e l e m . s t y l e [   f x . p r o p   ]   ! =   n u l l   )   {  
 	 	 	 	 f x . e l e m . s t y l e [   f x . p r o p   ]   =   ( f x . p r o p   = = =   " w i d t h "   | |   f x . p r o p   = = =   " h e i g h t "   ?   M a t h . m a x ( 0 ,   f x . n o w )   :   f x . n o w )   +   f x . u n i t ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 f x . e l e m [   f x . p r o p   ]   =   f x . n o w ;  
 	 	 	 }  
 	 	 }  
 	 }  
 } ) ;  
  
 i f   (   j Q u e r y . e x p r   & &   j Q u e r y . e x p r . f i l t e r s   )   {  
 	 j Q u e r y . e x p r . f i l t e r s . a n i m a t e d   =   f u n c t i o n (   e l e m   )   {  
 	 	 r e t u r n   j Q u e r y . g r e p ( j Q u e r y . t i m e r s ,   f u n c t i o n (   f n   )   {  
 	 	 	 r e t u r n   e l e m   = = =   f n . e l e m ;  
 	 	 } ) . l e n g t h ;  
 	 } ;  
 }  
  
 / /   T r y   t o   r e s t o r e   t h e   d e f a u l t   d i s p l a y   v a l u e   o f   a n   e l e m e n t  
 f u n c t i o n   d e f a u l t D i s p l a y (   n o d e N a m e   )   {  
  
 	 i f   (   ! e l e m d i s p l a y [   n o d e N a m e   ]   )   {  
  
 	 	 v a r   e l e m   =   j Q u e r y (   " < "   +   n o d e N a m e   +   " > "   ) . a p p e n d T o (   " b o d y "   ) ,  
 	 	 	 d i s p l a y   =   e l e m . c s s (   " d i s p l a y "   ) ;  
  
 	 	 e l e m . r e m o v e ( ) ;  
  
 	 	 / /   I f   t h e   s i m p l e   w a y   f a i l s ,  
 	 	 / /   g e t   e l e m e n t ' s   r e a l   d e f a u l t   d i s p l a y   b y   a t t a c h i n g   i t   t o   a   t e m p   i f r a m e  
 	 	 i f   (   d i s p l a y   = = =   " n o n e "   | |   d i s p l a y   = = =   " "   )   {  
 	 	 	 / /   N o   i f r a m e   t o   u s e   y e t ,   s o   c r e a t e   i t  
 	 	 	 i f   (   ! i f r a m e   )   {  
 	 	 	 	 i f r a m e   =   d o c u m e n t . c r e a t e E l e m e n t (   " i f r a m e "   ) ;  
 	 	 	 	 i f r a m e . f r a m e B o r d e r   =   i f r a m e . w i d t h   =   i f r a m e . h e i g h t   =   0 ;  
 	 	 	 }  
  
 	 	 	 d o c u m e n t . b o d y . a p p e n d C h i l d (   i f r a m e   ) ;  
  
 	 	 	 / /   C r e a t e   a   c a c h e a b l e   c o p y   o f   t h e   i f r a m e   d o c u m e n t   o n   f i r s t   c a l l .  
 	 	 	 / /   I E   a n d   O p e r a   w i l l   a l l o w   u s   t o   r e u s e   t h e   i f r a m e D o c   w i t h o u t   r e - w r i t i n g   t h e   f a k e   h t m l  
 	 	 	 / /   d o c u m e n t   t o   i t ,   W e b k i t   &   F i r e f o x   w o n ' t   a l l o w   r e u s i n g   t h e   i f r a m e   d o c u m e n t  
 	 	 	 i f   (   ! i f r a m e D o c   | |   ! i f r a m e . c r e a t e E l e m e n t   )   {  
 	 	 	 	 i f r a m e D o c   =   (   i f r a m e . c o n t e n t W i n d o w   | |   i f r a m e . c o n t e n t D o c u m e n t   ) . d o c u m e n t ;  
 	 	 	 	 i f r a m e D o c . w r i t e (   " < ! d o c t y p e > < h t m l > < b o d y > < / b o d y > < / h t m l > "   ) ;  
 	 	 	 }  
  
 	 	 	 e l e m   =   i f r a m e D o c . c r e a t e E l e m e n t (   n o d e N a m e   ) ;  
  
 	 	 	 i f r a m e D o c . b o d y . a p p e n d C h i l d (   e l e m   ) ;  
  
 	 	 	 d i s p l a y   =   j Q u e r y . c s s (   e l e m ,   " d i s p l a y "   ) ;  
  
 	 	 	 d o c u m e n t . b o d y . r e m o v e C h i l d (   i f r a m e   ) ;  
 	 	 }  
  
 	 	 / /   S t o r e   t h e   c o r r e c t   d e f a u l t   d i s p l a y  
 	 	 e l e m d i s p l a y [   n o d e N a m e   ]   =   d i s p l a y ;  
 	 }  
  
 	 r e t u r n   e l e m d i s p l a y [   n o d e N a m e   ] ;  
 }  
  
  
  
  
 v a r   r t a b l e   =   / ^ t ( ? : a b l e | d | h ) $ / i ,  
 	 r r o o t   =   / ^ ( ? : b o d y | h t m l ) $ / i ;  
  
 i f   (   " g e t B o u n d i n g C l i e n t R e c t "   i n   d o c u m e n t . d o c u m e n t E l e m e n t   )   {  
 	 j Q u e r y . f n . o f f s e t   =   f u n c t i o n (   o p t i o n s   )   {  
 	 	 v a r   e l e m   =   t h i s [ 0 ] ,   b o x ;  
  
 	 	 i f   (   o p t i o n s   )   {  
 	 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n (   i   )   {  
 	 	 	 	 j Q u e r y . o f f s e t . s e t O f f s e t (   t h i s ,   o p t i o n s ,   i   ) ;  
 	 	 	 } ) ;  
 	 	 }  
  
 	 	 i f   (   ! e l e m   | |   ! e l e m . o w n e r D o c u m e n t   )   {  
 	 	 	 r e t u r n   n u l l ;  
 	 	 }  
  
 	 	 i f   (   e l e m   = = =   e l e m . o w n e r D o c u m e n t . b o d y   )   {  
 	 	 	 r e t u r n   j Q u e r y . o f f s e t . b o d y O f f s e t (   e l e m   ) ;  
 	 	 }  
  
 	 	 t r y   {  
 	 	 	 b o x   =   e l e m . g e t B o u n d i n g C l i e n t R e c t ( ) ;  
 	 	 }   c a t c h ( e )   { }  
  
 	 	 v a r   d o c   =   e l e m . o w n e r D o c u m e n t ,  
 	 	 	 d o c E l e m   =   d o c . d o c u m e n t E l e m e n t ;  
  
 	 	 / /   M a k e   s u r e   w e ' r e   n o t   d e a l i n g   w i t h   a   d i s c o n n e c t e d   D O M   n o d e  
 	 	 i f   (   ! b o x   | |   ! j Q u e r y . c o n t a i n s (   d o c E l e m ,   e l e m   )   )   {  
 	 	 	 r e t u r n   b o x   ?   {   t o p :   b o x . t o p ,   l e f t :   b o x . l e f t   }   :   {   t o p :   0 ,   l e f t :   0   } ;  
 	 	 }  
  
 	 	 v a r   b o d y   =   d o c . b o d y ,  
 	 	 	 w i n   =   g e t W i n d o w ( d o c ) ,  
 	 	 	 c l i e n t T o p     =   d o c E l e m . c l i e n t T o p     | |   b o d y . c l i e n t T o p     | |   0 ,  
 	 	 	 c l i e n t L e f t   =   d o c E l e m . c l i e n t L e f t   | |   b o d y . c l i e n t L e f t   | |   0 ,  
 	 	 	 s c r o l l T o p     =   w i n . p a g e Y O f f s e t   | |   j Q u e r y . s u p p o r t . b o x M o d e l   & &   d o c E l e m . s c r o l l T o p     | |   b o d y . s c r o l l T o p ,  
 	 	 	 s c r o l l L e f t   =   w i n . p a g e X O f f s e t   | |   j Q u e r y . s u p p o r t . b o x M o d e l   & &   d o c E l e m . s c r o l l L e f t   | |   b o d y . s c r o l l L e f t ,  
 	 	 	 t o p     =   b o x . t o p     +   s c r o l l T o p     -   c l i e n t T o p ,  
 	 	 	 l e f t   =   b o x . l e f t   +   s c r o l l L e f t   -   c l i e n t L e f t ;  
  
 	 	 r e t u r n   {   t o p :   t o p ,   l e f t :   l e f t   } ;  
 	 } ;  
  
 }   e l s e   {  
 	 j Q u e r y . f n . o f f s e t   =   f u n c t i o n (   o p t i o n s   )   {  
 	 	 v a r   e l e m   =   t h i s [ 0 ] ;  
  
 	 	 i f   (   o p t i o n s   )   {  
 	 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n (   i   )   {  
 	 	 	 	 j Q u e r y . o f f s e t . s e t O f f s e t (   t h i s ,   o p t i o n s ,   i   ) ;  
 	 	 	 } ) ;  
 	 	 }  
  
 	 	 i f   (   ! e l e m   | |   ! e l e m . o w n e r D o c u m e n t   )   {  
 	 	 	 r e t u r n   n u l l ;  
 	 	 }  
  
 	 	 i f   (   e l e m   = = =   e l e m . o w n e r D o c u m e n t . b o d y   )   {  
 	 	 	 r e t u r n   j Q u e r y . o f f s e t . b o d y O f f s e t (   e l e m   ) ;  
 	 	 }  
  
 	 	 j Q u e r y . o f f s e t . i n i t i a l i z e ( ) ;  
  
 	 	 v a r   c o m p u t e d S t y l e ,  
 	 	 	 o f f s e t P a r e n t   =   e l e m . o f f s e t P a r e n t ,  
 	 	 	 p r e v O f f s e t P a r e n t   =   e l e m ,  
 	 	 	 d o c   =   e l e m . o w n e r D o c u m e n t ,  
 	 	 	 d o c E l e m   =   d o c . d o c u m e n t E l e m e n t ,  
 	 	 	 b o d y   =   d o c . b o d y ,  
 	 	 	 d e f a u l t V i e w   =   d o c . d e f a u l t V i e w ,  
 	 	 	 p r e v C o m p u t e d S t y l e   =   d e f a u l t V i e w   ?   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 (   e l e m ,   n u l l   )   :   e l e m . c u r r e n t S t y l e ,  
 	 	 	 t o p   =   e l e m . o f f s e t T o p ,  
 	 	 	 l e f t   =   e l e m . o f f s e t L e f t ;  
  
 	 	 w h i l e   (   ( e l e m   =   e l e m . p a r e n t N o d e )   & &   e l e m   ! = =   b o d y   & &   e l e m   ! = =   d o c E l e m   )   {  
 	 	 	 i f   (   j Q u e r y . o f f s e t . s u p p o r t s F i x e d P o s i t i o n   & &   p r e v C o m p u t e d S t y l e . p o s i t i o n   = = =   " f i x e d "   )   {  
 	 	 	 	 b r e a k ;  
 	 	 	 }  
  
 	 	 	 c o m p u t e d S t y l e   =   d e f a u l t V i e w   ?   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 ( e l e m ,   n u l l )   :   e l e m . c u r r e n t S t y l e ;  
 	 	 	 t o p     - =   e l e m . s c r o l l T o p ;  
 	 	 	 l e f t   - =   e l e m . s c r o l l L e f t ;  
  
 	 	 	 i f   (   e l e m   = = =   o f f s e t P a r e n t   )   {  
 	 	 	 	 t o p     + =   e l e m . o f f s e t T o p ;  
 	 	 	 	 l e f t   + =   e l e m . o f f s e t L e f t ;  
  
 	 	 	 	 i f   (   j Q u e r y . o f f s e t . d o e s N o t A d d B o r d e r   & &   ! ( j Q u e r y . o f f s e t . d o e s A d d B o r d e r F o r T a b l e A n d C e l l s   & &   r t a b l e . t e s t ( e l e m . n o d e N a m e ) )   )   {  
 	 	 	 	 	 t o p     + =   p a r s e F l o a t (   c o m p u t e d S t y l e . b o r d e r T o p W i d t h     )   | |   0 ;  
 	 	 	 	 	 l e f t   + =   p a r s e F l o a t (   c o m p u t e d S t y l e . b o r d e r L e f t W i d t h   )   | |   0 ;  
 	 	 	 	 }  
  
 	 	 	 	 p r e v O f f s e t P a r e n t   =   o f f s e t P a r e n t ;  
 	 	 	 	 o f f s e t P a r e n t   =   e l e m . o f f s e t P a r e n t ;  
 	 	 	 }  
  
 	 	 	 i f   (   j Q u e r y . o f f s e t . s u b t r a c t s B o r d e r F o r O v e r f l o w N o t V i s i b l e   & &   c o m p u t e d S t y l e . o v e r f l o w   ! = =   " v i s i b l e "   )   {  
 	 	 	 	 t o p     + =   p a r s e F l o a t (   c o m p u t e d S t y l e . b o r d e r T o p W i d t h     )   | |   0 ;  
 	 	 	 	 l e f t   + =   p a r s e F l o a t (   c o m p u t e d S t y l e . b o r d e r L e f t W i d t h   )   | |   0 ;  
 	 	 	 }  
  
 	 	 	 p r e v C o m p u t e d S t y l e   =   c o m p u t e d S t y l e ;  
 	 	 }  
  
 	 	 i f   (   p r e v C o m p u t e d S t y l e . p o s i t i o n   = = =   " r e l a t i v e "   | |   p r e v C o m p u t e d S t y l e . p o s i t i o n   = = =   " s t a t i c "   )   {  
 	 	 	 t o p     + =   b o d y . o f f s e t T o p ;  
 	 	 	 l e f t   + =   b o d y . o f f s e t L e f t ;  
 	 	 }  
  
 	 	 i f   (   j Q u e r y . o f f s e t . s u p p o r t s F i x e d P o s i t i o n   & &   p r e v C o m p u t e d S t y l e . p o s i t i o n   = = =   " f i x e d "   )   {  
 	 	 	 t o p     + =   M a t h . m a x (   d o c E l e m . s c r o l l T o p ,   b o d y . s c r o l l T o p   ) ;  
 	 	 	 l e f t   + =   M a t h . m a x (   d o c E l e m . s c r o l l L e f t ,   b o d y . s c r o l l L e f t   ) ;  
 	 	 }  
  
 	 	 r e t u r n   {   t o p :   t o p ,   l e f t :   l e f t   } ;  
 	 } ;  
 }  
  
 j Q u e r y . o f f s e t   =   {  
 	 i n i t i a l i z e :   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 ,   c o n t a i n e r   =   d o c u m e n t . c r e a t e E l e m e n t ( " d i v " ) ,   i n n e r D i v ,   c h e c k D i v ,   t a b l e ,   t d ,   b o d y M a r g i n T o p   =   p a r s e F l o a t (   j Q u e r y . c s s ( b o d y ,   " m a r g i n T o p " )   )   | |   0 ,  
 	 	 	 h t m l   =   " < d i v   s t y l e = ' p o s i t i o n : a b s o l u t e ; t o p : 0 ; l e f t : 0 ; m a r g i n : 0 ; b o r d e r : 5 p x   s o l i d   # 0 0 0 ; p a d d i n g : 0 ; w i d t h : 1 p x ; h e i g h t : 1 p x ; ' > < d i v > < / d i v > < / d i v > < t a b l e   s t y l e = ' p o s i t i o n : a b s o l u t e ; t o p : 0 ; l e f t : 0 ; m a r g i n : 0 ; b o r d e r : 5 p x   s o l i d   # 0 0 0 ; p a d d i n g : 0 ; w i d t h : 1 p x ; h e i g h t : 1 p x ; '   c e l l p a d d i n g = ' 0 '   c e l l s p a c i n g = ' 0 ' > < t r > < t d > < / t d > < / t r > < / t a b l e > " ;  
  
 	 	 j Q u e r y . e x t e n d (   c o n t a i n e r . s t y l e ,   {   p o s i t i o n :   " a b s o l u t e " ,   t o p :   0 ,   l e f t :   0 ,   m a r g i n :   0 ,   b o r d e r :   0 ,   w i d t h :   " 1 p x " ,   h e i g h t :   " 1 p x " ,   v i s i b i l i t y :   " h i d d e n "   }   ) ;  
  
 	 	 c o n t a i n e r . i n n e r H T M L   =   h t m l ;  
 	 	 b o d y . i n s e r t B e f o r e (   c o n t a i n e r ,   b o d y . f i r s t C h i l d   ) ;  
 	 	 i n n e r D i v   =   c o n t a i n e r . f i r s t C h i l d ;  
 	 	 c h e c k D i v   =   i n n e r D i v . f i r s t C h i l d ;  
 	 	 t d   =   i n n e r D i v . n e x t S i b l i n g . f i r s t C h i l d . f i r s t C h i l d ;  
  
 	 	 t h i s . d o e s N o t A d d B o r d e r   =   ( c h e c k D i v . o f f s e t T o p   ! = =   5 ) ;  
 	 	 t h i s . d o e s A d d B o r d e r F o r T a b l e A n d C e l l s   =   ( t d . o f f s e t T o p   = = =   5 ) ;  
  
 	 	 c h e c k D i v . s t y l e . p o s i t i o n   =   " f i x e d " ;  
 	 	 c h e c k D i v . s t y l e . t o p   =   " 2 0 p x " ;  
  
 	 	 / /   s a f a r i   s u b t r a c t s   p a r e n t   b o r d e r   w i d t h   h e r e   w h i c h   i s   5 p x  
 	 	 t h i s . s u p p o r t s F i x e d P o s i t i o n   =   ( c h e c k D i v . o f f s e t T o p   = = =   2 0   | |   c h e c k D i v . o f f s e t T o p   = = =   1 5 ) ;  
 	 	 c h e c k D i v . s t y l e . p o s i t i o n   =   c h e c k D i v . s t y l e . t o p   =   " " ;  
  
 	 	 i n n e r D i v . s t y l e . o v e r f l o w   =   " h i d d e n " ;  
 	 	 i n n e r D i v . 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 . s u b t r a c t s B o r d e r F o r O v e r f l o w N o t V i s i b l e   =   ( c h e c k D i v . o f f s e t T o p   = = =   - 5 ) ;  
  
 	 	 t h i s . d o e s N o t I n c l u d e M a r g i n I n B o d y O f f s e t   =   ( b o d y . o f f s e t T o p   ! = =   b o d y M a r g i n T o p ) ;  
  
 	 	 b o d y . r e m o v e C h i l d (   c o n t a i n e r   ) ;  
 	 	 j Q u e r y . o f f s e t . i n i t i a l i z e   =   j Q u e r y . n o o p ;  
 	 } ,  
  
 	 b o d y O f f s e t :   f u n c t i o n (   b o d y   )   {  
 	 	 v a r   t o p   =   b o d y . o f f s e t T o p ,  
 	 	 	 l e f t   =   b o d y . o f f s e t L e f t ;  
  
 	 	 j Q u e r y . o f f s e t . i n i t i a l i z e ( ) ;  
  
 	 	 i f   (   j Q u e r y . o f f s e t . d o e s N o t I n c l u d e M a r g i n I n B o d y O f f s e t   )   {  
 	 	 	 t o p     + =   p a r s e F l o a t (   j Q u e r y . c s s ( b o d y ,   " m a r g i n T o p " )   )   | |   0 ;  
 	 	 	 l e f t   + =   p a r s e F l o a t (   j Q u e r y . c s s ( b o d y ,   " m a r g i n L e f t " )   )   | |   0 ;  
 	 	 }  
  
 	 	 r e t u r n   {   t o p :   t o p ,   l e f t :   l e f t   } ;  
 	 } ,  
  
 	 s e t O f f s e t :   f u n c t i o n (   e l e m ,   o p t i o n s ,   i   )   {  
 	 	 v a r   p o s i t i o n   =   j Q u e r y . c s s (   e l e m ,   " p o s i t i o n "   ) ;  
  
 	 	 / /   s e t   p o s i t i o n   f i r s t ,   i n - c a s e   t o p / l e f t   a r e   s e t   e v e n   o n   s t a t i c   e l e m  
 	 	 i f   (   p o s i t i o n   = = =   " s t a t i c "   )   {  
 	 	 	 e l e m . s t y l e . p o s i t i o n   =   " r e l a t i v e " ;  
 	 	 }  
  
 	 	 v a r   c u r E l e m   =   j Q u e r y (   e l e m   ) ,  
 	 	 	 c u r O f f s e t   =   c u r E l e m . o f f s e t ( ) ,  
 	 	 	 c u r C S S T o p   =   j Q u e r y . c s s (   e l e m ,   " t o p "   ) ,  
 	 	 	 c u r C S S L e f t   =   j Q u e r y . c s s (   e l e m ,   " l e f t "   ) ,  
 	 	 	 c a l c u l a t e P o s i t i o n   =   ( p o s i t i o n   = = =   " a b s o l u t e "   | |   p o s i t i o n   = = =   " f i x e d " )   & &   j Q u e r y . i n A r r a y ( " a u t o " ,   [ c u r C S S T o p ,   c u r C S S L e f t ] )   >   - 1 ,  
 	 	 	 p r o p s   =   { } ,   c u r P o s i t i o n   =   { } ,   c u r T o p ,   c u r L e f t ;  
  
 	 	 / /   n e e d   t o   b e   a b l e   t o   c a l c u l a t e   p o s i t i o n   i f   e i t h e r   t o p   o r   l e f t   i s   a u t o   a n d   p o s i t i o n   i s   e i t h e r   a b s o l u t e   o r   f i x e d  
 	 	 i f   (   c a l c u l a t e P o s i t i o n   )   {  
 	 	 	 c u r P o s i t i o n   =   c u r E l e m . p o s i t i o n ( ) ;  
 	 	 	 c u r T o p   =   c u r P o s i t i o n . t o p ;  
 	 	 	 c u r L e f t   =   c u r P o s i t i o n . l e f t ;  
 	 	 }   e l s e   {  
 	 	 	 c u r T o p   =   p a r s e F l o a t (   c u r C S S T o p   )   | |   0 ;  
 	 	 	 c u r L e f t   =   p a r s e F l o a t (   c u r C S S L e f t   )   | |   0 ;  
 	 	 }  
  
 	 	 i f   (   j Q u e r y . i s F u n c t i o n (   o p t i o n s   )   )   {  
 	 	 	 o p t i o n s   =   o p t i o n s . c a l l (   e l e m ,   i ,   c u r O f f s e t   ) ;  
 	 	 }  
  
 	 	 i f   ( o p t i o n s . t o p   ! =   n u l l )   {  
 	 	 	 p r o p s . t o p   =   ( o p t i o n s . t o p   -   c u r O f f s e t . t o p )   +   c u r T o p ;  
 	 	 }  
 	 	 i f   ( o p t i o n s . l e f t   ! =   n u l l )   {  
 	 	 	 p r o p s . l e f t   =   ( o p t i o n s . l e f t   -   c u r O f f s e t . l e f t )   +   c u r L e f t ;  
 	 	 }  
  
 	 	 i f   (   " u s i n g "   i n   o p t i o n s   )   {  
 	 	 	 o p t i o n s . u s i n g . c a l l (   e l e m ,   p r o p s   ) ;  
 	 	 }   e l s e   {  
 	 	 	 c u r E l e m . c s s (   p r o p s   ) ;  
 	 	 }  
 	 }  
 } ;  
  
  
 j Q u e r y . f n . e x t e n d ( {  
 	 p o s i t i o n :   f u n c t i o n ( )   {  
 	 	 i f   (   ! t h i s [ 0 ]   )   {  
 	 	 	 r e t u r n   n u l l ;  
 	 	 }  
  
 	 	 v a r   e l e m   =   t h i s [ 0 ] ,  
  
 	 	 / /   G e t   * r e a l *   o f f s e t P a r e n t  
 	 	 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 ( ) ,  
  
 	 	 / /   G e t   c o r r e c t   o f f s e t s  
 	 	 o f f s e t               =   t h i s . o f f s e t ( ) ,  
 	 	 p a r e n t O f f s e t   =   r r o o t . t e s t ( o f f s e t P a r e n t [ 0 ] . n o d e N a m e )   ?   {   t o p :   0 ,   l e f t :   0   }   :   o f f s e t P a r e n t . o f f s e t ( ) ;  
  
 	 	 / /   S u b t r a c t   e l e m e n t   m a r g i n s  
 	 	 / /   n o t e :   w h e n   a n   e l e m e n t   h a s   m a r g i n :   a u t o   t h e   o f f s e t L e f t   a n d   m a r g i n L e f t  
 	 	 / /   a r e   t h e   s a m e   i n   S a f a r i   c a u s i n g   o f f s e t . l e f t   t o   i n c o r r e c t l y   b e   0  
 	 	 o f f s e t . t o p     - =   p a r s e F l o a t (   j Q u e r y . c s s ( e l e m ,   " m a r g i n T o p " )   )   | |   0 ;  
 	 	 o f f s e t . l e f t   - =   p a r s e F l o a t (   j Q u e r y . c s s ( e l e m ,   " m a r g i n L e f t " )   )   | |   0 ;  
  
 	 	 / /   A d d   o f f s e t P a r e n t   b o r d e r s  
 	 	 p a r e n t O f f s e t . t o p     + =   p a r s e F l o a t (   j Q u e r y . c s s ( o f f s e t P a r e n t [ 0 ] ,   " b o r d e r T o p W i d t h " )   )   | |   0 ;  
 	 	 p a r e n t O f f s e t . l e f t   + =   p a r s e F l o a t (   j Q u e r y . c s s ( o f f s e t P a r e n t [ 0 ] ,   " b o r d e r L e f t W i d t h " )   )   | |   0 ;  
  
 	 	 / /   S u b t r a c t   t h e   t w o   o f f s e t s  
 	 	 r e t u r n   {  
 	 	 	 t o p :     o f f s e t . t o p     -   p a r e n t O f f s e t . t o p ,  
 	 	 	 l e f t :   o f f s e t . l e f t   -   p a r e n t O f f s e t . l e f t  
 	 	 } ;  
 	 } ,  
  
 	 o f f s e t P a r e n t :   f u n c t i o n ( )   {  
 	 	 r e t u r n   t h i s . m a p ( f u n c t i o n ( )   {  
 	 	 	 v a r   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   | |   d o c u m e n t . b o d y ;  
 	 	 	 w h i l e   (   o f f s e t P a r e n t   & &   ( ! r r o o t . t e s t ( o f f s e t P a r e n t . n o d e N a m e )   & &   j Q u e r y . c s s ( o f f s e t P a r e n t ,   " p o s i t i o n " )   = = =   " s t a t i c " )   )   {  
 	 	 	 	 o f f s e t P a r e n t   =   o f f s e t P a r e n t . o f f s e t P a r e n t ;  
 	 	 	 }  
 	 	 	 r e t u r n   o f f s e t P a r e n t ;  
 	 	 } ) ;  
 	 }  
 } ) ;  
  
  
 / /   C r e a t e   s c r o l l L e f t   a n d   s c r o l l T o p   m e t h o d s  
 j Q u e r y . e a c h (   [ " L e f t " ,   " T o p " ] ,   f u n c t i o n (   i ,   n a m e   )   {  
 	 v a r   m e t h o d   =   " s c r o l l "   +   n a m e ;  
  
 	 j Q u e r y . f n [   m e t h o d   ]   =   f u n c t i o n (   v a l   )   {  
 	 	 v a r   e l e m ,   w i n ;  
  
 	 	 i f   (   v a l   = = =   u n d e f i n e d   )   {  
 	 	 	 e l e m   =   t h i s [   0   ] ;  
  
 	 	 	 i f   (   ! e l e m   )   {  
 	 	 	 	 r e t u r n   n u l l ;  
 	 	 	 }  
  
 	 	 	 w i n   =   g e t W i n d o w (   e l e m   ) ;  
  
 	 	 	 / /   R e t u r n   t h e   s c r o l l   o f f s e t  
 	 	 	 r e t u r n   w i n   ?   ( " p a g e X O f f s e t "   i n   w i n )   ?   w i n [   i   ?   " p a g e Y O f f s e t "   :   " p a g e X O f f s e t "   ]   :  
 	 	 	 	 j Q u e r y . s u p p o r t . b o x M o d e l   & &   w i n . d o c u m e n t . d o c u m e n t E l e m e n t [   m e t h o d   ]   | |  
 	 	 	 	 	 w i n . d o c u m e n t . b o d y [   m e t h o d   ]   :  
 	 	 	 	 e l e m [   m e t h o d   ] ;  
 	 	 }  
  
 	 	 / /   S e t   t h e   s c r o l l   o f f s e t  
 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( )   {  
 	 	 	 w i n   =   g e t W i n d o w (   t h i s   ) ;  
  
 	 	 	 i f   (   w i n   )   {  
 	 	 	 	 w i n . s c r o l l T o (  
 	 	 	 	 	 ! i   ?   v a l   :   j Q u e r y (   w i n   ) . s c r o l l L e f t ( ) ,  
 	 	 	 	 	   i   ?   v a l   :   j Q u e r y (   w i n   ) . s c r o l l T o p ( )  
 	 	 	 	 ) ;  
  
 	 	 	 }   e l s e   {  
 	 	 	 	 t h i s [   m e t h o d   ]   =   v a l ;  
 	 	 	 }  
 	 	 } ) ;  
 	 } ;  
 } ) ;  
  
 f u n c t i o n   g e t W i n d o w (   e l e m   )   {  
 	 r e t u r n   j Q u e r y . i s W i n d o w (   e l e m   )   ?  
 	 	 e l e m   :  
 	 	 e l e m . n o d e T y p e   = = =   9   ?  
 	 	 	 e l e m . d e f a u l t V i e w   | |   e l e m . p a r e n t W i n d o w   :  
 	 	 	 f a l s e ;  
 }  
  
  
  
  
 / /   C r e a t e   i n n e r H e i g h t ,   i n n e r W i d t h ,   o u t e r H e i g h t   a n d   o u t e r W i d t h   m e t h o d s  
 j Q u e r y . e a c h ( [   " H e i g h t " ,   " W i d t h "   ] ,   f u n c t i o n (   i ,   n a m e   )   {  
  
 	 v a r   t y p e   =   n a m e . t o L o w e r C a s e ( ) ;  
  
 	 / /   i n n e r H e i g h t   a n d   i n n e r W i d t h  
 	 j Q u e r y . f n [ " i n n e r "   +   n a m e ]   =   f u n c t i o n ( )   {  
 	 	 r e t u r n   t h i s [ 0 ]   ?  
 	 	 	 p a r s e F l o a t (   j Q u e r y . c s s (   t h i s [ 0 ] ,   t y p e ,   " p a d d i n g "   )   )   :  
 	 	 	 n u l l ;  
 	 } ;  
  
 	 / /   o u t e r H e i g h t   a n d   o u t e r W i d t h  
 	 j Q u e r y . f n [ " o u t e r "   +   n a m e ]   =   f u n c t i o n (   m a r g i n   )   {  
 	 	 r e t u r n   t h i s [ 0 ]   ?  
 	 	 	 p a r s e F l o a t (   j Q u e r y . c s s (   t h i s [ 0 ] ,   t y p e ,   m a r g i n   ?   " m a r g i n "   :   " b o r d e r "   )   )   :  
 	 	 	 n u l l ;  
 	 } ;  
  
 	 j Q u e r y . f n [   t y p e   ]   =   f u n c t i o n (   s i z e   )   {  
 	 	 / /   G e t   w i n d o w   w i d t h   o r   h e i g h t  
 	 	 v a r   e l e m   =   t h i s [ 0 ] ;  
 	 	 i f   (   ! e l e m   )   {  
 	 	 	 r e t u r n   s i z e   = =   n u l l   ?   n u l l   :   t h i s ;  
 	 	 }  
  
 	 	 i f   (   j Q u e r y . i s F u n c t i o n (   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 (   i   )   {  
 	 	 	 	 v a r   s e l f   =   j Q u e r y (   t h i s   ) ;  
 	 	 	 	 s e l f [   t y p e   ] (   s i z e . c a l l (   t h i s ,   i ,   s e l f [   t y p e   ] ( )   )   ) ;  
 	 	 	 } ) ;  
 	 	 }  
  
 	 	 i f   (   j Q u e r y . i s W i n d o w (   e l e m   )   )   {  
 	 	 	 / /   E v e r y o n e   e l s e   u s e   d o c u m e n t . d o c u m e n t E l e m e n t   o r   d o c u m e n t . b o d y   d e p e n d i n g   o n   Q u i r k s   v s   S t a n d a r d s   m o d e  
 	 	 	 / /   3 r d   c o n d i t i o n   a l l o w s   N o k i a   s u p p o r t ,   a s   i t   s u p p o r t s   t h e   d o c E l e m   p r o p   b u t   n o t   C S S 1 C o m p a t  
 	 	 	 v a r   d o c E l e m P r o p   =   e l e m . d o c u m e n t . d o c u m e n t E l e m e n t [   " c l i e n t "   +   n a m e   ] ;  
 	 	 	 r e t u r n   e l e m . d o c u m e n t . c o m p a t M o d e   = = =   " C S S 1 C o m p a t "   & &   d o c E l e m P r o p   | |  
 	 	 	 	 e l e m . d o c u m e n t . b o d y [   " c l i e n t "   +   n a m e   ]   | |   d o c E l e m P r o p ;  
  
 	 	 / /   G e t   d o c u m e n t   w i d t h   o r   h e i g h t  
 	 	 }   e l s e   i f   (   e l e m . n o d e T y p e   = = =   9   )   {  
 	 	 	 / /   E i t h e r   s c r o l l [ W i d t h / H e i g h t ]   o r   o f f s e t [ W i d t h / H e i g h t ] ,   w h i c h e v e r   i s   g r e a t e r  
 	 	 	 r e t u r n   M a t h . m a x (  
 	 	 	 	 e l e m . d o c u m e n t E l e m e n t [ " c l i e n t "   +   n a m e ] ,  
 	 	 	 	 e l e m . b o d y [ " s c r o l l "   +   n a m e ] ,   e l e m . d o c u m e n t E l e m e n t [ " s c r o l l "   +   n a m e ] ,  
 	 	 	 	 e l e m . b o d y [ " o f f s e t "   +   n a m e ] ,   e l e m . d o c u m e n t E l e m e n t [ " o f f s e t "   +   n a m e ]  
 	 	 	 ) ;  
  
 	 	 / /   G e t   o r   s e t   w i d t h   o r   h e i g h t   o n   t h e   e l e m e n t  
 	 	 }   e l s e   i f   (   s i z e   = = =   u n d e f i n e d   )   {  
 	 	 	 v a r   o r i g   =   j Q u e r y . c s s (   e l e m ,   t y p e   ) ,  
 	 	 	 	 r e t   =   p a r s e F l o a t (   o r i g   ) ;  
  
 	 	 	 r e t u r n   j Q u e r y . i s N a N (   r e t   )   ?   o r i g   :   r e t ;  
  
 	 	 / /   S e t   t h e   w i d t h   o r   h e i g h t   o n   t h e   e l e m e n t   ( d e f a u l t   t o   p i x e l s   i f   v a l u e   i s   u n i t l e s s )  
 	 	 }   e l s e   {  
 	 	 	 r e t u r n   t h i s . c s s (   t y p e ,   t y p e o f   s i z e   = = =   " s t r i n g "   ?   s i z e   :   s i z e   +   " p x "   ) ;  
 	 	 }  
 	 } ;  
  
 } ) ;  
  
  
 w i n d o w . j Q u e r y   =   w i n d o w . $   =   j Q u e r y ;  
 } ) ( w i n d o w ) ; 
