ÿþ$ . f n . c e n t e r I n C l i e n t   =   f u n c t i o n ( o p t i o n s )   {  
         / / /   < s u m m a r y > C e n t e r s   t h e   s e l e c t e d   i t e m s   i n   t h e   b r o w s e r   w i n d o w .   T a k e s   i n t o   a c c o u n t   s c r o l l   p o s i t i o n .  
         / / /   I d e a l l y   t h e   s e l e c t e d   s e t   s h o u l d   o n l y   m a t c h   a   s i n g l e   e l e m e n t .  
         / / /   < / s u m m a r y >          
         / / /   < p a r a m   n a m e = " f n "   t y p e = " F u n c t i o n " > O p t i o n a l   f u n c t i o n   c a l l e d   w h e n   c e n t e r i n g   i s   c o m p l e t e .   P a s s e d   D O M   e l e m e n t   a s   p a r a m e t e r < / p a r a m >          
         / / /   < p a r a m   n a m e = " f o r c e A b s o l u t e "   t y p e = " B o o l e a n " > i f   t r u e   f o r c e s   t h e   e l e m e n t   t o   b e   r e m o v e d   f r o m   t h e   d o c u m e n t   f l o w    
         / / /     a n d   a t t a c h e d   t o   t h e   b o d y   e l e m e n t   t o   e n s u r e   p r o p e r   a b s o l u t e   p o s i t i o n i n g .    
         / / /   B e   a w a r e   t h a t   t h i s   m a y   c a u s e   I D   h i e r a c h y   f o r   C S S   s t y l e s   t o   b e   a f f e c t e d .  
         / / /   < / p a r a m >  
         / / /   < r e t u r n s   t y p e = " j Q u e r y "   / >  
         v a r   o p t   =   {   f o r c e A b s o l u t e :   f a l s e ,  
                                 c o n t a i n e r :   w i n d o w ,         / /   s e l e c t o r   o f   e l e m e n t   t o   c e n t e r   i n  
                                 c o m p l e t e H a n d l e r :   n u l l  
                             } ;  
         $ . e x t e n d ( o p t ,   o p t i o n s ) ;  
        
         r e t u r n   t h i s . e a c h ( f u n c t i o n ( i )   {  
                 v a r   e l   =   $ ( t h i s ) ;  
                 v a r   j W i n   =   $ ( o p t . c o n t a i n e r ) ;  
                 v a r   i s W i n   =   o p t . c o n t a i n e r   = =   w i n d o w ;  
  
                 / /   f o r c e   t o   t h e   t o p   o f   d o c u m e n t   t o   E N S U R E   t h a t    
                 / /   d o c u m e n t   a b s o l u t e   p o s i t i o n i n g   i s   a v a i l a b l e  
                 i f   ( o p t . f o r c e A b s o l u t e )   {  
                         i f   ( i s W i n )  
                                 e l . r e m o v e ( ) . a p p e n d T o ( " b o d y " ) ;  
                         e l s e  
                                 e l . r e m o v e ( ) . a p p e n d T o ( j W i n . g e t ( 0 ) ) ;  
                 }  
  
                 / /   h a v e   t o   m a k e   a b s o l u t e  
                 e l . c s s ( " p o s i t i o n " ,   " a b s o l u t e " ) ;  
  
                 / /   h e i g h t   i s   o f f   a   b i t   s o   f u d g e   i t  
                 v a r   h e i g h t F u d g e   =   i s W i n   ?   2 . 0   :   1 . 8 ;  
  
                 v a r   x   =   ( i s W i n   ?   j W i n . w i d t h ( )   :   j W i n . o u t e r W i d t h ( ) )   /   2   -   e l . o u t e r W i d t h ( )   /   2 ;  
                 v a r   y   =   ( i s W i n   ?   j W i n . h e i g h t ( )   :   j W i n . o u t e r H e i g h t ( ) )   /   h e i g h t F u d g e   -   e l . o u t e r H e i g h t ( )   /   2 ;  
  
                 e l . c s s ( " l e f t " ,   x   +   j W i n . s c r o l l L e f t ( ) ) ;  
                 e l . c s s ( " t o p " ,   y   +   j W i n . s c r o l l T o p ( ) ) ;  
  
                 / /   i f   s p e c i f i e d   m a k e   c a l l b a c k   a n d   p a s s   e l e m e n t  
                 i f   ( o p t . c o m p l e t e H a n d l e r )  
                         o p t . c o m p l e t e H a n d l e r ( t h i s ) ;  
         } ) ;  
 } 
