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