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