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