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