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