þÿ / / f a d i n g   i m a g e s   c o d e   f r o m   w w w . b r a i n e r r o r . n e t   v e r   1 . 3   ©   J u n e   7 ,   2 0 0 4   
 
 f u n c t i o n   o p a c i t y ( i d ,   o p a c S t a r t ,   o p a c E n d ,   m i l l i s e c )   { 
 	 / / s p e e d   f o r   e a c h   f r a m e 
 	 v a r   s p e e d   =   M a t h . r o u n d ( m i l l i s e c   /   1 0 0 ) ; 
 	 v a r   t i m e r   =   0 ; 
 
 	 / / d e t e r m i n e   t h e   d i r e c t i o n   f o r   t h e   b l e n d i n g ,   i f   s t a r t   a n d   e n d   a r e   t h e   s a m e   n o t h i n g   h a p p e n s 
 	 i f ( o p a c S t a r t   >   o p a c E n d )   { 
 	 	 f o r ( i   =   o p a c S t a r t ;   i   > =   o p a c E n d ;   i - - )   { 
 	 	 	 s e t T i m e o u t ( " c h a n g e O p a c ( "   +   i   +   " , ' "   +   i d   +   " ' ) " , ( t i m e r   *   s p e e d ) ) ; 
 	 	 	 t i m e r + + ; 
 	 	 } 
 	 }   e l s e   i f ( o p a c S t a r t   <   o p a c E n d )   { 
 	 	 f o r ( i   =   o p a c S t a r t ;   i   < =   o p a c E n d ;   i + + ) 
 	 	 	 { 
 	 	 	 s e t T i m e o u t ( " c h a n g e O p a c ( "   +   i   +   " , ' "   +   i d   +   " ' ) " , ( t i m e r   *   s p e e d ) ) ; 
 	 	 	 t i m e r + + ; 
 	 	 } 
 	 } 
 } 
 
 / / c h a n g e   t h e   o p a c i t y   f o r   d i f f e r e n t   b r o w s e r s 
 f u n c t i o n   c h a n g e O p a c ( o p a c i t y ,   i d )   { 
 	 v a r   o b j e c t   =   d o c u m e n t . g e t E l e m e n t B y I d ( i d ) . s t y l e ;   
 	 o b j e c t . o p a c i t y   =   ( o p a c i t y   /   1 0 1 ) ; 
 	 o b j e c t . M o z O p a c i t y   =   ( o p a c i t y   /   1 0 1 ) ; 
 	 o b j e c t . K h t m l O p a c i t y   =   ( o p a c i t y   /   1 0 0 ) ; 
 	 o b j e c t . f i l t e r   =   " a l p h a ( o p a c i t y = "   +   o p a c i t y   +   " ) " ; 
 } 
 
 f u n c t i o n   s h i f t O p a c i t y ( i d ,   m i l l i s e c )   { 
 	 / / i f   a n   e l e m e n t   i s   i n v i s i b l e ,   m a k e   i t   v i s i b l e ,   e l s e   m a k e   i t   i v i s i b l 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 ( i d ) . s t y l e . o p a c i t y   = =   0 )   { 
 	 	 o p a c i t y ( i d ,   0 ,   1 0 0 ,   m i l l i s e c ) ; 
 	 }   e l s e   { 
 	 	 o p a c i t y ( i d ,   1 0 0 ,   0 ,   m i l l i s e c ) ; 
 	 } 
 } 
 
 f u n c t i o n   b l e n d i m a g e ( d i v i d ,   i m a g e i d ,   i m a g e f i l e ,   m i l l i s e c )   { 
 	 v a r   s p e e d   =   M a t h . r o u n d ( m i l l i s e c   /   1 0 0 ) ; 
 	 v a r   t i m e r   =   0 ; 
 	 
 	 / / s e t   t h e   c u r r e n t   i m a g e   a s   b a c k g r o u n d 
 	 d o c u m e n t . g e t E l e m e n t B y I d ( d i v i d ) . s t y l e . b a c k g r o u n d I m a g e   =   " u r l ( "   +   d o c u m e n t . g e t E l e m e n t B y I d ( i m a g e i d ) . s r c   +   " ) " ; 
 	 
 	 / / m a k e   i m a g e   t r a n s p a r e n t 
 	 c h a n g e O p a c ( 0 ,   i m a g e i d ) ; 
 	 
 	 / / m a k e   n e w   i m a g e 
 	 d o c u m e n t . g e t E l e m e n t B y I d ( i m a g e i d ) . s r c   =   i m a g e f i l e ; 
 
 	 / / f a d e   i n   i m a g e 
 	 f o r ( i   =   0 ;   i   < =   1 0 0 ;   i + + )   { 
 	 	 s e t T i m e o u t ( " c h a n g e O p a c ( "   +   i   +   " , ' "   +   i m a g e i d   +   " ' ) " , ( t i m e r   *   s p e e d ) ) ; 
 	 	 t i m e r + + ; 
 	 } 
 } 
 
 f u n c t i o n   c u r r e n t O p a c ( i d ,   o p a c E n d ,   m i l l i s e c )   { 
 	 / / s t a n d a r d   o p a c i t y   i s   1 0 0 
 	 v a r   c u r r e n t O p a c   =   1 0 0 ; 
 	 
 	 / / i f   t h e   e l e m e n t   h a s   a n   o p a c i t y   s e t ,   g e t   i t 
 	 i f ( d o c u m e n t . g e t E l e m e n t B y I d ( i d ) . s t y l e . o p a c i t y   <   1 0 0 )   { 
 	 	 c u r r e n t O p a c   =   d o c u m e n t . g e t E l e m e n t B y I d ( i d ) . s t y l e . o p a c i t y   *   1 0 0 ; 
 	 } 
 
 	 / / c a l l   f o r   t h e   f u n c t i o n   t h a t   c h a n g e s   t h e   o p a c i t y 
 	 o p a c i t y ( i d ,   c u r r e n t O p a c ,   o p a c E n d ,   m i l l i s e c ) 
 }