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