ÿþ/ * !  
   *   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 . 3 . 2  
   *  
   *   C o p y r i g h t   ( c )   2 0 0 9   J o h n   R e s i g ,   h t t p : / / j q u e r y . c o m /  
   *    
   *   P e r m i s s i o n   i s   h e r e b y   g r a n t e d ,   f r e e   o f   c h a r g e ,   t o   a n y   p e r s o n   o b t a i n i n g  
   *   a   c o p y   o f   t h i s   s o f t w a r e   a n d   a s s o c i a t e d   d o c u m e n t a t i o n   f i l e s   ( t h e  
   *   " S o f t w a r e " ) ,   t o   d e a l   i n   t h e   S o f t w a r e   w i t h o u t   r e s t r i c t i o n ,   i n c l u d i n g  
   *   w i t h o u t   l i m i t a t i o n   t h e   r i g h t s   t o   u s e ,   c o p y ,   m o d i f y ,   m e r g e ,   p u b l i s h ,  
   *   d i s t r i b u t e ,   s u b l i c e n s e ,   a n d / o r   s e l l   c o p i e s   o f   t h e   S o f t w a r e ,   a n d   t o  
   *   p e r m i t   p e r s o n s   t o   w h o m   t h e   S o f t w a r e   i s   f u r n i s h e d   t o   d o   s o ,   s u b j e c t   t o  
   *   t h e   f o l l o w i n g   c o n d i t i o n s :  
   *    
   *   T h e   a b o v e   c o p y r i g h t   n o t i c e   a n d   t h i s   p e r m i s s i o n   n o t i c e   s h a l l   b e  
   *   i n c l u d e d   i n   a l l   c o p i e s   o r   s u b s t a n t i a l   p o r t i o n s   o f   t h e   S o f t w a r e .  
   *    
   *   T H E   S O F T W A R E   I S   P R O V I D E D   " A S   I S " ,   W I T H O U T   W A R R A N T Y   O F   A N Y   K I N D ,  
   *   E X P R E S S   O R   I M P L I E D ,   I N C L U D I N G   B U T   N O T   L I M I T E D   T O   T H E   W A R R A N T I E S   O F  
   *   M E R C H A N T A B I L I T Y ,   F I T N E S S   F O R   A   P A R T I C U L A R   P U R P O S E   A N D  
   *   N O N I N F R I N G E M E N T .   I N   N O   E V E N T   S H A L L   T H E   A U T H O R S   O R   C O P Y R I G H T   H O L D E R S   B E  
   *   L I A B L E   F O R   A N Y   C L A I M ,   D A M A G E S   O R   O T H E R   L I A B I L I T Y ,   W H E T H E R   I N   A N   A C T I O N  
   *   O F   C O N T R A C T ,   T O R T   O R   O T H E R W I S E ,   A R I S I N G   F R O M ,   O U T   O F   O R   I N   C O N N E C T I O N  
   *   W I T H   T H E   S O F T W A R E   O R   T H E   U S E   O R   O T H E R   D E A L I N G S   I N   T H E   S O F T W A R E .  
   *  
   *   D a t e :   2 0 0 9 - 0 2 - 1 9   1 7 : 3 4 : 2 1   - 0 5 0 0   ( T h u ,   1 9   F e b   2 0 0 9 )  
   *   R e v i s i o n :   6 2 4 6  
   * /  
 ( f u n c t i o n ( ) {  
  
 v a r    
 	 / /   W i l l   s p e e d   u p   r e f e r e n c e s   t o   w i n d o w ,   a n d   a l l o w s   m u n g i n g   i t s   n a m e .  
 	 w i n d o w   =   t h i s ,  
 	 / /   W i l l   s p e e d   u p   r e f e r e n c e s   t o   u n d e f i n e d ,   a n d   a l l o w s   m u n g i n g   i t s   n a m e .  
 	 u n d e f i n e d ,  
 	 / /   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 . $ ,  
  
 	 j Q u e r y   =   w i n d o w . j Q u e r y   =   w i n d o w . $   =   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   ) ;  
 	 } ,  
  
 	 / /   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   =   / ^ [ ^ < ] * ( < ( . | \ s ) + > ) [ ^ > ] * $ | ^ # ( [ \ w - ] + ) $ / ,  
 	 / /   I s   i t   a   s i m p l e   s e l e c t o r  
 	 i s S i m p l e   =   / ^ . [ ^ : # \ [ \ . , ] * $ / ;  
  
 j Q u e r y . f n   =   j Q u e r y . p r o t o t y p e   =   {  
 	 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   )   {  
 	 	 / /   M a k e   s u r e   t h a t   a   s e l e c t i o n   w a s   p r o v i d e d  
 	 	 s e l e c t o r   =   s e l e c t o r   | |   d o c u m e n t ;  
  
 	 	 / /   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 [ 0 ]   =   s e l e c t o r ;  
 	 	 	 t h i s . l e n g t h   =   1 ;  
 	 	 	 t h i s . c o n t e x t   =   s e l e c t o r ;  
 	 	 	 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 ?  
 	 	 	 v a r   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 ]   )  
 	 	 	 	 	 s e l e c t o r   =   j Q u e r y . c l e a n (   [   m a t c h [ 1 ]   ] ,   c o n t e x t   ) ;  
  
 	 	 	 	 / /   H A N D L E :   $ ( " # i d " )  
 	 	 	 	 e l s e   {  
 	 	 	 	 	 v a r   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 [ 3 ]   ) ;  
  
 	 	 	 	 	 / /   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   & &   e l e m . i d   ! =   m a t c h [ 3 ]   )  
 	 	 	 	 	 	 r e t u r n   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  
 	 	 	 	 	 v a r   r e t   =   j Q u e r y (   e l e m   | |   [ ]   ) ;  
 	 	 	 	 	 r e t . c o n t e x t   =   d o c u m e n t ;  
 	 	 	 	 	 r e t . s e l e c t o r   =   s e l e c t o r ;  
 	 	 	 	 	 r e t u r n   r e t ;  
 	 	 	 	 }  
  
 	 	 	 / /   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 n t ) . f i n d ( e x p r )  
 	 	 	 }   e l s e  
 	 	 	 	 r e t u r n   j Q u e r y (   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   j Q u e r y (   d o c u m e n t   ) . r e a d y (   s e l e c t o r   ) ;  
  
 	 	 / /   M a k e   s u r e   t h a t   o l d   s e l e c t o r   s t a t e   i s   p a s s e d   a l o n g  
 	 	 i f   (   s e l e c t o r . s e l e c t o r   & &   s e l e c t o r . c o n t e x t   )   {  
 	 	 	 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   t h i s . s e t A r r a y ( j Q u e r y . i s A r r a y (   s e l e c t o r   )   ?  
 	 	 	 s e l e c t o r   :  
 	 	 	 j Q u e r y . m a k e A r r a y ( s e l e c t o r ) ) ;  
 	 } ,  
  
 	 / /   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 . 3 . 2 " ,  
  
 	 / /   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 ;  
 	 } ,  
  
 	 / /   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   = = =   u n d e f i n e d   ?  
  
 	 	 	 / /   R e t u r n   a   ' c l e a n '   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 (   t h i s   )   :  
  
 	 	 	 / /   R e t u r n   j u s t   t h e   o b j e c t  
 	 	 	 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   =   j Q u e r y (   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 ;  
 	 } ,  
  
 	 / /   F o r c e   t h e   c u r r e n t   m a t c h e d   s e t   o f   e l e m e n t s   t o   b e c o m e  
 	 / /   t h e   s p e c i f i e d   a r r a y   o f   e l e m e n t s   ( d e s t r o y i n g   t h e   s t a c k   i n   t h e   p r o c e s s )  
 	 / /   Y o u   s h o u l d   u s e   p u s h S t a c k ( )   i n   o r d e r   t o   d o   t h i s ,   b u t   m a i n t a i n   t h e   s t a c k  
 	 s e t A r r a y :   f u n c t i o n (   e l e m s   )   {  
 	 	 / /   R e s e t t i n g   t h e   l e n g t h   t o   0 ,   t h e n   u s i n g   t h e   n a t i v e   A r r a y   p u s h  
 	 	 / /   i s   a   s u p e r - f a s t   w a y   t o   p o p u l a t e   a n   o b j e c t   w i t h   a r r a y - l i k e   p r o p e r t i e s  
 	 	 t h i s . l e n g t h   =   0 ;  
 	 	 A r r a y . p r o t o t y p e . p u s h . a p p l y (   t h i s ,   e l e m s   ) ;  
  
 	 	 r e t u r n   t h i s ;  
 	 } ,  
  
 	 / /   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   ) ;  
 	 } ,  
  
 	 / /   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   )   {  
 	 	 / /   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   & &   e l e m . j q u e r y   ?   e l e m [ 0 ]   :   e l e m  
 	 	 ,   t h i s   ) ;  
 	 } ,  
  
 	 a t t r :   f u n c t i o n (   n a m e ,   v a l u e ,   t y p e   )   {  
 	 	 v a r   o p t i o n s   =   n a m e ;  
  
 	 	 / /   L o o k   f o r   t h e   c a s e   w h e r e   w e ' r e   a c c e s s i n g   a   s t y l e   v a l u e  
 	 	 i f   (   t y p e o f   n a m e   = = =   " s t r i n g "   )  
 	 	 	 i f   (   v a l u e   = = =   u n d e f i n e d   )  
 	 	 	 	 r e t u r n   t h i s [ 0 ]   & &   j Q u e r y [   t y p e   | |   " a t t r "   ] (   t h i s [ 0 ] ,   n a m e   ) ;  
  
 	 	 	 e l s e   {  
 	 	 	 	 o p t i o n s   =   { } ;  
 	 	 	 	 o p t i o n s [   n a m e   ]   =   v a l u e ;  
 	 	 	 }  
  
 	 	 / /   C h e c k   t o   s e e   i f   w e ' r e   s e t t i n g   s t y l e   v a l u e s  
 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( i ) {  
 	 	 	 / /   S e t   a l l   t h e   s t y l e s  
 	 	 	 f o r   (   n a m e   i n   o p t i o n s   )  
 	 	 	 	 j Q u e r y . a t t r (  
 	 	 	 	 	 t y p e   ?  
 	 	 	 	 	 	 t h i s . s t y l e   :  
 	 	 	 	 	 	 t h i s ,  
 	 	 	 	 	 n a m e ,   j Q u e r y . p r o p (   t h i s ,   o p t i o n s [   n a m e   ] ,   t y p e ,   i ,   n a m e   )  
 	 	 	 	 ) ;  
 	 	 } ) ;  
 	 } ,  
  
 	 c s s :   f u n c t i o n (   k e y ,   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  
 	 	 i f   (   ( k e y   = =   ' w i d t h '   | |   k e y   = =   ' h e i g h t ' )   & &   p a r s e F l o a t ( v a l u e )   <   0   )  
 	 	 	 v a l u e   =   u n d e f i n e d ;  
 	 	 r e t u r n   t h i s . a t t r (   k e y ,   v a l u e ,   " c u r C S S "   ) ;  
 	 } ,  
  
 	 t e x t :   f u n c t i o n (   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   ! =   n u l l   )  
 	 	 	 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   )   ) ;  
  
 	 	 v a r   r e t   =   " " ;  
  
 	 	 j Q u e r y . e a c h (   t e x t   | |   t h i s ,   f u n c t i o n ( ) {  
 	 	 	 j Q u e r y . e a c h (   t h i s . c h i l d N o d e s ,   f u n c t i o n ( ) {  
 	 	 	 	 i f   (   t h i s . n o d e T y p e   ! =   8   )  
 	 	 	 	 	 r e t   + =   t h i s . n o d e T y p e   ! =   1   ?  
 	 	 	 	 	 	 t h i s . n o d e V a l u e   :  
 	 	 	 	 	 	 j Q u e r y . f n . t e x t (   [   t h i s   ]   ) ;  
 	 	 	 } ) ;  
 	 	 } ) ;  
  
 	 	 r e t u r n   r e t ;  
 	 } ,  
  
 	 w r a p A l l :   f u n c t i o n (   h t m l   )   {  
 	 	 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   ) . c l o n 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   =   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   )   {  
 	 	 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   ) . c o n t e n t s ( ) . w r a p A l l (   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   ) ;  
 	 	 } ) ;  
 	 } ,  
  
 	 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 ( )   {  
 	 	 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   ) ;  
 	 	 } ) ;  
 	 } ,  
  
 	 a f t e r :   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 ,   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 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   | |   j Q u e r y (   [ ]   ) ;  
 	 } ,  
  
 	 / /   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 ,  
  
 	 f i n d :   f u n c t i o n (   s e l e c t o r   )   {  
 	 	 i f   (   t h i s . l e n g t h   = = =   1   )   {  
 	 	 	 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   ) ;  
 	 	 	 r e t . l e n g t h   =   0 ;  
 	 	 	 j Q u e r y . f i n d (   s e l e c t o r ,   t h i s [ 0 ] ,   r e t   ) ;  
 	 	 	 r e t u r n   r e t ;  
 	 	 }   e l s e   {  
 	 	 	 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 . u n i q u e ( 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 ) {  
 	 	 	 	 r e t u r n   j Q u e r y . f i n d (   s e l e c t o r ,   e l e m   ) ;  
 	 	 	 } ) ) ,   " f i n d " ,   s e l e c t o r   ) ;  
 	 	 }  
 	 } ,  
  
 	 c l o n e :   f u n c t i o n (   e v e n t s   )   {  
 	 	 / /   D o   t h e   c l o n e  
 	 	 v a r   r e t   =   t h i s . m a p ( f u n c t i o n ( ) {  
 	 	 	 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 . i s X M L D o c ( t h i s )   )   {  
 	 	 	 	 / /   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 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   i n n e r H T M L .  
 	 	 	 	 / /   U n f o r t u n a t e l y ,   t h i s   m e a n s   s o m e   m o d i f i c a t i o n s   t o  
 	 	 	 	 / /   a t t r i b u t e s   i n   I E   t h a t   a r e   a c t u a l l y   o n l y   s t o r e d  
 	 	 	 	 / /   a s   p r o p e r t i e s   w i l l   n o t   b e   c o p i e d   ( s u c h   a s   t h e  
 	 	 	 	 / /   t h e   n a m e   a t t r i b u t e   o n   a n   i n p u t ) .  
 	 	 	 	 v a r   h t m l   =   t h i s . o u t e r H T M L ;  
 	 	 	 	 i f   (   ! h t m l   )   {  
 	 	 	 	 	 v a r   d i v   =   t h i s . 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 ( " d i v " ) ;  
 	 	 	 	 	 d i v . a p p e n d C h i l d (   t h i s . c l o n e N o d e ( t r u e )   ) ;  
 	 	 	 	 	 h t m l   =   d i v . i n n e r H T M L ;  
 	 	 	 	 }  
  
 	 	 	 	 r e t u r n   j Q u e r y . c l e a n ( [ h t m l . r e p l a c e ( /   j Q u e r y \ d + = " ( ? : \ d + | n u l l ) " / g ,   " " ) . r e p l a c e ( / ^ \ s * / ,   " " ) ] ) [ 0 ] ;  
 	 	 	 }   e l s e  
 	 	 	 	 r e t u r n   t h i s . c l o n e N o d e ( t r u e ) ;  
 	 	 } ) ;  
  
 	 	 / /   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   (   e v e n t s   = = =   t r u e   )   {  
 	 	 	 v a r   o r i g   =   t h i s . f i n d ( " * " ) . a n d S e l f ( ) ,   i   =   0 ;  
  
 	 	 	 r e t . f i n d ( " * " ) . a n d S e l f ( ) . e a c h ( f u n c t i o n ( ) {  
 	 	 	 	 i f   (   t h i s . n o d e N a m e   ! = =   o r i g [ i ] . n o d e N a m e   )  
 	 	 	 	 	 r e t u r n ;  
  
 	 	 	 	 v a r   e v e n t s   =   j Q u e r y . d a t a (   o r i g [ i ] ,   " 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   h a n d l e r   i n   e v e n t s [   t y p e   ]   )   {  
 	 	 	 	 	 	 j Q u e r y . e v e n t . a d d (   t h i s ,   t y p e ,   e v e n t s [   t y p e   ] [   h a n d l e r   ] ,   e v e n t s [   t y p e   ] [   h a n d l e r   ] . d a t a   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 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   r e t ;  
 	 } ,  
  
 	 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 (  
 	 	 	 j Q u e r y . i s F u n c t i o n (   s e l e c t o r   )   & &  
 	 	 	 j Q u e r y . g r e p ( t h i s ,   f u n c t i o n ( e l e m ,   i ) {  
 	 	 	 	 r e t u r n   s e l e c t o r . c a l l (   e l e m ,   i   ) ;  
 	 	 	 } )   | |  
  
 	 	 	 j Q u e r y . m u l t i F i l t e r (   s e l e c t o r ,   j Q u e r y . g r e p ( t h i 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 ;  
 	 	 	 } )   ) ,   " f i l t e r " ,   s e l e c t o r   ) ;  
 	 } ,  
  
 	 c l o s e s t :   f u n c t i o n (   s e l e c t o r   )   {  
 	 	 v a r   p o s   =   j Q u e r y . e x p r . m a t c h . 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 )   :   n u l l ,  
 	 	 	 c l o s e r   =   0 ;  
  
 	 	 r e t u r n   t h i s . m a p ( f u n c t i o n ( ) {  
 	 	 	 v a r   c u r   =   t h i s ;  
 	 	 	 w h i l e   (   c u r   & &   c u r . o w n e r D o c u m e n t   )   {  
 	 	 	 	 i f   (   p o s   ?   p o s . i n d e x ( c u r )   >   - 1   :   j Q u e r y ( c u r ) . i s ( s e l e c t o r )   )   {  
 	 	 	 	 	 j Q u e r y . d a t a ( c u r ,   " c l o s e s t " ,   c l o s e r ) ;  
 	 	 	 	 	 r e t u r n   c u r ;  
 	 	 	 	 }  
 	 	 	 	 c u r   =   c u r . p a r e n t N o d e ;  
 	 	 	 	 c l o s e r + + ;  
 	 	 	 }  
 	 	 } ) ;  
 	 } ,  
  
 	 n o t :   f u n c t i o n (   s e l e c t o r   )   {  
 	 	 i f   (   t y p e o f   s e l e c t o r   = = =   " s t r i n g "   )  
 	 	 	 / /   t e s t   s p e c i a l   c a s e   w h e r e   j u s t   o n e   s e l e c t o r   i s   p a s s e d   i n  
 	 	 	 i f   (   i s S i m p l e . t e s t (   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 (   j Q u e r y . m u l t i F i l t e r (   s e l e c t o r ,   t h i s ,   t r u e   ) ,   " n o t " ,   s e l e c t o r   ) ;  
 	 	 	 e l s e  
 	 	 	 	 s e l e c t o r   =   j Q u e r y . m u l t i F i l t e r (   s e l e c t o r ,   t h i s   ) ;  
  
 	 	 v a r   i s A r r a y L i k e   =   s e l e c t o r . l e n g t h   & &   s e l e c t o r [ s e l e c t o r . l e n g t h   -   1 ]   ! = =   u n d e f i n e d   & &   ! s e l e c t o r . n o d e T y p e ;  
 	 	 r e t u r n   t h i s . f i l t e r ( f u n c t i o n ( )   {  
 	 	 	 r e t u r n   i s A r r a y L i k e   ?   j Q u e r y . i n A r r a y (   t h i s ,   s e l e c t o r   )   <   0   :   t h i s   ! =   s e l e c t o r ;  
 	 	 } ) ;  
 	 } ,  
  
 	 a d d :   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 (   j Q u e r y . u n i q u e (   j Q u e r y . m e r g e (  
 	 	 	 t h i s . g 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   )   :  
 	 	 	 	 j Q u e r y . m a k e A r r a y (   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   & &   j Q u e r y . m u l t i 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 ;  
 	 } ,  
  
 	 h a s C l a s 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 h i s . i s (   " . "   +   s e l e c t o r   ) ;  
 	 } ,  
  
 	 v a 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   )   { 	 	 	  
 	 	 	 v a r   e l e m   =   t h i s [ 0 ] ;  
  
 	 	 	 i f   (   e l e m   )   {  
 	 	 	 	 i f (   j Q u e r y . n o d e N a m e (   e l e m ,   ' o p t i o n '   )   )  
 	 	 	 	 	 r e t u r n   ( e l e m . a t t r i b u t e s . v a l u e   | |   { } ) . 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 ;  
 	 	 	 	  
 	 	 	 	 / /   W e   n e e d   t o   h a n d l e   s e l e c t   b o x e s   s p e c i a l  
 	 	 	 	 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 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   ] ;  
  
 	 	 	 	 	 	 i f   (   o p t i o n . s e l e c t e d   )   {  
 	 	 	 	 	 	 	 / /   G e t   t h e   s p e c i f 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   ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
  
 	 	 	 	 	 r e t u r n   v a l u e s ; 	 	 	 	  
 	 	 	 	 }  
  
 	 	 	 	 / /   E v e r y t h i n g   e l s e ,   w e   j u s t   g r a b   t h e   v a l u e  
 	 	 	 	 r e t u r n   ( e l e m . v a l u e   | |   " " ) . r e p l a c e ( / \ r / g ,   " " ) ;  
  
 	 	 	 }  
  
 	 	 	 r e t u r n   u n d e f i n e d ;  
 	 	 }  
  
 	 	 i f   (   t y p e o f   v a l u e   = = =   " n u m b e r "   )  
 	 	 	 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 f   (   t h i s . n o d e T y p e   ! =   1   )  
 	 	 	 	 r e t u r n ;  
  
 	 	 	 i f   (   j Q u e r y . i s A r r a y ( v a l u e )   & &   / r a d i o | c h e c k b o x / . t e s t (   t h i s . t y p e   )   )  
 	 	 	 	 t h i s . c h e c k e d   =   ( j Q u e r y . i n A r r a y ( t h i s . v a l u e ,   v a l u e )   > =   0   | |  
 	 	 	 	 	 j Q u e r y . i n A r r a y ( t h i s . n a m e ,   v a l u e )   > =   0 ) ;  
  
 	 	 	 e l s e   i f   (   j Q u e r y . n o d e N a m e (   t h i s ,   " s e l e c t "   )   )   {  
 	 	 	 	 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 (   " o p t i o n " ,   t h i s   ) . 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 (   t h i s . v a l u e ,   v a l u e s   )   > =   0   | |  
 	 	 	 	 	 	 j Q u e r y . i n A r r a y (   t h i s . t e x t ,   v a l u e s   )   > =   0 ) ;  
 	 	 	 	 } ) ;  
  
 	 	 	 	 i f   (   ! v a l u e s . l e n g t h   )  
 	 	 	 	 	 t h i s . s e l e c t e d I n d e x   =   - 1 ;  
  
 	 	 	 }   e l s e  
 	 	 	 	 t h i s . v a l u e   =   v a l u e ;  
 	 	 } ) ;  
 	 } ,  
  
 	 h t m 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   = = =   u n d e f i n e d   ?  
 	 	 	 ( t h i s [ 0 ]   ?  
 	 	 	 	 t h i s [ 0 ] . i n n e r H T M L . r e p l a c e ( /   j Q u e r y \ d + = " ( ? : \ d + | n u l l ) " / g ,   " " )   :  
 	 	 	 	 n u l l )   :  
 	 	 	 t h i s . e m p t y ( ) . a p p e n d (   v a l u e   ) ;  
 	 } ,  
  
 	 r e p l a c e W i t h :   f u n c t i o n (   v a l u e   )   {  
 	 	 r e t u r n   t h i s . a f t e r (   v a l u e   ) . r e m o v e ( ) ;  
 	 } ,  
  
 	 e q :   f u n c t i o n (   i   )   {  
 	 	 r e t u r n   t h i s . s l i c e (   i ,   + i   +   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 (   A r r a y . p r o t o t y p e . 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 " ,   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 ) . 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   ) ;  
 	 	 } ) ) ;  
 	 } ,  
  
 	 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   ) ;  
 	 } ,  
  
 	 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   )   {  
 	 	 i f   (   t h i s [ 0 ]   )   {  
 	 	 	 v a r   f r a g m e n t   =   ( t h i s [ 0 ] . o w n e r D o c u m e n t   | |   t h i s [ 0 ] ) . c r e a t e D o c u m e n t F r a g m e n t ( ) ,  
 	 	 	 	 s c r i p t s   =   j Q u e r y . c l e a n (   a r g s ,   ( t h i s [ 0 ] . o w n e r D o c u m e n t   | |   t h i s [ 0 ] ) ,   f r a g m e n t   ) ,  
 	 	 	 	 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   )  
 	 	 	 	 f o r   (   v a r   i   =   0 ,   l   =   t h i s . l e n g t h ;   i   <   l ;   i + +   )  
 	 	 	 	 	 c a l l b a c k . c a l l (   r o o t ( t h i s [ i ] ,   f i r s t ) ,   t h i s . l e n g t h   >   1   | |   i   >   0   ?  
 	 	 	 	 	 	 	 f r a g m e n t . c l o n e N o d e ( t r u e )   :   f r a g m e n t   ) ;  
 	 	  
 	 	 	 i f   (   s c r i p t s   )  
 	 	 	 	 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   t a b l e   & &   j Q u e r y . n o d e N a m e ( e l e m ,   " t a b l e " )   & &   j Q u e r y . n o d e N a m e ( c u r ,   " t r " )   ?  
 	 	 	 	 ( 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 ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   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 ;  
  
 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   ) ;  
 }  
  
 f u n c t i o n   n o w ( ) {  
 	 r e t u r n   + n e w   D a t e ;  
 }  
  
 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 ( )   {  
 	 / /   c o p y   r e f e r e n c e   t o   t a r g e t   o b j e c t  
 	 v a r   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 ,   o p t i o n s ;  
  
 	 / /   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   (   v a r   n a m e   i n   o p t i o n s   )   {  
 	 	 	 	 v a r   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   o b j e c t   v a l u e s  
 	 	 	 	 i f   (   d e e p   & &   c o p y   & &   t y p e o f   c o p y   = = =   " o b j e c t "   & &   ! c o p y . n o d e T y p e   )  
 	 	 	 	 	 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 ,    
 	 	 	 	 	 	 / /   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  
 	 	 	 	 	 	 s r c   | |   (   c o p y . l e n g t h   ! =   n u l l   ?   [   ]   :   {   }   )  
 	 	 	 	 	 ,   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 ;  
 } ;  
  
 / /   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  
 v a r 	 e x c l u d e   =   / z - ? i n d e x | f o n t - ? w e i g h t | o p a c i t y | z o o m | l i n e - ? h e i g h t / i ,  
 	 / /   c a c h e   d e f a u l t V i e w  
 	 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   | |   { } ,  
 	 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 ;  
  
 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   )   {  
 	 	 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 ;  
  
 	 	 r e t u r n   j Q u e r y ;  
 	 } ,  
  
 	 / /   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   t o S t r i n g . c a l l ( o b j )   = = =   " [ o b j e c t   F u n c t i o n ] " ;  
 	 } ,  
  
 	 i s A r r a y :   f u n c t i o n (   o b j   )   {  
 	 	 r e t u r n   t o S t r i n g . c a l l ( o b j )   = = =   " [ o b j e c t   A r r a y ] " ;  
 	 } ,  
  
 	 / /   c h e c k   i f   a n   e l e m e n t   i s   i n   a   ( o r   i s   a n )   X M L   d o c u m e n t  
 	 i s X M L D o c :   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   = = =   9   & &   e l e m . 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 "   | |  
 	 	 	 ! ! e l e m . o w n e r D o c u m e n t   & &   j Q u e r y . i s X M L D o c (   e l e m . o w n e r D o c u m e n t   ) ;  
 	 } ,  
  
 	 / /   E v a l u l 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  
 	 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   & &   / \ S / . t e s t ( d a t a )   )   {  
 	 	 	 / /   I n s p i r e d   b y   c o d e   b y   A n d r e a   G i a m m a r c h i  
 	 	 	 / /   h t t p : / / w e b r e f l e c t i o n . b l o g s p o t . c o m / 2 0 0 7 / 0 8 / g l o b a l - s c o p e - e v a l u a t i o n - a n d - d o m . h t m l  
 	 	 	 v a r   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 ,  
 	 	 	 	 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 . t y p e   =   " t e x t / j a v a s c r i p t " ;  
 	 	 	 i f   (   j Q u e r y . s u p p o r t . s c r i p t E v a l   )  
 	 	 	 	 s c r i p 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 T e x t N o d e (   d a t a   )   ) ;  
 	 	 	 e l s e  
 	 	 	 	 s c r i p t . t e x t   =   d a t a ;  
  
 	 	 	 / /   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 ) .  
 	 	 	 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   ) ;  
 	 	 	 h e a d . r e m o v e C h i l d (   s c r i p t   ) ;  
 	 	 }  
 	 } ,  
  
 	 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 f   (   a r g s   )   {  
 	 	 	 i f   (   l e n g t h   = = =   u n d e f i n e d   )   {  
 	 	 	 	 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   (   l e n g t h   = = =   u n d e f i n e d   )   {  
 	 	 	 	 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   (   v a r   v a l u e   =   o b j e c t [ 0 ] ;  
 	 	 	 	 	 i   <   l e n g t h   & &   c a l l b a c k . c a l l (   v a l u e ,   i ,   v a l u e   )   ! = =   f a l s e ;   v a l u e   =   o b j e c t [ + + i ]   ) { }  
 	 	 }  
  
 	 	 r e t u r n   o b j e c t ;  
 	 } ,  
  
 	 p r o p :   f u n c t i o n (   e l e m ,   v a l u e ,   t y p e ,   i ,   n a m e   )   {  
 	 	 / /   H a n d l e   e x e c u t a b l e   f u n c t i o n s  
 	 	 i f   (   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 . c a l l (   e l e m ,   i   ) ;  
  
 	 	 / /   H a n d l e   p a s s i n g   i n   a   n u m b e r   t o   a   C S S   p r o p e r t y  
 	 	 r e t u r n   t y p e o f   v a l u e   = = =   " n u m b e r "   & &   t y p e   = =   " c u r C S S "   & &   ! e x c l u d e . t e s t (   n a m e   )   ?  
 	 	 	 v a l u e   +   " p x "   :  
 	 	 	 v a l u e ;  
 	 } ,  
  
 	 c l a s s N a m e :   {  
 	 	 / /   i n t e r n a l   o n l y ,   u s e   a d d C l a s s ( " c l a s s " )  
 	 	 a d d :   f u n c t i o n (   e l e m ,   c l a s s N a m e s   )   {  
 	 	 	 j Q u e r y . e a c h ( ( c l a s s N a m e s   | |   " " ) . s p l i t ( / \ s + / ) ,   f u n c t i o n ( i ,   c l a s s N a m e ) {  
 	 	 	 	 i f   (   e l e m . n o d e T y p e   = =   1   & &   ! j Q u e r y . c l a s s N a m e . h a s (   e l e m . c l a s s N a m e ,   c l a s s N a m e   )   )  
 	 	 	 	 	 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   ?   "   "   :   " " )   +   c l a s s N a m e ;  
 	 	 	 } ) ;  
 	 	 } ,  
  
 	 	 / /   i n t e r n a l   o n l y ,   u s e   r e m o v e C l a s s ( " c l a s s " )  
 	 	 r e m o v e :   f u n c t i o n (   e l e m ,   c l a s s N a m e s   )   {  
 	 	 	 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   =   c l a s s N a m e s   ! = =   u n d e f i n e d   ?  
 	 	 	 	 	 j Q u e r y . g r e p ( e l e m . c l a s s N a m e . s p l i t ( / \ s + / ) ,   f u n c t i o n ( c l a s s N a m e ) {  
 	 	 	 	 	 	 r e t u r n   ! j Q u e r y . c l a s s N a m e . h a s (   c l a s s N a m e s ,   c l a s s N a m e   ) ;  
 	 	 	 	 	 } ) . j o i n ( "   " )   :  
 	 	 	 	 	 " " ;  
 	 	 } ,  
  
 	 	 / /   i n t e r n a l   o n l y ,   u s e   h a s C l a s s ( " c l a s s " )  
 	 	 h a s :   f u n c t i o n (   e l e m ,   c l a s s N a m e   )   {  
 	 	 	 r e t u r n   e l e m   & &   j Q u e r y . i n A r r a y (   c l a s s N a m e ,   ( e l e m . c l a s s N a m e   | |   e l e m ) . t o S t r i n g ( ) . s p l i t ( / \ s + / )   )   >   - 1 ;  
 	 	 }  
 	 } ,  
  
 	 / /   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   (   v a 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 s s :   f u n c t i o n (   e l e m ,   n a m e ,   f o r c e ,   e x t r a   )   {  
 	 	 i f   (   n a m e   = =   " w i d t h "   | |   n a m e   = =   " h e i g h t "   )   {  
 	 	 	 v a r   v a l ,   p r o p s   =   {   p o s i t i o n :   " a b s o l u t e " ,   v i s i b i l i t y :   " h i d d e n " ,   d i s p l a y : " b l o c k "   } ,   w h i c h   =   n a m e   = =   " w i d t h "   ?   [   " L e f t " ,   " R i g h t "   ]   :   [   " T o p " ,   " B o t t o m "   ] ;  
  
 	 	 	 f u n c t i o n   g e t W H ( )   {  
 	 	 	 	 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 ;  
  
 	 	 	 	 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 u r C S S (   e l e m ,   " p a d d i n g "   +   t h i s ,   t r u e ) )   | |   0 ;  
 	 	 	 	 	 i f   (   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 u r C S S (   e l e m ,   " m a r g i n "   +   t h i s ,   t r u e ) )   | |   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 u r C S S (   e l e m ,   " b o r d e r "   +   t h i s   +   " W i d t h " ,   t r u e ) )   | |   0 ;  
 	 	 	 	 } ) ;  
 	 	 	 }  
  
 	 	 	 i f   (   e l e m . o f f s e t W i d t h   ! = =   0   )  
 	 	 	 	 g e t W H ( ) ;  
 	 	 	 e l s e  
 	 	 	 	 j Q u e r y . s w a p (   e l e m ,   p r o p s ,   g e t W H   ) ;  
  
 	 	 	 r e t u r n   M a t h . m a x ( 0 ,   M a t h . r o u n d ( v a l ) ) ;  
 	 	 }  
  
 	 	 r e t u r n   j Q u e r y . c u r C S S (   e l e m ,   n a m e ,   f o r c e   ) ;  
 	 } ,  
  
 	 c u r C S S :   f u n c t i o n (   e l e m ,   n a m e ,   f o r c e   )   {  
 	 	 v a r   r e t ,   s t y l e   =   e l e m . s t y l e ;  
  
 	 	 / /   W e   n e e d   t o   h a n d l e   o p a c i t y   s p e c i a l   i n   I E  
 	 	 i f   (   n a m e   = =   " o p a c i t y "   & &   ! j Q u e r y . s u p p o r t . o p a c i t y   )   {  
 	 	 	 r e t   =   j Q u e r y . a t t r (   s t y l e ,   " o p a c i t y "   ) ;  
  
 	 	 	 r e t u r n   r e t   = =   " "   ?  
 	 	 	 	 " 1 "   :  
 	 	 	 	 r e t ;  
 	 	 }  
  
 	 	 / /   M a k e   s u r e   w e ' r e   u s i n g   t h e   r i g h t   n a m e   f o r   g e t t i n g   t h e   f l o a t   v a l u e  
 	 	 i f   (   n a m e . m a t c h (   / f l o a t / i   )   )  
 	 	 	 n a m e   =   s t y l e F l o a t ;  
  
 	 	 i f   (   ! f o r c e   & &   s t y l e   & &   s t y l e [   n a m e   ]   )  
 	 	 	 r e t   =   s t y l e [   n a m e   ] ;  
  
 	 	 e l s e   i f   (   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   )   {  
  
 	 	 	 / /   O n l y   " f l o a t "   i s   n e e d e d   h e r e  
 	 	 	 i f   (   n a m e . m a t c h (   / f l o a t / i   )   )  
 	 	 	 	 n a m e   =   " f l o a t " ;  
  
 	 	 	 n a m e   =   n a m e . r e p l a c e (   / ( [ A - Z ] ) / g ,   " - $ 1 "   ) . t o L o w e r C a s e ( ) ;  
  
 	 	 	 v a r   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   ) ;  
  
 	 	 	 i f   (   c o m p u t e d S t y l e   )  
 	 	 	 	 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   ) ;  
  
 	 	 	 / /   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  
 	 	 	 i f   (   n a m e   = =   " o p a c i t y "   & &   r e t   = =   " "   )  
 	 	 	 	 r e t   =   " 1 " ;  
  
 	 	 }   e l s e   i f   (   e l e m . c u r r e n t S t y l e   )   {  
 	 	 	 v a r   c a m e l C a s e   =   n a m e . r e p l a c e ( / \ - ( \ w ) / g ,   f u n c t i o n ( a l l ,   l e t t e r ) {  
 	 	 	 	 r e t u r n   l e t t e r . t o U p p e r C a s e ( ) ;  
 	 	 	 } ) ;  
  
 	 	 	 r e t   =   e l e m . c u r r e n t S t y l e [   n a m e   ]   | |   e l e m . c u r r e n t S t y l e [   c a m e l C a s 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   (   ! / ^ \ d + ( p x ) ? $ / i . t e s t (   r e t   )   & &   / ^ \ d / . 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  
 	 	 	 	 v a r   l e f t   =   s t y l e . l e f t ,   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 ;  
  
 	 	 	 	 / /   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  
 	 	 	 	 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   =   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 ;  
 	 	 	 	 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 ;  
 	 } ,  
  
 	 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   )   {  
 	 	 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 ;  
  
 	 	 / /   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  
 	 	 i f   (   ! f r a g m e n t   & &   e l e m s . l e n g t h   = = =   1   & &   t y p e o f   e l e m s [ 0 ]   = = =   " s t r i n g "   )   {  
 	 	 	 v a r   m a t c h   =   / ^ < ( \ w + ) \ s * \ / ? > $ / . e x e c ( e l e m s [ 0 ] ) ;  
 	 	 	 i f   (   m a t c h   )  
 	 	 	 	 r e t u r n   [   c o n t e x t . c r e a t e E l e m e n t (   m a t c h [ 1 ]   )   ] ;  
 	 	 }  
  
 	 	 v a r   r e t   =   [ ] ,   s c r i p t s   =   [ ] ,   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 " ) ;  
  
 	 	 j Q u e r y . e a c h ( e l e m s ,   f u n c t i o n ( i ,   e l e m ) {  
 	 	 	 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   )  
 	 	 	 	 r e t u r n ;  
  
 	 	 	 / /   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 "   )   {  
 	 	 	 	 / /   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 ( / ( < ( \ w + ) [ ^ > ] * ? ) \ / > / g ,   f u n c t i o n ( a l l ,   f r o n t ,   t a g ) {  
 	 	 	 	 	 r e t u r n   t a g . m a t c h ( / ^ ( a b b r | b r | c o l | i m g | i n p u t | l i n k | m e t a | p a r a m | h r | a r e a | e m b e d ) $ / i )   ?  
 	 	 	 	 	 	 a l l   :  
 	 	 	 	 	 	 f r o n t   +   " > < / "   +   t a g   +   " > " ;  
 	 	 	 	 } ) ;  
  
 	 	 	 	 / /   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 s   =   e l e m . r e p l a c e ( / ^ \ s + / ,   " " ) . s u b s t r i n g ( 0 ,   1 0 ) . t o L o w e r C a s e ( ) ;  
  
 	 	 	 	 v a r   w r a p   =  
 	 	 	 	 	 / /   o p t i o n   o r   o p t g r o u p  
 	 	 	 	 	 ! t a g s . i n d e x O f ( " < o p t " )   & &  
 	 	 	 	 	 [   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 > "   ]   | |  
  
 	 	 	 	 	 ! t a g s . i n d e x O f ( " < l e g " )   & &  
 	 	 	 	 	 [   1 ,   " < f i e l d s e t > " ,   " < / f i e l d s e t > "   ]   | |  
  
 	 	 	 	 	 t a g s . m a t c h ( / ^ < ( t h e a d | t b o d y | t f o o t | c o l g | c a p ) / )   & &  
 	 	 	 	 	 [   1 ,   " < t a b l e > " ,   " < / t a b l e > "   ]   | |  
  
 	 	 	 	 	 ! t a g s . i n d e x O f ( " < t r " )   & &  
 	 	 	 	 	 [   2 ,   " < t a b l e > < t b o d y > " ,   " < / t b o d y > < / t a b l e > "   ]   | |  
  
 	 	 	 	   	 / /   < t h e a d >   m a t c h e d   a b o v e  
 	 	 	 	 	 ( ! t a g s . i n d e x O f ( " < t d " )   | |   ! t a g s . i n d e x O f ( " < t h " ) )   & &  
 	 	 	 	 	 [   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 > "   ]   | |  
  
 	 	 	 	 	 ! t a g s . i n d e x O f ( " < 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 > "   ]   | |  
  
 	 	 	 	 	 / /   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  
 	 	 	 	 	 ! 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   & &  
 	 	 	 	 	 [   1 ,   " d i v < d i v > " ,   " < / d i v > "   ]   | |  
  
 	 	 	 	 	 [   0 ,   " " ,   " "   ] ;  
  
 	 	 	 	 / /   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   (   w r a p [ 0 ] - -   )  
 	 	 	 	 	 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   =   / < t b o d y / i . t e s t ( e l e m ) ,  
 	 	 	 	 	 	 t b o d y   =   ! t a g s . i n d e x O f ( " < 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   & &   / ^ \ s / . 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 (   e l e m . m a t c h ( / ^ \ s * / ) [ 0 ]   ) ,   d i v . f i r s t C h i l d   ) ;  
 	 	 	 	  
 	 	 	 	 e l e m   =   j Q u e r y . m a k e A r r a y (   d i v . c h i l d N o d e s   ) ;  
 	 	 	 }  
  
 	 	 	 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   )   {  
 	 	 	 f o r   (   v a r   i   =   0 ;   r e t [ i ] ;   i + +   )   {  
 	 	 	 	 i f   (   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   )  
 	 	 	 	 	 	 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 Q u e r y . m a k e A r r a y ( 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 " ) ) )   ) ;  
 	 	 	 	 	 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   s c r i p t s ;  
 	 	 }  
  
 	 	 r e t u r n   r e t ;  
 	 } ,  
  
 	 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   )   {  
 	 	 / /   d o n ' t   s e t   a t t r i b u t 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 )  
 	 	 	 r e t u r n   u n d e f i n e d ;  
  
 	 	 v a r   n o t x m l   =   ! j Q u e r y . i s X M L D o c (   e l e m   ) ,  
 	 	 	 / /   W h e t h e r   w e   a r e   s e t t i n g   ( o r   g e t t i n g )  
 	 	 	 s e t   =   v a l u e   ! = =   u n d e f i n e d ;  
  
 	 	 / /   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 s [   n a m e   ]   | |   n a m e ;  
  
 	 	 / /   O n l y   d o   a l l   t h e   f o l l o w i n g   i f   t h i s   i s   a   n o d e   ( f a s t e r   f o r   s t y l e )  
 	 	 / /   I E   e l e m . g e t A t t r i b u t e   p a s s e s   e v e n   f o r   s t y l e  
 	 	 i f   (   e l e m . t a g N a m e   )   {  
  
 	 	 	 / /   T h e s e   a t t r i b u t e s   r e q u i r e   s p e c i a l   t r e a t m e n t  
 	 	 	 v a r   s p e c i a l   =   / h r e f | s r c | s t y l e / . t e s t (   n a m 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   h i d d e 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   (   n a m e   = =   " s e l e c t e d "   & &   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 ;  
  
 	 	 	 / /   I f   a p p l i c a b l e ,   a c c e s s   t h e   a t t r i b u t e   v i a   t h e   D O M   0   w a y  
 	 	 	 i f   (   n a m e   i n   e l e m   & &   n o t x m l   & &   ! s p e c i a l   )   {  
 	 	 	 	 i f   (   s e t   ) {  
 	 	 	 	 	 / /   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   (   n a m e   = =   " 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 . p a r e n t N o d e   )  
 	 	 	 	 	 	 t h r o w   " 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 e m [   n a m e   ]   =   v a l u e ;  
 	 	 	 	 }  
  
 	 	 	 	 / /   b r o w s e r s   i n d e x   e l e m e n t s   b y   i d / n a m e   o n   f o r m s ,   g i v e   p r i o r i t y   t o   a t t r i b u t e s .  
 	 	 	 	 i f (   j Q u e r y . n o d e N a m e (   e l e m ,   " f o r m "   )   & &   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   e l e m . g e t A t t r i b u t e N o d e (   n a m e   ) . n o d e V a l u e ;  
  
 	 	 	 	 / /   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 /  
 	 	 	 	 i f   (   n a m e   = =   " t a b I n d e x "   )   {  
 	 	 	 	 	 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  
 	 	 	 	 	 	 ?   a t t r i b u t e N o d e . v a l u e  
 	 	 	 	 	 	 :   e l e m . n o d e N a m e . m a t c h ( / ( 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 )  
 	 	 	 	 	 	 	 ?   0  
 	 	 	 	 	 	 	 :   e l e m . n o d e N a m e . m a t c h ( / ^ ( a | a r e a ) $ / i )   & &   e l e m . h r e f  
 	 	 	 	 	 	 	 	 ?   0  
 	 	 	 	 	 	 	 	 :   u n d e f i n e d ;  
 	 	 	 	 }  
  
 	 	 	 	 r e t u r n   e l e m [   n a m e   ] ;  
 	 	 	 }  
  
 	 	 	 i f   (   ! j Q u e r y . s u p p o r t . s t y l e   & &   n o t x m l   & &     n a m e   = =   " s t y l e "   )  
 	 	 	 	 r e t u r n   j Q u e r y . a t t r (   e l e m . s t y l e ,   " c s s T e x t " ,   v a l u e   ) ;  
  
 	 	 	 i f   (   s e t   )  
 	 	 	 	 / /   c o n v e r t   t h e   v a l u e   t o   a   s t r i n g   ( a l l   b r o w s e r s   d o   t h i s   b u t   I E )   s e e   # 1 0 7 0  
 	 	 	 	 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   ) ;  
  
 	 	 	 v a r   a t t r   =   ! 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   & &   n o t x m l   & &   s p e c i a l  
 	 	 	 	 	 / /   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  
 	 	 	 	 	 ?   e l e m . g e t A t t r i b u t e (   n a m e ,   2   )  
 	 	 	 	 	 :   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   a t t r   = = =   n u l l   ?   u n d e f i n e d   :   a t t r ;  
 	 	 }  
  
 	 	 / /   e l e m   i s   a c t u a l l y   e l e m . s t y l e   . . .   s e t   t h e   s t y l e  
  
 	 	 / /   I E   u s e s   f i l t e r s   f o r   o p a c i t y  
 	 	 i f   (   ! j Q u e r y . s u p p o r t . o p a c i t y   & &   n a m e   = =   " o p a c i t y "   )   {  
 	 	 	 i f   (   s e t   )   {  
 	 	 	 	 / /   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  
 	 	 	 	 e l e m . 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  
 	 	 	 	 e l e m . f i l t e r   =   ( e l e m . f i l t e r   | |   " " ) . r e p l a c e (   / a l p h a \ ( [ ^ ) ] * \ ) / ,   " "   )   +  
 	 	 	 	 	 ( p a r s e I n t (   v a l u e   )   +   ' '   = =   " N a N "   ?   " "   :   " a l p h a ( o p a c i t y = "   +   v a l u e   *   1 0 0   +   " ) " ) ;  
 	 	 	 }  
  
 	 	 	 r e t u r n   e l e m . f i l t e r   & &   e l e m . f i l t e r . i n d e x O f ( " o p a c i t y = " )   > =   0   ?  
 	 	 	 	 ( p a r s e F l o a t (   e l e m . f i l t e r . m a t c h ( / o p a c i t y = ( [ ^ ) ] * ) / ) [ 1 ]   )   /   1 0 0 )   +   ' ' :  
 	 	 	 	 " " ;  
 	 	 }  
  
 	 	 n a m e   =   n a m e . r e p l a c e ( / - ( [ a - z ] ) / i g ,   f u n c t i o n ( a l l ,   l e t t e r ) {  
 	 	 	 r e t u r n   l e t t e r . t o U p p e r C a s e ( ) ;  
 	 	 } ) ;  
  
 	 	 i f   (   s e t   )  
 	 	 	 e l e m [   n a m e   ]   =   v a l u e ;  
  
 	 	 r e t u r n   e l e m [   n a m e   ] ;  
 	 } ,  
  
 	 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   | |   " " ) . r e p l a c e (   / ^ \ s + | \ s + $ / g ,   " "   ) ;  
 	 } ,  
  
 	 m a k e A r r a y :   f u n c t i o n (   a r r a y   )   {  
 	 	 v a r   r e t   =   [ ] ;  
  
 	 	 i f (   a r r a y   ! =   n u l l   ) {  
 	 	 	 v a r   i   =   a r r a y . l e n g t h ;  
 	 	 	 / /   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 '  
 	 	 	 i f (   i   = =   n u l l   | |   t y p e o f   a r r a y   = = =   " s t r i n g "   | |   j Q u e r y . i s F u n c t i o n ( a r r a y )   | |   a r r a y . s e t I n t e r v a l   )  
 	 	 	 	 r e t [ 0 ]   =   a r r a y ;  
 	 	 	 e l s e  
 	 	 	 	 w h i l e (   i   )  
 	 	 	 	 	 r e t [ - - i ]   =   a r r a y [ i ] ;  
 	 	 }  
  
 	 	 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   )   {  
 	 	 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 + +   )  
 	 	 / /   U s e   = = =   b e c a u s e   o n   I E ,   w i n d o w   = =   d o c u m e n t  
 	 	 	 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   )   {  
 	 	 / /   W e   h a v e   t o   l o o p   t h i s   w a y   b e c a u s e   I E   &   O p e r a   o v e r w r i t e   t h e   l e n g t h  
 	 	 / /   e x p a n d o   o f   g e t E l e m e n t s B y T a g N a m e  
 	 	 v a r   i   =   0 ,   e l e m ,   p o s   =   f i r s t . l e n g t h ;  
 	 	 / /   A l s o ,   w e   n e e d   t o   m a k e   s u r e   t h a t   t h e   c o r r e c t   e l e m e n t s   a r e   b e i n g   r e t u r n e d  
 	 	 / /   ( I E   r e t u r n s   c o m m e n t   n o d e s   i n   a   ' * '   q u e r y )  
 	 	 i f   (   ! j Q u e r y . s u p p o r t . g e t A l l   )   {  
 	 	 	 w h i l e   (   ( e l e m   =   s e c o n d [   i + +   ] )   ! =   n u l l   )  
 	 	 	 	 i f   (   e l e m . n o d e T y p e   ! =   8   )  
 	 	 	 	 	 f i r s t [   p o s + +   ]   =   e l e m ;  
  
 	 	 }   e l s e  
 	 	 	 w h i l e   (   ( e l e m   =   s e c o n d [   i + +   ] )   ! =   n u l l   )  
 	 	 	 	 f i r s t [   p o s + +   ]   =   e l e m ;  
  
 	 	 r e t u r n   f i r s t ;  
 	 } ,  
  
 	 u n i q u e :   f u n c t i o n (   a r r a y   )   {  
 	 	 v a r   r e t   =   [ ] ,   d o n e   =   { } ;  
  
 	 	 t r y   {  
  
 	 	 	 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 + +   )   {  
 	 	 	 	 v a r   i d   =   j Q u e r y . d a t a (   a r r a y [   i   ]   ) ;  
  
 	 	 	 	 i f   (   ! d o n e [   i d   ]   )   {  
 	 	 	 	 	 d o n e [   i d   ]   =   t r u e ;  
 	 	 	 	 	 r e t . p u s h (   a r r a y [   i   ]   ) ;  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 }   c a t c h (   e   )   {  
 	 	 	 r e t   =   a r r a y ;  
 	 	 }  
  
 	 	 r e t u r n   r e 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   =   [ ] ;  
  
 	 	 / /   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 + +   )  
 	 	 	 i f   (   ! i n v   ! =   ! c a l l b a c k (   e l e m s [   i   ] ,   i   )   )  
 	 	 	 	 r e t . p u s h (   e l e m s [   i   ]   ) ;  
  
 	 	 r e t u r n   r e t ;  
 	 } ,  
  
 	 m a p :   f u n c t i o n (   e l e m s ,   c a l l b a c k   )   {  
 	 	 v a r   r e t   =   [ ] ;  
  
 	 	 / /   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  
 	 	 / /   n e w   v a l u e   ( o r   v a l u e s ) .  
 	 	 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 + +   )   {  
 	 	 	 v a r   v a l u e   =   c a l l b a c k (   e l e m s [   i   ] ,   i   ) ;  
  
 	 	 	 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 ;  
 	 	 }  
  
 	 	 r e t u r n   r e t . c o n c a t . a p p l y (   [ ] ,   r e t   ) ;  
 	 }  
 } ) ;  
  
 / /   U s e   o f   j Q u e r y . b r o w s e r   i s   d e p r e c a t e d .  
 / /   I t ' s   i n c l u d e d   f o r   b a c k w a r d s   c o m p a t i b i l i t y   a n d   p l u g i n s ,  
 / /   a l t h o u g h   t h e y   s h o u l d   w o r k   t o   m i g r a t e   a w a y .  
  
 v a 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 . t o L o w e r C a s e ( ) ;  
  
 / /   F i g u r e   o u t   w h a t   b r o w s e r   i s   b e i n g   u s e d  
 j Q u e r y . b r o w s e r   =   {  
 	 v e r s i o n :   ( u s e r A g e n t . m a t c h (   / . + ( ? : r v | i t | r a | i e ) [ \ / :   ] ( [ \ d . ] + ) /   )   | |   [ 0 , ' 0 ' ] ) [ 1 ] ,  
 	 s a f a r i :   / w e b k i t / . t e s t (   u s e r A g e n t   ) ,  
 	 o p e r a :   / o p e r a / . t e s t (   u s e r A g e n t   ) ,  
 	 m s i e :   / m s i e / . t e s t (   u s e r A g e n t   )   & &   ! / o p e r a / . t e s t (   u s e r A g e n t   ) ,  
 	 m o z i l l a :   / m o z i l l a / . t e s t (   u s e r A g e n t   )   & &   ! / ( c o m p a t i b l e | w e b k i t ) / . t e s t (   u s e r A g e n t   )  
 } ;  
  
 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 ) { r e t u r n   e l e m . p a r e n t N o d e ; } ,  
 	 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 " ) ; } ,  
 	 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 " ) ; } ,  
 	 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 (   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   ) ;  
  
 	 	 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 . m u l t i F i l t e r (   s e l e c t o r ,   r e t   ) ;  
  
 	 	 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 . u n i q u e (   r e t   ) ,   n a m e ,   s e l e c t o r   ) ;  
 	 } ;  
 } ) ;  
  
 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   ) ;  
  
 	 	 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 . f n [   o r i g i n a l   ] . a p p l y (   j Q u e r y ( i n s e r t [ i ] ) ,   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 ,   s e l e c t o r   ) ;  
 	 } ;  
 } ) ;  
  
 j Q u e r y . e a c h ( {  
 	 r e m o v e A t t r :   f u n c t i o n (   n a m e   )   {  
 	 	 j Q u e r y . a t t r (   t h i s ,   n a m e ,   " "   ) ;  
 	 	 i f   ( t h i s . n o d e T y p e   = =   1 )  
 	 	 	 t h i s . r e m o v e A t t r i b u t e (   n a m e   ) ;  
 	 } ,  
  
 	 a d d C l a s s :   f u n c t i o n (   c l a s s N a m e s   )   {  
 	 	 j Q u e r y . c l a s s N a m e . a d d (   t h i s ,   c l a s s N a m e s   ) ;  
 	 } ,  
  
 	 r e m o v e C l a s s :   f u n c t i o n (   c l a s s N a m e s   )   {  
 	 	 j Q u e r y . c l a s s N a m e . r e m o v e (   t h i s ,   c l a s s N a m e s   ) ;  
 	 } ,  
  
 	 t o g g l e C l a s s :   f u n c t i o n (   c l a s s N a m e s ,   s t a t e   )   {  
 	 	 i f (   t y p e o f   s t a t e   ! = =   " b o o l e a n "   )  
 	 	 	 s t a t e   =   ! j Q u e r y . c l a s s N a m e . h a s (   t h i s ,   c l a s s N a m e s   ) ;  
 	 	 j Q u e r y . c l a s s N a m e [   s t a t e   ?   " a d d "   :   " r e m o v e "   ] (   t h i s ,   c l a s s N a m e s   ) ;  
 	 } ,  
  
 	 r e m o v e :   f u n c t i o n (   s e l e c t o r   )   {  
 	 	 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 ,   [   t h i s   ]   ) . l e n g t h   )   {  
 	 	 	 / /   P r e v e n t   m e m o r y   l e a k s  
 	 	 	 j Q u e r y (   " * " ,   t h i s   ) . a d d ( [ 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 . r e m o v e ( t h i s ) ;  
 	 	 	 	 j Q u e r y . r e m o v e D a t a ( t h i s ) ;  
 	 	 	 } ) ;  
 	 	 	 i f   ( t h i s . p a r e n t N o d e )  
 	 	 	 	 t h i s . p a r e n t N o d e . r e m o v e C h i l d (   t h i s   ) ;  
 	 	 }  
 	 } ,  
  
 	 e m p t y :   f u n c t i o n ( )   {  
 	 	 / /   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  
 	 	 j Q u e r y ( t h i s ) . c h i l d r e n ( ) . r e m o v 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   (   t h i s . f i r s t C h i l d   )  
 	 	 	 t h i s . r e m o v e C h i l d (   t h i s . f i r s t C h i l d   ) ;  
 	 }  
 } ,   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 ( ) {  
 	 	 r e t u r n   t h i s . e a c h (   f n ,   a r g u m e n t s   ) ;  
 	 } ;  
 } ) ;  
  
 / /   H e l p e r   f u n c t i o n   u s e d   b y   t h e   d i m e n s i o n s   a n d   o f f s e t   m o d u l e s  
 f u n c t i o n   n u m ( e l e m ,   p r o p )   {  
 	 r e t u r n   e l e m [ 0 ]   & &   p a r s e I n t (   j Q u e r y . c u r C S S ( e l e m [ 0 ] ,   p r o p ,   t r u e ) ,   1 0   )   | |   0 ;  
 }  
 v a r   e x p a n d o   =   " j Q u e r y "   +   n o w ( ) ,   u u i d   =   0 ,   w i n d o w D a t a   =   { } ;  
  
 j Q u e r y . e x t e n d ( {  
 	 c a c h e :   { } ,  
  
 	 d a t a :   f u n c t i o n (   e l e m ,   n a m e ,   d a t a   )   {  
 	 	 e l e m   =   e l e m   = =   w i n d o w   ?  
 	 	 	 w i n d o w D a t a   :  
 	 	 	 e l e m ;  
  
 	 	 v a r   i d   =   e l e m [   e x p a n d o   ] ;  
  
 	 	 / /   C o m p u t e   a   u n i q u e   I D   f o r   t h e   e l e m e n t  
 	 	 i f   (   ! i d   )  
 	 	 	 i d   =   e l e m [   e x p a n d o   ]   =   + + u u i d ;  
  
 	 	 / /   O n l y   g e n e r a t e   t h e   d a t a   c a c h e   i f   w e ' r e  
 	 	 / /   t r y i n g   t o   a c c e s s   o r   m a n i p u l a t e   i t  
 	 	 i f   (   n a m e   & &   ! j Q u e r y . c a c h e [   i d   ]   )  
 	 	 	 j Q u e r y . c a c h e [   i d   ]   =   { } ;  
  
 	 	 / /   P r e v e n t   o v e r r i d i n g   t h e   n a m e d   c a c h e   w i t h   u n d e f i n e d   v a l u e s  
 	 	 i f   (   d a t a   ! = =   u n d e f i n e d   )  
 	 	 	 j Q u e r y . c a c h e [   i d   ] [   n a m e   ]   =   d a t a ;  
  
 	 	 / /   R e t u r n   t h e   n a m e d   c a c h e   d a t a ,   o r   t h e   I D   f o r   t h e   e l e m e n t  
 	 	 r e t u r n   n a m e   ?  
 	 	 	 j Q u e r y . c a c h e [   i d   ] [   n a m e   ]   :  
 	 	 	 i d ;  
 	 } ,  
  
 	 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   )   {  
 	 	 e l e m   =   e l e m   = =   w i n d o w   ?  
 	 	 	 w i n d o w D a t a   :  
 	 	 	 e l e m ;  
  
 	 	 v a r   i d   =   e l e m [   e x p a n d o   ] ;  
  
 	 	 / /   I f   w e   w a n t   t o   r e m o v e   a   s p e c i f i c   s e c t i o n   o f   t h e   e l e m e n t ' s   d a t a  
 	 	 i f   (   n a m e   )   {  
 	 	 	 i f   (   j Q u e r y . c a c h e [   i d   ]   )   {  
 	 	 	 	 / /   R e m o v e   t h e   s e c t i o n   o f   c a c h e   d a t a  
 	 	 	 	 d e l e t e   j Q u e r y . c a c h e [   i d   ] [   n a m e   ] ;  
  
 	 	 	 	 / /   I f   w e ' v e   r e m o v e d   a l l   t h e   d a t a ,   r e m o v e   t h e   e l e m e n t ' s   c a c h e  
 	 	 	 	 n a m e   =   " " ;  
  
 	 	 	 	 f o r   (   n a m e   i n   j Q u e r y . c a c h e [   i d   ]   )  
 	 	 	 	 	 b r e a k ;  
  
 	 	 	 	 i f   (   ! n a m e   )  
 	 	 	 	 	 j Q u e r y . r e m o v e D a t a (   e l e m   ) ;  
 	 	 	 }  
  
 	 	 / /   O t h e r w i s e ,   w e   w a n t   t o   r e m o v e   a l l   o f   t h e   e l e m e n t ' s   d a t a  
 	 	 }   e l s e   {  
 	 	 	 / /   C l e a n   u p   t h e   e l e m e n t   e x p a n d o  
 	 	 	 t r y   {  
 	 	 	 	 d e l e t e   e l e m [   e x p a n d o   ] ;  
 	 	 	 }   c a t c h ( e ) {  
 	 	 	 	 / /   I E   h a s   t r o u b l e   d i r e c t l y   r e m o v i n g   t h e   e x p a n d o  
 	 	 	 	 / /   b u t   i t ' s   o k   w i t h   u s i n g   r e m o v e A t t r i b u t 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 (   e x p a n d o   ) ;  
 	 	 	 }  
  
 	 	 	 / /   C o m p l e t e l y   r e m o v e   t h e   d a t a   c a c h e  
 	 	 	 d e l e t e   j Q u e r y . c a c h e [   i d   ] ;  
 	 	 }  
 	 } ,  
 	 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   ) ;  
 	  
 	 	 	 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 )   ) ;  
 	 	 	 e l s e   i f (   d a t a   )  
 	 	 	 	 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   ) {  
 	 	 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 ( ) ;  
 	 	  
 	 	 i f (   ! t y p e   | |   t y p e   = = =   " f x "   )  
 	 	 	 f n   =   q u e u e [ 0 ] ;  
 	 	 	  
 	 	 i f (   f n   ! = =   u n d e f i n e d   )  
 	 	 	 f n . c a l l ( e l e m ) ;  
 	 }  
 } ) ;  
  
 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   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   )   {  
 	 	 	 v a r   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 ] ] ) ;  
  
 	 	 	 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   ) ;  
  
 	 	 	 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 . t r i g g e r ( " s e t D a t a "   +   p a r t s [ 1 ]   +   " ! " ,   [ p a r t s [ 0 ] ,   v a l u e ] ) . 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 l u e   ) ;  
 	 	 	 } ) ;  
 	 } ,  
  
 	 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   ) ;  
 	 	 } ) ;  
 	 } ,  
 	 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 . l e n g t h   = =   1   )  
 	 	 	 	 q u e u e [ 0 ] . c a l l ( t h i s ) ;  
 	 	 } ) ;  
 	 } ,  
 	 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   ) ;  
 	 	 } ) ;  
 	 }  
 } ) ; / * !  
   *   S i z z l e   C S S   S e l e c t o r   E n g i n e   -   v 0 . 9 . 3  
   *     C o p y r i g h t   2 0 0 9 ,   T h e   D o j o   F o u n d a t i o n  
   *     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 /  
   *  
   *   P e r m i s s i o n   i s   h e r e b y   g r a n t e d ,   f r e e   o f   c h a r g e ,   t o   a n y   p e r s o n   o b t a i n i n g   a   c o p y  
   *   o f   t h i s   s o f t w a r e   a n d   a s s o c i a t e d   d o c u m e n t a t i o n   f i l e s   ( t h e   " S o f t w a r e " ) ,   t o   d e a l  
   *   i n   t h e   S o f t w a r e   w i t h o u t   r e s t r i c t i o n ,   i n c l u d i n g   w i t h o u t   l i m i t a t i o n   t h e   r i g h t s  
   *   t o   u s e ,   c o p y ,   m o d i f y ,   m e r g e ,   p u b l i s h ,   d i s t r i b u t e ,   s u b l i c e n s e ,   a n d / o r   s e l l  
   *   c o p i e s   o f   t h e   S o f t w a r e ,   a n d   t o   p e r m i t   p e r s o n s   t o   w h o m   t h e   S o f t w a r e   i s  
   *   f u r n i s h e d   t o   d o   s o ,   s u b j e c t   t o   t h e   f o l l o w i n g   c o n d i t i o n s :  
   *  
   *   T h e   a b o v e   c o p y r i g h t   n o t i c e   a n d   t h i s   p e r m i s s i o n   n o t i c e   s h a l l   b e   i n c l u d e d   i n  
   *   a l l   c o p i e s   o r   s u b s t a n t i a l   p o r t i o n s   o f   t h e   S o f t w a r e .  
   *  
   *   T H E   S O F T W A R E   I S   P R O V I D E D   " A S   I S " ,   W I T H O U T   W A R R A N T Y   O F   A N Y   K I N D ,   E X P R E S S   O R  
   *   I M P L I E D ,   I N C L U D I N G   B U T   N O T   L I M I T E D   T O   T H E   W A R R A N T I E S   O F   M E R C H A N T A B I L I T Y ,  
   *   F I T N E S S   F O R   A   P A R T I C U L A R   P U R P O S E   A N D   N O N I N F R I N G E M E N T .   I N   N O   E V E N T   S H A L L   T H E  
   *   A U T H O R S   O R   C O P Y R I G H T   H O L D E R S   B E   L I A B L E   F O R   A N Y   C L A I M ,   D A M A G E S   O R   O T H E R  
   *   L I A B I L I T Y ,   W H E T H E R   I N   A N   A C T I O N   O F   C O N T R A C T ,   T O R T   O R   O T H E R W I S E ,   A R I S I N G   F R O M ,  
   *   O U T   O F   O R   I N   C O N N E C T I O N   W I T H   T H E   S O F T W A R E   O R   T H E   U S E   O R   O T H E R   D E A L I N G S   I N  
   *   T H E   S O F T W A R E .  
   *  
   * /  
 ( f u n c t i o n ( ) {  
  
 v a r   c h u n k e r   =   / ( ( ? : \ ( ( ? : \ ( [ ^ ( ) ] + \ ) | [ ^ ( ) ] + ) + \ ) | \ [ ( ? : \ [ [ ^ [ \ ] ] * \ ] | [ ' " ] [ ^ ' " ] * [ ' " ] | [ ^ [ \ ] ' " ] + ) + \ ] | \ \ . | [ ^   > + ~ , ( \ [ \ \ ] + ) + | [ > + ~ ] ) ( \ s * , \ s * ) ? / 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 ;  
  
 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 ;  
  
 	 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   p a r t s   =   [ ] ,   m ,   s e t ,   c h e c k S e t ,   c h e c k ,   m o d e ,   e x t r a ,   p r u n e   =   t r u e ;  
 	  
 	 / /   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 )  
 	 c h u n k e r . l a s t I n d e x   =   0 ;  
 	  
 	 w h i l e   (   ( m   =   c h u n k e r . e x e c ( s e l e c t o r ) )   ! = =   n u l l   )   {  
 	 	 p a r t s . p u s h (   m [ 1 ]   ) ;  
 	 	  
 	 	 i f   (   m [ 2 ]   )   {  
 	 	 	 e x t r a   =   R e g E x p . r i g h t C o n t e x t ;  
 	 	 	 b r e a k ;  
 	 	 }  
 	 }  
  
 	 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   {  
 	 	 v a r   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   & &   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 ,   i s X M L ( c o n t e x t )   ) ;  
 	 	 s e t   =   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   ) ;  
  
 	 	 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   )   {  
 	 	 	 v a r   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 ,   i s X M L ( c o n t e x t )   ) ;  
 	 	 }  
 	 }  
  
 	 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   )   {  
 	 	 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 :   "   +   ( 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 . n o d e T y p e   = = =   1   )   {  
 	 	 	 f o r   (   v a 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   & &   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   (   v a 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 ,   c o n t e x t ,   r e s u l t s ,   s e e d   ) ;  
  
 	 	 i f   (   s o r t O r d e r   )   {  
 	 	 	 h a s D u p l i c a t e   =   f a l s 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 . 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 ,   m a t c h ;  
  
 	 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   t y p e   =   E x p r . o r d e r [ i ] ,   m a t c h ;  
 	 	  
 	 	 i f   (   ( m a t c h   =   E x p r . m a t c h [   t y p e   ] . e x e c (   e x p r   ) )   )   {  
 	 	 	 v a r   l e f t   =   R e g E x p . l e f t C o n t e x t ;  
  
 	 	 	 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 ( / \ \ / g ,   " " ) ;  
 	 	 	 	 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   =   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   o l d   =   e x p r ,   r e s u l t   =   [ ] ,   c u r L o o p   =   s e t ,   m a t c h ,   a n y F o u n d ,  
 	 	 i s X M L F i l t e r   =   s e t   & &   s e t [ 0 ]   & &   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 . m a t c h [   t y p e   ] . e x e c (   e x p r   ) )   ! =   n u l l   )   {  
 	 	 	 	 v a r   f i l t e r   =   E x p r . f i l t e r [   t y p e   ] ,   f o u n d ,   i t e m ;  
 	 	 	 	 a n y F o u n d   =   f a l s 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   )   {  
 	 	 	 	 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 :   "   +   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 ;  
 } ;  
  
 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 | ) \ 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 ( ? : \ ( ( e v e n | o d d | [ \ d n + - ] * ) \ ) ) ? / ,  
 	 	 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 \ ( \ ) ] * ) + ) \ 2 \ ) ) ? /  
 	 } ,  
 	 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 " ) ;  
 	 	 }  
 	 } ,  
 	 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 ,   i s X M L ) {  
 	 	 	 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   & &   ! / \ W / . 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   & &   ! i s X M L   )   {  
 	 	 	 	 p a r t   =   p a r t . t o U p p 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   = = =   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 ,   i s X M L ) {  
 	 	 	 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 f   (   i s P a r t S t r   & &   ! / \ W / . t e s t ( p a r t )   )   {  
 	 	 	 	 p a r t   =   i s X M L   ?   p a r t   :   p a r t . t o U p p 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 ;   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   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   = = =   p a r t   ?   p a r e n t   :   f a l s e ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }   e l 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 ;   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   )   {  
 	 	 	 	 	 	 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   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   (   ! p a r t . m a t c h ( / \ W / )   )   {  
 	 	 	 	 v a r   n o d e C h e c k   =   p a r t   =   i s X M L   ?   p a r t   :   p a r t . t o U p p e r C a s e ( ) ;  
 	 	 	 	 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   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 "   & &   ! p a r t . m a t c h ( / \ W / )   )   {  
 	 	 	 	 v a r   n o d e C h e c k   =   p a r t   =   i s X M L   ?   p a r t   :   p a r t . t o U p p e r C a s e ( ) ;  
 	 	 	 	 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 ] ) ;  
 	 	 	 	 r e t u r n   m   ?   [ 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 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 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 ) {  
 	 	 	 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 ( / \ \ / g ,   " " )   +   "   " ;  
  
 	 	 	 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   +   "   " ) . 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 ( / \ \ / g ,   " " ) ;  
 	 	 } ,  
 	 	 T A G :   f u n c t i o n ( m a t c h ,   c u r L o o p ) {  
 	 	 	 f o r   (   v a r   i   =   0 ;   c u r L o o p [ i ]   = = =   f a l s e ;   i + +   ) { }  
 	 	 	 r e t u r n   c u r L o o p [ i ]   & &   i s X M L ( c u r L o o p [ i ] )   ?   m a t c h [ 1 ]   :   m a t c h [ 1 ] . t o U p p 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 "   )   {  
 	 	 	 	 / /   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 ;  
 	 	 	 }  
  
 	 	 	 / /   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 ] . r e p l a c e ( / \ \ / g ,   " " ) ;  
 	 	 	  
 	 	 	 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 ] ;  
 	 	 	 }  
  
 	 	 	 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   (   m a t c h [ 3 ] . m a t c h ( c h u n k e r ) . 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  
 	 	 	 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 ) {  
 	 	 	 r e t u r n   " t e x t "   = = =   e l e m . t y p e ;  
 	 	 } ,  
 	 	 r a d i o :   f u n c t i o n ( e l e m ) {  
 	 	 	 r e t u r n   " 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   " 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   " 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   " 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 ) {  
 	 	 	 r e t u r 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   " 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   " 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 ) {  
 	 	 	 r e t u r n   " b u t t o n "   = = =   e l e m . t y p e   | |   e l e m . n o d e N a m e . t o U p p e r C a s 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 ) ;  
 	 	 }  
 	 } ,  
 	 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   | |   " " ) . 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   i   =   0 ,   l   =   n o t . l e n g t h ;   i   <   l ;   i + +   )   {  
 	 	 	 	 	 i f   (   n o t [ i ]   = = =   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 ;  
 	 	 	 }  
 	 	 } ,  
 	 	 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   = = =   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 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   ]   =   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   ) ;  
 }  
  
 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   ) ;  
  
 	 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 .  
 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   ) ;  
  
 / /   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   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   i   =   0 ,   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   (   v a r   i   =   0 ;   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 ;  
  
 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   )   {  
 	 	 v a r   r e t   =   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   :   a   = = =   b   ?   0   :   1 ;  
 	 	 i f   (   r e t   = = =   0   )   {  
 	 	 	 h a s D u p l i c a t e   =   t r u e ;  
 	 	 }  
 	 	 r e t u r n   r e t ;  
 	 } ;  
 }   e l s e   i f   (   " s o u r c e I n d e x "   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   )   {  
 	 s o r t O r d e r   =   f u n c t i o n (   a ,   b   )   {  
 	 	 v a r   r e t   =   a . s o u r c e I n d e x   -   b . s o u r c e I n d e x ;  
 	 	 i f   (   r e t   = = =   0   )   {  
 	 	 	 h a s D u p l i c a t e   =   t r u e ;  
 	 	 }  
 	 	 r e t u r n   r e t ;  
 	 } ;  
 }   e l s e   i f   (   d o c u m e n t . c r e a t e R a n g e   )   {  
 	 s o r t O r d e r   =   f u n c t i o n (   a ,   b   )   {  
 	 	 v a r   a R a n g e   =   a . o w n e r D o c u m e n t . c r e a t e R a n g e ( ) ,   b R a n g e   =   b . o w n e r D o c u m e n t . c r e a t e R a n g e ( ) ;  
 	 	 a R a n g e . s e l e c t N o d e ( a ) ;  
 	 	 a R a n g e . c o l l a p s e ( t r u e ) ;  
 	 	 b R a n g e . s e l e c t N o d e ( b ) ;  
 	 	 b R a n g e . c o l l a p s e ( t r u e ) ;  
 	 	 v a r   r e t   =   a R a n g e . c o m p a r e B o u n d a r y P o i n t s ( R a n g e . S T A R T _ T O _ E N D ,   b R a n g e ) ;  
 	 	 i f   (   r e t   = = =   0   )   {  
 	 	 	 h a s D u p l i c a t e   =   t r u e ;  
 	 	 }  
 	 	 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 ( " f o r m " ) ,  
 	 	 i d   =   " s c r i p t "   +   ( n e w   D a t e ) . g e t T i m e ( ) ;  
 	 f o r m . i n n e r H T M L   =   " < i n p u t   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  
 	 v a r   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 ;  
 	 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   ) ;  
 } ) ( ) ;  
  
 ( 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 ) ;  
 	 	 } ;  
 	 }  
 } ) ( ) ;  
  
 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 " ) ;  
 	 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   & &   c o n t e x t . n o d e T y p e   = = =   9   & &   ! i s X M L ( c o n t e x t )   )   {  
 	 	 	 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 ( e ) { }  
 	 	 }  
 	 	  
 	 	 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 ) ;  
 	 } ;  
  
 	 S i z z l e . f i n d   =   o l d S i z z l e . f i n d ;  
 	 S i z z l e . f i l t e r   =   o l d S i z z l e . f i l t e r ;  
 	 S i z z l e . s e l e c t o r s   =   o l d S i z z l e . s e l e c t o r s ;  
 	 S i z z l e . m a t c h e s   =   o l d S i z z l e . m a t c h e s ;  
 } ) ( ) ;  
  
 i f   (   d o c u m e n t . g e t E l e m e n t s B y C l a s s N a m e   & &   d o c u m e n t . d o c u m e n t E l e m e n t . g e t E l e m e n t s B y C l a s s N a m e   )   ( 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 )  
 	 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   = = =   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 ] ) ;  
 	 	 }  
 	 } ;  
 } ) ( ) ;  
  
 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   )   {  
 	 v a r   s i b D i r   =   d i r   = =   " p r e v i o u s S i b l i n g "   & &   ! 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   )   {  
 	 	 	 i f   (   s i b D i r   & &   e l e m . n o d e T y p e   = = =   1   ) {  
 	 	 	 	 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 ;  
 	 	 	 }  
 	 	 	 e l e m   =   e l e m [ d i r ] ;  
 	 	 	 v a r   m a t c h   =   f a l s e ;  
  
 	 	 	 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   = = =   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   )   {  
 	 v a r   s i b D i r   =   d i r   = =   " p r e v i o u s S i b l i n g "   & &   ! 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   )   {  
 	 	 	 i f   (   s i b D i r   & &   e l e m . n o d e T y p e   = = =   1   )   {  
 	 	 	 	 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 ;  
 	 	 	 }  
 	 	 	 e l e m   =   e l e m [ d i r ] ;  
 	 	 	 v a r   m a t c h   =   f a l s e ;  
  
 	 	 	 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 ;  
 	 	 }  
 	 }  
 }  
  
 v a r   c o n t a i n s   =   d o c u m e n t . c o m p a r e D o c u m e n t P o s i t i o n   ?     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 ;  
 }   :   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 ) ;  
 } ;  
  
 v a r   i s X M L   =   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   = = =   9   & &   e l e m . 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 "   | |  
 	 	 ! ! e l e m . o w n e r D o c u m e n t   & &   i s X M L (   e l e m . o w n e r D o c u m e n t   ) ;  
 } ;  
  
 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   t m p S e t   =   [ ] ,   l a t e r   =   " " ,   m a t c h ,  
 	 	 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 . f i l t e r   =   S i z z l e . f i l t e r ;  
 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 ;  
  
 S i z z l e . s e l e c t o r s . 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 ) {  
 	 r e t u r n   e l e m . o f f s e t W i d t h   = = =   0   | |   e l e m . o f f s e t H e i g h t   = = =   0 ;  
 } ;  
  
 S i z z l e . s e l e c t o r s . 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   e l e m . o f f s e t W i d t h   >   0   | |   e l e m . o f f s e t H e i g h t   >   0 ;  
 } ;  
  
 S i z z l e . s e l e c t o r s . 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 ;  
 } ;  
  
 j Q u e r y . m u l t i 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   S i z z l e . m a t c h e s ( e x p r ,   e l e m s ) ;  
 } ;  
  
 j Q u e r y . d i r   =   f u n c t i o n (   e l e m ,   d i r   ) {  
 	 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   ! =   d o c u m e n t   )   {  
 	 	 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 ;  
 } ;  
  
 j Q u e r y . 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 ;  
 } ;  
  
 j Q u e r y . 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 ;  
 } ;  
  
 r e t u r n ;  
  
 w i n d o w . S i z z l e   =   S i z z l 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 ;  
  
 	 	 / /   F o r   w h a t e v e r   r e a s o n ,   I E   h a s   t r o u b l e   p a s s i n g   t h e   w i n d o w   o b j e c t  
 	 	 / /   a r o u n d ,   c a u s i n g   i t   t o   b e   c l o n e d   i n   t h e   p r o c e s s  
 	 	 i f   (   e l e m . s e t I n t e r v a l   & &   e l e m   ! =   w i n d o w   )  
 	 	 	 e l e m   =   w i n d o w ;  
  
 	 	 / /   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   =   t h i s . g u i d + + ;  
  
 	 	 / /   i f   d a t a   i s   p a s s e d ,   b i n d   t o   h a n d l e r  
 	 	 i f   (   d a t a   ! = =   u n d e f i n e d   )   {  
 	 	 	 / /   C r e a t e   t e m p o r a r y   f u n c t i o n   p o i n t e r   t o   o r i g i n a l   h a n d l e r  
 	 	 	 v a r   f n   =   h a n d l e r ;  
  
 	 	 	 / /   C r e a t e   u n i q u e   h a n d l e r   f u n c t i o n ,   w r a p p e d   a r o u n d   o r i g i n a l   h a n d l e r  
 	 	 	 h a n d l e r   =   t h i s . p r o x y (   f n   ) ;  
  
 	 	 	 / /   S t o r e   d a t a   i n   u n i q u e   h a n d l e r  
 	 	 	 h a n d l e r . d a t a   =   d a t a ;  
 	 	 }  
  
 	 	 / /   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 v e n t s   =   j Q u e r y . d a t a ( e l e m ,   " e v e n t s " )   | |   j Q u e r y . d a t a ( e l e m ,   " e v e n t s " ,   { } ) ,  
 	 	 	 h a n d l e   =   j Q u e r y . d a t a ( e l e m ,   " h a n d l e " )   | |   j Q u e r y . d a t a ( e l e m ,   " h a n d l e " ,   f u n c t i o n ( ) {  
 	 	 	 	 / /   H a n d l e   t h e   s e c o n d   e v e n t   o f   a   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 "   & &   ! j Q u e r y . e v e n t . t r i g g e r e d   ?  
 	 	 	 	 	 j Q u e r y . e v e n t . h a n d l e . a p p l y ( a r g u m e n t s . c a l l e 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   i n   I E .  
 	 	 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 ) ;  
 	 	 j Q u e r y . e a c h ( t y p e s . s p l i t ( / \ s + / ) ,   f u n c t i o n ( i n d e x ,   t y p e )   {  
 	 	 	 / /   N a m e s p a c e d   e v e n t   h a n d l e r s  
 	 	 	 v a r   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 r . t y p e   =   n a m e s p a c e s . s l i c e ( ) . s o r t ( ) . j o i n ( " . " ) ;  
  
 	 	 	 / /   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 ] ;  
 	 	 	  
 	 	 	 i f   (   j Q u e r y . e v e n t . s p e c i a l A l l [ t y p e ]   )  
 	 	 	 	 j Q u e r y . e v e n t . s p e c i a l A l l [ t y p e ] . 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 ) ;  
  
 	 	 	 / /   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   (   ! j Q u e r y . e v e n t . s p e c i a l [ t y p e ]   | |   j Q u e r y . e v e n t . s p e c i a l [ t y p e ] . 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 )   = = =   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 ,   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 ,   h a n d l e ) ;  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 / /   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 [ h a n d l e r . g u i d ]   =   h a n d l e r ;  
  
 	 	 	 / /   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   g l o b a l   t r i g g e r i n g  
 	 	 	 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 u i d :   1 ,  
 	 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 )   {  
 	 	 / /   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 ;  
  
 	 	 v a r   e v e n t s   =   j Q u e r y . d a t a ( e l e m ,   " e v e n t s " ) ,   r e t ,   i n d e x ;  
  
 	 	 i f   (   e v e n t s   )   {  
 	 	 	 / /   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   = = =   u n d e f i n e d   | |   ( 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 )   = =   " . " )   )  
 	 	 	 	 f o r   (   v a r   t y p e   i n   e v e n t s   )  
 	 	 	 	 	 t h i s . r e m o v e (   e l e m ,   t y p e   +   ( t y p e s   | |   " " )   ) ;  
 	 	 	 e l s e   {  
 	 	 	 	 / /   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   )   {  
 	 	 	 	 	 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 ;  
 	 	 	 	 }  
  
 	 	 	 	 / /   H a n d l e   m u l t i p l e   e v e n t s   s e p e 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 ) ;  
 	 	 	 	 j Q u e r y . e a c h ( t y p e s . s p l i t ( / \ s + / ) ,   f u n c t i o n ( i n d e x ,   t y p e ) {  
 	 	 	 	 	 / /   N a m e s p a c e d   e v e n t   h a n d l e r s  
 	 	 	 	 	 v a r   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 ( ) ;  
 	 	 	 	 	 v a r   n a m e s p a c e   =   R e g E x p ( " ( ^ | \ \ . ) "   +   n a m e s p a c e s . s l i c e ( ) . s o r t ( ) . j o i n ( " . * \ \ . " )   +   " ( \ \ . | $ ) " ) ;  
  
 	 	 	 	 	 i f   (   e v e n t s [ t y p e ]   )   {  
 	 	 	 	 	 	 / /   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   (   h a n d l e r   )  
 	 	 	 	 	 	 	 d e l e t e   e v e n t s [ t y p e ] [ h a n d l e r . g u i d ] ;  
  
 	 	 	 	 	 	 / /   r e m o v e   a l l   h a n d l e r s   f o r   t h e   g i v e n   t y p e  
 	 	 	 	 	 	 e l s e  
 	 	 	 	 	 	 	 f o r   (   v a r   h a n d l e   i n   e v e n t s [ t y p e ]   )  
 	 	 	 	 	 	 	 	 / /   H a n d l e   t h e   r e m o v a l   o f   n a m e s p a c e d   e v e n t s  
 	 	 	 	 	 	 	 	 i f   (   n a m e s p a c e . t e s t ( e v e n t s [ t y p e ] [ h a n d l e ] . t y p e )   )  
 	 	 	 	 	 	 	 	 	 d e l e t e   e v e n t s [ t y p e ] [ h a n d l e ] ;  
 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 i f   (   j Q u e r y . e v e n t . s p e c i a l A l l [ t y p e ]   )  
 	 	 	 	 	 	 	 j Q u e r y . e v e n t . s p e c i a l A l l [ t y p e ] . 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 ) ;  
  
 	 	 	 	 	 	 / /   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  
 	 	 	 	 	 	 f o r   (   r e t   i n   e v e n t s [ t y p e ]   )   b r e a k ;  
 	 	 	 	 	 	 i f   (   ! r e t   )   {  
 	 	 	 	 	 	 	 i f   (   ! j Q u e r y . e v e n t . s p e c i a l [ t y p e ]   | |   j Q u e r y . e v e n t . s p e c i a l [ t y p e ] . 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   )   {  
 	 	 	 	 	 	 	 	 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 ,   j Q u e r y . d a t a ( e l e m ,   " h a n d l e " ) ,   f a l s e ) ;  
 	 	 	 	 	 	 	 	 e l s 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 ,   j Q u e r y . d a t a ( e l e m ,   " 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  
 	 	 	 f o r   (   r e t   i n   e v e n t s   )   b r e a k ;  
 	 	 	 i f   (   ! r e t   )   {  
 	 	 	 	 v a r   h a n d l e   =   j Q u e r y . d a t a (   e l e m ,   " 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 ;  
 	 	 	 	 j Q u e r y . r e m o v e D a t a (   e l e m ,   " e v e n t s "   ) ;  
 	 	 	 	 j Q u e r y . r e m o v e D a t a (   e l e m ,   " h a n d l e "   ) ;  
 	 	 	 }  
 	 	 }  
 	 } ,  
  
 	 / /   b u b b l i n g   i s   i n t e r n a l  
 	 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 ,   b u b b l i n g   )   {  
 	 	 / /   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 ;  
  
 	 	 i f (   ! b u b b l 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 [ 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  
 	 	 	 	 j Q u e r y . e x t e n d (   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 )  
 	 	 	 	 j Q u e r y . E v e n t ( t y p e ) ;  
  
 	 	 	 i f   (   t y p e . i n d e x O f ( " ! " )   > =   0   )   {  
 	 	 	 	 e v e n t . t y p e   =   t y p e   =   t y p e . s l i c e ( 0 ,   - 1 ) ;  
 	 	 	 	 e v e n t . e x c l u s i v e   =   t r u e ;  
 	 	 	 }  
  
 	 	 	 / /   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   )   {  
 	 	 	 	 / /   D o n ' t   b u b b l e   c u s t o m   e v e n t s   w h e n   g l o b a l   ( t o   a v o i d   t o o   m u c h   o v e r h e a d )  
 	 	 	 	 e v e n t . s t o p P r o p a g a t i o n ( ) ;  
 	 	 	 	 / /   O n l y   t r i g g e r   i f   w e ' v e   e v e r   b o u n d   a n   e v e n t   f o r   i t  
 	 	 	 	 i f   (   t h i s . g l o b a l [ t y p e ]   )  
 	 	 	 	 	 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 f   (   t h i s . e v e n t s   & &   t h i s . 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 ,   t h i s . h a n d l e . e l e m   ) ;  
 	 	 	 	 	 } ) ;  
 	 	 	 }  
  
 	 	 	 / /   H a n d l e   t r i g g e r i n g   a   s i n g l e   e l e m e n t  
  
 	 	 	 / /   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   | |   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   u n d e f i n e d ;  
 	 	 	  
 	 	 	 / /   C l e a n   u p   i n   c a s e   i t   i s   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   t h e   i n c o m i n g   d a t a ,   i f   a n y  
 	 	 	 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   ) ;  
 	 	 }  
  
 	 	 e v e n t . c u r r e n t T a r g e t   =   e l e m ;  
  
 	 	 / /   T r i g g e r   t h e   e v e n t ,   i t   i s   a s s u m e d   t h a t   " h a n d l e "   i s   a   f u n c t i o n  
 	 	 v a r   h a n d l e   =   j Q u e r y . d a t a ( e l e m ,   " h a n d l e " ) ;  
 	 	 i f   (   h a n d l e   )  
 	 	 	 h a n d l e . a p p l y (   e l e m ,   d a t a   ) ;  
  
 	 	 / /   H a n d l e   t r i g g e r i n g   n a t i v e   . o n f o o   h a n d l e r s   ( a n d   o n   l i n k s   s i n c e   w e   d o n ' t   c a l l   . c l i c k ( )   f o r   l i n k s )  
 	 	 i f   (   ( ! e l e m [ t y p e ]   | |   ( j Q u e r y . n o d e N a m e ( e l e m ,   ' a ' )   & &   t y p e   = =   " c l i c k " ) )   & &   e l e m [ " o n " + t y p e ]   & &   e l e m [ " o n " + t y p e ] . a p p l y (   e l e m ,   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 ;  
  
 	 	 / /   T r i g g e r   t h e   n a t i v e   e v e n t s   ( e x c e p t   f o r   c l i c k s   o n   l i n k s )  
 	 	 i f   (   ! b u b b l i n g   & &   e l e m [ t y p e ]   & &   ! e v e n t . i s D e f a u l t P r e v e n t e d ( )   & &   ! ( j Q u e r y . n o d e N a m e ( e l e m ,   ' a ' )   & &   t y p e   = =   " c l i c k " )   )   {  
 	 	 	 t h i s . t r i g g e r e d   =   t r u e ;  
 	 	 	 t r y   {  
 	 	 	 	 e l e m [   t y p e   ] ( ) ;  
 	 	 	 / /   p r e v e n t   I E   f r o m   t h r o w i n g   a n   e r r o r   f o r   s o m e   h i d d e n   e l e m e n t s  
 	 	 	 }   c a t c h   ( e )   { }  
 	 	 }  
  
 	 	 t h i s . t r i g g e r e d   =   f a l s e ;  
  
 	 	 i f   (   ! 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 ( )   )   {  
 	 	 	 v a r   p a r e n t   =   e l e m . p a r e n t N o d e   | |   e l e m . o w n e r D o c u m e n t ;  
 	 	 	 i f   (   p a r e n t   )  
 	 	 	 	 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 ,   p a r e n t ,   t r u e ) ;  
 	 	 }  
 	 } ,  
  
 	 h a n d l e :   f u n c t i o n ( e v e n t )   {  
 	 	 / /   r e t u r n e d   u n d e f i n e d   o r   f a l s e  
 	 	 v a r   a l l ,   h a n d l e r s ;  
  
 	 	 e v e n t   =   a r g u m e n t s [ 0 ]   =   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   ) ;  
 	 	 e v e n t . c u r r e n t T a r g e t   =   t h i s ;  
 	 	  
 	 	 / /   N a m e s p a c e d   e v e n t   h a n d l e r s  
 	 	 v a r   n a m e s p a c e s   =   e v e n t . t y p e . s p l i t ( " . " ) ;  
 	 	 e v e n t . t y p e   =   n a m e s p a c e s . s h i f t ( ) ;  
  
 	 	 / /   C a c h e   t h i s   n o w ,   a l l   =   t r u e   m e a n s ,   a n y   h a n d l e r  
 	 	 a l l   =   ! n a m e s p a c e s . l e n g t h   & &   ! e v e n t . e x c l u s i v e ;  
 	 	  
 	 	 v a r   n a m e s p a c e   =   R e g E x p ( " ( ^ | \ \ . ) "   +   n a m e s p a c e s . s l i c e ( ) . s o r t ( ) . j o i n ( " . * \ \ . " )   +   " ( \ \ . | $ ) " ) ;  
  
 	 	 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 ] ;  
  
 	 	 f o r   (   v a r   j   i n   h a n d l e r s   )   {  
 	 	 	 v a r   h a n d l e r   =   h a n d l e r s [ j ] ;  
  
 	 	 	 / /   F i l t e r   t h e   f u n c t i o n s   b y   c l a s s  
 	 	 	 i f   (   a l l   | |   n a m e s p a c e . t e s t ( h a n d l e r . t y p 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 r ;  
 	 	 	 	 e v e n t . d a t a   =   h a n d l e r . d a t a ;  
  
 	 	 	 	 v a r   r e t   =   h a n d l e r . a p p l y ( t h i s ,   a r g u m e n t 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 ;  
  
 	 	 	 }  
 	 	 }  
 	 } ,  
  
 	 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   m e t a K e y   n e w V a l u e   o r i g i n a l T a r g e t   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 [ 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   )  
 	 	 	 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 ;   / /   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  
  
 	 	 / /   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   d o c   =   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   =   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 . 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 . 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   & &   ( ( e v e n t . c h a r C o d e   | |   e v e n t . c h a r C o d e   = = =   0 )   ?   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 )   )  
 	 	 	 e v e n t . w h i c h   =   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   )  
 	 	 	 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 ;  
 	 } ,  
  
 	 p r o x y :   f u n c t i o n (   f n ,   p r o x y   ) {  
 	 	 p r o x y   =   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 ( t h i s ,   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   | |   t h i s . g u i d + + ;  
 	 	 / /   S o   p r o x y   c a n   b e   d e c l a r e d   a s   a n   a r g u m e n t  
 	 	 r e t u r n   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 :   b i n d R e a d y ,  
 	 	 	 t e a r d o w n :   f u n c t i o n ( )   { }  
 	 	 }  
 	 } ,  
 	  
 	 s p e c i a l A l l :   {  
 	 	 l i v e :   {  
 	 	 	 s e t u p :   f u n c t i o n (   s e l e c t o r ,   n a m e s p a c e s   ) {  
 	 	 	 	 j Q u e r y . e v e n t . a d d (   t h i s ,   n a m e s p a c e s [ 0 ] ,   l i v e H a n d l e r   ) ;  
 	 	 	 } ,  
 	 	 	 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   ) {  
 	 	 	 	 i f   (   n a m e s p a c e s . l e n g t h   )   {  
 	 	 	 	 	 v a r   r e m o v e   =   0 ,   n a m e   =   R e g E x p ( " ( ^ | \ \ . ) "   +   n a m e s p a c e s [ 0 ]   +   " ( \ \ . | $ ) " ) ;  
 	 	 	 	 	  
 	 	 	 	 	 j Q u e r y . e a c h (   ( j Q u e r y . d a t a ( t h i s ,   " e v e n t s " ) . l i v e   | |   { } ) ,   f u n c t i o n ( ) {  
 	 	 	 	 	 	 i f   (   n a m e . t e s t ( t h i s . t y p e )   )  
 	 	 	 	 	 	 	 r e m o v e + + ;  
 	 	 	 	 	 } ) ;  
 	 	 	 	 	  
 	 	 	 	 	 i f   (   r e m o v e   <   1   )  
 	 	 	 	 	 	 j Q u e r y . e v e n t . r e m o v e (   t h i s ,   n a m e s p a c e s [ 0 ] ,   l i v e H a n d l e r   ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 }  
 } ;  
  
 j Q u e r y . E v e n t   =   f u n c t i o n (   s r c   ) {  
 	 / /   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 ) ;  
 	  
 	 / /   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   t y p e  
 	 } e l s e  
 	 	 t h i s . t y p e   =   s r c ;  
  
 	 / /   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   =   n o w ( ) ;  
 	  
 	 / /   M a r k   i t   a s   f i x e d  
 	 t h i s [ 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 . 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 ;  
 	 / /   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   )  
 	 	 t r y   {   p a r e n t   =   p a r e n t . p a r e n t N o d e ;   }  
 	 	 c a t c h ( e )   {   p a r e n t   =   t h i s ;   }  
 	  
 	 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   ) ;  
 	 }  
 } ;  
 	  
 j Q u e r y . e a c h ( {    
 	 m o u s e o v e r :   ' m o u s e e n t e r ' ,    
 	 m o u s e o u t :   ' m o u s e l e a v e '  
 } ,   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 [   f i x   ]   =   {  
 	 	 s e t u p :   f u n c t i o n ( ) {  
 	 	 	 j Q u e r y . e v e n t . a d d (   t h i s ,   o r i g ,   w i t h i n E l e m e n t ,   f i x   ) ;  
 	 	 } ,  
 	 	 t e a r d o w n :   f u n c t i o n ( ) {  
 	 	 	 j Q u e r y . e v e n t . r e m o v e (   t h i s ,   o r i g ,   w i t h i n E l e m e n t   ) ;  
 	 	 }  
 	 } ; 	 	 	        
 } ) ;  
  
 j Q u e r y . f n . e x t e n d ( {  
 	 b i n d :   f u n c t i o n (   t y p e ,   d a t a ,   f n   )   {  
 	 	 r e t u r n   t y p e   = =   " u n l o a d "   ?   t h i s . o n e ( t y p e ,   d a t a ,   f 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 . a d d (   t h i s ,   t y p e ,   f n   | |   d a t a ,   f n   & &   d a t a   ) ;  
 	 	 } ) ;  
 	 } ,  
  
 	 o n e :   f u n c t i o n (   t y p e ,   d a t a ,   f n   )   {  
 	 	 v a r   o n e   =   j Q u e r y . e v e n t . p r o x y (   f n   | |   d a t a ,   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 ,   o n e ) ;  
 	 	 	 r e t u r n   ( f n   | |   d a t a ) . a p p l y (   t h i s ,   a r g u m e n t s   ) ;  
 	 	 } ) ;  
 	 	 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 . a d d (   t h i s ,   t y p e ,   o n e ,   f n   & &   d a t a ) ;  
 	 	 } ) ;  
 	 } ,  
  
 	 u n b i n d :   f u n c t i o n (   t y p e ,   f n   )   {  
 	 	 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 . r e m o v e (   t h i s ,   t y p e ,   f n   ) ;  
 	 	 } ) ;  
 	 } ,  
  
 	 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 ]   ) {  
 	 	 	 v a r   e v e n t   =   j Q u e r y . E v e n t ( t y p 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 ( ) ;  
 	 	 	 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 ,   t h i s [ 0 ]   ) ;  
 	 	 	 r e t u r n   e v e n t . r e s u l t ;  
 	 	 } 	 	  
 	 } ,  
  
 	 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 ,   i   =   1 ;  
  
 	 	 / /   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  
 	 	 w h i l e (   i   <   a r g s . l e n g t h   )  
 	 	 	 j Q u e r y . e v e n t . p r o x y (   f n ,   a r g s [ i + + ]   ) ;  
  
 	 	 r e t u r n   t h i s . c l i c k (   j Q u e r y . e v e n t . p r o x y (   f n ,   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  
 	 	 	 t h i s . l a s t T o g g l e   =   (   t h i s . l a s t T o g g l e   | |   0   )   %   i ;  
  
 	 	 	 / /   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 [   t h i 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 ;  
 	 	 } ) ) ;  
 	 } ,  
  
 	 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 ) ;  
 	 } ,  
  
 	 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  
 	 	 b i n d R e a d y ( ) ;  
  
 	 	 / /   I f   t h e   D O M   i s   a l r e a d y   r e a d y  
 	 	 i f   (   j Q u e r y . i s R e a d y   )  
 	 	 	 / /   E x e c u t e   t h e   f u n c t i o n   i m m e d i a t e l y  
 	 	 	 f n . c a l l (   d o c u m e n t ,   j Q u e r y   ) ;  
  
 	 	 / /   O t h e r w i s e ,   r e m e m b e r   t h e   f u n c t i o n   f o r   l a t e r  
 	 	 e l s e  
 	 	 	 / /   A d d   t h e   f u n c t i o n   t o   t h e   w a i t   l i s t  
 	 	 	 j Q u e r y . r e a d y L i s t . p u s h (   f n   ) ;  
  
 	 	 r e t u r n   t h i s ;  
 	 } ,  
 	  
 	 l i v e :   f u n c t i o n (   t y p e ,   f n   ) {  
 	 	 v a r   p r o x y   =   j Q u e r y . e v e n t . p r o x y (   f n   ) ;  
 	 	 p r o x y . g u i d   + =   t h i s . s e l e c t o r   +   t y p e ;  
  
 	 	 j Q u e r y ( d o c u m e n t ) . b i n d (   l i v e C o n v e r t ( t y p e ,   t h i s . s e l e c t o r ) ,   t h i s . s e l e c t o r ,   p r o x y   ) ;  
  
 	 	 r e t u r n   t h i s ;  
 	 } ,  
 	  
 	 d i e :   f u n c t i o n (   t y p e ,   f n   ) {  
 	 	 j Q u e r y ( d o c u m e n t ) . u n b i n d (   l i v e C o n v e r t ( t y p e ,   t h i s . s e l e c t o r ) ,   f n   ?   {   g u i d :   f n . g u i d   +   t h i s . s e l e c t o r   +   t y p e   }   :   n u l l   ) ;  
 	 	 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   c h e c k   =   R e g E x p ( " ( ^ | \ \ . ) "   +   e v e n t . t y p e   +   " ( \ \ . | $ ) " ) ,  
 	 	 s t o p   =   t r u e ,  
 	 	 e l e m s   =   [ ] ;  
  
 	 j Q u e r y . e a c h ( j Q u e r y . d a t a ( t h i s ,   " e v e n t s " ) . l i v e   | |   [ ] ,   f u n c t i o n ( i ,   f n ) {  
 	 	 i f   (   c h e c k . t e s t ( f n . t y p e )   )   {  
 	 	 	 v a r   e l e m   =   j Q u e r y ( e v e n t . t a r g e t ) . c l o s e s t ( f n . d a t a ) [ 0 ] ;  
 	 	 	 i f   (   e l e m   )  
 	 	 	 	 e l e m s . p u s h ( {   e l e m :   e l e m ,   f n :   f n   } ) ;  
 	 	 }  
 	 } ) ;  
  
 	 e l e m s . s o r t ( f u n c t i o n ( a , b )   {  
 	 	 r e t u r n   j Q u e r y . d a t a ( a . e l e m ,   " c l o s e s t " )   -   j Q u e r y . d a t a ( b . e l e m ,   " c l o s e s t " ) ;  
 	 } ) ;  
 	  
 	 j Q u e r y . e a c h ( e l e m s ,   f u n c t i o n ( ) {  
 	 	 i f   (   t h i s . f n . c a l l ( t h i s . e l e m ,   e v e n t ,   t h i s . f n . d a t a )   = = =   f a l s e   )  
 	 	 	 r e t u r n   ( s t o p   =   f a l s e ) ;  
 	 } ) ;  
  
 	 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   [ " l i v e " ,   t y p e ,   s e l e c t o r . r e p l a c e ( / \ . / g ,   " ` " ) . r e p l a c e ( /   / g ,   " | " ) ] . j o i n ( " . " ) ;  
 }  
  
 j Q u e r y . e x t e n d ( {  
 	 i s R e a d y :   f a l s e ,  
 	 r e a d y L i s t :   [ ] ,  
 	 / /   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 ( )   {  
 	 	 / /   M a k e   s u r e   t h a t   t h e   D O M   i s   n o t   a l r e a d y   l o a d e d  
 	 	 i f   (   ! j Q u e r y . i s R e a d y   )   {  
 	 	 	 / /   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   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  
 	 	 	 i f   (   j Q u e r y . r e a d y L i s t   )   {  
 	 	 	 	 / /   E x e c u t e   a l l   o f   t h e m  
 	 	 	 	 j Q u e r y . e a c h (   j Q u e r y . r e a d y L i s t ,   f u n c t i o n ( ) {  
 	 	 	 	 	 t h i s . c a l l (   d o c u m e n t ,   j Q u e r y   ) ;  
 	 	 	 	 } ) ;  
  
 	 	 	 	 / /   R e s e t   t h e   l i s t   o f   f u n c t i o n s  
 	 	 	 	 j Q u e r y . r e a d y L i s t   =   n u l l ;  
 	 	 	 }  
  
 	 	 	 / /   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  
 	 	 	 j Q u e r y ( d o c u m e n t ) . t r i g g e r H a n d l e r ( " r e a d y " ) ;  
 	 	 }  
 	 }  
 } ) ;  
  
 v a r   r e a d y B o u n d   =   f a l s e ;  
  
 f u n c t i o n   b i n d R e a d y ( ) {  
 	 i f   (   r e a d y B o u n d   )   r e t u r n ;  
 	 r e a d y B o u n d   =   t r u e ;  
  
 	 / /   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 " ,   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 " ,   a r g u m e n t s . c a l l e e ,   f a l s e   ) ;  
 	 	 	 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 " ,   f u n c t i o n ( ) {  
 	 	 	 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 " ,   a r g u m e n t s . c a l l e e   ) ;  
 	 	 	 	 j Q u e r y . r e a d y ( ) ;  
 	 	 	 }  
 	 	 } ) ;  
  
 	 	 / /   I f   I E   a n d   n o t   a n   i 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  
 	 	 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   & &   w i n d o w   = =   w i n d o w . t o p   )   ( f u n c t i o n ( ) {  
 	 	 	 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 r r o r   )   {  
 	 	 	 	 s e t T i m e o u t (   a r g u m e n t s . c a l l e e ,   0   ) ;  
 	 	 	 	 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 ( ) ;  
 	 	 } ) ( ) ;  
 	 }  
  
 	 / /   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  
 	 j Q u e r y . e v e n t . a d d (   w i n d o w ,   " l o a d " ,   j Q u e r y . r e a d y   ) ;  
 }  
  
 j Q u e r y . e a c h (   ( " b l u r , f o c u s , 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 ( f n ) {  
 	 	 r e t u r n   f n   ?   t h i s . b i n d ( n a m e ,   f n )   :   t h i s . t r i g g e r ( n a m e ) ;  
 	 } ;  
 } ) ;  
  
 / /   P r e v e n t   m e m o r y   l e a k s   i n   I E  
 / /   A n d   p r e v e n t   e r r o r s   o n   r e f r e s h   w i t h   e v e n t s   l i k e   m o u s e o v e r   i n   o t h e r   b r o w s e r s  
 / /   W i n d o w   i s n ' t   i n c l u d e d   s o   a s   n o t   t o   u n b i n d   e x i s t i n g   u n l o a d   e v e n t s  
 j Q u e r y (   w i n d o w   ) . b i n d (   ' u n l o a d ' ,   f u n c t i o n ( ) {    
 	 f o r   (   v a r   i d   i n   j Q u e r y . c a c h e   )  
 	 	 / /   S k i p   t h e   w i n d o w  
 	 	 i f   (   i d   ! =   1   & &   j Q u e r y . c a c h e [   i d   ] . h a n d l e   )  
 	 	 	 j Q u e r y . e v e n t . r e m o v e (   j Q u e r y . c a c h e [   i d   ] . h a n d l e . e l e m   ) ;  
 } ) ;    
 ( f u n c t i o n ( ) {  
  
 	 j Q u e r y . s u p p o r t   =   { } ;  
  
 	 v a r   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 ,  
 	 	 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 " ) ,  
 	 	 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 c r i p t "   +   ( n e w   D a t e ) . g e t T i m e ( ) ;  
  
 	 d i v . s t y l e . d i s p l a y   =   " n o n e " ;  
 	 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 = " c o l o r : r e d ; f l o a t : l e f t ; o p a c i t y : . 5 ; " > a < / a > < s e l e c t > < o p t i o n > t e x t < / o p t i o n > < / s e l e c t > < o b j e c t > < p a r a m / > < / o b j e c t > ' ;  
  
 	 v a r   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 ;  
 	 }  
  
 	 j Q u e r y . 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   y o u   c a n   g e t   a l l   e l e m e n t s   i n   a n   < o b j e c t >   e l e m e n t  
 	 	 / /   I E   7   a l w a y s   r e t u r n s   n o   r e s u l t s  
 	 	 o b j e c t 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 ( " o b j e c t " ) [ 0 ]  
 	 	 	 . 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 ,  
 	 	  
 	 	 / /   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 d )  
 	 	 s t y l e :   / r e d / . 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 )  
 	 	 o p a c i t y :   a . s t y l e . o p a c i t y   = = =   " 0 . 5 " ,  
 	 	  
 	 	 / /   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 ,  
  
 	 	 / /   W i l l   b e   d e f i n e d   l a t e r  
 	 	 s c r i p t E v a l :   f a l s e ,  
 	 	 n o C l o n e E v e n t :   t r u e ,  
 	 	 b o x M o d e l :   n u l l  
 	 } ;  
 	  
 	 s c r i p t . t y p e   =   " t e x t / j a v a s c r i p t " ;  
 	 t r y   {  
 	 	 s c r i p 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 T e x t N o d e (   " w i n d o w . "   +   i d   +   " = 1 ; "   )   ) ;  
 	 }   c a t c h ( e ) { }  
  
 	 r o o t . i n s e r t B e f o r e (   s c r i p t ,   r o o t . f i r s t C h i l d   ) ;  
 	  
 	 / /   M a k e   s u r e   t h a t   t h e   e x e c u t i o n   o f   c o d e   w o r k s   b y   i n j e c t i n g   a   s c r i p t  
 	 / /   t a g   w i t h   a p p e n d C h i l d / c r e a t e T e x t N o d e  
 	 / /   ( I E   d o e s n ' t   s u p p o r t   t h i s ,   f a i l s ,   a n d   u s e s   . t e x t   i n s t e a d )  
 	 i f   (   w i n d o w [   i d   ]   )   {  
 	 	 j Q u e r y . s u p p o r t . s c r i p t E v a l   =   t r u e ;  
 	 	 d e l e t e   w i n d o w [   i d   ] ;  
 	 }  
  
 	 r o o t . r e m o v e C h i l d (   s c r i p t   ) ;  
  
 	 i f   (   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 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 )  
 	 	 	 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   =   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 " ,   a r g u m e n t s . c a l l e e ) ;  
 	 	 } ) ;  
 	 	 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 " ) ;  
 	 }  
  
 	 / /   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 o c u m e n t . b o d y   m u s t   e x i s t   b e f o r e   w e   c a n   d o   t h i s  
 	 j Q u e r y ( 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 . 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 " ;  
  
 	 	 d o c u m e n t . b o d y . a p p e n d C h i l d (   d i v   ) ;  
 	 	 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   =   d i v . o f f s e t W i d t h   = = =   2 ;  
 	 	 d o c u m e n t . b o d y . r e m o v e C h i l d (   d i v   ) . s t y l e . d i s p l a y   =   ' n o n e ' ;  
 	 } ) ;  
 } ) ( ) ;  
  
 v a r   s t y l e 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 " ;  
  
 j Q u e r y . p r o p s   =   {  
 	 " f o r " :   " h t m l F o r " ,  
 	 " c l a s s " :   " c l a s s N a m e " ,  
 	 " f l o a t " :   s t y l e F l o a t ,  
 	 c s s F l o a t :   s t y l e F l o a t ,  
 	 s t y l e F l o a t :   s t y l e F l o a t ,  
 	 r e a d o n l y :   " r e a d O n l y " ,  
 	 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 " ,  
 	 r o w s p a n :   " r o w S p a n " ,  
 	 t a b i n d e x :   " t a b I n d e x "  
 } ;  
 j Q u e r y . f n . e x t e n d ( {  
 	 / /   K e e p   a   c o p y   o f   t h e   o l d   l o a d  
 	 _ l o a d :   j Q u e r y . f n . l o a 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 "   )  
 	 	 	 r e t u r n   t h i s . _ l o a d (   u r l   ) ;  
  
 	 	 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   =   n u l l ;  
  
 	 	 	 / /   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   ) ;  
 	 	 	 	 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 :   f u n c t i o n ( r e s ,   s t a t u s ) {  
 	 	 	 	 / /   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   (   s t a t u s   = =   " s u c c e s s "   | |   s t a t u s   = =   " n o t m o d i f i e d "   )  
 	 	 	 	 	 / /   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 . r e s p o n s e T e x t . r e p l a c e ( / < s c r i p t ( . | \ s ) * ? \ / s c r i p t > / g ,   " " ) )  
  
 	 	 	 	 	 	 	 / /   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 . 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 . r e s p o n s e T e x t ,   s t a t u s ,   r e s ]   ) ;  
 	 	 	 }  
 	 	 } ) ;  
 	 	 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   | |   / s e l e c t | t e x t a r e a / i . t e s t ( t h i s . n o d e N a m e )   | |  
 	 	 	 	 	 / t e x t | h i d d e n | p a s s w o r d | s e a r c h / i . 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 } ;  
 	 	 	 	 	 } )   :  
 	 	 	 	 	 { n a m e :   e l e m . n a m e ,   v a l u e :   v a l } ;  
 	 	 } ) . 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 ) ;  
 	 } ;  
 } ) ;  
  
 v a r   j s c   =   n o w ( ) ;  
  
 j Q u e r y . e x t e n d ( {  
      
 	 g e t :   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 m i 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   )   )   {  
 	 	 	 c a l l b a c k   =   d a t a ;  
 	 	 	 d a t a   =   n u l l ;  
 	 	 }  
  
 	 	 r e t u r n   j Q u e r y . a j a x ( {  
 	 	 	 t y p e :   " G E T " ,  
 	 	 	 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  
 	 	 } ) ;  
 	 } ,  
  
 	 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 ,   n u l l ,   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 " ) ;  
 	 } ,  
  
 	 p o s t :   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   )   {  
 	 	 i f   (   j Q u e r y . i s F u n c t i o n (   d a t a   )   )   {  
 	 	 	 c a l l b a c k   =   d a t a ;  
 	 	 	 d a t a   =   { } ;  
 	 	 }  
  
 	 	 r e t u r n   j Q u e r y . a j a x ( {  
 	 	 	 t y p e :   " P O S T " ,  
 	 	 	 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  
 	 	 } ) ;  
 	 } ,  
  
 	 a j a x S e t u p :   f u n c t i o n (   s e t t i n g s   )   {  
 	 	 j Q u e r y . e x t e n d (   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   ) ;  
 	 } ,  
  
 	 a j a x S e t t i n g s :   {  
 	 	 u r l :   l o c a t i o n . h r e f ,  
 	 	 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 ,  
 	 	 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 r e a t e   t h e   r e q u e s t   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 ,   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  
 	 	 / /   T h i s   f u n c t i o n   c a n   b e   o v e r r i d e n   b y   c a l l i n g   j Q u e r y . a j a x S e t u p  
 	 	 x h r : f u n c t i o n ( ) {  
 	 	 	 r e t u r n   w i n d o w . A c t i v e X O b j e c t   ?   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 H T T P " )   :   n e w   X M L H t t p R e q u e s t ( ) ;  
 	 	 } ,  
 	 	 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 " ,  
 	 	 	 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 " ,  
 	 	 	 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 " ,  
 	 	 	 t e x t :   " t e x t / p l a i n " ,  
 	 	 	 _ d e f a u l t :   " * / * "  
 	 	 }  
 	 } ,  
  
 	 / /   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 :   { } ,  
  
 	 a j a x :   f u n c t i o n (   s   )   {  
 	 	 / /   E x t e n d   t h e   s e t t i n g s ,   b u t   r e - e x t e n d   ' s '   s o   t h a t   i t   c a n   b e  
 	 	 / /   c h e c k e d   a g a i n   l a t e r   ( i n   t h e   t e s t   s u i t e ,   s p e c i f i c a l l y )  
 	 	 s   =   j Q u e r y . e x t e n d ( t r u e ,   s ,   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 ) ) ;  
  
 	 	 v a r   j s o n p ,   j s r e   =   / = \ ? ( & | $ ) / g ,   s t a t u s ,   d a t a ,  
 	 	 	 t y p e   =   s . t y p e . t o U p p e r C a s e ( ) ;  
  
 	 	 / /   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 ) ;  
  
 	 	 / /   H a n d l e   J S O N P   P a r a m e t e r   C a l l b a c k s  
 	 	 i f   (   s . d a t a T y p e   = =   " j s o n p "   )   {  
 	 	 	 i f   (   t y p e   = =   " G E T "   )   {  
 	 	 	 	 i f   (   ! s . u r l . m a t c h ( j s r e )   )  
 	 	 	 	 	 s . u r l   + =   ( s . u r l . m a t c h ( / \ ? / )   ?   " & "   :   " ? " )   +   ( s . j s o n p   | |   " c a l l b a c k " )   +   " = ? " ;  
 	 	 	 }   e l s e   i f   (   ! s . d a t a   | |   ! s . d a t a . m a t c h ( j s r e )   )  
 	 	 	 	 s . d a t a   =   ( s . d a t a   ?   s . d a t a   +   " & "   :   " " )   +   ( s . j s o n p   | |   " c a l l b a c k " )   +   " = ? " ;  
 	 	 	 s . d a t a T y p e   =   " j s o n " ;  
 	 	 }  
  
 	 	 / /   B u i l d   t e m p o r a r y   J S O N P   f u n c t i o n  
 	 	 i f   (   s . d a t a T y p e   = =   " j s o n "   & &   ( s . d a t a   & &   s . d a t a . m a t c h ( j s r e )   | |   s . u r l . m a t c h ( j s r e ) )   )   {  
 	 	 	 j s o n p   =   " j s o n p "   +   j s c + + ;  
  
 	 	 	 / /   R e p l a c e   t h e   = ?   s e q u e n c e   b o t h   i n   t h e   q u e r y   s t r i n g   a n d   t h e   d a t a  
 	 	 	 i f   (   s . d a t a   )  
 	 	 	 	 s . d a t a   =   ( s . d a t a   +   " " ) . r e p l a c e ( j s r e ,   " = "   +   j s o n p   +   " $ 1 " ) ;  
 	 	 	 s . u r l   =   s . u r l . r e p l a c e ( j s r e ,   " = "   +   j s o n p   +   " $ 1 " ) ;  
  
 	 	 	 / /   W e   n e e d   t o   m a k e   s u r e  
 	 	 	 / /   t h a t   a   J S O N P   s t y l e   r e s p o n s e   i s   e x e c u t e d   p r o p e r l y  
 	 	 	 s . d a t a T y p e   =   " s c r i p t " ;  
  
 	 	 	 / /   H a n d l e   J S O N P - s t y l e   l o a d i n g  
 	 	 	 w i n d o w [   j s o n p   ]   =   f u n c t i o n ( t m p ) {  
 	 	 	 	 d a t a   =   t m p ;  
 	 	 	 	 s u c c e s s ( ) ;  
 	 	 	 	 c o m p l e t e ( ) ;  
 	 	 	 	 / /   G a r b a g e   c o l l e c t  
 	 	 	 	 w i n d o w [   j s o n p   ]   =   u n d e f i n e d ;  
 	 	 	 	 t r y {   d e l e t e   w i n d o w [   j s o n p   ] ;   }   c a t c h ( e ) { }  
 	 	 	 	 i f   (   h e a d   )  
 	 	 	 	 	 h e a d . r e m o v e C h i l d (   s c r i p t   ) ;  
 	 	 	 } ;  
 	 	 }  
  
 	 	 i f   (   s . d a t a T y p e   = =   " s c r i p t "   & &   s . c a c h e   = =   n u l l   )  
 	 	 	 s . c a c h e   =   f a l s e ;  
  
 	 	 i f   (   s . c a c h e   = = =   f a l s e   & &   t y p e   = =   " G E T "   )   {  
 	 	 	 v a r   t s   =   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  
 	 	 	 v a r   r e t   =   s . u r l . r e p l a c e ( / ( \ ? | & ) _ = . * ? ( & | $ ) / ,   " $ 1 _ = "   +   t s   +   " $ 2 " ) ;  
 	 	 	 / /   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 )   ?   ( s . u r l . m a t c h ( / \ ? / )   ?   " & "   :   " ? " )   +   " _ = "   +   t s   :   " " ) ;  
 	 	 }  
  
 	 	 / /   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   f o r   g e t   r e q u e s t s  
 	 	 i f   (   s . d a t a   & &   t y p e   = =   " G E T "   )   {  
 	 	 	 s . u r l   + =   ( s . u r l . m a t c h ( / \ ? / )   ?   " & "   :   " ? " )   +   s . d a t a ;  
  
 	 	 	 / /   I E   l i k e s   t o   s e n d   b o t h   g e t   a n d   p o s t   d a t a ,   p r e v e n t   t h i s  
 	 	 	 s . d a t a   =   n u l l ;  
 	 	 }  
  
 	 	 / /   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   (   s . g l o b a l   & &   !   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 a r t "   ) ;  
  
 	 	 / /   M a t c h e s   a n   a b s o l u t e   U R L ,   a n d   s a v e s   t h e   d o m a i n  
 	 	 v a r   p a r t s   =   / ^ ( \ w + : ) ? \ / \ / ( [ ^ \ / ? # ] + ) / . e x e c (   s . u r l   ) ;  
  
 	 	 / /   I f   w e ' r e   r e q u e s t i n g   a   r e m o t e   d o c u m e n t  
 	 	 / /   a n d   t r y i n g   t o   l o a d   J S O N   o r   S c r i p t   w i t h   a   G E T  
 	 	 i f   (   s . d a t a T y p e   = =   " s c r i p t "   & &   t y p e   = =   " G E T "   & &   p a r t s  
 	 	 	 & &   (   p a r t s [ 1 ]   & &   p a r t s [ 1 ]   ! =   l o c a t i o n . p r o t o c o l   | |   p a r t s [ 2 ]   ! =   l o c a t i o n . h o s t   ) ) {  
  
 	 	 	 v a r   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 ] ;  
 	 	 	 v a r   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 . s r c   =   s . u r l ;  
 	 	 	 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 ;  
  
 	 	 	 / /   H a n d l e   S c r i p t   l o a d i n g  
 	 	 	 i f   (   ! j s o n p   )   {  
 	 	 	 	 v a r   d o n e   =   f a l s e ;  
  
 	 	 	 	 / /   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 f   (   ! d o n e   & &   ( ! t h i s . r e a d y S t a t e   | |  
 	 	 	 	 	 	 	 t h i s . r e a d y S t a t e   = =   " l o a d e d "   | |   t h i s . r e a d y S t a t e   = =   " c o m p l e t e " )   )   {  
 	 	 	 	 	 	 d o n e   =   t r u e ;  
 	 	 	 	 	 	 s u c c e s s ( ) ;  
 	 	 	 	 	 	 c o m p l e 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 ;  
 	 	 	 	 	 	 h e a d . r e m o v e C h i l d (   s c r i p t   ) ;  
 	 	 	 	 	 }  
 	 	 	 	 } ;  
 	 	 	 }  
  
 	 	 	 h e a d . a p p e n d C h i l d ( s c r i p t ) ;  
  
 	 	 	 / /   W e   h a n d l e   e v e r y t h i n g   u s i n g   t h e   s c r i p t   e l e m e n t   i n j e c t i o n  
 	 	 	 r e t u r n   u n d e f i n e d ;  
 	 	 }  
  
 	 	 v a r   r e q u e s t D o n e   =   f a l s e ;  
  
 	 	 / /   C r e a t e   t h e   r e q u e s t   o b j e c t  
 	 	 v a r   x h r   =   s . x h r ( ) ;  
  
 	 	 / /   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 ( 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 ( t y p e ,   s . u r l ,   s . a s y n c ) ;  
  
 	 	 / /   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   {  
 	 	 	 / /   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   )  
 	 	 	 	 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   h e a d e r ,   i f   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   )  
 	 	 	 	 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 [ s . u r l ]   | |   " T h u ,   0 1   J a n   1 9 7 0   0 0 : 0 0 : 0 0   G M T "   ) ;  
  
 	 	 	 / /   S e t   h e a d e r   s o   t h e   c a l l e d   s c r i p t   k n o w s   t h a t   i t ' s   a n   X M L H t t p R e q u e s t  
 	 	 	 x h r . s e t R e q u e s t H e a d e r ( " 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 " ) ;  
  
 	 	 	 / /   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  
 	 	 	 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 . a c c e p t s [   s . d a t a T y p e   ]   ?  
 	 	 	 	 s . a c c e p t s [   s . d a t a T y p e   ]   +   " ,   * / * "   :  
 	 	 	 	 s . a c c e p t s . _ d e f a u l t   ) ;  
 	 	 }   c a t c h ( e ) { }  
  
 	 	 / /   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 ( x h r ,   s )   = = =   f a l s e   )   {  
 	 	 	 / /   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   (   s . g l o b a l   & &   !   - - 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 "   ) ;  
 	 	 	 / /   c l o s e   o p e n d e d   s o c k e t  
 	 	 	 x h r . a b o r t ( ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
  
 	 	 i f   (   s . g l o b a l   )  
 	 	 	 j Q u e r y . e v e n t . t r i g g e r ( " a j a x S e n d " ,   [ x h r ,   s ] ) ;  
  
 	 	 / /   W a i t   f o r   a   r e s p o n s e   t o   c o m e   b a c k  
 	 	 v a r   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 T i m e o u t ) {  
 	 	 	 / /   T h e   r e q u e s t   w a s   a b o r t e d ,   c l e a r   t h e   i n t e r v a l   a n d   d e c r e m e n t   j Q u e r y . a c t i v e  
 	 	 	 i f   ( x h r . r e a d y S t a t e   = =   0 )   {  
 	 	 	 	 i f   ( i v a l )   {  
 	 	 	 	 	 / /   c l e a r   p o l l   i n t e r v a l  
 	 	 	 	 	 c l e a r I n t e r v a l ( i v a l ) ;  
 	 	 	 	 	 i v a l   =   n u l l ;  
 	 	 	 	 	 / /   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   (   s . g l o b a l   & &   !   - - 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 "   ) ;  
 	 	 	 	 }  
 	 	 	 / /   T h e   t r a n s f e r   i s   c o m p l e t e   a n d   t h e   d a t a   i s   a v a i l a b l e ,   o r   t h e   r e q u e s t   t i m e d   o u t  
 	 	 	 }   e l s e   i f   (   ! r e q u e s t D o n e   & &   x h r   & &   ( x h r . r e a d y S t a t e   = =   4   | |   i s T i m e o u t   = =   " t i m e o u t " )   )   {  
 	 	 	 	 r e q u e s t D o n e   =   t r u e ;  
  
 	 	 	 	 / /   c l e a r   p o l l   i n t e r v a l  
 	 	 	 	 i f   ( i v a l )   {  
 	 	 	 	 	 c l e a r I n t e r v a l ( i v a l ) ;  
 	 	 	 	 	 i v a l   =   n u l l ;  
 	 	 	 	 }  
  
 	 	 	 	 s t a t u s   =   i s T i m e o u t   = =   " t i m e o u t "   ?   " t i m e o u t "   :  
 	 	 	 	 	 ! j Q u e r y . h t t p S u c c e s s (   x h r   )   ?   " e r r o r "   :  
 	 	 	 	 	 s . i f M o d i f i e d   & &   j Q u e r y . h t t p N o t M o d i f i e d (   x h r ,   s . u r l   )   ?   " n o t m o d i f i e d "   :  
 	 	 	 	 	 " s u c c e s s " ;  
  
 	 	 	 	 i f   (   s t a t u s   = =   " s u c c e s s "   )   {  
 	 	 	 	 	 / /   W a t c h   f o r ,   a n d   c a t c h ,   X M L   d o c u m e n t   p a r s e   e r r o r s  
 	 	 	 	 	 t r y   {  
 	 	 	 	 	 	 / /   p r o c e s s   t h e   d a t a   ( r u n s   t h e   x m l   t h r o u g h   h t t p D a t a   r e g a r d l e s s   o f   c a l l b a c k )  
 	 	 	 	 	 	 d a t a   =   j Q u e r y . h t t p D a t a (   x h r ,   s . d a t a T y p e ,   s   ) ;  
 	 	 	 	 	 }   c a t c h ( e )   {  
 	 	 	 	 	 	 s t a t u s   =   " p a r s e r e r r o r " ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 / /   M a k e   s u r e   t h a t   t h e   r e q u e s t   w a s   s u c c e s s f u l   o r   n o t m o d i f i e d  
 	 	 	 	 i f   (   s t a t u s   = =   " s u c c e s s "   )   {  
 	 	 	 	 	 / /   C a c h e   L a s t - M o d i f i e d   h e a d e r ,   i f   i f M o d i f i e d   m o d e .  
 	 	 	 	 	 v a r   m o d R e s ;  
 	 	 	 	 	 t r y   {  
 	 	 	 	 	 	 m o d R e s   =   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 " ) ;  
 	 	 	 	 	 }   c a t c h ( e )   { }   / /   s w a l l o w   e x c e p t i o n   t h r o w n   b y   F F   i f   h e a d e r   i s   n o t   a v a i l a b l e  
  
 	 	 	 	 	 i f   (   s . i f M o d i f i e d   & &   m o d R e s   )  
 	 	 	 	 	 	 j Q u e r y . l a s t M o d i f i e d [ s . u r l ]   =   m o d R e s ;  
  
 	 	 	 	 	 / /   J S O N P   h a n d l e s   i t s   o w n   s u c c e s s   c a l l b a c k  
 	 	 	 	 	 i f   (   ! j s o n p   )  
 	 	 	 	 	 	 s u c c e s s ( ) ;  
 	 	 	 	 }   e l s e  
 	 	 	 	 	 j Q u e r y . h a n d l e E r r o r ( s ,   x h r ,   s t a t u s ) ;  
  
 	 	 	 	 / /   F i r e   t h e   c o m p l e t e   h a n d l e r s  
 	 	 	 	 c o m p l e t e ( ) ;  
  
 	 	 	 	 i f   (   i s T i m e o u t   )  
 	 	 	 	 	 x h r . a b o r t ( ) ;  
  
 	 	 	 	 / /   S t o p   m e m o r y   l e a k s  
 	 	 	 	 i f   (   s . a s y n c   )  
 	 	 	 	 	 x h r   =   n u l l ;  
 	 	 	 }  
 	 	 } ;  
  
 	 	 i f   (   s . a s y n c   )   {  
 	 	 	 / /   d o n ' t   a t t a c h   t h e   h a n d l e r   t o   t h e   r e q u e s t ,   j u s t   p o l l   i t   i n s t e a d  
 	 	 	 v a r   i v a l   =   s e t I n t e r v a l ( o n r e a d y s t a t e c h a n g e ,   1 3 ) ;  
  
 	 	 	 / /   T i m e o u t   c h e c k e r  
 	 	 	 i f   (   s . t i m e o u t   >   0   )  
 	 	 	 	 s e t T i m e o u t ( f u n c t i o n ( ) {  
 	 	 	 	 	 / /   C h e c k   t o   s e e   i f   t h e   r e q u e s t   i s   s t i l l   h a p p e n i n g  
 	 	 	 	 	 i f   (   x h r   & &   ! r e q u e s t D o n e   )  
 	 	 	 	 	 	 o n r e a d y s t a t e c h a n g e (   " t i m e o u t "   ) ;  
 	 	 	 	 } ,   s . t i m e o u t ) ;  
 	 	 }  
  
 	 	 / /   S e n d   t h e   d a t a  
 	 	 t r y   {  
 	 	 	 x h r . s e n d ( s . d a t a ) ;  
 	 	 }   c a t c h ( e )   {  
 	 	 	 j Q u e r y . h a n d l e E r r o r ( s ,   x h r ,   n u l l ,   e ) ;  
 	 	 }  
  
 	 	 / /   f i r e f o x   1 . 5   d o e s n ' t   f i r e   s t a t e c h a n g e   f o r   s y n c   r e q u e s t s  
 	 	 i f   (   ! s . a s y n c   )  
 	 	 	 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   s u c c e s s ( ) {  
 	 	 	 / /   I f   a   l o c a l   c a l l b a c k   w a s   s p e c i f i e d ,   f i r e   i t   a n d   p a s s   i t   t h e   d a t a  
 	 	 	 i f   (   s . s u c c e s s   )  
 	 	 	 	 s . s u c c e s s (   d a t a ,   s t a t u s   ) ;  
  
 	 	 	 / /   F i r e   t h e   g l o b a l   c a l l b a c k  
 	 	 	 i f   (   s . g l o b a l   )  
 	 	 	 	 j Q u e r y . e v e n t . t r i g g e r (   " a j a x S u c c e s s " ,   [ x h r ,   s ]   ) ;  
 	 	 }  
  
 	 	 f u n c t i o n   c o m p l e t e ( ) {  
 	 	 	 / /   P r o c e s s   r e s u l t  
 	 	 	 i f   (   s . c o m p l e t e   )  
 	 	 	 	 s . c o m p l e t e ( x h r ,   s t a t u s ) ;  
  
 	 	 	 / /   T h e   r e q u e s t   w a s   c o m p l e t e d  
 	 	 	 i f   (   s . g l o b a l   )  
 	 	 	 	 j Q u e r y . e v e n t . t r i g g e r (   " a j a x C o m p l e t e " ,   [ 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   (   s . g l o b a l   & &   !   - - 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 "   ) ;  
 	 	 }  
  
 	 	 / /   r e t u r n   X M L H t t p R e q u e s t   t o   a l l o w   a b o r t i n g   t h e   r e q u e s t   e t c .  
 	 	 r e t u r n   x h r ;  
 	 } ,  
  
 	 h a n d l e E r r o r :   f u n c t i o n (   s ,   x h r ,   s t a t u s ,   e   )   {  
 	 	 / /   I f   a   l o c a l   c a l l b a c k   w a s   s p e c i f i e d ,   f i r e   i t  
 	 	 i f   (   s . e r r o r   )   s . e r r o r (   x h r ,   s t a t u s ,   e   ) ;  
  
 	 	 / /   F i r e   t h e   g l o b a l   c a l l b a c k  
 	 	 i f   (   s . g l o b a l   )  
 	 	 	 j Q u e r y . e v e n t . t r i g g e r (   " a j a x E r r o r " ,   [ x h r ,   s ,   e ]   ) ;  
 	 } ,  
  
 	 / /   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 ,  
  
 	 / /   D e t e r m i n e s   i f   a n   X M L H t t p R e q u e s t   w a s   s u c c e s s f u l   o r   n o t  
 	 h t t p S u c c e s s :   f u n c t i o n (   x h r   )   {  
 	 	 t r y   {  
 	 	 	 / /   I E   e r r o r   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   s o   t r e a t   i t   a s   s u c c e s s ,   s e e   # 1 4 5 0  
 	 	 	 r e t u r n   ! x h r . s t a t u s   & &   l o c a t i o n . p r o t o c o l   = =   " f i l e : "   | |  
 	 	 	 	 (   x h r . s t a t u s   > =   2 0 0   & &   x h r . s t a t u s   <   3 0 0   )   | |   x h r . s t a t u s   = =   3 0 4   | |   x h r . s t a t u s   = =   1 2 2 3 ;  
 	 	 }   c a t c h ( e ) { }  
 	 	 r e t u r n   f a l s e ;  
 	 } ,  
  
 	 / /   D e t e r m i n e s   i f   a n   X M L H t t p R e q u e s t   r e t u r n s   N o t M o d i f i e d  
 	 h t t p N o t M o d i f i e d :   f u n c t i o n (   x h r ,   u r l   )   {  
 	 	 t r y   {  
 	 	 	 v a r   x h r R e s   =   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 " ) ;  
  
 	 	 	 / /   F i r e f o x   a l w a y s   r e t u r n s   2 0 0 .   c h e c k   L a s t - M o d i f i e d   d a t e  
 	 	 	 r e t u r n   x h r . s t a t u s   = =   3 0 4   | |   x h r R e s   = =   j Q u e r y . l a s t M o d i f i e d [ u r l ] ;  
 	 	 }   c a t c h ( e ) { }  
 	 	 r e t u r n   f a l s e ;  
 	 } ,  
  
 	 h t t p D a t a :   f u n c t i o n (   x h r ,   t y p e ,   s   )   {  
 	 	 v a r   c t   =   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 " ) ,  
 	 	 	 x m l   =   t y p e   = =   " x m l "   | |   ! t y p e   & &   c t   & &   c t . i n d e x O f ( " x m l " )   > =   0 ,  
 	 	 	 d a t a   =   x m l   ?   x h r . r e s p o n s e X M L   :   x h r . r e s p o n s e T e x t ;  
  
 	 	 i f   (   x m l   & &   d a t a . d o c u m e n t E l e m e n t . t a g N a m e   = =   " p a r s e r e r r o r "   )  
 	 	 	 t h r o w   " p a r s e r e r r o r " ;  
 	 	 	  
 	 	 / /   A l l o w   a   p r e - f i l t e r i n g   f u n c t i o n   t o   s a n i t i z e   t h e   r e s p o n s e  
 	 	 / /   s   ! =   n u l l   i s   c h e c k e d   t o   k e e p   b a c k w a r d s   c o m p a t i b i l i t y  
 	 	 i f (   s   & &   s . d a t a F i l t e r   )  
 	 	 	 d a t a   =   s . d a t a F i l t e r (   d a t a ,   t y p e   ) ;  
  
 	 	 / /   T h e   f i l t e r   c a n   a c t u a l l y   p a r s e   t h e   r e s p o n s e  
 	 	 i f (   t y p e o f   d a t a   = = =   " s t r i n g "   ) {  
  
 	 	 	 / /   I f   t h e   t y p e   i s   " s c r i p t " ,   e v a l   i t   i n   g l o b a l   c o n t e x t  
 	 	 	 i f   (   t y p e   = =   " s c r i p t "   )  
 	 	 	 	 j Q u e r y . g l o b a l E v a l (   d a t a   ) ;  
  
 	 	 	 / /   G e t   t h e   J a v a S c r i p t   o b j e c t ,   i f   J S O N   i s   u s e d .  
 	 	 	 i f   (   t y p e   = =   " j s o n "   )  
 	 	 	 	 d a t a   =   w i n d o w [ " e v a l " ] ( " ( "   +   d a t a   +   " ) " ) ;  
 	 	 }  
 	 	  
 	 	 r e t u r n   d a t a ;  
 	 } ,  
  
 	 / /   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   )   {  
 	 	 v a r   s   =   [   ] ;  
  
 	 	 f u n c t i o n   a d d (   k e y ,   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 ) ;  
 	 	 } ;  
  
 	 	 / /   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   )  
 	 	 	 / /   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   ) ;  
 	 	 	 } ) ;  
  
 	 	 / /   O t h e r w i s e ,   a s s u m e   t h a t   i t ' s   a n   o b j e c t   o f   k e y / v a l u e   p a i r s  
 	 	 e l s e  
 	 	 	 / /   S e r i a l i z e   t h e   k e y / v a l u e s  
 	 	 	 f o r   (   v a r   j   i n   a   )  
 	 	 	 	 / /   I f   t h e   v a l u e   i s   a n   a r r a y   t h e n   t h e   k e y   n a m e s   n e e d   t o   b e   r e p e a t e d  
 	 	 	 	 i f   (   j Q u e r y . i s A r r a y ( a [ j ] )   )  
 	 	 	 	 	 j Q u e r y . e a c h (   a [ j ] ,   f u n c t i o n ( ) {  
 	 	 	 	 	 	 a d d (   j ,   t h i s   ) ;  
 	 	 	 	 	 } ) ;  
 	 	 	 	 e l s e  
 	 	 	 	 	 a d d (   j ,   j Q u e r y . i s F u n c t i o n ( a [ j ] )   ?   a [ j ] ( )   :   a [ j ]   ) ;  
  
 	 	 / /   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 ( / % 2 0 / g ,   " + " ) ;  
 	 }  
  
 } ) ;  
 v a r   e l e m d i s p l a y   =   { } ,  
 	 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 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 ;  
 }  
  
 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 , c a l l b a c k ) {  
 	 	 i f   (   s p e e d   )   {  
 	 	 	 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 ,   c a l l b a c k ) ;  
 	 	 }   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 + +   ) {  
 	 	 	 	 v a r   o l d   =   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 " ) ;  
 	 	 	 	  
 	 	 	 	 t h i s [ i ] . s t y l e . d i s p l a y   =   o l d   | |   " " ;  
 	 	 	 	  
 	 	 	 	 i f   (   j Q u e r y . c s s ( t h i s [ i ] ,   " d i s p l a y " )   = = =   " n o n e "   )   {  
 	 	 	 	 	 v a r   t a g N a m e   =   t h i s [ i ] . t a g N a m e ,   d i s p l a y ;  
 	 	 	 	 	  
 	 	 	 	 	 i f   (   e l e m d i s p l a y [   t a g N a m e   ]   )   {  
 	 	 	 	 	 	 d i s p l a y   =   e l e m d i s p l a y [   t a g N a m e   ] ;  
 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 v a r   e l e m   =   j Q u e r y ( " < "   +   t a g 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 " ) ;  
 	 	 	 	 	 	 i f   (   d i s p l a y   = = =   " n o n e "   )  
 	 	 	 	 	 	 	 d i s p l a y   =   " b l o c k " ;  
 	 	 	 	 	 	  
 	 	 	 	 	 	 e l e m . r e m o v e ( ) ;  
 	 	 	 	 	 	  
 	 	 	 	 	 	 e l e m d i s p l a y [   t a g N a m e   ]   =   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   (   v a r   i   =   0 ,   l   =   t h i s . l e n g t h ;   i   <   l ;   i + +   ) {  
 	 	 	 	 t h i s [ i ] . s t y l e . 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 " )   | |   " " ;  
 	 	 	 }  
 	 	 	  
 	 	 	 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 , c a l l b a c k ) {  
 	 	 i f   (   s p e e d   )   {  
 	 	 	 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 ,   c a l l b a c k ) ;  
 	 	 }   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 + +   ) {  
 	 	 	 	 v a r   o l d   =   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 " ) ;  
 	 	 	 	 i f   (   ! o l d   & &   o l d   ! = =   " 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 . c s s ( t h i s [ i ] ,   " 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   (   v a r   i   =   0 ,   l   =   t h i s . l e n g t h ;   i   <   l ;   i + +   ) {  
 	 	 	 	 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   ) {  
 	 	 v a r   b o o l   =   t y p e o f   f n   = = =   " b o o l e a n " ;  
  
 	 	 r e t u r n   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   )   :  
 	 	 	 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 "   ] ( ) ;  
 	 	 	 	 } )   :  
 	 	 	 	 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 ) ;  
 	 } ,  
  
 	 f a d e T o :   f u n c t i o n ( s p e e d , t o , 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 ( { o p a c i t y :   t o } ,   s p e e d ,   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 ) ;  
  
 	 	 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 ( ) {  
 	 	  
 	 	 	 v a r   o p t   =   j Q u e r y . e x t e n d ( { } ,   o p t a l l ) ,   p ,  
 	 	 	 	 h i d d e n   =   t h i s . n o d e T y p e   = =   1   & &   j Q u e r y ( t h i s ) . i s ( " : h i d d e n " ) ,  
 	 	 	 	 s e l f   =   t h i s ;  
 	  
 	 	 	 f o r   (   p   i n   p r o p   )   {  
 	 	 	 	 i f   (   p r o p [ p ]   = =   " h i d e "   & &   h i d d e n   | |   p r o p [ p ]   = =   " 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   (   (   p   = =   " h e i g h t "   | |   p   = =   " w i d t h "   )   & &   t h i s . s t y l e   )   {  
 	 	 	 	 	 / /   S t o r e   d i s p l a y   p r o p e r t y  
 	 	 	 	 	 o p t . d i s p l a y   =   j Q u e r y . c s s ( t h i s ,   " d i s p l a y " ) ;  
  
 	 	 	 	 	 / /   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  
 	 	 	 	 	 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 ;  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 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 " ;  
  
 	 	 	 o p t . c u r A n i m   =   j Q u e r y . e x t e n d ( { } ,   p r o p ) ;  
  
 	 	 	 j Q u e r y . e a c h (   p r o p ,   f u n c t i o n ( n a m e ,   v a l ) {  
 	 	 	 	 v a r   e   =   n e w   j Q u e r y . f x (   s e l f ,   o p t ,   n a m e   ) ;  
  
 	 	 	 	 i f   (   / t o g g l e | s h o w | h i d e / . 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   ] (   p r o p   ) ;  
 	 	 	 	 e l s e   {  
 	 	 	 	 	 v a r   p a r t s   =   v a l . t o S t r i n g ( ) . m a t c h ( / ^ ( [ + - ] = ) ? ( [ \ d + - . ] + ) ( . * ) $ / ) ,  
 	 	 	 	 	 	 s t a r t   =   e . c u r ( t r u e )   | |   0 ;  
  
 	 	 	 	 	 i f   (   p a r t s   )   {  
 	 	 	 	 	 	 v a r   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 ]   | |   " 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 "   )   {  
 	 	 	 	 	 	 	 s e l f . s t y l e [   n a m e   ]   =   ( e n d   | |   1 )   +   u n i t ;  
 	 	 	 	 	 	 	 s t a r t   =   ( ( e n d   | |   1 )   /   e . c u r ( t r u e ) )   *   s t a r t ;  
 	 	 	 	 	 	 	 s e l f . s t y l e [   n a m e   ]   =   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 ) {  
 	 	 v a r   t i m e r s   =   j Q u e r y . t i m e r s ;  
  
 	 	 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 ( ) {  
 	 	 	 / /   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  
 	 	 	 f o r   (   v a r   i   =   t i m e r s . l e n g t h   -   1 ;   i   > =   0 ;   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 ;  
 	 }  
  
 } ) ;  
  
 / /   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 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 ,   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 ,   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   =   t y p e o f   s p e e d   = = =   " o b j e c t "   ?   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   :  
 	 	 	 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 ( ) {  
 	 	 	 i f   (   o p t . q u e u e   ! = =   f a l s e   )  
 	 	 	 	 j Q u e r y ( t h i s ) . d e q u e u e ( ) ;  
 	 	 	 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 ;  
  
 	 	 i f   (   ! 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   ) ;  
  
 	 	 / /   S e t   d i s p l a y   p r o p e r t y   t o   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  
 	 	 i f   (   (   t h i s . p r o p   = =   " h e i g h t "   | |   t h i s . p r o p   = =   " w i d t h "   )   & &   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 . d i s p l a y   =   " b l o c k " ;  
 	 } ,  
  
 	 / /   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 ( f o r c e ) {  
 	 	 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   r   =   p a r s e F l o a t ( 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 ,   f o r c e ) ) ;  
 	 	 r e t u r n   r   & &   r   >   - 1 0 0 0 0   ?   r   :   p a r s e F l o a t ( j Q u e r y . c u r C S S ( t h i s . e l e m ,   t h i s . p r o p ) )   | |   0 ;  
 	 } ,  
  
 	 / /   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 ) {  
 	 	 t h i s . s t a r t T i m e   =   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   | |   " 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 ;  
  
 	 	 v a r   s e l f   =   t h i s ;  
 	 	 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   )   {  
 	 	 	 t i m e r I d   =   s e t I n t e r v a l ( 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 ;  
  
 	 	 	 	 f o r   (   v a r   i   =   0 ;   i   <   t i m e r s . l e n g t h ;   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   )   {  
 	 	 	 	 	 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   =   u n d e f i n e d ;  
 	 	 	 	 }  
 	 	 	 } ,   1 3 ) ;  
 	 	 }  
 	 } ,  
  
 	 / /   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 . a t t r (   t h i s . e l e m . s t y l e ,   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 . a t t r (   t h i s . e l e m . s t y l e ,   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   =   n o w ( ) ;  
  
 	 	 i f   (   g o t o E n d   | |   t   > =   t h i s . 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 ( ) ;  
  
 	 	 	 t h i s . o p t i o n s . c u r A n i m [   t h i s . p r o p   ]   =   t r u e ;  
  
 	 	 	 v a r   d o n e   =   t r u e ;  
 	 	 	 f o r   (   v a r   i   i n   t h i s . o p t i o n s . c u r A n i m   )  
 	 	 	 	 i f   (   t h i s . o p t i o n s . c u r A n i m [ i ]   ! = =   t r u e   )  
 	 	 	 	 	 d o n e   =   f a l s e ;  
  
 	 	 	 i f   (   d o n e   )   {  
 	 	 	 	 i f   (   t h i s . o p t i o n s . d i s p l a y   ! =   n u l l   )   {  
 	 	 	 	 	 / /   R e s e t   t h e   o v e r f l o w  
 	 	 	 	 	 t h i s . e l e m . s t y l e . o v e r f l o w   =   t h i s . o p t i o n s . o v e r f l o w ;  
  
 	 	 	 	 	 / /   R e s e t   t h e   d i s p l a y  
 	 	 	 	 	 t h i s . e l e m . s t y l e . d i s p l a y   =   t h i s . o p t i o n s . d i s p l a y ;  
 	 	 	 	 	 i f   (   j Q u e r y . c s s ( t h i s . e l e m ,   " d i s p l a y " )   = =   " n o n e "   )  
 	 	 	 	 	 	 t h i s . e l e m . s t y l e . d i s p l a y   =   " b l o c k " ;  
 	 	 	 	 }  
  
 	 	 	 	 / /   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   (   t h i s . o p t i o n s . h i d e   )  
 	 	 	 	 	 j Q u e r y ( t h i s . 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   (   t h i s . o p t i o n s . h i d e   | |   t h i s . o p t i o n s . s h o w   )  
 	 	 	 	 	 f o r   (   v a r   p   i n   t h i s . o p t i o n s . c u r A n i m   )  
 	 	 	 	 	 	 j Q u e r y . a t t r ( t h i s . e l e m . s t y l e ,   p ,   t h i s . 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  
 	 	 	 	 t h i s . o p t i o n s . c o m p l e t e . c a l l (   t h i s . e l e m   ) ;  
 	 	 	 }  
  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }   e l s e   {  
 	 	 	 v a r   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   /   t h i s . 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 [ t h i s . o p t i o n s . e a s i n g   | |   ( j Q u e r y . e a s i n g . s w i n g   ?   " s w i n g "   :   " l i n e a r " ) ] ( t h i s . s t a t e ,   n ,   0 ,   1 ,   t h i s . 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 ,   {  
 	 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 . a t t r ( f x . e l e m . s t y l e ,   " 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 . 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   (   d o c u m e n t . d o c u m e n t E l e m e n t [ " g e t B o u n d i n g C l i e n t R e c t " ]   )  
 	 j Q u e r y . f n . o f f s e t   =   f u n c t i o n ( )   {  
 	 	 i f   (   ! t h i s [ 0 ]   )   r e t u r n   {   t o p :   0 ,   l e f t :   0   } ;  
 	 	 i f   (   t h i s [ 0 ]   = = =   t h i s [ 0 ] . 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 (   t h i s [ 0 ]   ) ;  
 	 	 v a r   b o x     =   t h i s [ 0 ] . g e t B o u n d i n g C l i e n t R e c t ( ) ,   d o c   =   t h i s [ 0 ] . o w n e r D o c u m e n t ,   b o d y   =   d o c . b o d y ,   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 ,  
 	 	 	 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 ,  
 	 	 	 t o p     =   b o x . t o p     +   ( s e l f . p a g e Y O f f s e t   | |   j Q u e r y . 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   )   -   c l i e n t T o p ,  
 	 	 	 l e f t   =   b o x . l e f t   +   ( s e l f . p a g e X O f f s e t   | |   j Q u e r y . 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 )   -   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 ( )   {  
 	 	 i f   (   ! t h i s [ 0 ]   )   r e t u r n   {   t o p :   0 ,   l e f t :   0   } ;  
 	 	 i f   (   t h i s [ 0 ]   = = =   t h i s [ 0 ] . 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 (   t h i s [ 0 ]   ) ;  
 	 	 j Q u e r y . o f f s e t . i n i t i a l i z e d   | |   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   e l e m   =   t h i s [ 0 ] ,   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 ,   c o m p u t e d S t y l e ,   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 . g e t C o m p u t e d S t y l e ( e l e m ,   n u l l ) ,  
 	 	 	 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   )   {  
 	 	 	 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 ) ;  
 	 	 	 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   & &   / ^ t ( a b l e | d | h ) $ / i . t e s t ( e l e m . t a g N a m e ) )   )  
 	 	 	 	 	 t o p     + =   p a r s e I n 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 ,     1 0 )   | |   0 ,  
 	 	 	 	 	 l e f t   + =   p a r s e I n 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 ,   1 0 )   | |   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 I n 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 ,     1 0 )   | |   0 ,  
 	 	 	 	 l e f t   + =   p a r s e I n 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 ,   1 0 )   | |   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   (   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 ( )   {  
 	 	 i f   (   t h i s . i n i t i a l i z e d   )   r e t u r 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 ,   r u l e s ,   p r o p ,   b o d y M a r g i n T o p   =   b o d y . s t y l e . m a r g i n T o p ,  
 	 	 	 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 > ' ;  
  
 	 	 r u l e s   =   {   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 '   } ;  
 	 	 f o r   (   p r o p   i n   r u l e s   )   c o n t a i n e r . s t y l e [ p r o p ]   =   r u l e s [ p r o p ] ;  
  
 	 	 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 ) ;  
  
 	 	 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 ) ;  
  
 	 	 b o d y . s t y l e . m a r g i n T o p   =   ' 1 p x ' ;  
 	 	 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   = = =   0 ) ;  
 	 	 b o d y . s t y l e . m a r g i n 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 ) ;  
 	 	 t h i s . i n i t i a l i z e d   =   t r u e ;  
 	 } ,  
  
 	 b o d y O f f s e t :   f u n c t i o n ( b o d y )   {  
 	 	 j Q u e r y . o f f s e t . i n i t i a l i z e d   | |   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   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 . 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 I n t (   j Q u e r y . c u r C S S ( b o d y ,   ' m a r g i n T o p ' ,     t r u e ) ,   1 0   )   | |   0 ,  
 	 	 	 l e f t   + =   p a r s e I n t (   j Q u e r y . c u r C S S ( b o d y ,   ' m a r g i n L e f t ' ,   t r u e ) ,   1 0   )   | |   0 ;  
 	 	 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 . f n . e x t e n d ( {  
 	 p o s i t i o n :   f u n c t i o n ( )   {  
 	 	 v a r   l e f t   =   0 ,   t o p   =   0 ,   r e s u l t s ;  
  
 	 	 i f   (   t h i s [ 0 ]   )   {  
 	 	 	 / /   G e t   * r e a l *   o f f s e t P a r e n t  
 	 	 	 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 ( ) ,  
  
 	 	 	 / /   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   =   / ^ b o d y | h t m l $ / i . t e s t ( o f f s e t P a r e n t [ 0 ] . t a g 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     - =   n u m (   t h i s ,   ' m a r g i n T o p '     ) ;  
 	 	 	 o f f s e t . l e f t   - =   n u m (   t h i s ,   ' m a r g i n L e f t '   ) ;  
  
 	 	 	 / /   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     + =   n u m (   o f f s e t P a r e n t ,   ' b o r d e r T o p W i d t h '     ) ;  
 	 	 	 p a r e n t O f f s e t . l e f t   + =   n u m (   o f f s e t P a r e n t ,   ' b o r d e r L e f t W i d t h '   ) ;  
  
 	 	 	 / /   S u b t r a c t   t h e   t w o   o f f s e t s  
 	 	 	 r e s u l t s   =   {  
 	 	 	 	 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  
 	 	 	 } ;  
 	 	 }  
  
 	 	 r e t u r n   r e s u l t s ;  
 	 } ,  
  
 	 o f f s e t P a r e n t :   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 [ 0 ] . 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   & &   ( ! / ^ b o d y | h t m l $ / i . t e s t ( o f f s e t P a r e n t . t a g 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   j Q u e r y ( 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 )   {  
 	 	 i f   ( ! t h i s [ 0 ] )   r e t u r n   n u l l ;  
  
 	 	 r e t u r n   v a l   ! = =   u n d e f i n e d   ?  
  
 	 	 	 / /   S e t   t h e   s c r o l l   o f f s e t  
 	 	 	 t h i s . e a c h ( f u n c t i o n ( )   {  
 	 	 	 	 t h i s   = =   w i n d o w   | |   t h i s   = =   d o c u m e n t   ?  
 	 	 	 	 	 w i n d o w . s c r o l l T o (  
 	 	 	 	 	 	 ! i   ?   v a l   :   j Q u e r y ( w i n d o w ) . s c r o l l L e f t ( ) ,  
 	 	 	 	 	 	   i   ?   v a l   :   j Q u e r y ( w i n d o w ) . s c r o l l T o p ( )  
 	 	 	 	 	 )   :  
 	 	 	 	 	 t h i s [   m e t h o d   ]   =   v a l ;  
 	 	 	 } )   :  
  
 	 	 	 / /   R e t u r n   t h e   s c r o l l   o f f s e t  
 	 	 	 t h i s [ 0 ]   = =   w i n d o w   | |   t h i s [ 0 ]   = =   d o c u m e n t   ?  
 	 	 	 	 s e l f [   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 . b o x M o d e 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 e t h o d   ]   | |  
 	 	 	 	 	 d o c u m e n t . b o d y [   m e t h o d   ]   :  
 	 	 	 	 t h i s [ 0 ] [   m e t h o d   ] ;  
 	 } ;  
 } ) ;  
 / /   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 l   =   i   ?   " L e f t "     :   " T o p " ,     / /   t o p   o r   l e f t  
 	 	 b r   =   i   ?   " R i g h t "   :   " B o t t o m " ,   / /   b o t t o m   o r   r i g h t  
 	 	 l o w e r   =   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 ]   ?  
 	 	 	 j Q u e r y . c s s (   t h i s [ 0 ] ,   l o w e r ,   f a l s 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 ]   ?  
 	 	 	 j Q u e r y . c s s (   t h i s [ 0 ] ,   l o w e r ,   f a l s e ,   m a r g i n   ?   " m a r g i n "   :   " b o r d e r "   )   :  
 	 	 	 n u l l ;  
 	 } ;  
 	  
 	 v a r   t y p e   =   n a m e . t o L o w e r C a s e ( ) ;  
  
 	 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  
 	 	 r e t u r n   t h i s [ 0 ]   = =   w i n d o w   ?  
 	 	 	 / /   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  
 	 	 	 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 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   ]   | |  
 	 	 	 d o c u m e n t . b o d y [   " c l i e n t "   +   n a m e   ]   :  
  
 	 	 	 / /   G e t   d o c u m e n t   w i d t h   o r   h e i g h t  
 	 	 	 t h i s [ 0 ]   = =   d o c u m e n t   ?  
 	 	 	 	 / /   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  
 	 	 	 	 M a t h . m a x (  
 	 	 	 	 	 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 ] ,  
 	 	 	 	 	 d o c u m e n t . b o d y [ " s c r o l l "   +   n a m e ] ,   d o c u m e n t . 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 ] ,  
 	 	 	 	 	 d o c u m e n t . b o d y [ " o f f s e t "   +   n a m 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 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  
 	 	 	 	 s i z e   = = =   u n d e f i n e d   ?  
 	 	 	 	 	 / /   G 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  
 	 	 	 	 	 ( t h i s . l e n g t h   ?   j Q u e r y . c s s (   t h i s [ 0 ] ,   t y p e   )   :   n u l l )   :  
  
 	 	 	 	 	 / /   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 )  
 	 	 	 	 	 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 "   ) ;  
 	 } ;  
  
 } ) ;  
 } ) ( ) ;  
  
 f u n c t i o n   A d d t o C a r t s ( i d )   {  
         v a r   c l   =   $ ( ' # l i s t c l ' ) . v a l ( ) ;  
         v a r   s z   =   $ ( " # l i s t s z     o p t i o n : s e l e c t e d " ) . v a l ( ) ;  
         $ ( " # S o r t _ c a r t _ o v e r " ) . s h o w ( " s l o w " ) ;  
         $ ( " # C a r t _ g e t P r o d u c t " ) . h t m l ( "   < d i v   a l i g n = ' c e n t e r ' > < i m g   s r c = ' / i m a g e s / w a i t i n g . g i f '   a l i g n = ' c e n t e r ' > < b r > a n g   t h ñc   h i Çn < / d i v > " ) ;  
         $ . g e t ( " / C a r t / A d d t o C a r t / "   +   i d   + " ? c l = " + c l + " & s z = " + s z + " & r = "   +   M a t h . r a n d o m ( ) ,   f u n c t i o n ( h t m l )   {  
         $ . g e t ( " / C a r t / G e t P r o d u c t / "   +   i d   +   " ? c l = " + c l + " & s z = " + s z + " & r = "   +   M a t h . r a n d o m ( ) ,   f u n c t i o n ( d a t a )   {  
                 $ ( " # C a r t _ g e t P r o d u c t " ) . h t m l ( d a t a ) ;  
                 s e t T i m e o u t ( ' $ ( " # S o r t _ c a r t _ o v e r " ) . h i d e ( " s l o w " ) ; ' ,   3 0 0 0 )  
         } ) ;  
                 $ ( " # C a r t _ n u m b e r " ) . h t m l ( h t m l   +   "   s £n   p h ©m " ) ;  
                  
                 $ ( " # s l " ) . h t m l ( h t m l ) ;  
                 $ ( " # s l _ o v e r " ) . h t m l ( h t m l ) ;  
                            
  
         } ) ;  
  
 }  
  
  
  
 f u n c t i o n   a d d F a v ( i d ,   M e m )   {  
           i f   ( M e m   > =   1 )   {  
                 $ . g e t ( " / P r o d u c t / A d d t o F a v o r i t e ? P r o I d = "   +   i d   +   " & M e m b e r = "   +   M e m ,   f u n c t i o n ( h t m l )   {  
                         a l e r t ( " S £n   p h ©m   ã   °ãc   t h ê m   v à o   d a n h   s á c h   °a   t h í c h   c ça   b ¡n " ) ;  
                 } ) ;  
         }   e l s e   {  
                 i f   ( c o n f i r m ( " B ¡n   p h £i   n g   n h ­p   Ã  s í  d ån g   c h éc   n n g   n à y " ) )   {  
                         l o c a t i o n . h r e f   =   " / M e m b e r / L o g i n / " ;  
                 }  
         }  
 } 
