ÿþv a r   z o n e ;  
 v a r   l a n g u a g e   =   ' v i ' ;   / /   D e f a u l t   L a n g u a g e :   e n   -   e n g l i s h   ;   e s   -   s p a n i s h ;   d e   -   g e r m a n  
 v a r   e n a b l e P a s t   =   1 ;   	 / /   0   -   d i s a b l e d   ;   1   -   e n a b l e d  
 v a r   e n a b l e F u t u r e   =   1 ;       / /   0   -   d i s a b l e d   ;   1   -   e n a b l e d  
 v a r   f i x e d X   =   - 1 ;   	 / /   x   p o s i t i o n   ( - 1   i f   t o   a p p e a r   b e l o w   c o n t r o l )  
 v a r   f i x e d Y   =   - 1 ;   	 / /   y   p o s i t i o n   ( - 1   i f   t o   a p p e a r   b e l o w   c o n t r o l )  
 v a r   s t a r t A t   =   1 ;   	 / /   0   -   s u n d a y   ;   1   -   m o n d a y  
 v a r   s h o w W e e k N u m b e r   =   1 ;   / /   0   -   d o n ' t   s h o w ;   1   -   s h o w  
 v a r   s h o w T o d a y   =   1 ;   	 / /   0   -   d o n ' t   s h o w ;   1   -   s h o w  
 v a r   i m g D i r   =   ' / D e s k t o p M o d u l e s / A G . A r t i c l e A d v a n c e S e a r c h I n p u t / i m a g e s / ' ;   	 / /   d i r e c t o r y   f o r   i m a g e s   . . .   e . g .   v a r   i m g D i r = " / i m g / "  
 v a r   d a y N a m e   =   ' ' ;  
 v a r   f u l l d a y N a m e   =   ' ' ;  
 v a r   g o t o S t r i n g   =   {  
         e n :   ' G o   T o   C u r r e n t   M o n t h ' ,  
         e s :   ' I r   a l   M e s   A c t u a l ' ,  
         d e :   ' G e h e   z u   a k t u e l l e m   M o n a t ' ,  
         v i :   ' C h Ín   t h á n g   n à y '  
 } ;  
 v a r   t o d a y S t r i n g   =   {  
         e n :   ' T o d a y   i s ' ,  
         e s :   ' H o y   e s ' ,  
         d e :   ' H e u t e   i s t ' ,  
         v i :   ' H ô m   n a y   l à '  
 } ;  
 v a r   w e e k S t r i n g   =   {  
         e n :   ' W k ' ,  
         e s :   ' S e m ' ,  
         d e :   ' K W ' ,  
         v i :   ' T u §n '  
 } ;  
 v a r   s c r o l l L e f t M e s s a g e   =   {  
         e n :   ' C l i c k   t o   s c r o l l   t o   p r e v i o u s   m o n t h .   H o l d   m o u s e   b u t t o n   t o   s c r o l l   a u t o m a t i c a l l y . ' ,  
         e s :   ' P r e s i o n e   p a r a   p a s a r   a l   m e s   a n t e r i o r .   D e j e   p r e s i o n a d o   p a r a   p a s a r   v a r i o s   m e s e s . ' ,  
         d e :   ' K l i c k e n   u m   z u m   v o r i g e n   M o n a t   z u   g e l a n g e n .   G e d r ü c k t   h a l t e n ,   u m   a u t o m a t i s c h   w e i t e r   z u   s c r o l l e n . ' ,  
         v i :   ' C l i c k   Ã  c h Ín   t h á n g   t r °Ûc .   G i ï  c h u Ùt   Ã  t r °ãt   t ñ  Ùn g . '  
 } ;  
 v a r   s c r o l l R i g h t M e s s a g e   =   {  
         e n :   ' C l i c k   t o   s c r o l l   t o   n e x t   m o n t h .   H o l d   m o u s e   b u t t o n   t o   s c r o l l   a u t o m a t i c a l l y . ' ,  
         e s :   ' P r e s i o n e   p a r a   p a s a r   a l   s i g u i e n t e   m e s .   D e j e   p r e s i o n a d o   p a r a   p a s a r   v a r i o s   m e s e s . ' ,  
         d e :   ' K l i c k e n   u m   z u m   n ä c h s t e n   M o n a t   z u   g e l a n g e n .   G e d r ü c k t   h a l t e n ,   u m   a u t o m a t i s c h   w e i t e r   z u   s c r o l l e n . ' ,  
         v i :   ' C l i c k   Ã  c h Ín   t h á n g   s a u .   G i ï  c h u Ùt   Ã  t r °ãt   t ñ  Ùn g . '  
 } ;  
 v a r   s e l e c t M o n t h M e s s a g e   =   {  
         e n :   ' C l i c k   t o   s e l e c t   a   m o n t h . ' ,  
         e s :   ' P r e s i o n e   p a r a   s e l e c c i o n a r   u n   m e s ' ,  
         d e :   ' K l i c k e n   u m   M o n a t   a u s z u w ä h l e n ' ,  
         v i :   ' C l i c k   Ã  c h Ín   t h á n g . '  
 } ;  
 v a r   s e l e c t Y e a r M e s s a g e   =   {  
         e n :   ' C l i c k   t o   s e l e c t   a   y e a r . ' ,  
         e s :   ' P r e s i o n e   p a r a   s e l e c c i o n a r   u n   a ñ o ' ,  
         d e :   ' K l i c k e n   u m   J a h r   a u s z u w ä h l e n ' ,  
         v i :   ' C l i c k   Ã  c h Ín   n m . '  
 } ;  
 v a r   s e l e c t D a t e M e s s a g e   =   { 	 	 / /   d o   n o t   r e p l a c e   [ d a t e ] ,   i t   w i l l   b e   r e p l a c e d   b y   d a t e .  
         e n :   ' S e l e c t   [ d a t e ]   a s   d a t e . ' ,  
         e s :   ' S e l e c c i o n e   [ d a t e ]   c o m o   f e c h a ' ,  
         d e :   ' W ä h l e   [ d a t e ]   a l s   D a t u m . ' ,  
         v i :   ' C h Ín   n g à y   [ d a t e ] '  
 } ;  
 v a r   m o n t h N a m e   =   {  
         e n :   n e w   A r r a y ( ' J a n u a r y ' ,   ' F e b r u a r y ' ,   ' M a r c h ' ,   ' A p r i l ' ,   ' M a y ' ,   ' J u n e ' ,   ' J u l y ' ,   ' A u g u s t ' ,   ' S e p t e m b e r ' ,   ' O c t o b e r ' ,   ' N o v e m b e r ' ,   ' D e c e m b e r ' ) ,  
         e s :   n e w   A r r a y ( ' E n e r o ' ,   ' F e b r e r o ' ,   ' M a r z o ' ,   ' A b r i l ' ,   ' M a y o ' ,   ' J u n i o ' ,   ' J u l i o ' ,   ' A g o s t o ' ,   ' S e p t i e m b r e ' ,   ' O c t u b r e ' ,   ' N o v i e m b r e ' ,   ' D i c i e m b r e ' ) ,  
         d e :   n e w   A r r a y ( ' J a n u a r ' ,   ' F e b r u a r ' ,   ' M ä r z ' ,   ' A p r i l ' ,   ' M a i ' ,   ' J u n i ' ,   ' J u l i ' ,   ' A u g u s t ' ,   ' S e p t e m b e r ' ,   ' O k t o b e r ' ,   ' N o v e m b e r ' ,   ' D e z e m b e r ' ) ,  
         v i :   n e w   A r r a y ( ' T h á n g   G i ê n g ' ,   ' T h á n g   H a i ' ,   ' T h á n g   B a ' ,   ' T h á n g   T °' ,   ' T h á n g   N m ' ,   ' T h á n g   S á u ' ,   ' T h á n g   B £y ' ,   ' T h á n g   T á m ' ,   ' T h á n g   C h í n ' ,   ' T h á n g   M °Ýi ' ,   ' T h á n g   M °Ýi   M Ùt ' ,   ' T h á n g   M °Ýi   H a i ' )  
 } ;  
 v a r   m o n t h N a m e 2   =   {  
         e n :   n e w   A r r a y ( ' J A N ' ,   ' F E B ' ,   ' M A R ' ,   ' A P R ' ,   ' M A Y ' ,   ' J U N ' ,   ' J U L ' ,   ' A U G ' ,   ' S E P ' ,   ' O C T ' ,   ' N O V ' ,   ' D E C ' ) ,  
         e s :   n e w   A r r a y ( ' E N E ' ,   ' F E B ' ,   ' M A R ' ,   ' A B R ' ,   ' M A Y ' ,   ' J U N ' ,   ' J U L ' ,   ' A G O ' ,   ' S E P ' ,   ' O C T ' ,   ' N O V ' ,   ' D I C ' ) ,  
         d e :   n e w   A r r a y ( ' J A N ' ,   ' F E B ' ,   ' M R Z ' ,   ' A P R ' ,   ' M A I ' ,   ' J U N ' ,   ' J U L ' ,   ' A U G ' ,   ' S E P ' ,   ' O K T ' ,   ' N O V ' ,   ' D E Z ' ) ,  
         v i :   n e w   A r r a y ( ' G i ê n g ' ,   ' H a i ' ,   ' B a ' ,   ' T °' ,   ' N m ' ,   ' S á u ' ,   ' B £y ' ,   ' T á m ' ,   ' C h í n ' ,   ' M °Ýi ' ,   ' M °Ýi   M Ùt ' ,   ' C h ¡p ' )  
 } ;  
  
 i f   ( s t a r t A t   = =   0 )   {  
         d a y N a m e   =   {  
                 e n :   n e w   A r r a y ( ' S u n ' ,   ' M o n ' ,   ' T u e ' ,   ' W e d ' ,   ' T h u ' ,   ' F r i ' ,   ' S a t ' ) ,  
                 e s :   n e w   A r r a y ( ' D o m ' ,   ' L u n ' ,   ' M a r ' ,   ' M i e ' ,   ' J u e ' ,   ' V i e ' ,   ' S a b ' ) ,  
                 d e :   n e w   A r r a y ( ' S o ' ,   ' M o ' ,   ' D i ' ,   ' M i ' ,   ' D o ' ,   ' F r ' ,   ' S a ' ) ,  
                 v i :   n e w   A r r a y ( ' C N ' ,   ' H a i ' ,   ' B a ' ,   ' T °' ,   ' N m ' ,   ' S á u ' ,   ' B £y ' )  
         } ;  
         f u l l d a y N a m e   =   {  
                 e n :   n e w   A r r a y ( ' S u n d a y ' ,   ' M o n d a y ' ,   ' T u e s d a y ' ,   ' W e d n e s d a y ' ,   ' T h u r s d a y ' ,   ' F r i d a y ' ,   ' S a t u r d a y ' ) ,  
                 e s :   n e w   A r r a y ( ' D o m ' ,   ' L u n ' ,   ' M a r ' ,   ' M i e ' ,   ' J u e ' ,   ' V i e ' ,   ' S a b ' ) ,  
                 d e :   n e w   A r r a y ( ' S o ' ,   ' M o ' ,   ' D i ' ,   ' M i ' ,   ' D o ' ,   ' F r ' ,   ' S a ' ) ,  
                 v i :   n e w   A r r a y ( " C h ç  N h ­t " ,   " T h é  H a i " ,   " T h é  B a " ,   " T h é  T °" ,   " T h é  N m " ,   " T h é  S á u " ,   " T h é  B £y " )  
         }  
 }   e l s e   {  
         d a y N a m e   =   {  
                 e n :   n e w   A r r a y ( ' M o n ' ,   ' T u e ' ,   ' W e d ' ,   ' T h u ' ,   ' F r i ' ,   ' S a t ' ,   ' S u n ' ) ,  
                 e s :   n e w   A r r a y ( ' L u n ' ,   ' M a r ' ,   ' M i e ' ,   ' J u e ' ,   ' V i e ' ,   ' S a b ' ,   ' D o m ' ) ,  
                 d e :   n e w   A r r a y ( ' M o ' ,   ' D i ' ,   ' M i ' ,   ' D o ' ,   ' F r ' ,   ' S a ' ,   ' S o ' ) ,  
                 v i :   n e w   A r r a y ( ' H a i ' ,   ' B a ' ,   ' T °' ,   ' N m ' ,   ' S á u ' ,   ' B £y ' ,   ' C N ' )  
         } ;  
         f u l l d a y N a m e   =   {  
                 e n :   n e w   A r r a y ( ' M o n d a y ' ,   ' T u e s d a y ' ,   ' W e d n e s d a y ' ,   ' T h u r s d a y ' ,   ' F r i d a y ' ,   ' S a t u r d a y ' ,   ' S u n d a y ' ) ,  
                 e s :   n e w   A r r a y ( ' L u n ' ,   ' M a r ' ,   ' M i e ' ,   ' J u e ' ,   ' V i e ' ,   ' S a b ' ,   ' D o m ' ) ,  
                 d e :   n e w   A r r a y ( ' M o ' ,   ' D i ' ,   ' M i ' ,   ' D o ' ,   ' F r ' ,   ' S a ' ,   ' S o ' ) ,  
                 v i :   n e w   A r r a y ( " T h é  H a i " ,   " T h é  B a " ,   " T h é  T °" ,   " T h é  N m " ,   " T h é  S á u " ,   " T h é  B £y " ,   " C h ç  N h ­t " )  
         }  
 }  
  
 v a r   c r o s s o b j ,   c r o s s M o n t h O b j ,   c r o s s Y e a r O b j ,   m o n t h S e l e c t e d ,   y e a r S e l e c t e d ,   d a t e S e l e c t e d ,   o m o n t h S e l e c t e d ,   o y e a r S e l e c t e d ,   o d a t e S e l e c t e d ,   m o n t h C o n s t r u c t e d ,   y e a r C o n s t r u c t e d ,   i n t e r v a l I D 1 ,   i n t e r v a l I D 2 ,   t i m e o u t I D 1 ,   t i m e o u t I D 2 ,   c t l T o P l a c e V a l u e ,   c t l N o w ,   d a t e F o r m a t ,   n S t a r t i n g Y e a r ,   s e l D a y A c t i o n ,   i s P a s t ;  
 v a r   v i s Y e a r   =   0 ;  
 v a r   v i s M o n t h   =   0 ;  
 v a r   b P a g e L o a d e d   =   f a l s e ;  
 v a r   i e   =   d o c u m e n t . a l l ;  
 v a r   d o m   =   d o c u m e n t . g e t E l e m e n t B y I d ;  
 v a r   n s 4   =   d o c u m e n t . l a y e r s ;  
 v a r   t o d a y   =   n e w   D a t e ( ) ;  
 v a r   d a t e N o w   =   t o d a y . g e t D a t e ( ) ;  
 v a r   m o n t h N o w   =   t o d a y . g e t M o n t h ( ) ;  
 v a r   y e a r N o w   =   t o d a y . g e t Y e a r ( ) ;  
 v a r   i m g s r c   =   n e w   A r r a y ( ' d r o p 1 . g i f ' ,   ' d r o p 2 . g i f ' ,   ' l e f t 1 . g i f ' ,   ' l e f t 2 . g i f ' ,   ' r i g h t 1 . g i f ' ,   ' r i g h t 2 . g i f ' ) ;  
 v a r   i m g   =   n e w   A r r a y ( ) ;  
 v a r   b S h o w   =   f a l s e ;  
  
 / *   h i d e s   < s e l e c t >   a n d   < a p p l e t >   o b j e c t s   ( f o r   I E   o n l y )   * /  
 f u n c t i o n   h i d e E l e m e n t ( e l m I D ,   o v e r D i v )   {  
         i f   ( i e )   {  
                 f o r   ( i   =   0 ;   i   <   d o c u m e n t . a l l . t a g s ( e l m I D ) . l e n g t h ;   i + + )   {  
                         o b j   =   d o c u m e n t . a l l . t a g s ( e l m I D ) [ i ] ;  
                         i f   ( ! o b j   | |   ! o b j . o f f s e t P a r e n t )   c o n t i n u e ;  
  
                         / /   F i n d   t h e   e l e m e n t ' s   o f f s e t T o p   a n d   o f f s e t L e f t   r e l a t i v e   t o   t h e   B O D Y   t a g .  
                         o b j L e f t   =   o b j . o f f s e t L e f t ;  
                         o b j T o p   =   o b j . o f f s e t T o p ;  
                         o b j P a r e n t   =   o b j . o f f s e t P a r e n t ;  
  
                         w h i l e   ( o b j P a r e n t . t a g N a m e . t o U p p e r C a s e ( )   ! =   ' B O D Y ' )   {  
                                 o b j L e f t   + =   o b j P a r e n t . o f f s e t L e f t ;  
                                 o b j T o p   + =   o b j P a r e n t . o f f s e t T o p ;  
                                 o b j P a r e n t   =   o b j P a r e n t . o f f s e t P a r e n t ;  
                         }  
  
                         o b j H e i g h t   =   o b j . o f f s e t H e i g h t ;  
                         o b j W i d t h   =   o b j . o f f s e t W i d t h ;  
  
                         i f   ( ( o v e r D i v . o f f s e t L e f t   +   o v e r D i v . o f f s e t W i d t h )   < =   o b j L e f t ) ;  
                         e l s e   i f   ( ( o v e r D i v . o f f s e t T o p   +   o v e r D i v . o f f s e t H e i g h t )   < =   o b j T o p ) ;  
                         / *   C H A N G E   b y   C h a r l i e   R o c h e   f o r   n e s t e d   T D s * /  
                         e l s e   i f   ( o v e r D i v . o f f s e t T o p   > =   ( o b j T o p   +   o b j H e i g h t   +   o b j . h e i g h t ) ) ;  
                         / *   E N D   C H A N G E   * /  
                         e l s e   i f   ( o v e r D i v . o f f s e t L e f t   > =   ( o b j L e f t   +   o b j W i d t h ) ) ;  
                         e l s e   {  
                                 o b j . s t y l e . v i s i b i l i t y   =   ' h i d d e n ' ;  
                         }  
                 }  
         }  
 }  
  
 / *  
 *   u n h i d e s   < s e l e c t >   a n d   < a p p l e t >   o b j e c t s   ( f o r   I E   o n l y )  
 * /  
 f u n c t i o n   s h o w E l e m e n t ( e l m I D )   {  
         i f   ( i e )   {  
                 f o r   ( i   =   0 ;   i   <   d o c u m e n t . a l l . t a g s ( e l m I D ) . l e n g t h ;   i + + )   {  
                         o b j   =   d o c u m e n t . a l l . t a g s ( e l m I D ) [ i ] ;  
                         i f   ( ! o b j   | |   ! o b j . o f f s e t P a r e n t )   c o n t i n u e ;  
                         o b j . s t y l e . v i s i b i l i t y   =   ' ' ;  
                 }  
         }  
 }  
  
 f u n c t i o n   H o l i d a y R e c ( d ,   m ,   y ,   d e s c )   {  
         t h i s . d   =   d ;  
         t h i s . m   =   m ;  
         t h i s . y   =   y ;  
         t h i s . d e s c   =   d e s c ;  
 }  
  
 v a r   H o l i d a y s C o u n t e r   =   0 ;  
 v a r   H o l i d a y s   =   n e w   A r r a y ( ) ;  
  
 f u n c t i o n   a d d H o l i d a y ( d ,   m ,   y ,   d e s c )   {  
         H o l i d a y s [ H o l i d a y s C o u n t e r + + ]   =   n e w   H o l i d a y R e c ( d ,   m ,   y ,   d e s c ) ;  
 }  
  
 i f   ( d o m )   {  
         f o r   ( i   =   0 ;   i   <   i m g s r c . l e n g t h ;   i + + )   {  
                 i m g [ i ]   =   n e w   I m a g e ;  
                 i m g [ i ] . s r c   =   i m g D i r   +   i m g s r c [ i ] ;  
         }  
         d o c u m e n t . w r i t e ( ' < d i v   o n c l i c k = " b S h o w = t r u e "   i d = " c a l e n d a r "   s t y l e = " z - i n d e x : + 9 9 9 ; 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 ; " > < t a b l e   w i d t h = " '   +   ( ( s h o w W e e k N u m b e r   = =   1 )   ?   2 5 0   :   2 2 0 )   +   ' "   s t y l e = " f o n t - f a m i l y : A r i a l ; f o n t - s i z e : 1 1 p x ; b o r d e r :   1 p x   s o l i d   # A 0 A 0 A 0 ; "   b g c o l o r = " # f f f f f f " > < t r   b g c o l o r = " # 0 0 0 0 6 6 " > < t d > < t a b l e   w i d t h = " '   +   ( ( s h o w W e e k N u m b e r   = =   1 )   ?   2 4 8   :   2 1 8 )   +   ' " > < t r > < t d   s t y l e = " p a d d i n g : 2 p x ; f o n t - f a m i l y : A r i a l ; f o n t - s i z e : 1 1 p x ; " > < f o n t   c o l o r = " # f f f f f f '   +   ' '   / * C 9 D 3 E 9 * /   +   ' " > < b > < s p a n   i d = " c a p t i o n " > < / s p a n > < / b > < / f o n t > < / t d > < t d   a l i g n = " r i g h t " > < a   h r e f = " j a v a s c r i p t : h i d e C a l e n d a r ( ) " > < i m g   s r c = " '   +   i m g D i r   +   ' c l o s e . g i f "   w i d t h = " 1 5 "   h e i g h t = " 1 3 "   b o r d e r = " 0 "   / > < / a > < / t d > < / t r > < / t a b l e > < / t d > < / t r > < t r > < t d   s t y l e = " p a d d i n g : 5 p x "   b g c o l o r = " # f f f f f f " > < s p a n   i d = " c o n t e n t " > < / s p a n > < / t d > < / t r > ' ) ;  
  
         i f   ( s h o w T o d a y   = =   1 )   {  
                 d o c u m e n t . w r i t e ( ' < t r   b g c o l o r = " # f 0 f 0 f 0 " > < t d   s t y l e = " p a d d i n g : 5 p x "   a l i g n = " c e n t e r " > < s p a n   i d = " l b l T o d a y " > < / s p a n > < / t d > < / t r > ' ) ;  
         }  
  
         d o c u m e n t . w r i t e ( ' < / t a b l e > < / d i v > < d i v   i d = " s e l e c t M o n t h "   s t y l e = " z - i n d e x : + 9 9 9 ; 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 ; " > < / d i v > < d i v   i d = " s e l e c t Y e a r "   s t y l e = " z - i n d e x : + 9 9 9 ; 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 ; " > < / d i v > ' ) ;  
 }  
  
 v a r   s t y l e A n c h o r   =   ' t e x t - d e c o r a t i o n : n o n e ; c o l o r : b l a c k ; ' ;  
 v a r   s t y l e L i g h t B o r d e r   =   ' b o r d e r : 1 p x   s o l i d   # a 0 a 0 a 0 ; ' ;  
  
 f u n c t i o n   s w a p I m a g e ( s r c I m g ,   d e s t I m g )   {  
         i f   ( i e )   d o c u m e n t . g e t E l e m e n t B y I d ( s r c I m g ) . s e t A t t r i b u t e ( ' s r c ' ,   i m g D i r   +   d e s t I m g ) ;  
 }  
  
 f u n c t i o n   i n i t ( )   {  
         i f   ( ! n s 4 )   {  
                 i f   ( ! i e )   y e a r N o w   + =   1 9 0 0 ;  
  
                 c r o s s o b j   =   ( d o m )   ?   d o c u m e n t . g e t E l e m e n t B y I d ( ' c a l e n d a r ' ) . s t y l e   :   i e   ?   d o c u m e n t . a l l . c a l e n d a r   :   d o c u m e n t . c a l e n d a r ;  
                 h i d e C a l e n d a r ( ) ;  
  
                 c r o s s M o n t h O b j   =   ( d o m )   ?   d o c u m e n t . g e t E l e m e n t B y I d ( ' s e l e c t M o n t h ' ) . s t y l e   :   i e   ?   d o c u m e n t . a l l . s e l e c t M o n t h   :   d o c u m e n t . s e l e c t M o n t h ;  
  
                 c r o s s Y e a r O b j   =   ( d o m )   ?   d o c u m e n t . g e t E l e m e n t B y I d ( ' s e l e c t Y e a r ' ) . s t y l e   :   i e   ?   d o c u m e n t . a l l . s e l e c t Y e a r   :   d o c u m e n t . s e l e c t Y e a r ;  
  
                 m o n t h C o n s t r u c t e d   =   f a l s e ;  
                 y e a r C o n s t r u c t e d   =   f a l s e ;  
  
                 i f   ( s h o w T o d a y   = =   1 )   {  
                         d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l T o d a y ' ) . i n n e r H T M L   =   ' < f o n t   c o l o r = " # 0 0 0 0 6 6 " > '   +   t o d a y S t r i n g [ l a n g u a g e ]   +   '   < a   o n m o u s e m o v e = " w i n d o w . s t a t u s = \ ' '   +   g o t o S t r i n g [ l a n g u a g e ]   +   ' \ ' "   o n m o u s e o u t = " w i n d o w . s t a t u s = \ ' \ ' "   t i t l e = " '   +   g o t o S t r i n g [ l a n g u a g e ]   +   ' "   s t y l e = " '   +   s t y l e A n c h o r   +   ' "   h r e f = " j a v a s c r i p t : m o n t h S e l e c t e d = m o n t h N o w ; y e a r S e l e c t e d = y e a r N o w ; c o n s t r u c t C a l e n d a r ( ) ; " > '   +   ' < b > '   +   f u l l d a y N a m e [ l a n g u a g e ] [ ( t o d a y . g e t D a y ( )   -   s t a r t A t   = =   - 1 )   ?   6   :   ( t o d a y . g e t D a y ( )   -   s t a r t A t ) ]   +   ' < / b > ,   '   +   d a t e N o w   +   '   < b > '   +   m o n t h N a m e [ l a n g u a g e ] [ m o n t h N o w ]   +   ' < / b >   '   +   y e a r N o w   +   ' < / a > < / f o n t > ' ;  
                 }  
  
                 s H T M L 1   =   ' < s p a n   i d = " s p a n L e f t "   s t y l e = " b o r d e r : 1 p x   s o l i d   # 3 6 f ; c u r s o r : p o i n t e r "   o n m o u s e o v e r = " s w a p I m a g e ( \ ' c h a n g e L e f t \ ' , \ ' l e f t 2 . g i f \ ' ) ; t h i s . s t y l e . b o r d e r C o l o r = \ ' # 8 a f \ ' ; w i n d o w . s t a t u s = \ ' '   +   s c r o l l L e f t M e s s a g e [ l a n g u a g e ]   +   ' \ ' "   o n c l i c k = " d e c M o n t h ( ) "   o n m o u s e o u t = " c l e a r I n t e r v a l ( i n t e r v a l I D 1 ) ; s w a p I m a g e ( \ ' c h a n g e L e f t \ ' , \ ' l e f t 1 . g i f \ ' ) ; t h i s . s t y l e . b o r d e r C o l o r = \ ' # 3 6 f \ ' ; w i n d o w . s t a t u s = \ ' \ ' "   o n m o u s e d o w n = " c l e a r T i m e o u t ( t i m e o u t I D 1 ) ; t i m e o u t I D 1 = s e t T i m e o u t ( \ ' S t a r t D e c M o n t h ( ) \ ' , 5 0 0 ) "   o n m o u s e u p = " c l e a r T i m e o u t ( t i m e o u t I D 1 ) ; c l e a r I n t e r v a l ( i n t e r v a l I D 1 ) " > & n b s p < i m g   i d = " c h a n g e L e f t "   s r c = " '   +   i m g D i r   +   ' l e f t 1 . g i f "   w i d t h = " 1 0 "   h e i g h t = " 1 1 "   b o r d e r = " 0 " > & n b s p < / s p a n > & n b s p ; ' ;  
                 s H T M L 1   + =   ' < s p a n   i d = " s p a n R i g h t "   s t y l e = " b o r d e r : 1 p x   s o l i d   # 3 6 f ; c u r s o r : p o i n t e r "   o n m o u s e o v e r = " s w a p I m a g e ( \ ' c h a n g e R i g h t \ ' , \ ' r i g h t 2 . g i f \ ' ) ; t h i s . s t y l e . b o r d e r C o l o r = \ ' # 8 a f \ ' ; w i n d o w . s t a t u s = \ ' '   +   s c r o l l R i g h t M e s s a g e [ l a n g u a g e ]   +   ' \ ' "   o n m o u s e o u t = " c l e a r I n t e r v a l ( i n t e r v a l I D 1 ) ; s w a p I m a g e ( \ ' c h a n g e R i g h t \ ' , \ ' r i g h t 1 . g i f \ ' ) ; t h i s . s t y l e . b o r d e r C o l o r = \ ' # 3 6 f \ ' ; w i n d o w . s t a t u s = \ ' \ ' "   o n c l i c k = " i n c M o n t h ( ) "   o n m o u s e d o w n = " c l e a r T i m e o u t ( t i m e o u t I D 1 ) ; t i m e o u t I D 1 = s e t T i m e o u t ( \ ' S t a r t I n c M o n t h ( ) \ ' , 5 0 0 ) "   o n m o u s e u p = " c l e a r T i m e o u t ( t i m e o u t I D 1 ) ; c l e a r I n t e r v a l ( i n t e r v a l I D 1 ) " > & n b s p < i m g   i d = " c h a n g e R i g h t "   s r c = " '   +   i m g D i r   +   ' r i g h t 1 . g i f "   w i d t h = " 1 0 "   h e i g h t = " 1 1 "   b o r d e r = " 0 " > & n b s p < / s p a n > & n b s p ; ' ;  
                 s H T M L 1   + =   ' < s p a n   i d = " s p a n M o n t h "   s t y l e = " b o r d e r : 1 p x   s o l i d   # 3 6 f ; c u r s o r : p o i n t e r "   o n m o u s e o v e r = " s w a p I m a g e ( \ ' c h a n g e M o n t h \ ' , \ ' d r o p 2 . g i f \ ' ) ; t h i s . s t y l e . b o r d e r C o l o r = \ ' # 8 a f \ ' ; w i n d o w . s t a t u s = \ ' '   +   s e l e c t M o n t h M e s s a g e [ l a n g u a g e ]   +   ' \ ' "   o n m o u s e o u t = " s w a p I m a g e ( \ ' c h a n g e M o n t h \ ' , \ ' d r o p 1 . g i f \ ' ) ; t h i s . s t y l e . b o r d e r C o l o r = \ ' # 3 6 f \ ' ; w i n d o w . s t a t u s = \ ' \ ' "   o n c l i c k = " p o p U p M o n t h ( ) " > < / s p a n > & n b s p ; ' ;  
                 s H T M L 1   + =   ' < s p a n   i d = " s p a n Y e a r "   s t y l e = " b o r d e r : 1 p x   s o l i d   # 3 6 f ; c u r s o r : p o i n t e r "   o n m o u s e o v e r = " s w a p I m a g e ( \ ' c h a n g e Y e a r \ ' , \ ' d r o p 2 . g i f \ ' ) ; t h i s . s t y l e . b o r d e r C o l o r = \ ' # 8 a f \ ' ; w i n d o w . s t a t u s = \ ' '   +   s e l e c t Y e a r M e s s a g e [ l a n g u a g e ]   +   ' \ ' "   o n m o u s e o u t = " s w a p I m a g e ( \ ' c h a n g e Y e a r \ ' , \ ' d r o p 1 . g i f \ ' ) ; t h i s . s t y l e . b o r d e r C o l o r = \ ' # 3 6 f \ ' ; w i n d o w . s t a t u s = \ ' \ ' "   o n c l i c k = " p o p U p Y e a r ( ) " > < / s p a n > & n b s p ; ' ;  
  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' c a p t i o n ' ) . i n n e r H T M L   =   s H T M L 1 ;  
  
                 b P a g e L o a d e d   =   t r u e ;  
         }  
 }  
  
 f u n c t i o n   h i d e C a l e n d a r ( )   {  
         c r o s s o b j . v i s i b i l i t y   =   ' h i d d e n ' ;  
         i f   ( c r o s s M o n t h O b j   ! =   n u l l )   c r o s s M o n t h O b j . v i s i b i l i t y   =   ' h i d d e n ' ;  
         i f   ( c r o s s Y e a r O b j   ! =   n u l l )   c r o s s Y e a r O b j . v i s i b i l i t y   =   ' h i d d e n ' ;  
         s h o w E l e m e n t ( ' S E L E C T ' ) ;  
         s h o w E l e m e n t ( ' A P P L E T ' ) ;  
 }  
  
 f u n c t i o n   p a d Z e r o ( n u m )   {  
         r e t u r n   ( n u m   <   1 0 )   ?   ' 0 '   +   n u m   :   n u m ;  
 }  
  
 f u n c t i o n   c o n s t r u c t D a t e ( d ,   m ,   y )   {  
         s T m p   =   d a t e F o r m a t ;  
         s T m p   =   s T m p . r e p l a c e ( ' d d ' ,   ' < e > ' ) ;  
         s T m p   =   s T m p . r e p l a c e ( ' d ' ,   ' < d > ' ) ;  
         s T m p   =   s T m p . r e p l a c e ( ' < e > ' ,   p a d Z e r o ( d ) ) ;  
         s T m p   =   s T m p . r e p l a c e ( ' < d > ' ,   d ) ;  
         s T m p   =   s T m p . r e p l a c e ( ' m m m m ' ,   ' < p > ' ) ;  
         s T m p   =   s T m p . r e p l a c e ( ' m m m ' ,   ' < o > ' ) ;  
         s T m p   =   s T m p . r e p l a c e ( ' m m ' ,   ' < n > ' ) ;  
         s T m p   =   s T m p . r e p l a c e ( ' m ' ,   ' < m > ' ) ;  
         s T m p   =   s T m p . r e p l a c e ( ' < m > ' ,   m   +   1 ) ;  
         s T m p   =   s T m p . r e p l a c e ( ' < n > ' ,   p a d Z e r o ( m   +   1 ) ) ;  
         s T m p   =   s T m p . r e p l a c e ( ' < o > ' ,   m o n t h N a m e [ l a n g u a g e ] [ m ] ) ;  
         s T m p   =   s T m p . r e p l a c e ( ' < p > ' ,   m o n t h N a m e 2 [ l a n g u a g e ] [ m ] ) ;  
         s T m p   =   s T m p . r e p l a c e ( ' y y y y ' ,   y ) ;  
         r e t u r n   s T m p . r e p l a c e ( ' y y ' ,   p a d Z e r o ( y   %   1 0 0 ) ) ;  
 }  
  
 f u n c t i o n   G e t P o s t V a r i a b l e ( v N a m e ,   v D e f )   {  
         v a r   s t r   =   l o c a t i o n . h r e f ;  
         v a r   p o s   =   s t r . i n d e x O f ( ' ? ' . c o n c a t ( v N a m e ) . c o n c a t ( ' = ' ) ) ;  
  
         i f   ( p o s   = =   - 1 )   {  
                 p o s   =   s t r . i n d e x O f ( ' & ' . c o n c a t ( v N a m e ) . c o n c a t ( ' = ' ) ) ;  
                 i f   ( p o s   = =   - 1 )   r e t u r n   v D e f ;  
         }  
  
         s t r   =   s t r . s u b s t r i n g ( p o s   +   v N a m e . l e n g t h   +   2 ) ;  
         p o s   =   s t r . i n d e x O f ( ' & ' ) ;  
  
         i f   ( p o s   = =   - 1 )   {  
                 p o s   =   s t r . l e n g t h ;  
         }  
  
         i f   ( p o s   >   0 )   {  
                 s t r   =   s t r . s u b s t r i n g ( 0 ,   p o s ) ;  
         }  
  
         r e t u r n   s t r ;  
 }  
  
 f u n c t i o n   c l o s e C a l e n d a r ( )   {  
         c t l T o P l a c e V a l u e . v a l u e   =   c o n s t r u c t D a t e ( d a t e S e l e c t e d ,   m o n t h S e l e c t e d ,   y e a r S e l e c t e d ) ;  
         h i d e C a l e n d a r ( ) ;  
         r e t u r n ;  
  
 }  
  
 / * * *   M o n t h   P u l l d o w n 	 * * * /  
 f u n c t i o n   S t a r t D e c M o n t h ( )   {  
         i n t e r v a l I D 1   =   s e t I n t e r v a l ( " d e c M o n t h ( ) " ,   8 0 ) ;  
 }  
  
 f u n c t i o n   S t a r t I n c M o n t h ( )   {  
         i n t e r v a l I D 1   =   s e t I n t e r v a l ( " i n c M o n t h ( ) " ,   8 0 ) ;  
 }  
  
 f u n c t i o n   i n c M o n t h ( )   {  
         m o n t h S e l e c t e d + + ;  
         i f   ( m o n t h S e l e c t e d   >   1 1 )   {  
                 m o n t h S e l e c t e d   =   0 ;  
                 y e a r S e l e c t e d + + ;  
         }  
         c o n s t r u c t C a l e n d a r ( ) ;  
 }  
  
 f u n c t i o n   d e c M o n t h ( )   {  
         m o n t h S e l e c t e d - - ;  
         i f   ( m o n t h S e l e c t e d   <   0 )   {  
                 m o n t h S e l e c t e d   =   1 1 ;  
                 y e a r S e l e c t e d - - ;  
         }  
         c o n s t r u c t C a l e n d a r ( ) ;  
 }  
  
 f u n c t i o n   c o n s t r u c t M o n t h ( )   {  
         p o p D o w n Y e a r ( )  
         i f   ( ! m o n t h C o n s t r u c t e d )   {  
                 s H T M L   =   " " ;  
                 f o r   ( i   =   0 ;   i   <   1 2 ;   i + + )   {  
                         s N a m e   =   m o n t h N a m e [ l a n g u a g e ] [ i ] ;  
                         i f   ( i   = =   m o n t h S e l e c t e d )   {  
                                 s N a m e   =   ' < b > '   +   s N a m e   +   ' < / b > ' ;  
                         }  
                         s H T M L   + =   ' < t r > < t d   i d = " m '   +   i   +   ' "   o n m o u s e o v e r = " t h i s . s t y l e . b a c k g r o u n d C o l o r = \ ' # 9 0 9 0 9 0 \ ' "   o n m o u s e o u t = " t h i s . s t y l e . b a c k g r o u n d C o l o r = \ ' \ ' "   s t y l e = " c u r s o r : p o i n t e r "   o n c l i c k = " m o n t h C o n s t r u c t e d = f a l s e ; m o n t h S e l e c t e d = '   +   i   +   ' ; c o n s t r u c t C a l e n d a r ( ) ; p o p D o w n M o n t h ( ) ; e v e n t . c a n c e l B u b b l e = t r u e " > < f o n t   c o l o r = " # 0 0 0 0 6 6 " > & n b s p ; '   +   s N a m e   +   ' & n b s p ; < / f o n t > < / t d > < / t r > ' ;  
                 }  
  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' s e l e c t M o n t h ' ) . i n n e r H T M L   =   ' < t a b l e   w i d t h = " 1 0 3 "   s t y l e = " f o n t - f a m i l y : A r i a l ; f o n t - s i z e : 1 1 p x ; b o r d e r : 1 p x   s o l i d   # a 0 a 0 a 0 ; "   b g c o l o r = " # f 0 f 0 f 0 "   c e l l s p a c i n g = " 0 "   o n m o u s e o v e r = " c l e a r T i m e o u t ( t i m e o u t I D 1 ) "   o n m o u s e o u t = " c l e a r T i m e o u t ( t i m e o u t I D 1 ) ; t i m e o u t I D 1 = s e t T i m e o u t ( \ ' p o p D o w n M o n t h ( ) \ ' , 1 0 0 ) ; e v e n t . c a n c e l B u b b l e = t r u e " > '   +   s H T M L   +   ' < / t a b l e > ' ;  
  
                 m o n t h C o n s t r u c t e d   =   t r u e ;  
         }  
 }  
  
 f u n c t i o n   p o p U p M o n t h ( )   {  
         i f   ( v i s M o n t h   = =   1 )   {  
                 p o p D o w n M o n t h ( ) ;  
                 v i s M o n t h - - ;  
         }   e l s e   {  
                 c o n s t r u c t M o n t h ( ) ;  
                 c r o s s M o n t h O b j . v i s i b i l i t y   =   ( d o m   | |   i e )   ?   ' v i s i b l e '   :   ' s h o w ' ;  
                 c r o s s M o n t h O b j . l e f t   =   p a r s e I n t ( c r o s s o b j . l e f t )   +   5 0 ;  
                 c r o s s M o n t h O b j . t o p   =   p a r s e I n t ( c r o s s o b j . t o p )   +   2 6 ;  
                 h i d e E l e m e n t ( ' S E L E C T ' ,   d o c u m e n t . g e t E l e m e n t B y I d ( ' s e l e c t M o n t h ' ) ) ;  
                 h i d e E l e m e n t ( ' A P P L E T ' ,   d o c u m e n t . g e t E l e m e n t B y I d ( ' s e l e c t M o n t h ' ) ) ;  
                 v i s M o n t h + + ;  
         }  
 }  
  
 f u n c t i o n   p o p D o w n M o n t h ( )   {  
         c r o s s M o n t h O b j . v i s i b i l i t y   =   ' h i d d e n ' ;  
         v i s M o n t h   =   0 ;  
 }  
  
 / * * *   Y e a r   P u l l d o w n   * * * /  
 f u n c t i o n   i n c Y e a r ( )   {  
         f o r   ( i   =   0 ;   i   <   7 ;   i + + )   {  
                 n e w Y e a r   =   ( i   +   n S t a r t i n g Y e a r )   +   1 ;  
                 i f   ( n e w Y e a r   = =   y e a r S e l e c t e d )  
                         t x t Y e a r   =   ' < s p a n   s t y l e = " c o l o r : # 0 0 6 ; f o n t - w e i g h t : b o l d ; " > & n b s p ; '   +   n e w Y e a r   +   ' & n b s p ; < / s p a n > ' ;  
                 e l s e  
                         t x t Y e a r   =   ' < s p a n   s t y l e = " c o l o r : # 0 0 6 ; " > & n b s p ; '   +   n e w Y e a r   +   ' & n b s p ; < / s p a n > ' ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' y '   +   i ) . i n n e r H T M L   =   t x t Y e a r ;  
         }  
         n S t a r t i n g Y e a r + + ;  
         b S h o w   =   t r u e ;  
 }  
  
 f u n c t i o n   d e c Y e a r ( )   {  
         f o r   ( i   =   0 ;   i   <   7 ;   i + + )   {  
                 n e w Y e a r   =   ( i   +   n S t a r t i n g Y e a r )   -   1 ;  
                 i f   ( n e w Y e a r   = =   y e a r S e l e c t e d )  
                         t x t Y e a r   =   ' < s p a n   s t y l e = " c o l o r : # 0 0 6 ; f o n t - w e i g h t : b o l d " > & n b s p ; '   +   n e w Y e a r   +   ' & n b s p ; < / s p a n > ' ;  
                 e l s e  
                         t x t Y e a r   =   ' < s p a n   s t y l e = " c o l o r : # 0 0 6 ; " > & n b s p ; '   +   n e w Y e a r   +   ' & n b s p ; < / s p a n > ' ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' y '   +   i ) . i n n e r H T M L   =   t x t Y e a r ;  
         }  
         n S t a r t i n g Y e a r - - ;  
         b S h o w   =   t r u e ;  
 }  
  
 f u n c t i o n   s e l e c t Y e a r ( n Y e a r )   {  
         y e a r S e l e c t e d   =   p a r s e I n t ( n Y e a r   +   n S t a r t i n g Y e a r ) ;  
         y e a r C o n s t r u c t e d   =   f a l s e ;  
         c o n s t r u c t C a l e n d a r ( ) ;  
         p o p D o w n Y e a r ( ) ;  
 }  
  
 f u n c t i o n   c o n s t r u c t Y e a r ( )   {  
         p o p D o w n M o n t h ( ) ;  
         s H T M L   =   ' ' ;  
         i f   ( ! y e a r C o n s t r u c t e d )   {  
                 s H T M L   =   ' < t r > < t d   a l i g n = " c e n t e r "   o n m o u s e o v e r = " t h i s . s t y l e . b a c k g r o u n d C o l o r = \ ' # 9 0 9 0 9 0 \ ' "   o n m o u s e o u t = " c l e a r I n t e r v a l ( i n t e r v a l I D 1 ) ; t h i s . s t y l e . b a c k g r o u n d C o l o r = \ ' \ ' "   s t y l e = " c u r s o r : p o i n t e r "   o n m o u s e d o w n = " c l e a r I n t e r v a l ( i n t e r v a l I D 1 ) ; i n t e r v a l I D 1 = s e t I n t e r v a l ( \ ' d e c Y e a r ( ) \ ' , 3 0 ) "   o n m o u s e u p = " c l e a r I n t e r v a l ( i n t e r v a l I D 1 ) " > < f o n t   c o l o r = " # 0 0 0 0 6 6 " > - < / f o n t > < / t d > < / t r > ' ;  
  
                 j   =   0 ;  
                 n S t a r t i n g Y e a r   =   y e a r S e l e c t e d   -   3 ;  
                 f o r   ( i   =   ( y e a r S e l e c t e d   -   3 ) ;   i   < =   ( y e a r S e l e c t e d   +   3 ) ;   i + + )   {  
                         s N a m e   =   i ;  
                         i f   ( i   = =   y e a r S e l e c t e d )   s N a m e   =   ' < b > '   +   s N a m e   +   ' < / b > ' ;  
                         s H T M L   + =   ' < t r > < t d   i d = " y '   +   j   +   ' "   o n m o u s e o v e r = " t h i s . s t y l e . b a c k g r o u n d C o l o r = \ ' # 9 0 9 0 9 0 \ ' "   o n m o u s e o u t = " t h i s . s t y l e . b a c k g r o u n d C o l o r = \ ' \ ' "   s t y l e = " c u r s o r : p o i n t e r "   o n c l i c k = " s e l e c t Y e a r ( '   +   j   +   ' ) ; e v e n t . c a n c e l B u b b l e = t r u e " > < f o n t   c o l o r = " # 0 0 0 0 6 6 " > & n b s p ; '   +   s N a m e   +   ' & n b s p ; < / f o n t > < / t d > < / t r > ' ;  
                         j + + ;  
                 }  
  
                 s H T M L   + =   ' < t r > < t d   a l i g n = " c e n t e r "   o n m o u s e o v e r = " t h i s . s t y l e . b a c k g r o u n d C o l o r = \ ' # 9 0 9 0 9 0 \ ' "   o n m o u s e o u t = " c l e a r I n t e r v a l ( i n t e r v a l I D 2 ) ; t h i s . s t y l e . b a c k g r o u n d C o l o r = \ ' \ ' "   s t y l e = " c u r s o r : p o i n t e r "   o n m o u s e d o w n = " c l e a r I n t e r v a l ( i n t e r v a l I D 2 ) ; i n t e r v a l I D 2 = s e t I n t e r v a l ( \ ' i n c Y e a r ( ) \ ' , 3 0 ) "   o n m o u s e u p = " c l e a r I n t e r v a l ( i n t e r v a l I D 2 ) " > < f o n t   c o l o r = " # 0 0 0 0 6 6 " > + < / f o n t > < / t d > < / t r > ' ;  
  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' s e l e c t Y e a r ' ) . i n n e r H T M L   =   ' < t a b l e   w i d t h = " 4 4 "   c e l l s p a c i n g = " 0 "   b g c o l o r = " # f 0 f 0 f 0 "   s t y l e = " f o n t - f a m i l y : A r i a l ; f o n t - s i z e : 1 1 p x ; b o r d e r : 1 p x   s o l i d   # a 0 a 0 a 0 ; "   o n m o u s e o v e r = " c l e a r T i m e o u t ( t i m e o u t I D 2 ) "   o n m o u s e o u t = " c l e a r T i m e o u t ( t i m e o u t I D 2 ) ; t i m e o u t I D 2 = s e t T i m e o u t ( \ ' p o p D o w n Y e a r ( ) \ ' , 1 0 0 ) " > '   +   s H T M L   +   ' < / t a b l e > ' ;  
  
                 y e a r C o n s t r u c t e d   =   t r u e ;  
         }  
 }  
  
 f u n c t i o n   p o p D o w n Y e a r ( )   {  
         c l e a r I n t e r v a l ( i n t e r v a l I D 1 ) ;  
         c l e a r T i m e o u t ( t i m e o u t I D 1 ) ;  
         c l e a r I n t e r v a l ( i n t e r v a l I D 2 ) ;  
         c l e a r T i m e o u t ( t i m e o u t I D 2 ) ;  
         c r o s s Y e a r O b j . v i s i b i l i t y   =   ' h i d d e n ' ;  
         v i s Y e a r   =   0 ;  
 }  
  
 f u n c t i o n   p o p U p Y e a r ( )   {  
         v a r   l e f t O f f s e t  
         i f   ( v i s Y e a r   = =   1 )   {  
                 p o p D o w n Y e a r ( ) ;  
                 v i s Y e a r - - ;  
         }   e l s e   {  
                 c o n s t r u c t Y e a r ( ) ;  
                 c r o s s Y e a r O b j . v i s i b i l i t y   =   ( d o m   | |   i e )   ?   ' v i s i b l e '   :   ' s h o w ' ;  
                 l e f t O f f s e t   =   p a r s e I n t ( c r o s s o b j . l e f t )   +   d o c u m e n t . g e t E l e m e n t B y I d ( ' s p a n Y e a r ' ) . o f f s e t L e f t ;  
                 i f   ( i e )   l e f t O f f s e t   + =   6 ;  
                 c r o s s Y e a r O b j . l e f t   =   l e f t O f f s e t ;  
                 c r o s s Y e a r O b j . t o p   =   p a r s e I n t ( c r o s s o b j . t o p )   +   2 6 ;  
                 v i s Y e a r + + ;  
         }  
 }  
  
 / * * *   c a l e n d a r   * * * /  
 f u n c t i o n   W e e k N b r ( n )   {  
         / /   A l g o r i t h m   u s e d :  
         / /   F r o m   K l a u s   T o n d e r i n g ' s   C a l e n d a r   d o c u m e n t   ( T h e   A u t h o r i t y / G u r u )  
         / /   h t t p : / / w w w . t o n d e r i n g . d k / c l a u s / c a l e n d a r . h t m l  
         / /   a   =   ( 1 4 - m o n t h )   /   1 2  
         / /   y   =   y e a r   +   4 8 0 0   -   a  
         / /   m   =   m o n t h   +   1 2 a   -   3  
         / /   J   =   d a y   +   ( 1 5 3 m   +   2 )   /   5   +   3 6 5 y   +   y   /   4   -   y   /   1 0 0   +   y   /   4 0 0   -   3 2 0 4 5  
         / /   d 4   =   ( J   +   3 1 7 4 1   -   ( J   m o d   7 ) )   m o d   1 4 6 0 9 7   m o d   3 6 5 2 4   m o d   1 4 6 1  
         / /   L   =   d 4   /   1 4 6 0  
         / /   d 1   =   ( ( d 4   -   L )   m o d   3 6 5 )   +   L  
         / /   W e e k N u m b e r   =   d 1   /   7   +   1  
  
         y e a r   =   n . g e t F u l l Y e a r ( ) ;  
         m o n t h   =   n . g e t M o n t h ( )   +   1 ;  
         i f   ( s t a r t A t   = =   0 )   {  
                 d a y   =   n . g e t D a t e ( )   +   1 ;  
         }   e l s e   {  
                 d a y   =   n . g e t D a t e ( ) ;  
         }  
  
         a   =   M a t h . f l o o r ( ( 1 4   -   m o n t h )   /   1 2 ) ;  
         y   =   y e a r   +   4 8 0 0   -   a ;  
         m   =   m o n t h   +   1 2   *   a   -   3 ;  
         b   =   M a t h . f l o o r ( y   /   4 )   -   M a t h . f l o o r ( y   /   1 0 0 )   +   M a t h . f l o o r ( y   /   4 0 0 ) ;  
         J   =   d a y   +   M a t h . f l o o r ( ( 1 5 3   *   m   +   2 )   /   5 )   +   3 6 5   *   y   +   b   -   3 2 0 4 5 ;  
         d 4   =   ( ( ( J   +   3 1 7 4 1   -   ( J   %   7 ) )   %   1 4 6 0 9 7 )   %   3 6 5 2 4 )   %   1 4 6 1 ;  
         L   =   M a t h . f l o o r ( d 4   /   1 4 6 0 ) ;  
         d 1   =   ( ( d 4   -   L )   %   3 6 5 )   +   L ;  
         w e e k   =   M a t h . f l o o r ( d 1   /   7 )   +   1 ;  
  
         r e t u r n   w e e k ;  
 }  
  
 f u n c t i o n   c o n s t r u c t C a l e n d a r ( )   {  
         v a r   a N u m D a y s   =   A r r a y ( 3 1 ,   0 ,   3 1 ,   3 0 ,   3 1 ,   3 0 ,   3 1 ,   3 1 ,   3 0 ,   3 1 ,   3 0 ,   3 1 ) ;  
         v a r   d a t e M e s s a g e ;  
         v a r   s t a r t D a t e   =   n e w   D a t e ( y e a r S e l e c t e d ,   m o n t h S e l e c t e d ,   1 ) ;  
         v a r   e n d D a t e ;  
  
         i f   ( m o n t h S e l e c t e d   = =   1 )   {  
                 e n d D a t e   =   n e w   D a t e ( y e a r S e l e c t e d ,   m o n t h S e l e c t e d   +   1 ,   1 ) ;  
                 e n d D a t e   =   n e w   D a t e ( e n d D a t e   -   ( 2 4   *   6 0   *   6 0   *   1 0 0 0 ) ) ;  
                 n u m D a y s I n M o n t h   =   e n d D a t e . g e t D a t e ( ) ;  
         }   e l s e   {  
                 n u m D a y s I n M o n t h   =   a N u m D a y s [ m o n t h S e l e c t e d ] ;  
         }  
  
         d a t e P o i n t e r   =   0 ;  
         d a y P o i n t e r   =   s t a r t D a t e . g e t D a y ( )   -   s t a r t A t ;  
  
         i f   ( d a y P o i n t e r   <   0 )   d a y P o i n t e r   =   6 ;  
  
         s H T M L   =   ' < t a b l e   b o r d e r = " 0 "   s t y l e = " f o n t - f a m i l y : v e r d a n a ; f o n t - s i z e : 1 0 p x ; " > < t r > ' ;  
  
         i f   ( s h o w W e e k N u m b e r   = =   1 )   {  
                 s H T M L   + =   ' < t d   w i d t h = " 2 7 " > < b > '   +   w e e k S t r i n g [ l a n g u a g e ]   +   ' < / b > < / t d > < t d   w i d t h = " 1 "   r o w s p a n = " 7 "   b g c o l o r = " # d 0 d 0 d 0 "   s t y l e = " p a d d i n g : 0 p x " > < i m g   s r c = " '   +   i m g D i r   +   ' d i v i d e r . g i f "   w i d t h = " 1 " > < / t d > ' ;  
         }  
  
         f o r   ( i   =   0 ;   i   <   7 ;   i + + )   {  
                 s H T M L   + =   ' < t d   w i d t h = " 2 7 "   a l i g n = " r i g h t " > < b > < f o n t   c o l o r = " # 0 0 0 0 6 6 " > '   +   d a y N a m e [ l a n g u a g e ] [ i ]   +   ' < / f o n t > < / b > < / t d > ' ;  
         }  
  
         s H T M L   + =   ' < / t r > < t r > ' ;  
  
         i f   ( s h o w W e e k N u m b e r   = =   1 )   {  
                 s H T M L   + =   ' < t d   a l i g n = " r i g h t " > '   +   W e e k N b r ( s t a r t D a t e )   +   ' & n b s p ; < / t d > ' ;  
         }  
  
         f o r   ( v a r   i   =   1 ;   i   < =   d a y P o i n t e r ;   i + + )   {  
                 s H T M L   + =   ' < t d > & n b s p ; < / t d > ' ;  
         }  
  
         f o r   ( d a t e P o i n t e r   =   1 ;   d a t e P o i n t e r   < =   n u m D a y s I n M o n t h ;   d a t e P o i n t e r + + )   {  
                 d a y P o i n t e r + + ;  
                 s H T M L   + =   ' < t d   a l i g n = " r i g h t " > ' ;  
                 s S t y l e   =   s t y l e A n c h o r ;  
                 i f   ( ( d a t e P o i n t e r   = =   o d a t e S e l e c t e d )   & &   ( m o n t h S e l e c t e d   = =   o m o n t h S e l e c t e d )   & &   ( y e a r S e l e c t e d   = =   o y e a r S e l e c t e d ) )  
                 {   s S t y l e   + =   s t y l e L i g h t B o r d e r   }  
  
                 s H i n t   =   ' ' ;  
                 f o r   ( k   =   0 ;   k   <   H o l i d a y s C o u n t e r ;   k + + )   {  
                         i f   ( ( p a r s e I n t ( H o l i d a y s [ k ] . d )   = =   d a t e P o i n t e r )   & &   ( p a r s e I n t ( H o l i d a y s [ k ] . m )   = =   ( m o n t h S e l e c t e d   +   1 ) ) )   {  
                                 i f   ( ( p a r s e I n t ( H o l i d a y s [ k ] . y )   = =   0 )   | |   ( ( p a r s e I n t ( H o l i d a y s [ k ] . y )   = =   y e a r S e l e c t e d )   & &   ( p a r s e I n t ( H o l i d a y s [ k ] . y )   ! =   0 ) ) )   {  
                                         s S t y l e   + =   ' b a c k g r o u n d - c o l o r : # f d d ; ' ;  
                                         s H i n t   + =   s H i n t   = =   " "   ?   H o l i d a y s [ k ] . d e s c   :   " \ n "   +   H o l i d a y s [ k ] . d e s c ;  
                                 }  
                         }  
                 }  
  
                 s H i n t   =   s H i n t . r e p l a c e ( ' / \ " / g ' ,   ' & q u o t ; ' ) ;  
  
                 d a t e M e s s a g e   =   ' o n m o u s e m o v e = " w i n d o w . s t a t u s = \ ' '   +   s e l e c t D a t e M e s s a g e [ l a n g u a g e ] . r e p l a c e ( ' [ d a t e ] ' ,   c o n s t r u c t D a t e ( d a t e P o i n t e r ,   m o n t h S e l e c t e d ,   y e a r S e l e c t e d ) )   +   ' \ ' "   o n m o u s e o u t = " w i n d o w . s t a t u s = \ ' \ ' "   ' ;  
  
  
                 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /  
                 / / / / / / / / / /     M o d i f i c a t i o n s   P i n o T o y     / / / / / / / / / /  
                 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /  
                 i f   ( e n a b l e P a s t   = =   0   & &   ( ( y e a r S e l e c t e d   <   y e a r N o w )   | |   ( m o n t h S e l e c t e d   <   m o n t h N o w )   & &   ( y e a r S e l e c t e d   = =   y e a r N o w )   | |   ( d a t e P o i n t e r   <   d a t e N o w )   & &   ( m o n t h S e l e c t e d   = =   m o n t h N o w )   & &   ( y e a r S e l e c t e d   = =   y e a r N o w ) ) )   {  
                         s e l D a y A c t i o n   =   ' ' ;  
                         i s P a s t   =   1 ;  
                 }   e l s e   {  
                         i f   ( e n a b l e F u t u r e   = =   0   & &   ( ( y e a r S e l e c t e d   >   y e a r N o w )   | |   ( m o n t h S e l e c t e d   >   m o n t h N o w )   & &   ( y e a r S e l e c t e d   = =   y e a r N o w )   | |   ( d a t e P o i n t e r   >   d a t e N o w )   & &   ( m o n t h S e l e c t e d   = =   m o n t h N o w )   & &   ( y e a r S e l e c t e d   = =   y e a r N o w ) ) )   {  
                                 s e l D a y A c t i o n   =   ' ' ;  
                                 i s F u t u r e   =   1 ;  
                         }  
                         e l s e   {  
                                 s e l D a y A c t i o n   =   ' h r e f = " j a v a s c r i p t : d a t e S e l e c t e d = '   +   d a t e P o i n t e r   +   ' ; c l o s e C a l e n d a r ( ) ; " ' ;  
                                 i s P a s t   =   0 ;  
                                 i s F u t u r e   =   0 ;  
                         }  
                 }  
  
                 i f   ( ( d a t e P o i n t e r   = =   d a t e N o w )   & &   ( m o n t h S e l e c t e d   = =   m o n t h N o w )   & &   ( y e a r S e l e c t e d   = =   y e a r N o w ) )   { 	 / / / / /   t o d a y  
                         s H T M L   + =   " < b > < a   "   +   d a t e M e s s a g e   +   "   t i t l e = \ " "   +   s H i n t   +   " \ "   s t y l e = ' "   +   s S t y l e   +   " '   "   +   s e l D a y A c t i o n   +   " > < f o n t   c o l o r = # f f 0 0 0 0 > & n b s p ; "   +   d a t e P o i n t e r   +   " < / f o n t > & n b s p ; < / a > < / b > " ;  
                 }   e l s e   i f   ( d a y P o i n t e r   %   7   = =   ( s t a r t A t   *   - 1 )   +   1 )   { 	 	 	 	 	 	 	 	 	 / / / / /   S I   E S   D O M I N G O  
                         i f   ( i s P a s t   = =   1 )  
                                 s H T M L   + =   " < a   "   +   d a t e M e s s a g e   +   "   t i t l e = \ " "   +   s H i n t   +   " \ "   s t y l e = ' "   +   s S t y l e   +   " '   "   +   s e l D a y A c t i o n   +   " > & n b s p ; < f o n t   c o l o r = # 9 0 9 0 9 0 > "   +   d a t e P o i n t e r   +   " < / f o n t > & n b s p ; < / a > " ;  
                         e l s e   i f   ( i s F u t u r e   = =   1 )  
                                 s H T M L   + =   " < a   "   +   d a t e M e s s a g e   +   "   t i t l e = \ " "   +   s H i n t   +   " \ "   s t y l e = ' "   +   s S t y l e   +   " '   "   +   s e l D a y A c t i o n   +   " > & n b s p ; < f o n t   c o l o r = # 9 0 9 0 9 0 > "   +   d a t e P o i n t e r   +   " < / f o n t > & n b s p ; < / a > " ;  
                         e l s e  
                                 s H T M L   + =   " < a   "   +   d a t e M e s s a g e   +   "   t i t l e = \ " "   +   s H i n t   +   " \ "   s t y l e = ' "   +   s S t y l e   +   " '   "   +   s e l D a y A c t i o n   +   " > & n b s p ; < f o n t   c o l o r = # 5 4 A 6 E 2 > "   +   d a t e P o i n t e r   +   " < / f o n t > & n b s p ; < / a > " ;  
                 }   e l s e   i f   ( ( d a y P o i n t e r   %   7   = =   ( s t a r t A t   *   - 1 )   +   7   & &   s t a r t A t   = =   1 )   | |   ( d a y P o i n t e r   %   7   = =   s t a r t A t   & &   s t a r t A t   = =   0 ) )   { 	 / / / / /   S I   E S   S A B A D O  
                         i f   ( i s P a s t   = =   1 )  
                                 s H T M L   + =   " < a   "   +   d a t e M e s s a g e   +   "   t i t l e = \ " "   +   s H i n t   +   " \ "   s t y l e = ' "   +   s S t y l e   +   " '   "   +   s e l D a y A c t i o n   +   " > & n b s p ; < f o n t   c o l o r = # 9 0 9 0 9 0 > "   +   d a t e P o i n t e r   +   " < / f o n t > & n b s p ; < / a > " ;  
                         e l s e   i f   ( i s F u t u r e   = =   1 )  
                                 s H T M L   + =   " < a   "   +   d a t e M e s s a g e   +   "   t i t l e = \ " "   +   s H i n t   +   " \ "   s t y l e = ' "   +   s S t y l e   +   " '   "   +   s e l D a y A c t i o n   +   " > & n b s p ; < f o n t   c o l o r = # 9 0 9 0 9 0 > "   +   d a t e P o i n t e r   +   " < / f o n t > & n b s p ; < / a > " ;  
                         e l s e  
                                 s H T M L   + =   " < a   "   +   d a t e M e s s a g e   +   "   t i t l e = \ " "   +   s H i n t   +   " \ "   s t y l e = ' "   +   s S t y l e   +   " '   "   +   s e l D a y A c t i o n   +   " > & n b s p ; < f o n t   c o l o r = # 5 4 A 6 E 2 > "   +   d a t e P o i n t e r   +   " < / f o n t > & n b s p ; < / a > " ;  
                 }   e l s e   { 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 / / / / /   C U A L Q U I E R   O T R O   D I A  
                         i f   ( i s P a s t   = =   1 )  
                                 s H T M L   + =   " < a   "   +   d a t e M e s s a g e   +   "   t i t l e = \ " "   +   s H i n t   +   " \ "   s t y l e = ' "   +   s S t y l e   +   " '   "   +   s e l D a y A c t i o n   +   " > & n b s p ; < f o n t   c o l o r = # 9 0 9 0 9 0 > "   +   d a t e P o i n t e r   +   " < / f o n t > & n b s p ; < / a > " ;  
                         e l s e   i f   ( i s F u t u r e   = =   1 )  
                                 s H T M L   + =   " < a   "   +   d a t e M e s s a g e   +   "   t i t l e = \ " "   +   s H i n t   +   " \ "   s t y l e = ' "   +   s S t y l e   +   " '   "   +   s e l D a y A c t i o n   +   " > & n b s p ; < f o n t   c o l o r = # 9 0 9 0 9 0 > "   +   d a t e P o i n t e r   +   " < / f o n t > & n b s p ; < / a > " ;  
                         e l s e  
                                 s H T M L   + =   " < a   "   +   d a t e M e s s a g e   +   "   t i t l e = \ " "   +   s H i n t   +   " \ "   s t y l e = ' "   +   s S t y l e   +   " '   "   +   s e l D a y A c t i o n   +   " > & n b s p ; < f o n t   c o l o r = # 0 0 0 0 6 6 > "   +   d a t e P o i n t e r   +   " < / f o n t > & n b s p ; < / a > " ;  
                 }  
  
                 s H T M L   + =   ' ' ;  
                 i f   ( ( d a y P o i n t e r   +   s t a r t A t )   %   7   = =   s t a r t A t )   {  
                         s H T M L   + =   ' < / t r > < t r > ' ;  
                         i f   ( ( s h o w W e e k N u m b e r   = =   1 )   & &   ( d a t e P o i n t e r   <   n u m D a y s I n M o n t h ) )   {  
                                 s H T M L   + =   ' < t d   a l i g n = " r i g h t " > '   +   ( W e e k N b r ( n e w   D a t e ( y e a r S e l e c t e d ,   m o n t h S e l e c t e d ,   d a t e P o i n t e r   +   1 ) ) )   +   ' & n b s p ; < / t d > ' ;  
                         }  
                 }  
         }  
  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' c o n t e n t ' ) . i n n e r H T M L   =   s H T M L  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' s p a n M o n t h ' ) . i n n e r H T M L   =   ' & n b s p ; '   +   m o n t h N a m e [ l a n g u a g e ] [ m o n t h S e l e c t e d ]   +   ' & n b s p ; < i m g   i d = " c h a n g e M o n t h "   s r c = " '   +   i m g D i r   +   ' d r o p 1 . g i f "   w i d t h = " 1 2 "   h e i g h t = " 1 0 "   b o r d e r = " 0 " > '  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' s p a n Y e a r ' ) . i n n e r H T M L   =   ' & n b s p ; '   +   y e a r S e l e c t e d   +   ' & n b s p ; < i m g   i d = " c h a n g e Y e a r "   s r c = " '   +   i m g D i r   +   ' d r o p 1 . g i f "   w i d t h = " 1 2 "   h e i g h t = " 1 0 "   b o r d e r = " 0 " > ' ;  
 }  
  
 f u n c t i o n   s h o w C a l e n d a r ( c t l ,   c t l 2 ,   f o r m a t ,   l a n g ,   p a s t ,   f x ,   f y )   {  
         i f   ( l a n g   ! =   n u l l   & &   l a n g   ! =   ' ' )   l a n g u a g e   =   l a n g ;  
         i f   ( p a s t   ! =   n u l l )   e n a b l e P a s t   =   p a s t ;  
         e l s e   e n a b l e P a s t   =   0 ;  
         i f   ( f x   ! =   n u l l )   f i x e d X   =   f x ;  
         e l s e   f i x e d X   =   - 1 ;  
         i f   ( f y   ! =   n u l l )   f i x e d Y   =   f y ;  
         e l s e   f i x e d Y   =   - 1 ;  
  
         i f   ( s h o w T o d a y   = =   1 )   {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l T o d a y ' ) . i n n e r H T M L   =   ' < f o n t   c o l o r = " # 0 0 0 0 6 6 " > '   +   t o d a y S t r i n g [ l a n g u a g e ]   +   '   < a   o n m o u s e m o v e = " w i n d o w . s t a t u s = \ ' '   +   g o t o S t r i n g [ l a n g u a g e ]   +   ' \ ' "   o n m o u s e o u t = " w i n d o w . s t a t u s = \ ' \ ' "   t i t l e = " '   +   g o t o S t r i n g [ l a n g u a g e ]   +   ' "   s t y l e = " '   +   s t y l e A n c h o r   +   ' "   h r e f = " j a v a s c r i p t : m o n t h S e l e c t e d = m o n t h N o w ; y e a r S e l e c t e d = y e a r N o w ; c o n s t r u c t C a l e n d a r ( ) ; " > '   +   d a y N a m e [ l a n g u a g e ] [ ( t o d a y . g e t D a y ( )   -   s t a r t A t   = =   - 1 )   ?   6   :   ( t o d a y . g e t D a y ( )   -   s t a r t A t ) ]   +   ' ,   '   +   d a t e N o w   +   '   '   +   m o n t h N a m e [ l a n g u a g e ] [ m o n t h N o w ] . s u b s t r i n g ( 0 ,   3 )   +   '   '   +   y e a r N o w   +   ' < / a > < / f o n t > ' ;  
         }  
         p o p U p C a l e n d a r ( c t l ,   c t l 2 ,   f o r m a t ) ;  
 }  
  
 f u n c t i o n   p o p U p C a l e n d a r ( c t l ,   c t l 2 ,   f o r m a t ,   z o n e i d ,   l a n g )   {  
         v a r   l e f t p o s   =   0 ;  
         v a r   t o p p o s   =   0 ;  
         i f   ( l a n g   ! =   n u l l )   {  
                 l a n g u a g e   =   l a n g ;  
         }  
  
         i f   ( s h o w T o d a y   = =   1 )   {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l T o d a y ' ) . i n n e r H T M L   =   ' < f o n t   c o l o r = " # 0 0 0 0 6 6 " > '   +   t o d a y S t r i n g [ l a n g u a g e ]   +   '   < a   o n m o u s e m o v e = " w i n d o w . s t a t u s = \ ' '   +   g o t o S t r i n g [ l a n g u a g e ]   +   ' \ ' "   o n m o u s e o u t = " w i n d o w . s t a t u s = \ ' \ ' "   t i t l e = " '   +   g o t o S t r i n g [ l a n g u a g e ]   +   ' "   s t y l e = " '   +   s t y l e A n c h o r   +   ' "   h r e f = " j a v a s c r i p t : m o n t h S e l e c t e d = m o n t h N o w ; y e a r S e l e c t e d = y e a r N o w ; c o n s t r u c t C a l e n d a r ( ) ; " > '   +   ' < b > '   +   f u l l d a y N a m e [ l a n g u a g e ] [ ( t o d a y . g e t D a y ( )   -   s t a r t A t   = =   - 1 )   ?   6   :   ( t o d a y . g e t D a y ( )   -   s t a r t A t ) ]   +   ' < / b > ,   '   +   d a t e N o w   +   '   < b > '   +   m o n t h N a m e [ l a n g u a g e ] [ m o n t h N o w ]   +   ' < / b >   '   +   y e a r N o w   +   ' < / a > < / f o n t > ' ;  
         }  
  
         z o n e   =   z o n e i d ;  
         i f   ( b P a g e L o a d e d )   {  
                 i f   ( c r o s s o b j . v i s i b i l i t y   = =   ' h i d d e n ' )   {  
                         c t l T o P l a c e V a l u e   =   c t l 2 ;  
                         d a t e F o r m a t   =   f o r m a t ;  
                         f o r m a t C h a r   =   '   ' ;  
                         a F o r m a t   =   d a t e F o r m a t . s p l i t ( f o r m a t C h a r ) ;  
                         i f   ( a F o r m a t . l e n g t h   <   3 )   {  
                                 f o r m a t C h a r   =   ' / ' ;  
                                 a F o r m a t   =   d a t e F o r m a t . s p l i t ( f o r m a t C h a r ) ;  
                                 i f   ( a F o r m a t . l e n g t h   <   3 )   {  
                                         f o r m a t C h a r   =   ' . ' ;  
                                         a F o r m a t   =   d a t e F o r m a t . s p l i t ( f o r m a t C h a r ) ;  
                                         i f   ( a F o r m a t . l e n g t h   <   3 )   {  
                                                 f o r m a t C h a r   =   ' - ' ;  
                                                 a F o r m a t   =   d a t e F o r m a t . s p l i t ( f o r m a t C h a r ) ;  
                                                 i f   ( a F o r m a t . l e n g t h   <   3 )   {  
                                                         f o r m a t C h a r   =   ' ' ;   	 	 	 	 / /   i n v a l i d   d a t e   f o r m a t  
  
                                                 }  
                                         }  
                                 }  
                         }  
  
                         t o k e n s C h a n g e d   =   0 ;  
                         i f   ( f o r m a t C h a r   ! =   " " )   {  
                                 i f   ( c t l 2 . v a l u e   ! =   n u l l )   {  
                                         a D a t a   =   c t l 2 . v a l u e . s p l i t ( f o r m a t C h a r ) ;   	 	 / /   u s e   u s e r ' s   d a t e  
  
                                         f o r   ( i   =   0 ;   i   <   3 ;   i + + )   {  
                                                 i f   ( ( a F o r m a t [ i ]   = =   " d " )   | |   ( a F o r m a t [ i ]   = =   " d d " ) )   {  
                                                         d a t e S e l e c t e d   =   p a r s e I n t ( a D a t a [ i ] ,   1 0 ) ;  
                                                         t o k e n s C h a n g e d + + ;  
                                                 }   e l s e   i f   ( ( a F o r m a t [ i ]   = =   " m " )   | |   ( a F o r m a t [ i ]   = =   " m m " ) )   {  
                                                         m o n t h S e l e c t e d   =   p a r s e I n t ( a D a t a [ i ] ,   1 0 )   -   1 ;  
                                                         t o k e n s C h a n g e d + + ;  
                                                 }   e l s e   i f   ( a F o r m a t [ i ]   = =   " y y y y " )   {  
                                                         y e a r S e l e c t e d   =   p a r s e I n t ( a D a t a [ i ] ,   1 0 ) ;  
                                                         t o k e n s C h a n g e d + + ;  
                                                 }   e l s e   i f   ( a F o r m a t [ i ]   = =   " m m m " )   {  
                                                         f o r   ( j   =   0 ;   j   <   1 2 ;   j + + )   {  
                                                                 i f   ( a D a t a [ i ]   = =   m o n t h N a m e [ l a n g u a g e ] [ j ] )   {  
                                                                         m o n t h S e l e c t e d   =   j ;  
                                                                         t o k e n s C h a n g e d + + ;  
                                                                 }  
                                                         }  
                                                 }   e l s e   i f   ( a F o r m a t [ i ]   = =   " m m m m " )   {  
                                                         f o r   ( j   =   0 ;   j   <   1 2 ;   j + + )   {  
                                                                 i f   ( a D a t a [ i ]   = =   m o n t h N a m e 2 [ l a n g u a g e ] [ j ] )   {  
                                                                         m o n t h S e l e c t e d   =   j ;  
                                                                         t o k e n s C h a n g e d + + ;  
                                                                 }  
                                                         }  
                                                 }  
                                         }  
                                 }  
                         }  
  
                         i f   ( ( t o k e n s C h a n g e d   ! =   3 )   | |   i s N a N ( d a t e S e l e c t e d )   | |   i s N a N ( m o n t h S e l e c t e d )   | |   i s N a N ( y e a r S e l e c t e d ) )   {  
                                 d a t e S e l e c t e d   =   d a t e N o w ;  
                                 m o n t h S e l e c t e d   =   m o n t h N o w ;  
                                 y e a r S e l e c t e d   =   y e a r N o w ;  
                         }  
  
                         o d a t e S e l e c t e d   =   d a t e S e l e c t e d ;  
                         o m o n t h S e l e c t e d   =   m o n t h S e l e c t e d ;  
                         o y e a r S e l e c t e d   =   y e a r S e l e c t e d ;  
  
                         a T a g   =   c t l ;  
                         d o   {  
                                 a T a g   =   a T a g . o f f s e t P a r e n t ;  
                                 l e f t p o s   + =   a T a g . o f f s e t L e f t ;  
                                 t o p p o s   + =   a T a g . o f f s e t T o p ;  
                         }   w h i l e   ( a T a g . t a g N a m e   ! =   ' B O D Y ' ) ;  
  
                         c r o s s o b j . l e f t   =   ( f i x e d X   = =   - 1 )   ?   l e f t p o s   +   c t l . o f f s e t L e f t   -   1 1 0   :   f i x e d X ;  
                         c r o s s o b j . t o p   =   ( f i x e d Y   = =   - 1 )   ?   c t l . o f f s e t T o p   +   t o p p o s   +   c t l . o f f s e t H e i g h t   +   2   :   f i x e d Y ;  
                         c o n s t r u c t C a l e n d a r ( 1 ,   m o n t h S e l e c t e d ,   y e a r S e l e c t e d ) ;  
                         c r o s s o b j . v i s i b i l i t y   =   ( d o m   | |   i e )   ?   " v i s i b l e "   :   " s h o w " ;  
  
                         h i d e E l e m e n t ( ' S E L E C T ' ,   d o c u m e n t . g e t E l e m e n t B y I d ( ' c a l e n d a r ' ) ) ;  
                         h i d e E l e m e n t ( ' A P P L E T ' ,   d o c u m e n t . g e t E l e m e n t B y I d ( ' c a l e n d a r ' ) ) ;  
  
                         b S h o w   =   t r u e ;  
                 }   e l s e   {  
                         h i d e C a l e n d a r ( ) ;  
                         i f   ( c t l N o w   ! =   c t l )   p o p U p C a l e n d a r ( c t l ,   c t l 2 ,   f o r m a t ) ;  
                 }  
                 c t l N o w   =   c t l ;  
         }  
 }  
  
 d o c u m e n t . o n k e y p r e s s   =   f u n c t i o n   h i d e c a l 1 ( )   {  
         h i d e C a l e n d a r ( ) ;  
 }  
 d o c u m e n t . o n c l i c k   =   f u n c t i o n   h i d e c a l 2 ( )   {  
         i f   ( ! b S h o w )   h i d e C a l e n d a r ( ) ;  
         b S h o w   =   f a l s e ;  
 }  
  
 i f   ( i e )   {  
         i n i t ( ) ;  
 }   e l s e   {  
         w i n d o w . o n l o a d   =   i n i t ;  
 } 
