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