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