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