ÿþ/ /   S Ñ  l °ãn g   b ô n g   T u y ¿t  
 v a r   s n o w m a x = 6 0  
  
 / /   C h Ín   m à u   c h o   b ô n g   T u y ¿t  
 v a r   s n o w c o l o r = n e w   A r r a y ( " # A A A A C C " , " # D D D D F F " , " # C C C C D D " , " # F 3 F 3 F 3 " , " # F 0 F F F F " )  
  
 / /   C h Ín   F o n t   c h ï  c h o   B ô n g   t u y ¿t  
 v a r   s n o w t y p e = n e w   A r r a y ( " A r i a l   B l a c k " , " A r i a l   N a r r o w " , " T i m e s " , " C o m i c   S a n s   M S " )  
  
 / /   K i Ãu   b ô n g   t u y ¿t   ( V D :   " * " )  
 v a r   s n o w l e t t e r = " * "  
  
 / /   T Ñc   Ù  ( r e c o m m e n d e d   v a l u e s   r a n g e   f r o m   0 . 3   t o   2 )  
 v a r   s i n k s p e e d = 0 . 6  
  
 / /   k í c h   t h °Ûc   l Ûn   n h ¥t   c h o   b ô n g   t u y ¿t  
 v a r   s n o w m a x s i z e = 2 5  
  
 / /   k í c h   t h °Ûc   n h Ï  n h ¥t   c h o   b ô n g   t u y ¿t  
 v a r   s n o w m i n s i z e = 1 2  
  
  
 / /   S e t   1   f o r   a l l - o v e r - s n o w i n g ,   s e t   2   f o r   l e f t - s i d e - s n o w i n g  
 / /   S e t   3   f o r   c e n t e r - s n o w i n g ,   s e t   4   f o r   r i g h t - s i d e - s n o w i n g  
 v a r   s n o w i n g z o n e = 1  
  
     / *  
       / /       *   N O   C O N F I G U R A T I O N   B E L O W   H E R E   *  
 * /  
  
 / /   p h §n   d °Ûi   â y   t Ñt   n h ¥t   l à   k o   n ê n   c h Én h   s ía  
 v a r   s n o w = n e w   A r r a y ( )  
 v a r   m a r g i n b o t t o m  
 v a r   m a r g i n r i g h t  
 v a r   t i m e r  
 v a r   i _ s n o w = 0  
 v a r   x _ m v = n e w   A r r a y ( ) ;  
 v a r   c r d s = n e w   A r r a y ( ) ;  
 v a r   l f t r g h t = n e w   A r r a y ( ) ;  
 v a r   b r o w s e r i n f o s = n a v i g a t o r . u s e r A g e n t  
 v a r   i e 5 = d o c u m e n t . a l l & & d o c u m e n t . g e t E l e m e n t B y I d & & ! b r o w s e r i n f o s . m a t c h ( / O p e r a / )  
 v a r   n s 6 = 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 . a l l  
 v a r   o p e r a = b r o w s e r i n f o s . m a t c h ( / O p e r a / )      
 v a r   b r o w s e r o k = i e 5 | | n s 6 | | o p e r a  
  
 f u n c t i o n   r a n d o m m a k e r ( r a n g e )   {                  
         r a n d = M a t h . f l o o r ( r a n g e * M a t h . r a n d o m ( ) )  
         r e t u r n   r a n d  
 }  
  
 f u n c t i o n   i n i t s n o w ( )   {  
         i f   ( i e 5   | |   o p e r a )   {  
                 m a r g i n b o t t o m   =   d o c u m e n t . b o d y . c l i e n t H e i g h t  
                 m a r g i n r i g h t   =   d o c u m e n t . b o d y . c l i e n t W i d t h  
         }  
         e l s e   i f   ( n s 6 )   {  
                 m a r g i n b o t t o m   =   w i n d o w . i n n e r H e i g h t  
                 m a r g i n r i g h t   =   w i n d o w . i n n e r W i d t h  
         }  
         v a r   s n o w s i z e r a n g e = s n o w m a x s i z e - s n o w m i n s i z e  
         f o r   ( i = 0 ; i < = s n o w m a x ; i + + )   {  
                 c r d s [ i ]   =   0 ;                                              
                 l f t r g h t [ i ]   =   M a t h . r a n d o m ( ) * 1 5 ;                  
                 x _ m v [ i ]   =   0 . 0 3   +   M a t h . r a n d o m ( ) / 1 0 ;  
                 s n o w [ i ] = d o c u m e n t . g e t E l e m e n t B y I d ( " s " + i )  
                 s n o w [ i ] . s t y l e . f o n t F a m i l y = s n o w t y p e [ r a n d o m m a k e r ( s n o w t y p e . l e n g t h ) ]  
                 s n o w [ i ] . s i z e = r a n d o m m a k e r ( s n o w s i z e r a n g e ) + s n o w m i n s i z e  
                 s n o w [ i ] . s t y l e . f o n t S i z e = s n o w [ i ] . s i z e  
                 s n o w [ i ] . s t y l e . c o l o r = s n o w c o l o r [ r a n d o m m a k e r ( s n o w c o l o r . l e n g t h ) ]  
                 s n o w [ i ] . s i n k = s i n k s p e e d * s n o w [ i ] . s i z e / 5  
                 i f   ( s n o w i n g z o n e = = 1 )   { s n o w [ i ] . p o s x = r a n d o m m a k e r ( m a r g i n r i g h t - s n o w [ i ] . s i z e ) }  
                 i f   ( s n o w i n g z o n e = = 2 )   { s n o w [ i ] . p o s x = r a n d o m m a k e r ( m a r g i n r i g h t / 2 - s n o w [ i ] . s i z e ) }  
                 i f   ( s n o w i n g z o n e = = 3 )   { s n o w [ i ] . p o s x = r a n d o m m a k e r ( m a r g i n r i g h t / 2 - s n o w [ i ] . s i z e ) + m a r g i n r i g h t / 4 }  
                 i f   ( s n o w i n g z o n e = = 4 )   { s n o w [ i ] . p o s x = r a n d o m m a k e r ( m a r g i n r i g h t / 2 - s n o w [ i ] . s i z e ) + m a r g i n r i g h t / 2 }  
                 s n o w [ i ] . p o s y = r a n d o m m a k e r ( 2 * m a r g i n b o t t o m - m a r g i n b o t t o m - 2 * s n o w [ i ] . s i z e )  
                 s n o w [ i ] . s t y l e . l e f t = s n o w [ i ] . p o s x  
                 s n o w [ i ] . s t y l e . t o p = s n o w [ i ] . p o s y  
         }  
         m o v e s n o w ( )  
 }  
  
 f u n c t i o n   m o v e s n o w ( )   {  
         f o r   ( i = 0 ; i < = s n o w m a x ; i + + )   {  
                 c r d s [ i ]   + =   x _ m v [ i ] ;  
                 s n o w [ i ] . p o s y + = s n o w [ i ] . s i n k  
                 s n o w [ i ] . s t y l e . l e f t = s n o w [ i ] . p o s x + l f t r g h t [ i ] * M a t h . s i n ( c r d s [ i ] ) ;  
                 s n o w [ i ] . s t y l e . t o p = s n o w [ i ] . p o s y  
                  
                 i f   ( s n o w [ i ] . p o s y > = m a r g i n b o t t o m - 2 * s n o w [ i ] . s i z e   | |   p a r s e I n t ( s n o w [ i ] . s t y l e . l e f t ) > ( m a r g i n r i g h t - 3 * l f t r g h t [ i ] ) ) {  
                         i f   ( s n o w i n g z o n e = = 1 )   { s n o w [ i ] . p o s x = r a n d o m m a k e r ( m a r g i n r i g h t - s n o w [ i ] . s i z e ) }  
                         i f   ( s n o w i n g z o n e = = 2 )   { s n o w [ i ] . p o s x = r a n d o m m a k e r ( m a r g i n r i g h t / 2 - s n o w [ i ] . s i z e ) }  
                         i f   ( s n o w i n g z o n e = = 3 )   { s n o w [ i ] . p o s x = r a n d o m m a k e r ( m a r g i n r i g h t / 2 - s n o w [ i ] . s i z e ) + m a r g i n r i g h t / 4 }  
                         i f   ( s n o w i n g z o n e = = 4 )   { s n o w [ i ] . p o s x = r a n d o m m a k e r ( m a r g i n r i g h t / 2 - s n o w [ i ] . s i z e ) + m a r g i n r i g h t / 2 }  
                         s n o w [ i ] . p o s y = 0  
                 }  
         }  
         v a r   t i m e r = s e t T i m e o u t ( " m o v e s n o w ( ) " , 5 0 )  
 }  
  
 f o r   ( i = 0 ; i < = s n o w m a x ; i + + )   {  
         d o c u m e n t . w r i t e ( " < s p a n   i d = ' s " + i + " '   s t y l e = ' p o s i t i o n : a b s o l u t e ; t o p : - " + s n o w m a x s i z e + " ' > " + s n o w l e t t e r + " < / s p a n > " )  
 }  
 i f   ( b r o w s e r o k )   {  
         w i n d o w . o n l o a d = i n i t s n o w  
 } 
