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