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