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