ÿþv a r   m o n t h   =   ' 9 ' ;   / /   1   t h r o u g h   1 2   o r   ' * '   w i t h i n   t h e   n e x t   m o n t h ,   ' 0 '   f o r   t h e   c u r r e n t   m o n t h  
 v a r   d a y   =   ' 1 6 ' ;       / /   d a y   o f   m o n t h   o r   +   d a y   o f f s e t  
 v a r   d o w   =   0 ;           / /   d a y   o f   w e e k   s u n = 1   s a t = 7   o r   0   f o r   w h a t e v e r   d a y   i t   f a l l s   o n  
 v a r   h o u r   =   1 3 ;         / /   0   t h r o u g h   2 3   f o r   t h e   h o u r   o f   t h e   d a y  
 v a r   m i n   =   0 ;         / /   0   t h r o u g h   5 9   f o r   m i n u t e s   a f t e r   t h e   h o u r  
 v a r   t z   =   - 5 ;           / /   o f f s e t   i n   h o u r s   f r o m   U T C   t o   y o u r   t i m e z o n e  
 v a r   l a b   =   ' _ c o u n t d o w n ' ;     / /   i d   o f   t h e   e n t r y   o n   t h e   p a g e   w h e r e   t h e   c o u n t e r   i s   t o   b e   i n s e r t e d  
  
 f u n c t i o n   s t a r t ( )    
 	 {  
 	 	 d i s p l a y C o u n t d o w n ( s e t C o u n t d o w n ( m o n t h , d a y , h o u r , m i n , t z ) , l a b ) ;  
 	 }  
  
 l o a d e d ( l a b , s t a r t ) ;  
  
 v a r   p a g e L o a d e d   =   0 ;   w i n d o w . o n l o a d   =   f u n c t i o n ( )   { p a g e L o a d e d   =   1 ; }  
  
 f u n c t i o n   l o a d e d ( i , f )    
 	 {  
 	 	 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 . g e t E l e m e n t B y I d ( i )   ! =   n u l l )    
 	 	 	 f ( ) ;    
 	 	 e l s e   i f   ( ! p a g e L o a d e d )    
 	 	 	 s e t T i m e o u t ( ' l o a d e d ( \ ' ' + i + ' \ ' , ' + f + ' ) ' , 1 0 0 ) ;  
 	 }  
  
 f u n c t i o n   s e t C o u n t d o w n ( m o n t h , d a y , h o u r , m i n , t z )    
 	 {  
 	 	 v a r   m   =   m o n t h ;    
 	 	 i f   ( m o n t h = = ' * ' )   m   =   0 ;      
 	 	  
 	 	 v a r   c   =   s e t C ( m , d a y , h o u r , t z ) ;    
 	 	 i f   ( m o n t h   = =   ' * '   & &   c   <   0 )      
 	 	 	 c   =   s e t C ( ' * ' , d a y , h o u r , t z ) ;    
 	 	 r e t u r n   c ;  
 	 }    
  
 f u n c t i o n   s e t C ( m o n t h , d a y , h o u r , t z )    
 	 {  
 	 	 v a r   t o D a t e   =   n e w   D a t e ( ) ;  
 	 	 i f   ( d a y . s u b s t r ( 0 , 1 )   = =   ' + ' )    
 	 	 {  
 	 	 	 v a r   d a y 1   =   p a r s e I n t ( d a y . s u b s t r ( 1 ) ) ;  
 	 	 	 t o D a t e . s e t D a t e ( t o D a t e . g e t D a t e ( ) + d a y 1 ) ;  
 	 	 }    
 	 	 e l s e  
 	 	 {  
 	 	 	 t o D a t e . s e t D a t e ( d a y ) ;  
 	 	 }  
 	 	 i f   ( m o n t h   = =   ' * ' )   t o D a t e . s e t M o n t h ( t o D a t e . g e t M o n t h ( )   +   1 ) ;  
 	 	 e l s e   i f   ( m o n t h   >   0 )    
 	 	 {    
 	 	 	 i f   ( m o n t h   < =   t o D a t e . g e t M o n t h ( ) )   t o D a t e . s e t F u l l Y e a r ( t o D a t e . g e t F u l l Y e a r ( )   +   1 ) ;  
 	 	 	 t o D a t e . s e t M o n t h ( m o n t h - 1 ) ;  
 	 	 }  
 	 	 i f   ( d o w   > 0 )   t o D a t e . s e t D a t e ( t o D a t e . g e t D a t e ( ) + ( d o w - 1 - t o D a t e . g e t D a y ( ) ) % 7 ) ;  
 	 	 t o D a t e . s e t H o u r s ( h o u r ) ;  
 	 	 t o D a t e . s e t M i n u t e s ( m i n - ( t z * 6 0 ) ) ;  
 	 	 t o D a t e . s e t S e c o n d s ( 0 ) ;  
 	 	 v a r   f r o m D a t e   =   n e w   D a t e ( ) ;  
 	 	 f r o m D a t e . s e t M i n u t e s ( f r o m D a t e . g e t M i n u t e s ( )   +   f r o m D a t e . g e t T i m e z o n e O f f s e t ( ) ) ;  
 	 	 v a r   d i f f D a t e   =   n e w   D a t e ( 0 ) ;  
 	 	 d i f f D a t e . s e t M i l l i s e c o n d s ( t o D a t e   -   f r o m D a t e ) ;  
 	 	 r e t u r n   M a t h . f l o o r ( d i f f D a t e . v a l u e O f ( ) / 1 0 0 0 ) ;  
 	 }  
  
 f u n c t i o n   d i s p l a y C o u n t d o w n ( c o u n t d n , c d )    
 	 {  
 	         i f   ( c o u n t d n   <   0 )    
 	 	         d o c u m e n t . g e t E l e m e n t B y I d ( c d ) . i n n e r H T M L   =   " 3 - >9  !"  !  !"   '!/!   # ! " ;    
 	 	 e l s e    
 	 	 {  
 	 	 	 v a r   s e c s   =   c o u n t d n   %   6 0 ;    
 	 	 	 i f   ( s e c s   <   1 0 )   s e c s   =   ' 0 ' + s e c s ;  
 	 	 	 v a r   c o u n t d n 1   =   ( c o u n t d n   -   s e c s )   /   6 0 ;  
 	 	 	 v a r   m i n s   =   c o u n t d n 1   %   6 0 ;    
 	 	 	 i f   ( m i n s   <   1 0 )   m i n s   =   ' 0 ' + m i n s ;  
 	 	 	 c o u n t d n 1   =   ( c o u n t d n 1   -   m i n s )   /   6 0 ;  
 	 	 	 v a r   h o u r s   =   c o u n t d n 1   %   2 4 ;  
 	 	 	 v a r   d a y s   =   ( c o u n t d n 1   -   h o u r s )   /   2 4 ;  
 	 	 	  
 	 	 	 v a r   d a y s S t r = d a y s + ' ' ;  
 	 	 	 v a r   l e n = d a y s S t r . l e n g t h ;  
 	 	 	 v a r   f i r s t _ c h a r   =   d a y s S t r . c h a r A t ( 0 ) ;  
             v a r   l a s t _ c h a r   =   d a y s S t r . c h a r A t ( l e n - 1 ) ;  
             v a r   d a y s _ t e x t   =   ' ' ;  
              
             i f   ( l e n > 1   & &   f i r s t _ c h a r   = = ' 1 ' )  
             {  
             	 	 d a y s _ t e x t   =   d a y s + '   4=59  ' ;  
             }  
 	 	 	 e l s e   i f   ( l a s t _ c h a r = = ' 1 ' )  
 	 	 	 {  
 	 	 	         d a y s _ t e x t   =   d a y s + '   45=L  ' ;  
 	 	 	 }  
 	 	 	 e l s e   i f   ( l a s t _ c h a r > ' 4 '   | |   l a s t _ c h a r = = ' 0 ' )  
 	 	 	 {  
 	 	 	         d a y s _ t e x t   =   d a y s + '   4=59  ' ;  
 	 	 	 }  
 	 	 	 e l s e  
 	 	 	 {  
 	 	 	         d a y s _ t e x t   =   d a y s + '   4=O  ' ;  
 	 	 	 }  
 	 	 	  
 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( c d ) . i n n e r H T M L   =   ' >  =>2>3>  A;QB0  -   ' + d a y s _ t e x t + '   ' + h o u r s + ' : ' + m i n s + ' : ' + s e c s + ' ! ' ;  
 	 	 	 s e t T i m e o u t ( ' d i s p l a y C o u n t d o w n ( ' + ( c o u n t d n - 1 ) + ' , \ ' ' + c d + ' \ ' ) ; ' , 9 9 9 ) ;  
 	 	 }  
 	 } 
