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