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