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