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