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