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