þÿ / *   *   M a g e n t o   E n t e r p r i s e   E d i t i o n 
   * 
   *   N O T I C E   O F   L I C E N S E 
   * 
   *   T h i s   s o u r c e   f i l e   i s   s u b j e c t   t o   t h e   M a g e n t o   E n t e r p r i s e   E d i t i o n   L i c e n s e 
   *   t h a t   i s   b u n d l e d   w i t h   t h i s   p a c k a g e   i n   t h e   f i l e   L I C E N S E _ E E . t x t . 
   *   I t   i s   a l s o   a v a i l a b l e   t h r o u g h   t h e   w o r l d - w i d e - w e b   a t   t h i s   U R L : 
   *   h t t p : / / w w w . m a g e n t o c o m m e r c e . c o m / l i c e n s e / e n t e r p r i s e - e d i t i o n 
   *   I f   y o u   d i d   n o t   r e c e i v e   a   c o p y   o f   t h e   l i c e n s e   a n d   a r e   u n a b l e   t o 
   *   o b t a i n   i t   t h r o u g h   t h e   w o r l d - w i d e - w e b ,   p l e a s e   s e n d   a n   e m a i l 
   *   t o   l i c e n s e @ m a g e n t o c o m m e r c e . c o m   s o   w e   c a n   s e n d   y o u   a   c o p y   i m m e d i a t e l y . 
   * 
   *   D I S C L A I M E R 
   * 
   *   D o   n o t   e d i t   o r   a d d   t o   t h i s   f i l e   i f   y o u   w i s h   t o   u p g r a d e   M a g e n t o   t o   n e w e r 
   *   v e r s i o n s   i n   t h e   f u t u r e .   I f   y o u   w i s h   t o   c u s t o m i z e   M a g e n t o   f o r   y o u r 
   *   n e e d s   p l e a s e   r e f e r   t o   h t t p : / / w w w . m a g e n t o c o m m e r c e . c o m   f o r   m o r e   i n f o r m a t i o n . 
   * 
   *   @ c a t e g o r y         d e s i g n 
   *   @ p a c k a g e           e n t e r p r i s e _ c o n n e c t 
   *   @ c o p y r i g h t       C o p y r i g h t   ( c )   2 0 1 0   M a g e n t o   I n c .   ( h t t p : / / w w w . m a g e n t o c o m m e r c e . c o m ) 
   *   @ l i c e n s e           h t t p : / / w w w . m a g e n t o c o m m e r c e . c o m / l i c e n s e / e n t e r p r i s e - e d i t i o n 
 
 
 ? ? ? ? ? ? ? ?   ? ? ? ? ? ? ? ? ? ? ?   ? ? ? ? ?   ? ? ? ? ? ? ? ?   ? ? ? ? ? ? ? ?   ? ? ? ? ?   ? ? ? ? ? ? ? ?   ? ? ? ? ? ? ? ? ,   ? ? ? ? ? ? ? ? ? ?   ? ? ? ? ?   ?   ? ? ? ? ? ? ?   ?   ? ? ? ? ?   ? ? ? ? ? ,   ? ? ?   ? ? ? ? ?   ? ?   . s e l e c t   ? ? ? ?   o p t i o n s   ? ? ? ? ? ? ?   ? ? ? ? ? ? ? ,   ? ? ? ?   ? ? ? ? ?   ? ? ? ?   ? ? ? ? ?   ? ? ?   ? ? ? ? ? ? ? ?   o p t i o n s   ? ? ? ? ? ? ? ? ?   ? ? ? ? ? * / 
 v a r   N i c e f o r m s   =   { 
         f o r m s :   [ ] , 
         s e l e c t s :   [ ] , 
         c h e c k b o x e s :   [ ] , 
         r a d i o s :   [ ] , 
         i n p u t s :   [ ] , 
         t e x t a r e a s :   [ ] , 
         f o r m C l a s s N a m e :   ' n i c e - f o r m ' , 
         s e l e c t C l a s s N a m e :   ' n i c e - s e l e c t ' , 
         c h e c k b o x C l a s s N a m e :   ' n i c e - c h e c k b o x ' , 
         r a d i o C l a s s N a m e :   ' n i c e - r a d i o ' , 
         i n p u t C l a s s N a m e :   ' n i c e - i n p u t ' , 
         t e x t a r e a C l a s s N a m e :   ' n i c e - t e x t a r e a ' , 
         f o r m :   n u l l , 
 
         i n i t :   f u n c t i o n ( c o n f i g )   { 
                 v a r   _ _ t h i s   =   t h i s ; 
                 
                 t h i s . s e l e c t C l a s s N a m e   =   t y p e o f (   c o n f i g   )   ! =   ' u n d e f i n e d '   & &   c o n f i g . s e l e c t C l a s s N a m e   ?   c o n f i g . s e l e c t C l a s s N a m e   :   t h i s . s e l e c t C l a s s N a m e ; 
                 t h i s . c h e c k b o x C l a s s N a m e   =   t y p e o f (   c o n f i g   )   ! =   ' u n d e f i n e d '   & &   c o n f i g . c h e c k b o x C l a s s N a m e   ?   c o n f i g . c h e c k b o x C l a s s N a m e   :   t h i s . c h e c k b o x C l a s s N a m e ; 
                 t h i s . r a d i o C l a s s N a m e   =   t y p e o f (   c o n f i g   )   ! =   ' u n d e f i n e d '   & &   c o n f i g . r a d i o C l a s s N a m e   ?   c o n f i g . r a d i o C l a s s N a m e   :   t h i s . r a d i o C l a s s N a m e ; 
                 t h i s . i n p u t C l a s s N a m e   =   t y p e o f (   c o n f i g   )   ! =   ' u n d e f i n e d '   & &   c o n f i g . i n p u t C l a s s N a m e   ?   c o n f i g . i n p u t C l a s s N a m e   :   t h i s . i n p u t C l a s s N a m e ; 
                 t h i s . t e x t a r e a C l a s s N a m e   =   t y p e o f (   c o n f i g   )   ! =   ' u n d e f i n e d '   & &   c o n f i g . t e x t a r e a C l a s s N a m e   ?   c o n f i g . t e x t a r e a C l a s s N a m e   :   t h i s . t e x t a r e a C l a s s N a m e ; 
                 t h i s . f o r m C l a s s N a m e   =   t y p e o f (   c o n f i g   )   ! =   ' u n d e f i n e d '   & &   c o n f i g . f o r m C l a s s N a m e   ?   c o n f i g . f o r m C l a s s N a m e   :   t h i s . f o r m C l a s s N a m e ; 
                 t h i s . f o r m   =   t y p e o f (   c o n f i g   )   ! =   ' u n d e f i n e d '   & &   c o n f i g . f o r m   ?   c o n f i g . f o r m   :   n u l l ; 
 
                 i f   ( t h i s . f o r m   = =   n u l l )   { 
                         t h i s . f o r m s   =   $ $ ( ' . ' + t h i s . f o r m C l a s s N a m e ) ; 
                         f o r   ( v a r   f o r m L e n   =   t h i s . f o r m s . l e n g t h ,   i   =   0 ;   i   <   f o r m L e n ;   i + + )   { 
                                 i f   ( ! t h i s . f o r m s [ i ] . h a s C l a s s N a m e ( ' s t y l e d ' ) )   { 
                                         t h i s . d r a w E l e m s ( t h i s . f o r m s [ i ] ) ; 
                                 } 
                         } 
                 }   e l s e   { 
                         i f   ( ! t h i s . f o r m . h a s C l a s s N a m e ( ' s t y l e d ' ) )   { 
                                 t h i s . d r a w E l e m s ( t h i s . f o r m ) ; 
                         } 
                 } 
         } , 
 
         d r a w E l e m s :   f u n c t i o n ( f o r m )   { 
                 v a r   e l e m s   =   f o r m . s e l e c t ( ' s e l e c t ' ) , 
                         l a b e l s   =   f o r m . s e l e c t ( ' l a b e l ' ) ; 
 
                 f o r   ( v a r   l e n   =   e l e m s . l e n g t h ,   k   =   0 ;   k   <   l e n ;   k + + )   { 
                         t h i s . s e l e c t s . p u s h ( e l e m s [ k ] ) ; 
                         t h i s . d r a w S e l e c t ( e l e m s [ k ] ) ; 
                 } 
 
                 e l e m s   =   f o r m . s e l e c t ( ' i n p u t [ t y p e = c h e c k b o x ] ' ) ; 
                 f o r   ( v a r   l e n   =   e l e m s . l e n g t h ,   k   =   0 ;   k   <   l e n ;   k + + )   { 
                         t h i s . c h e c k b o x e s . p u s h ( e l e m s [ k ] ) ; 
                         t h i s . d r a w C h e c k b o x e s ( e l e m s [ k ] ) ; 
                 } 
 
                 e l e m s   =   f o r m . s e l e c t ( ' i n p u t [ t y p e = r a d i o ] ' ) ; 
                 f o r   ( v a r   l e n   =   e l e m s . l e n g t h ,   k   =   0 ;   k   <   l e n ;   k + + )   { 
                         t h i s . r a d i o s . p u s h ( e l e m s [ k ] ) ; 
                         t h i s . d r a w R a d i o ( e l e m s [ k ] ) ; 
                 } 
 
                 e l e m s   =   f o r m . s e l e c t ( ' i n p u t [ t y p e = t e x t ] ' ) ; 
                 f o r   ( v a r   l e n   =   e l e m s . l e n g t h ,   k   =   0 ;   k   <   l e n ;   k + + )   { 
                         t h i s . i n p u t s . p u s h ( e l e m s [ k ] ) ; 
                         t h i s . d r a w I n p u t ( e l e m s [ k ] ) ; 
                 } 
 
                 e l e m s   =   f o r m . s e l e c t ( ' t e x t a r e a ' ) ; 
                 f o r   ( v a r   l e n   =   e l e m s . l e n g t h ,   k   =   0 ;   k   <   l e n ;   k + + )   { 
                         t h i s . t e x t a r e a s . p u s h ( e l e m s [ k ] ) ; 
                         t h i s . d r a w T e x t a r e a ( e l e m s [ k ] ) ; 
                 } 
                 f o r m . a d d C l a s s N a m e ( ' s t y l e d ' ) ; 
 
                 l a b e l s . e a c h ( f u n c t i o n ( e )   { 
                         e . o b s e r v e ( ' c l i c k ' ,   f u n c t i o n ( e v e n t )   { 
                                 v a r   i n p   =   $ ( t h i s . h t m l F o r ) ; 
 
                                 i f   ( i n p . g e t A t t r i b u t e ( ' t y p e ' )   = =   ' c h e c k b o x '   & &   i n p . u p ( ) . h a s C l a s s N a m e ( ' c h e c k e d ' )   & &   ! i n p . d i s a b l e d )   { 
                                         i n p . u p ( ) . r e m o v e C l a s s N a m e ( ' c h e c k e d ' ) ; 
                                         i n p . c h e c k e d   =   t r u e ; 
                                 }   e l s e   i f   ( i n p . g e t A t t r i b u t e ( ' t y p e ' )   = =   ' c h e c k b o x '   & &   ! i n p . d i s a b l e d )   { 
                                         i n p . u p ( ) . a d d C l a s s N a m e ( ' c h e c k e d ' ) ; 
                                         i n p . c h e c k e d   =   f a l s e ; 
                                 } 
                         } ) ; 
                 } ) ; 
         } , 
 
         d r a w R a d i o :   f u n c t i o n ( e l e m ) { 
                 v a r   _ _ t h i s   =   t h i s , 
                         w r a p E l   =   n e w   E l e m e n t ( ' s p a n ' ) , 
                         o l d   =   E l e m e n t . M e t h o d s . B y T a g . S E L E C T . s e t V a l u e ; 
 
                 w r a p E l . c l a s s N a m e   =   t h i s . r a d i o C l a s s N a m e   +   '   '   +   e l e m . c l a s s N a m e ; 
                 e l e m . w r a p ( w r a p E l ) ; 
 
                 t h i s . m a k e D i s a b l e d ( w r a p E l ,   e l e m ) ; 
 
                 w r a p E l [ e l e m . c h e c k e d   ?   ' a d d C l a s s N a m e '   :   ' r e m o v e C l a s s N a m e ' ] ( ' c h e c k e d ' ) ; 
 
                 / /   r e p l a c e   P r o t o t y p e ' s   e l e m e n t s   m e t h o d   s e t V a l u e ( )   b y   c u s t o m 
                 v a r   s e t V a l u e   =   f u n c t i o n ( e l e m e n t )   { 
                         / /   s e t   e l e m e n t   v a l u e 
                         o l d ( t h i s ,   e l e m e n t ) ; 
 
                         w r a p E l [ e l e m . c h e c k e d   ?   ' a d d C l a s s N a m e '   :   ' r e m o v e C l a s s N a m e ' ] ( ' c h e c k e d ' ) ; 
                 } ; 
 
                 e l e m . s e t V a l u e   =   s e t V a l u e ; 
 
                 w r a p E l . o b s e r v e ( ' c l i c k ' ,   f u n c t i o n ( e v e n t )   { 
                         i f   ( d o c u m e n t . c r e a t e E v e n t )   { 
                                 v a r   e v O b j   =   d o c u m e n t . c r e a t e E v e n t ( ' E v e n t s ' ) ; 
 
                                 e v O b j . i n i t E v e n t ( ' c h a n g e ' ,   t r u e ,   f a l s e ) ; 
                                 e l e m . d i s p a t c h E v e n t ( e v O b j ) ; 
                         }   e l s e   i f   ( d o c u m e n t . c r e a t e E v e n t O b j e c t )   { 
                                 e l e m . f i r e E v e n t ( ' o n c h a n g e ' ) ; 
                         } 
 
                         $ $ ( ' . '   +   _ _ t h i s . r a d i o C l a s s N a m e ) . e a c h ( f u n c t i o n ( i )   { 
                                 i f   ( e l e m . n a m e   = =   i . d o w n ( ) . n a m e   & &   e l e m . d i s a b l e d   ! =   t r u e )   { 
                                         i . r e m o v e C l a s s N a m e ( ' c h e c k e d ' ) ; 
                                 } 
                         } ) ; 
 
                         i f   ( e l e m . c h e c k e d   & &   ! e l e m . d i s a b l e d )   { 
                                 t h i s . a d d C l a s s N a m e ( ' c h e c k e d ' ) ; 
                         } 
                 } ) ; 
 
                 e l e m . o b s e r v e ( ' c h a n g e ' ,   f u n c t i o n ( e v e n t )   { 
                         i f   ( ! e l e m . d i s a b l e d )   { 
                                 t h i s . c h e c k e d   =   t r u e ; 
                         } 
                 } ) 
         } , 
 
         d r a w C h e c k b o x e s :   f u n c t i o n ( e l e m )   { 
                 v a r   w r a p E l   =   n e w   E l e m e n t ( ' s p a n ' ) , 
                         o l d   =   E l e m e n t . M e t h o d s . B y T a g . S E L E C T . s e t V a l u e ; 
 
                 w r a p E l . c l a s s N a m e   =   t h i s . c h e c k b o x C l a s s N a m e   +   '   '   +   e l e m . c l a s s N a m e ; 
                 e l e m . w r a p ( w r a p E l ) ; 
 
                 t h i s . m a k e D i s a b l e d ( w r a p E l ,   e l e m ) ; 
 
                 w r a p E l [ e l e m . c h e c k e d   ?   ' a d d C l a s s N a m e '   :   ' r e m o v e C l a s s N a m e ' ] ( ' c h e c k e d ' ) ; 
 
                 / /   r e p l a c e   P r o t o t y p e ' s   e l e m e n t s   m e t h o d   s e t V a l u e ( )   b y   c u s t o m 
                 v a r   s e t V a l u e   =   f u n c t i o n ( e l e m e n t ,   v a l u e )   { 
                         / /   s e t   e l e m e n t   v a l u e 
                         o l d ( t h i s ,   e l e m e n t ) ; 
                         w r a p E l [ e l e m . c h e c k e d   ?   ' a d d C l a s s N a m e '   :   ' r e m o v e C l a s s N a m e ' ] ( ' c h e c k e d ' ) ; 
                 } ; 
 
                 e l e m . s e t V a l u e   =   s e t V a l u e ; 
 
                 w r a p E l . o b s e r v e ( ' c l i c k ' ,   f u n c t i o n ( e v e n t )   { 
                         i f   ( w r a p E l   = =   e v e n t . t a r g e t   & &   ! e l e m . d i s a b l e d )   { 
                                 / /   C l i c k   o n   c h e c k b o x   a n d   c a l l   i t s   ' c l i c k '   o b s e r v e r s 
                                 i f   ( t h i s . h a s C l a s s N a m e ( ' c h e c k e d ' ) )   { 
                                         t h i s . r e m o v e C l a s s N a m e ( ' c h e c k e d ' ) ; 
                                         e l e m . c h e c k e d   =   f a l s e ; 
                                 }   e l s e   { 
                                         t h i s . a d d C l a s s N a m e ( ' c h e c k e d ' ) ; 
                                         e l e m . c h e c k e d   =   t r u e ; 
                                 } 
                                 i f   ( d o c u m e n t . c r e a t e E v e n t )   { 
                                         v a r   e v O b j   =   d o c u m e n t . c r e a t e E v e n t ( ' E v e n t s ' ) ; 
 
                                         e v O b j . i n i t E v e n t ( ' c l i c k ' ,   t r u e ,   f a l s e ) ; 
                                         e l e m . d i s p a t c h E v e n t ( e v O b j ) ; 
                                 }   e l s e   i f   ( d o c u m e n t . c r e a t e E v e n t O b j e c t )   { 
                                         e l e m . f i r e E v e n t ( ' o n c l i c k ' ) ; 
                                 } 
                         } 
                 } ) ; 
         } , 
 
         d r a w S e l e c t :   f u n c t i o n ( e l e m )   { 
                 v a r   w r a p E l ,   _ _ t h i s   =   t h i s , 
                         o l d   =   E l e m e n t . M e t h o d s . B y T a g . S E L E C T . s e t V a l u e ; 
 
                 / / g e n e r a t i n g   n i c e - s e l e c t   h t m l   
                 w r a p E l   =   n e w   E l e m e n t ( ' d i v ' ) ; 
 
                 w r a p E l . c l a s s N a m e   =   t h i s . s e l e c t C l a s s N a m e   +   '   '   +   e l e m . c l a s s N a m e ; 
                 e l e m . w r a p ( w r a p E l ) ; 
 
                 / /   r e p l a c e   P r o t o t y p e ' s   e l e m e n t s   m e t h o d   s e t V a l u e ( )   b y   c u s t o m 
                 v a r   s e t V a l u e   =   f u n c t i o n ( e l e m e n t )   { 
                         / /   s e t   e l e m e n t   v a l u e 
                         o l d ( t h i s ,   e l e m e n t ) ; 
                         / /   s e t   s t y l e d   d r o p d o w n   v a l u e 
                         _ _ t h i s . g e n e r a t e S e l e c t ( e l e m ,   w r a p E l ,   ' u p d a t e ' ) ; 
                 } ; 
 
                 e l e m . s e t V a l u e   =   s e t V a l u e ; 
 
                 t h i s . g e n e r a t e S e l e c t ( e l e m ,   w r a p E l ) . o b s e r v e ( ' c h a n g e ' ,   f u n c t i o n ( e v e n t )   { 
                         _ _ t h i s . g e n e r a t e S e l e c t ( t h i s ,   w r a p E l ,   ' u p d a t e ' ) ; 
                 } ) ; 
 
                 t h i s . m a k e D i s a b l e d ( w r a p E l ,   e l e m ) ; 
 
                 / / c l o s e   d r o p d o w n   w h e n   c l i c k   o u t s i d e   i t 
                 $ ( d o c u m e n t ) . o b s e r v e ( ' c l i c k ' ,   f u n c t i o n ( e v e n t )   { 
                         v a r   e l e m   =   E v e n t . f i n d E l e m e n t ( e v e n t ,   ' d i v . n i c e - s e l e c t ' ) ; 
 
                         i f   ( e l e m   ! =   w r a p E l )   { 
                                 w r a p E l . r e m o v e C l a s s N a m e ( ' a c t i v e ' ) ; 
                         } 
                 } ) 
 
         } , 
 
         g e n e r a t e S e l e c t :   f u n c t i o n ( e l e m ,   w r a p E l ,   t y p e )   { 
                 v a r   s e l e c t e d O p t i o n ,   p r e T e x t ,   o p t H t m l ,   o p t l i s t , 
                         _ _ t h i s   =   t h i s , 
                         d i s a b l e   =   f a l s e ; 
 
                 / /   m a k e   o r i g .   d i s a b l e d   s e l e c t   a c t i v e   t o   g e t   i t ' s   c o n t e n t 
                 / /   i t   w i l l   b e   d i s a b l e   a g a i n   a t   t h e   e n d   o f   t h i s   m e t h o d 
                 t h i s . m a k e D i s a b l e d ( w r a p E l ,   e l e m ) ; 
 
                 i f   ( e l e m . d i s a b l e d )   { 
                         d i s a b l e   =   t r u e ; 
                         e l e m . d i s a b l e d   =   f a l s e ; 
                 } 
 
                 / / g e n e r a t i n g   n i c e - s e l e c t   h t m l 
                 o p t l i s t   =   e l e m . s e l e c t ( ' o p t i o n ' ) ; 
 
                 s e l e c t e d O p t i o n   =   o p t l i s t [ e l e m . s e l e c t e d I n d e x ] ; 
                 p r e T e x t   =   e l e m . h a s C l a s s N a m e ( ' p r e t e x t ' )   & &   e l e m . r e a d A t t r i b u t e ( ' t i t l e ' )   ?   ' < s t r o n g > ' + e l e m . r e a d A t t r i b u t e ( ' t i t l e ' ) + '   < / s t r o n g > '   :   p r e T e x t   =   ' ' ; 
                 o p t H t m l   =   ' < d i v   c l a s s = " o p t i o n s " > < u l > ' ; 
                 
                 f o r   ( v a r   o p t L e n g h t   =   o p t l i s t . l e n g t h ,   c u r O p t   =   0 ;   c u r O p t   <   o p t L e n g h t ;   c u r O p t + + )   { 
                         v a r   s e l e c t e d   =   ' ' ; 
 
                         i f   ( c u r O p t   = =   e l e m . s e l e c t e d I n d e x )   { 
                                 s e l e c t e d   =   '   c l a s s = " s e l e c t e d " ' ; 
                         } 
                         o p t H t m l   + =   ' < l i ' +   s e l e c t e d   + '   v a l u e = " ' + c u r O p t + ' " > < s p a n   t i t l e = " ' +   o p t l i s t [ c u r O p t ] . i n n e r H T M L   +   ' " > '   +   p r e T e x t   +   ' '   +   o p t l i s t [ c u r O p t ] . i n n e r H T M L   +   '   < / s p a n > < / l i > ' ; 
                 } 
                 o p t H t m l   + =   ' < / u l > < d i v   c l a s s = " t o p - c o r n e r s " > < s p a n > < / s p a n > < / d i v > < d i v   c l a s s = " b o t - c o r n e r s " > < s p a n > < / s p a n > < / d i v > < / d i v > ' ; 
                 s e l H t m l   =   ' < d i v   c l a s s = " s e l e c t " > < d i v > < s p a n   t i t l e = " ' +   s e l e c t e d O p t i o n . i n n e r H T M L     + ' " > '   +   p r e T e x t   +   ' '   +   s e l e c t e d O p t i o n . i n n e r H T M L   +   ' < / s p a n > < / d i v > < / d i v > '   +   o p t H t m l ; 
                 
                 i f   ( t y p e   = =   ' u p d a t e ' )   { 
                         w r a p E l . d o w n ( ' d i v . o p t i o n s ' ) . r e m o v e ( ) ; 
                         w r a p E l . d o w n ( ' d i v . s e l e c t ' ) . r e m o v e ( ) ; 
                         w r a p E l . i n s e r t ( {   b o t t o m :   s e l H t m l   } ) ; 
                 }   e l s e   { 
                         w r a p E l . i n s e r t ( {   b o t t o m :   s e l H t m l   } ) ; 
                 } 
 
                 w r a p E l . d o w n ( ' d i v . s e l e c t ' ) . o b s e r v e ( ' c l i c k ' ,   f u n c t i o n ( e v e n t ) { 
                         i f   ( ! e l e m . d i s a b l e d )   { 
                                 _ _ t h i s . s h o w O p t i o n s ( t h i s ) ; 
                         } 
                 } ) ; 
 
                 / / a d d   o b s e r v e s   f o r   o p t i o n s 
                 f o r   ( v a r   o p t   =   w r a p E l . s e l e c t ( ' l i ' ) ,   o p t i o n L e n g t h   =   o p t . l e n g t h ,   c u r O p t i o n   =   0 ;   c u r O p t i o n   <   o p t i o n L e n g t h ;   c u r O p t i o n + + )   { 
                         o p t [ c u r O p t i o n ] . o b s e r v e ( ' c l i c k ' ,   f u n c t i o n ( e v e n t )   { 
                                 f o r ( v a r   r   =   0 ;   r   <   o p t i o n L e n g t h ;   r + + )   { 
                                         o p t [ r ] . r e m o v e C l a s s N a m e ( ' s e l e c t e d ' ) ; 
                                 } 
                                 t h i s . a d d C l a s s N a m e ( ' s e l e c t e d ' ) ; 
                                 t h i s . u p ( 2 ) . r e m o v e C l a s s N a m e ( ' a c t i v e ' ) ; 
                                 t h i s . u p ( 2 ) . s e l e c t ( ' d i v . s e l e c t   d i v ' ) [ 0 ] . u p d a t e ( t h i s . i n n e r H T M L ) ; 
 
                                 v a r   e l e m   =   t h i s . u p ( 2 ) . s e l e c t ( ' s e l e c t ' ) [ 0 ] ; 
                                 e l e m . o p t i o n s [ t h i s . v a l u e ] . s e l e c t e d   =   t r u e ; 
 
                                 i f   ( d o c u m e n t . c r e a t e E v e n t )   { 
                                         v a r   e v O b j   =   d o c u m e n t . c r e a t e E v e n t ( ' E v e n t s ' ) ; 
 
                                         e v O b j . i n i t E v e n t ( ' c h a n g e ' ,   t r u e ,   f a l s e ) ; 
                                         e l e m . d i s p a t c h E v e n t ( e v O b j ) ; 
                                 }   e l s e   i f   ( d o c u m e n t . c r e a t e E v e n t O b j e c t )   { 
                                         e l e m . f i r e E v e n t ( ' o n c h a n g e ' ) ; 
                                 } 
                         } ) ; 
                 } 
                 i f   ( d i s a b l e )   { 
                         d i s a b l e   =   f a l s e ; 
                         e l e m . d i s a b l e d   =   t r u e ; 
                 } 
                 r e t u r n   e l e m ; 
         } , 
 
         s h o w O p t i o n s :   f u n c t i o n ( e l e m )   { 
                 f o r   ( v a r   s e l e c t s   =   $ $ ( ' . '   +   t h i s . s e l e c t C l a s s N a m e ) ,   l e n   =   s e l e c t s . l e n g t h ,   i   =   0 ;   i   <   l e n ;   i + + )   { 
                         s e l e c t s [ i ] . r e m o v e C l a s s N a m e ( ' a c t i v e ' ) ; 
                 } 
                 e l e m . u p ( ) . a d d C l a s s N a m e ( ' a c t i v e ' ) ; 
         } , 
 
         m a k e D i s a b l e d :   f u n c t i o n ( w r a p ,   e l e m )   { 
                 w r a p [ e l e m . d i s a b l e d   ?   ' a d d C l a s s N a m e '   :   ' r e m o v e C l a s s N a m e ' ] ( ' d i s a b l e d ' ) ; 
         } , 
 
         d r a w I n p u t :   f u n c t i o n ( e l e m )   { 
                 v a r   w r a p E l   =   n e w   E l e m e n t ( ' d i v ' ) ; 
 
                 w r a p E l . c l a s s N a m e   =   t h i s . i n p u t C l a s s N a m e   +   '   '   +   e l e m . c l a s s N a m e ; 
                 E l e m e n t . w r a p ( e l e m ,   w r a p E l ) ; 
                 t h i s . m a k e D i s a b l e d ( w r a p E l ,   e l e m ) ; 
         } ,   
         
         d r a w T e x t a r e a :   f u n c t i o n ( e l e m )   { 
                 v a r   w r a p E l   =   n e w   E l e m e n t ( ' d i v ' ) ; 
                 
                 w r a p E l . c l a s s N a m e   =   t h i s . t e x t a r e a C l a s s N a m e   +   '   '   +   e l e m . c l a s s N a m e ; 
                 E l e m e n t . w r a p ( e l e m ,   w r a p E l ) ; 
                 t h i s . m a k e D i s a b l e d ( w r a p E l ,   e l e m ) ; 
         } 
 } ; 
 / * i n i t   i n   f o o t e r . p h t m l * /
