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