ÿþ/ / P o p - i t   m e n u -   B y   D y n a m i c   D r i v e  
 / / F o r   f u l l   s o u r c e   c o d e   a n d   m o r e   D H T M L   s c r i p t s ,   v i s i t   h t t p : / / w w w . d y n a m i c d r i v e . c o m  
 / / T h i s   c r e d i t   M U S T   s t a y   i n t a c t   f o r   u s e  
  
  
 / / / / N o   n e e d   t o   e d i t   b e y o n d   h e r e  
  
 v a r   i e 4 = d o c u m e n t . a l l & & n a v i g a t o r . u s e r A g e n t . i n d e x O f ( " O p e r a " ) = = - 1  
 v a r   n s 6 = d o c u m e n t . g e t E l e m e n t B y I d  
 / / v a r   n s 6 = d o c u m e n t . g e t E l e m e n t B y I d & & ! d o c u m e n t . a l l  
 v a r   n s 4 = d o c u m e n t . l a y e r s  
  
 f u n c t i o n   f i n d P o s X ( o b j )  
 {  
 	 v a r   c u r l e f t   =   0 ;  
 	 i f   ( o b j . o f f s e t P a r e n t )  
 	 {  
 	 	 w h i l e   ( o b j . o f f s e t P a r e n t )  
 	 	 {  
 	 	 	 c u r l e f t   + =   o b j . o f f s e t L e f t  
 	 	 	 o b j   =   o b j . o f f s e t P a r e n t ;  
 	 	 }  
 	 }  
 	 e l s e   i f   ( o b j . x )  
 	 	 c u r l e f t   + =   o b j . x ;  
 	 r e t u r n   c u r l e f t ;  
 }  
  
 f u n c t i o n   f i n d P o s Y ( o b j )  
 {  
 	 v a r   c u r t o p   =   0 ;  
 	 i f   ( o b j . o f f s e t P a r e n t )  
 	 {  
 	 	 w h i l e   ( o b j . o f f s e t P a r e n t )  
 	 	 {  
 	 	 	 c u r t o p   + =   o b j . o f f s e t T o p  
 	 	 	 o b j   =   o b j . o f f s e t P a r e n t ;  
 	 	 }  
 	 }  
 	 e l s e   i f   ( o b j . y )  
 	 	 c u r t o p   + =   o b j . y ;  
 	 r e t u r n   c u r t o p ;  
 }  
  
 f u n c t i o n   s h o w m e n u ( e , w h i c h ,   l e f t p o s ,   t o p p o s ,   a b s p o s ) {  
  
 i f   ( ! d o c u m e n t . a l l & & ! d o c u m e n t . g e t E l e m e n t B y I d & & ! d o c u m e n t . l a y e r s )  
 r e t u r n  
  
 c l e a r h i d e m e n u ( )  
  
 v a r   t a r g ;  
  
 i f   ( ! e )   v a r   e   =   w i n d o w . e v e n t ;  
 i f   ( e . t a r g e t )  
 	 t a r g   =   e . t a r g e t ;  
 e l s e   i f   ( e . s r c E l e m e n t )  
 	 t a r g   =   e . s r c E l e m e n t ;  
  
 i f   ( t a r g . t a g N a m e   ! =   ' T D ' )   r e t u r n  
  
 m e n u o b j = i e 4 ?   d o c u m e n t . a l l . p o p m e n u   :   n s 6 ?   d o c u m e n t . g e t E l e m e n t B y I d ( " p o p m e n u " )   :   n s 4 ?   d o c u m e n t . p o p m e n u   :   " "  
 m e n u o b j . t h e s t y l e = ( i e 4 | | n s 6 ) ?   m e n u o b j . s t y l e   :   m e n u o b j  
  
 i f   ( i e 4 | | n s 6 )  
 m e n u o b j . i n n e r H T M L = w h i c h  
 e l s e {  
 m e n u o b j . d o c u m e n t . w r i t e ( ' < l a y e r   n a m e = g u i   b g C o l o r = # f f f f f   w i d t h = 1 6 5   o n m o u s e o v e r = " c l e a r h i d e m e n u ( ) "   o n m o u s e o u t = " h i d e m e n u ( ) " > ' + w h i c h + ' < / l a y e r > ' )  
 m e n u o b j . d o c u m e n t . c l o s e ( )  
 }  
  
 m e n u o b j . c o n t e n t w i d t h = ( i e 4 | | n s 6 ) ?   m e n u o b j . o f f s e t W i d t h   :   m e n u o b j . d o c u m e n t . g u i . d o c u m e n t . w i d t h  
 m e n u o b j . c o n t e n t h e i g h t = ( i e 4 | | n s 6 ) ?   m e n u o b j . o f f s e t H e i g h t   :   m e n u o b j . d o c u m e n t . g u i . d o c u m e n t . h e i g h t  
  
 e v e n t X = i e 4 ?   e v e n t . c l i e n t X - e v e n t . o f f s e t X - 2   :   n s 6 ?   f i n d P o s X ( t a r g ) + 0   :   e . x ;  
 e v e n t Y = i e 4 ?   e v e n t . c l i e n t Y - e v e n t . o f f s e t Y + 2 5   :   n s 6 ?   f i n d P o s Y ( t a r g ) + 2 7   :   e . y ;  
  
 / / F i n d   o u t   h o w   c l o s e   t h e   m o u s e   i s   t o   t h e   c o r n e r   o f   t h e   w i n d o w  
 v a r   r i g h t e d g e = i e 4 ?   d o c u m e n t . b o d y . c l i e n t W i d t h - e v e n t X   :   w i n d o w . i n n e r W i d t h - e v e n t X ;  
 v a r   b o t t o m e d g e = i e 4 ?   d o c u m e n t . b o d y . c l i e n t H e i g h t - e v e n t Y   :   w i n d o w . i n n e r H e i g h t - e v e n t Y ;  
  
 / / i f   t h e   h o r i z o n t a l   d i s t a n c e   i s n ' t   e n o u g h   t o   a c c o m o d a t e   t h e   w i d t h   o f   t h e   c o n t e x t   m e n u  
 i f   ( r i g h t e d g e < m e n u o b j . c o n t e n t w i d t h )  
 / / m o v e   t h e   h o r i z o n t a l   p o s i t i o n   o f   t h e   m e n u   t o   t h e   l e f t   b y   i t ' s   w i d t h  
 m e n u o b j . t h e s t y l e . l e f t = i e 4 ?   d o c u m e n t . b o d y . s c r o l l L e f t + e v e n t X - m e n u o b j . c o n t e n t w i d t h   :   e v e n t X - m e n u o b j . c o n t e n t w i d t h  
 e l s e  
 / / p o s i t i o n   t h e   h o r i z o n t a l   p o s i t i o n   o f   t h e   m e n u   w h e r e   t h e   m o u s e   w a s   c l i c k e d  
 m e n u o b j . t h e s t y l e . l e f t = i e 4 ?   d o c u m e n t . b o d y . s c r o l l L e f t + e v e n t X   :   e v e n t X  
  
 / / s a m e   c o n c e p t   w i t h   t h e   v e r t i c a l   p o s i t i o n  
 i f   ( b o t t o m e d g e < m e n u o b j . c o n t e n t h e i g h t )  
 m e n u o b j . t h e s t y l e . t o p = i e 4 ?   d o c u m e n t . b o d y . s c r o l l T o p + e v e n t Y   :   e v e n t Y ;  
 / / m e n u o b j . t h e s t y l e . t o p = i e 4 ?   d o c u m e n t . b o d y . s c r o l l T o p + e v e n t Y - m e n u o b j . c o n t e n t h e i g h t   :   e v e n t Y - m e n u o b j . c o n t e n t h e i g h t ;  
 e l s e  
 m e n u o b j . t h e s t y l e . t o p = i e 4 ?   d o c u m e n t . b o d y . s c r o l l T o p + e v e n t Y   :   e v e n t Y ;  
 m e n u o b j . t h e s t y l e . v i s i b i l i t y = " v i s i b l e " ;  
 r e t u r n   f a l s e  
 }  
  
 f u n c t i o n   c o n t a i n s _ n s 6 ( a ,   b )   {  
 / / D e t e r m i n e s   i f   1   e l e m e n t   i n   c o n t a i n e d   i n   a n o t h e r -   b y   B r a i n j a r . c o m  
 w h i l e   ( b . p a r e n t N o d e )  
 i f   ( ( b   =   b . p a r e n t N o d e )   = =   a )  
 r e t u r n   t r u e ;  
 r e t u r n   f a l s e ;  
 }  
  
 f u n c t i o n   h i d e m e n u ( ) {  
 i f   ( w i n d o w . m e n u o b j )  
 m e n u o b j . t h e s t y l e . v i s i b i l i t y = ( i e 4 | | n s 6 ) ?   " h i d d e n "   :   " h i d e "  
 }  
  
 f u n c t i o n   d y n a m i c h i d e ( e ) {  
 i f   ( i e 4 & & ! m e n u o b j . c o n t a i n s ( e . t o E l e m e n t ) )  
 h i d e m e n u ( )  
 e l s e   i f   ( n s 6 & & e . c u r r e n t T a r g e t ! =   e . r e l a t e d T a r g e t & &   ! c o n t a i n s _ n s 6 ( e . c u r r e n t T a r g e t ,   e . r e l a t e d T a r g e t ) )  
 h i d e m e n u ( )  
 }  
  
 f u n c t i o n   d e l a y h i d e m e n u ( ) {  
 i f   ( i e 4 | | n s 6 | | n s 4 )  
 d e l a y h i d e = s e t T i m e o u t ( " h i d e m e n u ( ) " , 5 0 )  
 }  
  
 f u n c t i o n   c l e a r h i d e m e n u ( ) {  
 i f   ( w i n d o w . d e l a y h i d e )  
 c l e a r T i m e o u t ( d e l a y h i d e )  
 }  
  
 f u n c t i o n   h i g h l i g h t m e n u ( e , s t a t e ) {  
 i f   ( d o c u m e n t . a l l )  
 s o u r c e _ e l = e v e n t . s r c E l e m e n t  
 e l s e   i f   ( d o c u m e n t . g e t E l e m e n t B y I d )  
 s o u r c e _ e l = e . t a r g e t  
 i f   ( s o u r c e _ e l . c l a s s N a m e = = " m e n u i t e m s " ) {  
 s o u r c e _ e l . i d = ( s t a t e = = " o n " ) ?   " m o u s e o v e r s t y l e "   :   " "  
 }  
 e l s e {  
 w h i l e ( s o u r c e _ e l . i d ! = " p o p m e n u " ) {  
 s o u r c e _ e l = d o c u m e n t . g e t E l e m e n t B y I d ?   s o u r c e _ e l . p a r e n t N o d e   :   s o u r c e _ e l . p a r e n t E l e m e n t  
 i f   ( s o u r c e _ e l . c l a s s N a m e = = " m e n u i t e m s " ) {  
 s o u r c e _ e l . i d = ( s t a t e = = " o n " ) ?   " m o u s e o v e r s t y l e "   :   " "  
 }  
 }  
 }  
 }  
  
 / / i f   ( i e 4 | | n s 6 )  
 / / d o c u m e n t . o n c l i c k = h i d e m e n u  
 
