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