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