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