ÿþ 
 f u n c t i o n   r e m a i n t i m e ( T i m e L e f t ,   f o r m a t )  
 {  
           h t m l _ c o d e   =   ' < d i v   i d = " c o u n t d o w n " > < / d i v > ' ;  
           d o c u m e n t . w r i t e ( h t m l _ c o d e ) ;  
           c o u n t d o w n ( T i m e L e f t ,   f o r m a t ) ;                                  
 }  
 f u n c t i o n   c o u n t d o w n ( T i m e _ L e f t ,   f o r m a t )  
 {  
 	 T i m e L e f t = T i m e _ L e f t ;  
 	 i f ( T i m e _ L e f t   <   0 )  
 	 {  
 	         w i n d o w . l o c a t i o n . r e l o a d ( ) ;  
 	 }  
 	  
 	 s w i t c h ( f o r m a t )  
 	 {  
 	 	 c a s e   0 :  
 	 	 	 / / T h e   s i m p l e s t   w a y   t o   d i s p l a y   t h e   t i m e   l e f t .  
 	 	 	 d o c u m e n t . a l l . c o u n t d o w n . i n n e r H T M L   =   T i m e _ L e f t   +   '   g i â y ' ;  
 	 	 	 b r e a k ;  
 	 	 c a s e   1 :  
 	 	 	 / / M o r e   d a t a i l e d .  
 	 	 	  
 	 	 	 d a y s   =   M a t h . f l o o r ( T i m e _ L e f t   /   ( 6 0   *   6 0   *   2 4 ) ) ;  
 	 	 	 T i m e _ L e f t   % =   ( 6 0   *   6 0   *   2 4 ) ;  
 	 	 	 h o u r s   =   M a t h . f l o o r ( T i m e _ L e f t   /   ( 6 0   *   6 0 ) ) ;  
 	 	 	 T i m e _ L e f t   % =   ( 6 0   *   6 0 ) ;  
 	 	 	 m i n u t e s   =   M a t h . f l o o r ( T i m e _ L e f t   /   6 0 ) ;  
 	 	 	 T i m e _ L e f t   % =   6 0 ;  
 	 	 	 s e c o n d s   =   T i m e _ L e f t ;  
 	 	 	  
 	 	 	 d p s   =   ' ' ;   h p s   =   ' ' ;   m p s   =   ' ' ;   s p s   =   ' ' ;  
 	 	 	 / / p s   i s   s h o r t   f o r   p l u r a l   s u f f i x .  
 	 	 	 i f ( d a y s   = =   1 )   d p s   = ' ' ;  
 	 	 	 i f ( h o u r s   = =   1 )   h p s   = ' ' ;  
 	 	 	 i f ( m i n u t e s   = =   1 )   m p s   = ' ' ;  
 	 	 	 i f ( s e c o n d s   = =   1 )   s p s   = ' ' ;  
 	 	 	  
 	 	 	 a   =   ' ' ;  
 	 	 	 a   =   d a y s   +   '   n g à y '   +   d p s   +   '   ' ;  
 	 	 	 a   + =   h o u r s   +   '   g i Ý'   +   h p s   +   '   ' ;  
 	 	 	 a   + =   m i n u t e s   +   '   p h ú t '   +   m p s   +   '   ' ;  
 	 	 	 a   + =   M a t h . r o u n d ( s e c o n d s )   +   '   g i â y '   +   s p s ;  
 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' c o u n t d o w n ' ) . i n n e r H T M L   =   a ;  
 	 	 	 b r e a k ;  
 	 	 d e f a u l t :    
 	 	 	 d o c u m e n t . a l l . c o u n t d o w n . i n n e r H T M L   =   T i m e _ L e f t   +   '   g i â y ' ;  
 	 } 	 	 	 	 	  
 	 s e t T i m e o u t ( " c o u n t d o w n ( "   +   ( T i m e L e f t - 1 )   + " , " + f o r m a t +   " ) " ,   1 0 0 0 ) ; 	 	  
 }  
 
