ÿþ/ / 	 w r i t t e n 	 b y   T a n   L i n g 	 W e e 	 o n   2   D e c   2 0 0 1  
 / / 	 l a s t   u p d a t e d   1 0   A p r   2 0 0 2  
 / / 	 e m a i l   : 	 f u u s h i k a d e n @ y a h o o . c o m  
 / /     M o d i f i e d   ( v e r y   l i t t l e )   b y   S a i   o n   0 1 / 0 2 / 0 5  
 / /     e m a i l   : 	 s a i _ f r e e l a n c e @ y a h o o . c o m  
  
 	 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   =   0   / /   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   =   0 	 / /   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   =   " / P M O / U s e r C o n t r o l s / C a l e n d a r / D a t e S e l e c t o r / c a l / " 	 / /   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   g o t o S t r i n g   =   " G o   T o   C u r r e n t   M o n t h "  
 	 v a r   t o d a y S t r i n g   =   " ÔÙÕÝ  ÙÕÝ"  
 	 v a r   w e e k S t r i n g   =   " W k "  
 	 v a r   s c r o l l L e f t M e s s a g e   =   " 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 . "  
 	 v a r   s c r o l l R i g h t M e s s a g e   =   " 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 . "  
 	 v a r   s e l e c t M o n t h M e s s a g e   =   " C l i c k   t o   s e l e c t   a   m o n t h . "  
 	 v a r   s e l e c t Y e a r M e s s a g e   =   " C l i c k   t o   s e l e c t   a   y e a r . "  
 	 v a r   s e l e c t D a t e M e s s a g e   =   " S e l e c t   [ d a t e ]   a s   d a t 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 .  
  
 	 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  
  
 	 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   o F u n c t i o n s   =   " "  
  
 	 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   ) ;  
                     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   ) ) ;  
                     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   +   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 ' 	 c l a s s = ' d i v - s t y l e ' > < 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 8 0 : 2 5 0 ) + "   c l a s s = ' t a b l e - s t y l e ' > < t r   c l a s s = ' t i t l e - b a c k g r o u n d - s t y l e '   > < 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 7 8 : 2 4 8 ) + " ' > < t r > < t d   c l a s s = ' t i t l e - s t y l e ' > < B > < s p a n   i d = ' c a p t i o n ' > < / s p a n > < / B > < / 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 L T = ' C l o s e   t h e   C a l e n d a r ' > < / a > < / t d > < / t r > < / t a b l e > < / t d > < / t r > < t r > < t d   c l a s s = ' b o d y - s t y l e ' > < 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   c l a s s = ' t o d a y - s t y l e ' > < t d > < 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 '   c l a s s = ' d i v - s t y l e ' > < / d i v > < d i v   i d = ' s e l e c t Y e a r '   c l a s s = ' d i v - s t y l e ' > < / d i v > " ) ;  
 	 }  
  
 	 / / v a r 	 m o n t h N a m e   = 	 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 " )  
 	 v a r 	 m o n t h N a m e   = 	 n e w 	 A r r a y ( " ÙàÕÐè" , " äÑÕÐè" , " Þèå" , " ÐäèÙÜ" , " ÞÐÙ" , " ÙÕàÙ" , " ÙÕÜÙ" , " ÐÕÒÕáØ" , " áäØÞÑè" , " ÐÕçØÕÑè" , " àÕÑÞÑè" , " ÓæÞÑè" )  
 	  
 	 i f   ( s t a r t A t = = 0 )  
 	 {  
 	 	 / / d a y N a m e   =   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 " )  
 	 	 d a y N a m e   =   n e w   A r r a y 	 ( " èÐéÕß" , " éàÙ" , " éÜÙéÙ" , " èÑÙâÙ" , " ×ÞÙéÙ" , " éÙéÙ" , " éÑê" )  
 	 	  
 	 }  
 	 e l s e  
 	 {  
 	 	 / / d a y N a m e   =   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 " ) 	  
 	 	 d a y N a m e   =   n e w   A r r a y 	 ( " èÐéÕß" , " éàÙ" , " éÜÙéÙ" , " èÑÙâÙ" , " ×ÞÙéÙ" , " éÙéÙ" , " éÑê" )  
 	 	 	  
 	 }  
  
 	 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   = 	   "   < a   c l a s s = ' t o d a y - s t y l e '   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 + " \ " '   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 + " '   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 ( ) ; ' > " + t o d a y S t r i n g   + "   "   + d a y N a m 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 [ 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 > "  
 	 	 	 }  
  
 	 	 	 s H T M L 1 =   " < s p a n   i d = ' s p a n L e f t '     c l a s s = ' t i t l e - c o n t r o l - n o r m a l - s t y l e '   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 . c l a s s N a m e = \ " t i t l e - c o n t r o l - s e l e c t - s t y l e \ " ; 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 + " \ " '   o n c l i c k = ' j a v a s c r i p t : 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 . c l a s s N a m e = \ " t i t l e - c o n t r o l - n o r m a l - s t y l e \ " ; 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 '   c l a s s = ' t i t l e - c o n t r o l - n o r m a l - s t y l e '   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 . c l a s s N a m e = \ " t i t l e - c o n t r o l - s e l e c t - s t y l e \ " ; 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 + " \ " '   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 . c l a s s N a m e = \ " t i t l e - c o n t r o l - n o r m a l - s t y l e \ " ; 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 '   c l a s s = ' t i t l e - c o n t r o l - n o r m a l - s t y l e '   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 . c l a s s N a m e = \ " t i t l e - c o n t r o l - s e l e c t - s t y l e \ " ; 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 + " \ " '   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 . c l a s s N a m e = \ " t i t l e - c o n t r o l - n o r m a l - s t y l e \ " ; 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 '     c l a s s = ' t i t l e - c o n t r o l - n o r m a l - s t y l e '   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 . c l a s s N a m e = \ " t i t l e - c o n t r o l - s e l e c t - s t y l e \ " ; 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 + " \ " ' 	 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 . c l a s s N a m e = \ " t i t l e - c o n t r o l - n o r m a l - s t y l e \ " ; 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 ( ) 	 {  
 	 	 i f ( c r o s s o b j ) {  
 	 	 	 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 " , " < 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 [ m ] )  
 	 	 r e t u r n   s T m p . r e p l a c e   ( " y y y y " , y )  
 	 }  
  
 	 f u n c t i o n   c l o s e C a l e n d a r ( )   {  
 	 	 v a r 	 s T m p  
  
 	 	 h i d 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 )  
 	 }  
  
 	 / * * *   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 [ 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 . c l a s s N a m e = \ " d r o p d o w n - s e l e c t - s t y l e \ " '   o n m o u s e o u t = ' t h i s . c l a s s N a m e = \ " d r o p d o w n - n o r m a l - s t y l e \ " '   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 ' > & n b s p ; "   +   s N a m e   +   " & n b s p ; < / 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 = 7 0 	 c l a s s = ' d r o p d o w n - s t y l e '   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 ( )   {  
 	 	 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 )   +   1 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  
 	 }  
  
 	 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 "  
 	 }  
  
 	 / * * *   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   = 	 " & n b s p ; < B > " 	 +   n e w Y e a r   + 	 " < / B > & n b s p ; "   }  
 	 	 	 e l s e  
 	 	 	 {   t x t Y e a r   = 	 " & n b s p ; "   +   n e w Y e a r   +   " & 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 ( " 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   = 	 " & n b s p ; < B > " 	 +   n e w Y e a r   + 	 " < / B > & n b s p ; "   }  
 	 	 	 e l s e  
 	 	 	 {   t x t Y e a r   = 	 " & n b s p ; "   +   n e w Y e a r   +   " & 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 ( " 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 . c l a s s N a m e = \ " d r o p d o w n - s e l e c t - s t y l 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 ) ; t h i s . c l a s s N a m e = \ " d r o p d o w n - n o r m a l - s t y l e \ " '   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 ) ' > - < / 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 . c l a s s N a m e = \ " d r o p d o w n - s e l e c t - s t y l e \ " '   o n m o u s e o u t = ' t h i s . c l a s s N a m e = \ " d r o p d o w n - n o r m a l - s t y l e \ " '   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 ' > & n b s p ; "   +   s N a m e   +   " & n b s p ; < / 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 . c l a s s N a m e = \ " d r o p d o w n - s e l e c t - s t y l 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 2 ) ; t h i s . c l a s s N a m e = \ " d r o p d o w n - n o r m a l - s t y l e \ " '   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 ) ' > + < / 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 l a s s = ' d r o p d o w n - s t y l e '   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 ) '   c e l l s p a c i n g = 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 "  
 	 }  
  
 	 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  
  
 	 	 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  
 	 }  
  
 	 / * * *   c a l e n d a r   * * * /  
  
 	 f u n c t i o n   W e e k N b r ( t o d a y )  
         {  
 	 	 Y e a r   =   t a k e Y e a r ( t o d a y ) ;  
 	 	 M o n t h   =   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 ( ) ;  
 	 	 n o w   =   D a t e . U T C ( Y e a r , M o n t h , D a y + 1 , 0 , 0 , 0 ) ;  
 	 	 v a r   F i r s t d a y   =   n e w   D a t e ( ) ;  
 	 	 F i r s t d a y . s e t Y e a r ( Y e a r ) ;  
 	 	 F i r s t d a y . s e t M o n t h ( 0 ) ;  
 	 	 F i r s t d a y . s e t D a t e ( 1 ) ;  
 	 	 t h e n   =   D a t e . U T C ( Y e a r , 0 , 1 , 0 , 0 , 0 ) ;  
 	 	 v a r   C o m p e n s a t i o n   =   F i r s t d a y . g e t D a y ( ) ;  
 	 	 i f   ( C o m p e n s a t i o n   >   3 )   C o m p e n s a t i o n   - =   4 ;  
 	 	 e l s e   C o m p e n s a t i o n   + =   3 ;  
 	 	 N u m b e r O f W e e k   =     M a t h . r o u n d ( ( ( ( n o w - t h e n ) / 8 6 4 0 0 0 0 0 ) + C o m p e n s a t i o n ) / 7 ) ;  
 	 	 r e t u r n   N u m b e r O f W e e k ;  
 	 }  
  
 	 f u n c t i o n   t a k e Y e a r ( t h e D a t e )  
 	 {  
 	 	 x   =   t h e D a t e . g e t Y e a r ( ) ;  
 	 	 v a r   y   =   x   %   1 0 0 ;  
 	 	 y   + =   ( y   <   3 8 )   ?   2 0 0 0   :   1 9 0 0 ;  
 	 	 r e t u r n   y ;  
 	 }  
  
 	 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   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 	 =   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 ( )  
  
 	 	 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   c l a s s = ' b o d y - s t y l e ' > < 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   +   " < / b > < / t d > < t d   w i d t h = 1   r o w s p a n = 7   c l a s s = ' w e e k n u m b e r - d i v - s t y l e ' > < 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 = ' 3 0 '   a l i g n = ' r i g h t ' > < B > " +   d a y N a m e [ i ] + " < / 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 > "  
  
 	 	 	 v a r   s S t y l e = " n o r m a l - d a y - s t y l e " ;   / / r e g u l a r   d a y  
  
 	 	 	 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 S t y l e   =   " c u r r e n t - d a y - s t y l e " ;   }    
 	 	 	 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 )   )   / / e n d - o f - t h e - w e e k   d a y  
 	 	 	 {   s S t y l e   =   " e n d - o f - w e e k d a y - s t y l e " ;   }  
  
 	 	 	 / / s e l e c t e d   d a y  
 	 	 	 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 e l e c t e d - d a y - s t y l e " ;   }  
  
 	 	 	 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   + =   "   h o l i d a y - s t y l e " ;  
 	 	 	 	 	 	 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  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 v a r   r e g e x p =   / \ " / g  
 	 	 	 s H i n t = s H i n t . r e p l a c e ( r e g e x p , " & 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 . 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 = \ " \ " '   "  
  
 	 	 	 s H T M L   + =   " < a   c l a s s = ' " + s S t y l e + " '   " + d a t e M e s s a g e + "   t i t l e = \ " "   +   s H i n t   +   " \ "   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 ( ) ; d o O t h e r F u n c t i o n s ( ) ; ' > & n b s p ; "   +   d a t e P o i n t e r   +   " & 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 [ 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   d o O t h e r F u n c t i o n s ( ) {  
 	 	 / / C o m m e n t s   B y   S a i  
 	 	 / / i f ( o F u n c t i o n s   ! =   " " ) {  
 	 	 / / 	 e v a l ( o F u n c t i o n s )  
 	 	 / / }  
 	 	  
 	 	  
 	 }  
  
 	 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 ,   O t h e r F u n c t i o n s )   {  
  
 	 	 v a r 	 l e f t p o s = 0  
 	 	 v a r 	 t o p p o s = 0  
 	 	 o F u n c t i o n s   =   O t h e r F u n c t i o n s  
 	 	 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 )  
 	 	 	 	 	 	 	 {  
 	 	 	 	 	 	 	 	 / /   i n v a l i d   d a t e 	 f o r m a t  
 	 	 	 	 	 	 	 	 f o r m a t C h a r = " "  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 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 	 ! =   " "   )  
 	 	 	 	 {  
 	 	 	 	 	 / /   u s e   u s e r ' s   d a t e  
 	 	 	 	 	 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 )  
  
 	 	 	 	 	 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 [ 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   ?   c t l . o f f s e t L e f t 	 +   l e f t p o s   : 	 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  
 	 	 {  
 	 	 	 i n i 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 ,   O t h e r F u n c t i o n s )  
 	 	 }  
 	 }  
 	 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   ( )   {    
 	 	 i f   ( e v e n t . k e y C o d e = = 2 7 )    
 	 	 {  
 	 	 	 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  
 	 }  
  
 	 / / w i n d o w . o n l o a d = i n i t ( )  
 	 f u n c t i o n   C l e a r D a t e ( C l i e n t )  
 	 {  
                         v a r   f r o m D a t e V a l u e O b j   =   d o c u m e n t . g e t E l e m e n t B y I d ( C l i e n t . i d ) ;      
                           f r o m D a t e V a l u e O b j . v a l u e   =   " " ;  
 	 }  
 	 
