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