ÿþ/ * 	 C a l e n d a r   f o r   J A P A N i C A N . c o m . k r   o n l y 	 2 0 0 8 . 1 1 . 1 6 	 * /  
  
 / *   S O U R C E   F I L E :   A n c h o r P o s i t i o n . j s   * /  
  
 / *    
 A n c h o r P o s i t i o n . j s  
 A u t h o r :   M a t t   K r u s e  
 L a s t   m o d i f i e d :   1 0 / 1 1 / 0 2  
  
 D E S C R I P T I O N :   T h e s e   f u n c t i o n s   f i n d   t h e   p o s i t i o n   o f   a n   < A >   t a g   i n   a   d o c u m e n t ,  
 s o   o t h e r   e l e m e n t s   c a n   b e   p o s i t i o n e d   r e l a t i v e   t o   i t .  
  
 C O M P A T A B I L I T Y :   N e t s c a p e   4 . x , 6 . x , M o z i l l a ,   I E   5 . x , 6 . x   o n   W i n d o w s .   S o m e   s m a l l  
 p o s i t i o n i n g   e r r o r s   -   u s u a l l y   w i t h   W i n d o w   p o s i t i o n i n g   -   o c c u r   o n   t h e    
 M a c i n t o s h   p l a t f o r m .  
  
 F U N C T I O N S :  
 g e t A n c h o r P o s i t i o n ( a n c h o r n a m e )  
     R e t u r n s   a n   O b j e c t ( )   h a v i n g   . x   a n d   . y   p r o p e r t i e s   o f   t h e   p i x e l   c o o r d i n a t e s  
     o f   t h e   u p p e r - l e f t   c o r n e r   o f   t h e   a n c h o r .   P o s i t i o n   i s   r e l a t i v e   t o   t h e   P A G E .  
  
 g e t A n c h o r W i n d o w P o s i t i o n ( a n c h o r n a m e )  
     R e t u r n s   a n   O b j e c t ( )   h a v i n g   . x   a n d   . y   p r o p e r t i e s   o f   t h e   p i x e l   c o o r d i n a t e s  
     o f   t h e   u p p e r - l e f t   c o r n e r   o f   t h e   a n c h o r ,   r e l a t i v e   t o   t h e   W H O L E   S C R E E N .  
  
 N O T E S :  
  
 1 )   F o r   p o p p i n g   u p   s e p a r a t e   b r o w s e r   w i n d o w s ,   u s e   g e t A n c h o r W i n d o w P o s i t i o n .    
       O t h e r w i s e ,   u s e   g e t A n c h o r P o s i t i o n  
  
 2 )   Y o u r   a n c h o r   t a g   M U S T   c o n t a i n   b o t h   N A M E   a n d   I D   a t t r i b u t e s   w h i c h   a r e   t h e    
       s a m e .   F o r   e x a m p l e :  
       < A   N A M E = " t e s t "   I D = " t e s t " >   < / A >  
  
 3 )   T h e r e   m u s t   b e   a t   l e a s t   a   s p a c e   b e t w e e n   < A >   < / A >   f o r   I E 5 . 5   t o   s e e   t h e    
       a n c h o r   t a g   c o r r e c t l y .   D o   n o t   d o   < A > < / A >   w i t h   n o   s p a c e .  
 * /    
  
 / /   g e t A n c h o r P o s i t i o n ( a n c h o r n a m e )  
 / /       T h i s   f u n c t i o n   r e t u r n s   a n   o b j e c t   h a v i n g   . x   a n d   . y   p r o p e r t i e s   w h i c h   a r e   t h e   c o o r d i n a t e s  
 / /       o f   t h e   n a m e d   a n c h o r ,   r e l a t i v e   t o   t h e   p a g e .  
 f u n c t i o n   g e t A n c h o r P o s i t i o n ( a n c h o r n a m e )   {  
 	 / /   T h i s   f u n c t i o n   w i l l   r e t u r n   a n   O b j e c t   w i t h   x   a n d   y   p r o p e r t i e s  
 	 v a r   u s e W i n d o w = f a l s e ;  
 	 v a r   c o o r d i n a t e s = n e w   O b j e c t ( ) ;  
 	 v a r   x = 0 , y = 0 ;  
 	 / /   B r o w s e r   c a p a b i l i t y   s n i f f i n g  
 	 v a r   u s e _ g e b i = f a l s e ,   u s e _ c s s = f a l s e ,   u s e _ l a y e r s = f a l s e ;  
 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d )   {   u s e _ g e b i = t r u e ;   }  
 	 e l s e   i f   ( d o c u m e n t . a l l )   {   u s e _ c s s = t r u e ;   }  
 	 e l s e   i f   ( d o c u m e n t . l a y e r s )   {   u s e _ l a y e r s = t r u e ;   }  
 	 / /   L o g i c   t o   f i n d   p o s i t i o n  
   	 i f   ( u s e _ g e b i   & &   d o c u m e n t . a l l )   {  
 	 	 x = A n c h o r P o s i t i o n _ g e t P a g e O f f s e t L e f t ( d o c u m e n t . a l l [ a n c h o r n a m e ] ) ;  
 	 	 y = A n c h o r P o s i t i o n _ g e t P a g e O f f s e t T o p ( d o c u m e n t . a l l [ a n c h o r n a m e ] ) ;  
 	 	 }  
 	 e l s e   i f   ( u s e _ g e b i )   {  
 	 	 v a r   o = d o c u m e n t . g e t E l e m e n t B y I d ( a n c h o r n a m e ) ;  
 	 	 x = A n c h o r P o s i t i o n _ g e t P a g e O f f s e t L e f t ( o ) ;  
 	 	 y = A n c h o r P o s i t i o n _ g e t P a g e O f f s e t T o p ( o ) ;  
 	 	 }  
   	 e l s e   i f   ( u s e _ c s s )   {  
 	 	 x = A n c h o r P o s i t i o n _ g e t P a g e O f f s e t L e f t ( d o c u m e n t . a l l [ a n c h o r n a m e ] ) ;  
 	 	 y = A n c h o r P o s i t i o n _ g e t P a g e O f f s e t T o p ( d o c u m e n t . a l l [ a n c h o r n a m e ] ) ;  
 	 	 }  
 	 e l s e   i f   ( u s e _ l a y e r s )   {  
 	 	 v a r   f o u n d = 0 ;  
 	 	 f o r   ( v a r   i = 0 ;   i < d o c u m e n t . a n c h o r s . l e n g t h ;   i + + )   {  
 	 	 	 i f   ( d o c u m e n t . a n c h o r s [ i ] . n a m e = = a n c h o r n a m e )   {   f o u n d = 1 ;   b r e a k ;   }  
 	 	 	 }  
 	 	 i f   ( f o u n d = = 0 )   {  
 	 	 	 c o o r d i n a t e s . x = 0 ;   c o o r d i n a t e s . y = 0 ;   r e t u r n   c o o r d i n a t e s ;  
 	 	 	 }  
 	 	 x = d o c u m e n t . a n c h o r s [ i ] . x ;  
 	 	 y = d o c u m e n t . a n c h o r s [ i ] . y ;  
 	 	 }  
 	 e l s e   {  
 	 	 c o o r d i n a t e s . x = 0 ;   c o o r d i n a t e s . y = 0 ;   r e t u r n   c o o r d i n a t e s ;  
 	 	 }  
 	 c o o r d i n a t e s . x = x ;  
 	 c o o r d i n a t e s . y = y ;  
 	 r e t u r n   c o o r d i n a t e s ;  
 	 }  
  
 / /   g e t A n c h o r W i n d o w P o s i t i o n ( a n c h o r n a m e )  
 / /       T h i s   f u n c t i o n   r e t u r n s   a n   o b j e c t   h a v i n g   . x   a n d   . y   p r o p e r t i e s   w h i c h   a r e   t h e   c o o r d i n a t e s  
 / /       o f   t h e   n a m e d   a n c h o r ,   r e l a t i v e   t o   t h e   w i n d o w  
 f u n c t i o n   g e t A n c h o r W i n d o w P o s i t i o n ( a n c h o r n a m e )   {  
 	 v a r   c o o r d i n a t e s = g e t A n c h o r P o s i t i o n ( a n c h o r n a m e ) ;  
 	 v a r   x = 0 ;  
 	 v a r   y = 0 ;  
 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d )   {  
 	 	 i f   ( i s N a N ( w i n d o w . s c r e e n X ) )   {  
 	 	 	 x = c o o r d i n a t e s . x - d o c u m e n t . b o d y . s c r o l l L e f t + w i n d o w . s c r e e n L e f t ;  
 	 	 	 y = c o o r d i n a t e s . y - d o c u m e n t . b o d y . s c r o l l T o p + w i n d o w . s c r e e n T o p ;  
 	 	 	 }  
 	 	 e l s e   {  
 	 	 	 x = c o o r d i n a t e s . x + w i n d o w . s c r e e n X + ( w i n d o w . o u t e r W i d t h - w i n d o w . i n n e r W i d t h ) - w i n d o w . p a g e X O f f s e t ;  
 	 	 	 y = c o o r d i n a t e s . y + w i n d o w . s c r e e n Y + ( w i n d o w . o u t e r H e i g h t - 2 4 - w i n d o w . i n n e r H e i g h t ) - w i n d o w . p a g e Y O f f s e t ;  
 	 	 	 }  
 	 	 }  
 	 e l s e   i f   ( d o c u m e n t . a l l )   {  
 	 	 x = c o o r d i n a t e s . x - d o c u m e n t . b o d y . s c r o l l L e f t + w i n d o w . s c r e e n L e f t ;  
 	 	 y = c o o r d i n a t e s . y - d o c u m e n t . b o d y . s c r o l l T o p + w i n d o w . s c r e e n T o p ;  
 	 	 }  
 	 e l s e   i f   ( d o c u m e n t . l a y e r s )   {  
 	 	 x = c o o r d i n a t e s . x + w i n d o w . s c r e e n X + ( w i n d o w . o u t e r W i d t h - w i n d o w . i n n e r W i d t h ) - w i n d o w . p a g e X O f f s e t ;  
 	 	 y = c o o r d i n a t e s . y + w i n d o w . s c r e e n Y + ( w i n d o w . o u t e r H e i g h t - 2 4 - w i n d o w . i n n e r H e i g h t ) - w i n d o w . p a g e Y O f f s e t ;  
 	 	 }  
 	 c o o r d i n a t e s . x = x ;  
 	 c o o r d i n a t e s . y = y ;  
 	 r e t u r n   c o o r d i n a t e s ;  
 	 }  
  
 / /   F u n c t i o n s   f o r   I E   t o   g e t   p o s i t i o n   o f   a n   o b j e c t  
 f u n c t i o n   A n c h o r P o s i t i o n _ g e t P a g e O f f s e t L e f t   ( e l )   {  
 	 v a r   o l = e l . o f f s e t L e f t ;  
 	 w h i l e   ( ( e l = e l . o f f s e t P a r e n t )   ! =   n u l l )   {   o l   + =   e l . o f f s e t L e f t ;   }  
 	 r e t u r n   o l ;  
 	 }  
 f u n c t i o n   A n c h o r P o s i t i o n _ g e t W i n d o w O f f s e t L e f t   ( e l )   {  
 	 r e t u r n   A n c h o r P o s i t i o n _ g e t P a g e O f f s e t L e f t ( e l ) - d o c u m e n t . b o d y . s c r o l l L e f t ;  
 	 } 	  
 f u n c t i o n   A n c h o r P o s i t i o n _ g e t P a g e O f f s e t T o p   ( e l )   {  
 	 v a r   o t = e l . o f f s e t T o p ;  
 	 w h i l e ( ( e l = e l . o f f s e t P a r e n t )   ! =   n u l l )   {   o t   + =   e l . o f f s e t T o p ;   }  
 	 r e t u r n   o t ;  
 	 }  
 f u n c t i o n   A n c h o r P o s i t i o n _ g e t W i n d o w O f f s e t T o p   ( e l )   {  
 	 r e t u r n   A n c h o r P o s i t i o n _ g e t P a g e O f f s e t T o p ( e l ) - d o c u m e n t . b o d y . s c r o l l T o p ;  
 	 }  
  
 / *   S O U R C E   F I L E :   d a t e . j s   * /  
  
 / /   H I S T O R Y  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / /   M a y   1 7 ,   2 0 0 3 :   F i x e d   b u g   i n   p a r s e D a t e ( )   f o r   d a t e s   < 1 9 7 0  
 / /   M a r c h   1 1 ,   2 0 0 3 :   A d d e d   p a r s e D a t e ( )   f u n c t i o n  
 / /   M a r c h   1 1 ,   2 0 0 3 :   A d d e d   " N N N "   f o r m a t t i n g   o p t i o n .   D o e s n ' t   m a t c h   u p  
 / /                                   p e r f e c t l y   w i t h   S i m p l e D a t e F o r m a t   f o r m a t s ,   b u t    
 / /                                   b a c k w a r d s - c o m p a t a b i l i t y   w a s   r e q u i r e d .  
  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / /   T h e s e   f u n c t i o n s   u s e   t h e   s a m e   ' f o r m a t '   s t r i n g s   a s   t h e    
 / /   j a v a . t e x t . S i m p l e D a t e F o r m a t   c l a s s ,   w i t h   m i n o r   e x c e p t i o n s .  
 / /   T h e   f o r m a t   s t r i n g   c o n s i s t s   o f   t h e   f o l l o w i n g   a b b r e v i a t i o n s :  
 / /    
 / /   F i e l d                 |   F u l l   F o r m                     |   S h o r t   F o r m  
 / /   - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - -  
 / /   Y e a r                   |   y y y y   ( 4   d i g i t s )         |   y y   ( 2   d i g i t s ) ,   y   ( 2   o r   4   d i g i t s )  
 / /   M o n t h                 |   M M M   ( n a m e   o r   a b b r . ) |   M M   ( 2   d i g i t s ) ,   M   ( 1   o r   2   d i g i t s )  
 / /                             |   N N N   ( a b b r . )                 |  
 / /   D a y   o f   M o n t h   |   d d   ( 2   d i g i t s )             |   d   ( 1   o r   2   d i g i t s )  
 / /   D a y   o f   W e e k     |   E E   ( n a m e )                     |   E   ( a b b r )  
 / /   H o u r   ( 1 - 1 2 )     |   h h   ( 2   d i g i t s )             |   h   ( 1   o r   2   d i g i t s )  
 / /   H o u r   ( 0 - 2 3 )     |   H H   ( 2   d i g i t s )             |   H   ( 1   o r   2   d i g i t s )  
 / /   H o u r   ( 0 - 1 1 )     |   K K   ( 2   d i g i t s )             |   K   ( 1   o r   2   d i g i t s )  
 / /   H o u r   ( 1 - 2 4 )     |   k k   ( 2   d i g i t s )             |   k   ( 1   o r   2   d i g i t s )  
 / /   M i n u t e               |   m m   ( 2   d i g i t s )             |   m   ( 1   o r   2   d i g i t s )  
 / /   S e c o n d               |   s s   ( 2   d i g i t s )             |   s   ( 1   o r   2   d i g i t s )  
 / /   A M / P M                 |   a                                     |  
 / /  
 / /   N O T E   T H E   D I F F E R E N C E   B E T W E E N   M M   a n d   m m !   M o n t h = M M ,   n o t   m m !  
 / /   E x a m p l e s :  
 / /     " M M M   d ,   y "   m a t c h e s :   J a n u a r y   0 1 ,   2 0 0 0  
 / /                                             D e c   1 ,   1 9 0 0  
 / /                                             N o v   2 0 ,   0 0  
 / /     " M / d / y y "       m a t c h e s :   0 1 / 2 0 / 0 0  
 / /                                             9 / 2 / 0 0  
 / /     " M M M   d d ,   y y y y   h h : m m : s s a "   m a t c h e s :   " J a n u a r y   0 1 ,   2 0 0 0   1 2 : 3 0 : 4 5 A M "  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
  
 v a r   M O N T H _ N A M E S = n e w   A r r a y ( ' 1 ' , ' 2 ' , ' 3 ' , ' 4 ' , ' 5 ' , ' 6 ' , ' 7 ' , ' 8 ' , ' 9 ' , ' 1 0 ' , ' 1 1 ' , ' 1 2 ' , ' 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 ' ) ;  
 v a r   D A Y _ N A M E S = 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 ' , ' S u n ' , ' M o n ' , ' T u e ' , ' W e d ' , ' T h u ' , ' F r i ' , ' S a t ' ) ;  
 f u n c t i o n   L Z ( x )   { r e t u r n ( x < 0 | | x > 9 ? " " : " 0 " ) + x }  
  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / /   i s D a t e   (   d a t e _ s t r i n g ,   f o r m a t _ s t r i n g   )  
 / /   R e t u r n s   t r u e   i f   d a t e   s t r i n g   m a t c h e s   f o r m a t   o f   f o r m a t   s t r i n g   a n d  
 / /   i s   a   v a l i d   d a t e .   E l s e   r e t u r n s   f a l s e .  
 / /   I t   i s   r e c o m m e n d e d   t h a t   y o u   t r i m   w h i t e s p a c e   a r o u n d   t h e   v a l u e   b e f o r e  
 / /   p a s s i n g   i t   t o   t h i s   f u n c t i o n ,   a s   w h i t e s p a c e   i s   N O T   i g n o r e d !  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   i s D a t e ( v a l , f o r m a t )   {  
 	 v a r   d a t e = g e t D a t e F r o m F o r m a t ( v a l , f o r m a t ) ;  
 	 i f   ( d a t e = = 0 )   {   r e t u r n   f a l s e ;   }  
 	 r e t u r n   t r u e ;  
 	 }  
  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / /   c o m p a r e D a t e s ( d a t e 1 , d a t e 1 f o r m a t , d a t e 2 , d a t e 2 f o r m a t )  
 / /       C o m p a r e   t w o   d a t e   s t r i n g s   t o   s e e   w h i c h   i s   g r e a t e r .  
 / /       R e t u r n s :  
 / /       1   i f   d a t e 1   i s   g r e a t e r   t h a n   d a t e 2  
 / /       0   i f   d a t e 2   i s   g r e a t e r   t h a n   d a t e 1   o f   i f   t h e y   a r e   t h e   s a m e  
 / /     - 1   i f   e i t h e r   o f   t h e   d a t e s   i s   i n   a n   i n v a l i d   f o r m a t  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   c o m p a r e D a t e s ( d a t e 1 , d a t e f o r m a t 1 , d a t e 2 , d a t e f o r m a t 2 )   {  
 	 v a r   d 1 = g e t D a t e F r o m F o r m a t ( d a t e 1 , d a t e f o r m a t 1 ) ;  
 	 v a r   d 2 = g e t D a t e F r o m F o r m a t ( d a t e 2 , d a t e f o r m a t 2 ) ;  
 	 i f   ( d 1 = = 0   | |   d 2 = = 0 )   {  
 	 	 r e t u r n   - 1 ;  
 	 	 }  
 	 e l s e   i f   ( d 1   >   d 2 )   {  
 	 	 r e t u r n   1 ;  
 	 	 }  
 	 r e t u r n   0 ;  
 	 }  
  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / /   f o r m a t D a t e   ( d a t e _ o b j e c t ,   f o r m a t )  
 / /   R e t u r n s   a   d a t e   i n   t h e   o u t p u t   f o r m a t   s p e c i f i e d .  
 / /   T h e   f o r m a t   s t r i n g   u s e s   t h e   s a m e   a b b r e v i a t i o n s   a s   i n   g e t D a t e F r o m F o r m a t ( )  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   f o r m a t D a t e ( d a t e , f o r m a t )   {  
 	 f o r m a t = f o r m a t + " " ;  
 	 v a r   r e s u l t = " " ;  
 	 v a r   i _ f o r m a t = 0 ;  
 	 v a r   c = " " ;  
 	 v a r   t o k e n = " " ;  
 	 v a r   y = d a t e . g e t Y e a r ( ) + " " ;  
 	 v a r   M = d a t e . g e t M o n t h ( ) + 1 ;  
 	 v a r   d = d a t e . g e t D a t e ( ) ;  
 	 v a r   E = d a t e . g e t D a y ( ) ;  
 	 v a r   H = d a t e . g e t H o u r s ( ) ;  
 	 v a r   m = d a t e . g e t M i n u t e s ( ) ;  
 	 v a r   s = d a t e . g e t S e c o n d s ( ) ;  
 	 v a r   y y y y , y y , M M M , M M , d d , h h , h , m m , s s , a m p m , H H , H , K K , K , k k , k ;  
 	 / /   C o n v e r t   r e a l   d a t e   p a r t s   i n t o   f o r m a t t e d   v e r s i o n s  
 	 v a r   v a l u e = n e w   O b j e c t ( ) ;  
 	 i f   ( y . l e n g t h   <   4 )   { y = " " + ( y - 0 + 1 9 0 0 ) ; }  
 	 v a l u e [ " y " ] = " " + y ;  
 	 v a l u e [ " y y y y " ] = y ;  
 	 v a l u e [ " y y " ] = y . s u b s t r i n g ( 2 , 4 ) ;  
 	 v a l u e [ " M " ] = M ;  
 	 v a l u e [ " M M " ] = L Z ( M ) ;  
 	 v a l u e [ " M M M " ] = M O N T H _ N A M E S [ M - 1 ] ;  
 	 v a l u e [ " N N N " ] = M O N T H _ N A M E S [ M + 1 1 ] ;  
 	 v a l u e [ " d " ] = d ;  
 	 v a l u e [ " d d " ] = L Z ( d ) ;  
 	 v a l u e [ " E " ] = D A Y _ N A M E S [ E + 7 ] ;  
 	 v a l u e [ " E E " ] = D A Y _ N A M E S [ E ] ;  
 	 v a l u e [ " H " ] = H ;  
 	 v a l u e [ " H H " ] = L Z ( H ) ;  
 	 i f   ( H = = 0 ) { v a l u e [ " h " ] = 1 2 ; }  
 	 e l s e   i f   ( H > 1 2 ) { v a l u e [ " h " ] = H - 1 2 ; }  
 	 e l s e   { v a l u e [ " h " ] = H ; }  
 	 v a l u e [ " h h " ] = L Z ( v a l u e [ " h " ] ) ;  
 	 i f   ( H > 1 1 ) { v a l u e [ " K " ] = H - 1 2 ; }   e l s e   { v a l u e [ " K " ] = H ; }  
 	 v a l u e [ " k " ] = H + 1 ;  
 	 v a l u e [ " K K " ] = L Z ( v a l u e [ " K " ] ) ;  
 	 v a l u e [ " k k " ] = L Z ( v a l u e [ " k " ] ) ;  
 	 i f   ( H   >   1 1 )   {   v a l u e [ " a " ] = " P M " ;   }  
 	 e l s e   {   v a l u e [ " a " ] = " A M " ;   }  
 	 v a l u e [ " m " ] = m ;  
 	 v a l u e [ " m m " ] = L Z ( m ) ;  
 	 v a l u e [ " s " ] = s ;  
 	 v a l u e [ " s s " ] = L Z ( s ) ;  
 	 w h i l e   ( i _ f o r m a t   <   f o r m a t . l e n g t h )   {  
 	 	 c = f o r m a t . c h a r A t ( i _ f o r m a t ) ;  
 	 	 t o k e n = " " ;  
 	 	 w h i l e   ( ( f o r m a t . c h a r A t ( i _ f o r m a t ) = = c )   & &   ( i _ f o r m a t   <   f o r m a t . l e n g t h ) )   {  
 	 	 	 t o k e n   + =   f o r m a t . c h a r A t ( i _ f o r m a t + + ) ;  
 	 	 	 }  
 	 	 i f   ( v a l u e [ t o k e n ]   ! =   n u l l )   {   r e s u l t = r e s u l t   +   v a l u e [ t o k e n ] ;   }  
 	 	 e l s e   {   r e s u l t = r e s u l t   +   t o k e n ;   }  
 	 	 }  
 	 r e t u r n   r e s u l t ;  
 	 }  
 	  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / /   U t i l i t y   f u n c t i o n s   f o r   p a r s i n g   i n   g e t D a t e F r o m F o r m a t ( )  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   _ i s I n t e g e r ( v a l )   {  
 	 v a r   d i g i t s = " 1 2 3 4 5 6 7 8 9 0 " ;  
 	 f o r   ( v a r   i = 0 ;   i   <   v a l . l e n g t h ;   i + + )   {  
 	 	 i f   ( d i g i t s . i n d e x O f ( v a l . c h a r A t ( i ) ) = = - 1 )   {   r e t u r n   f a l s e ;   }  
 	 	 }  
 	 r e t u r n   t r u e ;  
 	 }  
 f u n c t i o n   _ g e t I n t ( s t r , i , m i n l e n g t h , m a x l e n g t h )   {  
 	 f o r   ( v a r   x = m a x l e n g t h ;   x > = m i n l e n g t h ;   x - - )   {  
 	 	 v a r   t o k e n = s t r . s u b s t r i n g ( i , i + x ) ;  
 	 	 i f   ( t o k e n . l e n g t h   <   m i n l e n g t h )   {   r e t u r n   n u l l ;   }  
 	 	 i f   ( _ i s I n t e g e r ( t o k e n ) )   {   r e t u r n   t o k e n ;   }  
 	 	 }  
 	 r e t u r n   n u l l ;  
 	 }  
 	  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / /   g e t D a t e F r o m F o r m a t (   d a t e _ s t r i n g   ,   f o r m a t _ s t r i n g   )  
 / /  
 / /   T h i s   f u n c t i o n   t a k e s   a   d a t e   s t r i n g   a n d   a   f o r m a t   s t r i n g .   I t   m a t c h e s  
 / /   I f   t h e   d a t e   s t r i n g   m a t c h e s   t h e   f o r m a t   s t r i n g ,   i t   r e t u r n s   t h e    
 / /   g e t T i m e ( )   o f   t h e   d a t e .   I f   i t   d o e s   n o t   m a t c h ,   i t   r e t u r n s   0 .  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   g e t D a t e F r o m F o r m a t ( v a l , f o r m a t )   {  
 	 v a l = v a l + " " ;  
 	 f o r m a t = f o r m a t + " " ;  
 	 v a r   i _ v a l = 0 ;  
 	 v a r   i _ f o r m a t = 0 ;  
 	 v a r   c = " " ;  
 	 v a r   t o k e n = " " ;  
 	 v a r   t o k e n 2 = " " ;  
 	 v a r   x , y ;  
 	 v a r   n o w = n e w   D a t e ( ) ;  
 	 v a r   y e a r = n o w . g e t Y e a r ( ) ;  
 	 v a r   m o n t h = n o w . g e t M o n t h ( ) + 1 ;  
 	 v a r   d a t e = 1 ;  
 	 v a r   h h = n o w . g e t H o u r s ( ) ;  
 	 v a r   m m = n o w . g e t M i n u t e s ( ) ;  
 	 v a r   s s = n o w . g e t S e c o n d s ( ) ;  
 	 v a r   a m p m = " " ;  
 	  
 	 w h i l e   ( i _ f o r m a t   <   f o r m a t . l e n g t h )   {  
 	 	 / /   G e t   n e x t   t o k e n   f r o m   f o r m a t   s t r i n g  
 	 	 c = f o r m a t . c h a r A t ( i _ f o r m a t ) ;  
 	 	 t o k e n = " " ;  
 	 	 w h i l e   ( ( f o r m a t . c h a r A t ( i _ f o r m a t ) = = c )   & &   ( i _ f o r m a t   <   f o r m a t . l e n g t h ) )   {  
 	 	 	 t o k e n   + =   f o r m a t . c h a r A t ( i _ f o r m a t + + ) ;  
 	 	 	 }  
 	 	 / /   E x t r a c t   c o n t e n t s   o f   v a l u e   b a s e d   o n   f o r m a t   t o k e n  
 	 	 i f   ( t o k e n = = " y y y y "   | |   t o k e n = = " y y "   | |   t o k e n = = " y " )   {  
 	 	 	 i f   ( t o k e n = = " y y y y " )   {   x = 4 ; y = 4 ;   }  
 	 	 	 i f   ( t o k e n = = " y y " )       {   x = 2 ; y = 2 ;   }  
 	 	 	 i f   ( t o k e n = = " y " )         {   x = 2 ; y = 4 ;   }  
 	 	 	 y e a r = _ g e t I n t ( v a l , i _ v a l , x , y ) ;  
 	 	 	 i f   ( y e a r = = n u l l )   {   r e t u r n   0 ;   }  
 	 	 	 i _ v a l   + =   y e a r . l e n g t h ;  
 	 	 	 i f   ( y e a r . l e n g t h = = 2 )   {  
 	 	 	 	 i f   ( y e a r   >   7 0 )   {   y e a r = 1 9 0 0 + ( y e a r - 0 ) ;   }  
 	 	 	 	 e l s e   {   y e a r = 2 0 0 0 + ( y e a r - 0 ) ;   }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 e l s e   i f   ( t o k e n = = " M M M " | | t o k e n = = " N N N " ) {  
 	 	 	 m o n t h = 0 ;  
 	 	 	 f o r   ( v a r   i = 0 ;   i < M O N T H _ N A M E S . l e n g t h ;   i + + )   {  
 	 	 	 	 v a r   m o n t h _ n a m e = M O N T H _ N A M E S [ i ] ;  
 	 	 	 	 i f   ( v a l . s u b s t r i n g ( i _ v a l , i _ v a l + m o n t h _ n a m e . l e n g t h ) . t o L o w e r C a s e ( ) = = m o n t h _ n a m e . t o L o w e r C a s e ( ) )   {  
 	 	 	 	 	 i f   ( t o k e n = = " M M M " | | ( t o k e n = = " N N N " & & i > 1 1 ) )   {  
 	 	 	 	 	 	 m o n t h = i + 1 ;  
 	 	 	 	 	 	 i f   ( m o n t h > 1 2 )   {   m o n t h   - =   1 2 ;   }  
 	 	 	 	 	 	 i _ v a l   + =   m o n t h _ n a m e . l e n g t h ;  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 i f   ( ( m o n t h   <   1 ) | | ( m o n t h > 1 2 ) ) { r e t u r n   0 ; }  
 	 	 	 }  
 	 	 e l s e   i f   ( t o k e n = = " E E " | | t o k e n = = " E " ) {  
 	 	 	 f o r   ( v a r   i = 0 ;   i < D A Y _ N A M E S . l e n g t h ;   i + + )   {  
 	 	 	 	 v a r   d a y _ n a m e = D A Y _ N A M E S [ i ] ;  
 	 	 	 	 i f   ( v a l . s u b s t r i n g ( i _ v a l , i _ v a l + d a y _ n a m e . l e n g t h ) . t o L o w e r C a s e ( ) = = d a y _ n a m e . t o L o w e r C a s e ( ) )   {  
 	 	 	 	 	 i _ v a l   + =   d a y _ n a m e . l e n g t h ;  
 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 e l s e   i f   ( t o k e n = = " M M " | | t o k e n = = " M " )   {  
 	 	 	 m o n t h = _ g e t I n t ( v a l , i _ v a l , t o k e n . l e n g t h , 2 ) ;  
 	 	 	 i f ( m o n t h = = n u l l | | ( m o n t h < 1 ) | | ( m o n t h > 1 2 ) ) { r e t u r n   0 ; }  
 	 	 	 i _ v a l + = m o n t h . l e n g t h ; }  
 	 	 e l s e   i f   ( t o k e n = = " d d " | | t o k e n = = " d " )   {  
 	 	 	 d a t e = _ g e t I n t ( v a l , i _ v a l , t o k e n . l e n g t h , 2 ) ;  
 	 	 	 i f ( d a t e = = n u l l | | ( d a t e < 1 ) | | ( d a t e > 3 1 ) ) { r e t u r n   0 ; }  
 	 	 	 i _ v a l + = d a t e . l e n g t h ; }  
 	 	 e l s e   i f   ( t o k e n = = " h h " | | t o k e n = = " h " )   {  
 	 	 	 h h = _ g e t I n t ( v a l , i _ v a l , t o k e n . l e n g t h , 2 ) ;  
 	 	 	 i f ( h h = = n u l l | | ( h h < 1 ) | | ( h h > 1 2 ) ) { r e t u r n   0 ; }  
 	 	 	 i _ v a l + = h h . l e n g t h ; }  
 	 	 e l s e   i f   ( t o k e n = = " H H " | | t o k e n = = " H " )   {  
 	 	 	 h h = _ g e t I n t ( v a l , i _ v a l , t o k e n . l e n g t h , 2 ) ;  
 	 	 	 i f ( h h = = n u l l | | ( h h < 0 ) | | ( h h > 2 3 ) ) { r e t u r n   0 ; }  
 	 	 	 i _ v a l + = h h . l e n g t h ; }  
 	 	 e l s e   i f   ( t o k e n = = " K K " | | t o k e n = = " K " )   {  
 	 	 	 h h = _ g e t I n t ( v a l , i _ v a l , t o k e n . l e n g t h , 2 ) ;  
 	 	 	 i f ( h h = = n u l l | | ( h h < 0 ) | | ( h h > 1 1 ) ) { r e t u r n   0 ; }  
 	 	 	 i _ v a l + = h h . l e n g t h ; }  
 	 	 e l s e   i f   ( t o k e n = = " k k " | | t o k e n = = " k " )   {  
 	 	 	 h h = _ g e t I n t ( v a l , i _ v a l , t o k e n . l e n g t h , 2 ) ;  
 	 	 	 i f ( h h = = n u l l | | ( h h < 1 ) | | ( h h > 2 4 ) ) { r e t u r n   0 ; }  
 	 	 	 i _ v a l + = h h . l e n g t h ; h h - - ; }  
 	 	 e l s e   i f   ( t o k e n = = " m m " | | t o k e n = = " m " )   {  
 	 	 	 m m = _ g e t I n t ( v a l , i _ v a l , t o k e n . l e n g t h , 2 ) ;  
 	 	 	 i f ( m m = = n u l l | | ( m m < 0 ) | | ( m m > 5 9 ) ) { r e t u r n   0 ; }  
 	 	 	 i _ v a l + = m m . l e n g t h ; }  
 	 	 e l s e   i f   ( t o k e n = = " s s " | | t o k e n = = " s " )   {  
 	 	 	 s s = _ g e t I n t ( v a l , i _ v a l , t o k e n . l e n g t h , 2 ) ;  
 	 	 	 i f ( s s = = n u l l | | ( s s < 0 ) | | ( s s > 5 9 ) ) { r e t u r n   0 ; }  
 	 	 	 i _ v a l + = s s . l e n g t h ; }  
 	 	 e l s e   i f   ( t o k e n = = " a " )   {  
 	 	 	 i f   ( v a l . s u b s t r i n g ( i _ v a l , i _ v a l + 2 ) . t o L o w e r C a s e ( ) = = " a m " )   { a m p m = " A M " ; }  
 	 	 	 e l s e   i f   ( v a l . s u b s t r i n g ( i _ v a l , i _ v a l + 2 ) . t o L o w e r C a s e ( ) = = " p m " )   { a m p m = " P M " ; }  
 	 	 	 e l s e   { r e t u r n   0 ; }  
 	 	 	 i _ v a l + = 2 ; }  
 	 	 e l s e   {  
 	 	 	 i f   ( v a l . s u b s t r i n g ( i _ v a l , i _ v a l + t o k e n . l e n g t h ) ! = t o k e n )   { r e t u r n   0 ; }  
 	 	 	 e l s e   { i _ v a l + = t o k e n . l e n g t h ; }  
 	 	 	 }  
 	 	 }  
 	 / /   I f   t h e r e   a r e   a n y   t r a i l i n g   c h a r a c t e r s   l e f t   i n   t h e   v a l u e ,   i t   d o e s n ' t   m a t c h  
 	 i f   ( i _ v a l   ! =   v a l . l e n g t h )   {   r e t u r n   0 ;   }  
 	 / /   I s   d a t e   v a l i d   f o r   m o n t h ?  
 	 i f   ( m o n t h = = 2 )   {  
 	 	 / /   C h e c k   f o r   l e a p   y e a r  
 	 	 i f   (   (   ( y e a r % 4 = = 0 ) & & ( y e a r % 1 0 0   ! =   0 )   )   | |   ( y e a r % 4 0 0 = = 0 )   )   {   / /   l e a p   y e a r  
 	 	 	 i f   ( d a t e   >   2 9 ) {   r e t u r n   0 ;   }  
 	 	 	 }  
 	 	 e l s e   {   i f   ( d a t e   >   2 8 )   {   r e t u r n   0 ;   }   }  
 	 	 }  
 	 i f   ( ( m o n t h = = 4 ) | | ( m o n t h = = 6 ) | | ( m o n t h = = 9 ) | | ( m o n t h = = 1 1 ) )   {  
 	 	 i f   ( d a t e   >   3 0 )   {   r e t u r n   0 ;   }  
 	 	 }  
 	 / /   C o r r e c t   h o u r s   v a l u e  
 	 i f   ( h h < 1 2   & &   a m p m = = " P M " )   {   h h = h h - 0 + 1 2 ;   }  
 	 e l s e   i f   ( h h > 1 1   & &   a m p m = = " A M " )   {   h h - = 1 2 ;   }  
 	 v a r   n e w d a t e = n e w   D a t e ( y e a r , m o n t h - 1 , d a t e , h h , m m , s s ) ;  
 	 r e t u r n   n e w d a t e . g e t T i m e ( ) ;  
 	 }  
  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / /   p a r s e D a t e (   d a t e _ s t r i n g   [ ,   p r e f e r _ e u r o _ f o r m a t ]   )  
 / /  
 / /   T h i s   f u n c t i o n   t a k e s   a   d a t e   s t r i n g   a n d   t r i e s   t o   m a t c h   i t   t o   a  
 / /   n u m b e r   o f   p o s s i b l e   d a t e   f o r m a t s   t o   g e t   t h e   v a l u e .   I t   w i l l   t r y   t o  
 / /   m a t c h   a g a i n s t   t h e   f o l l o w i n g   i n t e r n a t i o n a l   f o r m a t s ,   i n   t h i s   o r d e r :  
 / /   y - M - d       M M M   d ,   y       M M M   d , y       y - M M M - d       d - M M M - y     M M M   d  
 / /   M / d / y       M - d - y             M . d . y           M M M - d           M / d             M - d  
 / /   d / M / y       d - M - y             d . M . y           d - M M M           d / M             d - M  
 / /   A   s e c o n d   a r g u m e n t   m a y   b e   p a s s e d   t o   i n s t r u c t   t h e   m e t h o d   t o   s e a r c h  
 / /   f o r   f o r m a t s   l i k e   d / M / y   ( e u r o p e a n   f o r m a t )   b e f o r e   M / d / y   ( A m e r i c a n ) .  
 / /   R e t u r n s   a   D a t e   o b j e c t   o r   n u l l   i f   n o   p a t t e r n s   m a t c h .  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   p a r s e D a t e ( v a l )   {  
 	 v a r   p r e f e r E u r o = ( a r g u m e n t s . l e n g t h = = 2 ) ? a r g u m e n t s [ 1 ] : f a l s e ;  
 	 g e n e r a l F o r m a t s = n e w   A r r a y ( ' y - M - d ' , ' M M M   d ,   y ' , ' M M M   d , y ' , ' y - M M M - d ' , ' d - M M M - y ' , ' M M M   d ' ) ;  
 	 m o n t h F i r s t = n e w   A r r a y ( ' M / d / y ' , ' M - d - y ' , ' M . d . y ' , ' M M M - d ' , ' M / d ' , ' M - d ' ) ;  
 	 d a t e F i r s t   = n e w   A r r a y ( ' d / M / y ' , ' d - M - y ' , ' d . M . y ' , ' d - M M M ' , ' d / M ' , ' d - M ' ) ;  
 	 v a r   c h e c k L i s t = n e w   A r r a y ( ' g e n e r a l F o r m a t s ' , p r e f e r E u r o ? ' d a t e F i r s t ' : ' m o n t h F i r s t ' , p r e f e r E u r o ? ' m o n t h F i r s t ' : ' d a t e F i r s t ' ) ;  
 	 v a r   d = n u l l ;  
 	 f o r   ( v a r   i = 0 ;   i < c h e c k L i s t . l e n g t h ;   i + + )   {  
 	 	 v a r   l = w i n d o w [ c h e c k L i s t [ i ] ] ;  
 	 	 f o r   ( v a r   j = 0 ;   j < l . l e n g t h ;   j + + )   {  
 	 	 	 d = g e t D a t e F r o m F o r m a t ( v a l , l [ j ] ) ;  
 	 	 	 i f   ( d ! = 0 )   {   r e t u r n   n e w   D a t e ( d ) ;   }  
 	 	 	 }  
 	 	 }  
 	 r e t u r n   n u l l ;  
 	 }  
  
 / *   S O U R C E   F I L E :   P o p u p W i n d o w . j s   * /  
  
 / *    
 P o p u p W i n d o w . j s  
 A u t h o r :   M a t t   K r u s e  
 L a s t   m o d i f i e d :   0 2 / 1 6 / 0 4  
  
 D E S C R I P T I O N :   T h i s   o b j e c t   a l l o w s   y o u   t o   e a s i l y   a n d   q u i c k l y   p o p u p   a   w i n d o w  
 i n   a   c e r t a i n   p l a c e .   T h e   w i n d o w   c a n   e i t h e r   b e   a   D I V   o r   a   s e p a r a t e   b r o w s e r  
 w i n d o w .  
  
 C O M P A T A B I L I T Y :   W o r k s   w i t h   N e t s c a p e   4 . x ,   6 . x ,   I E   5 . x   o n   W i n d o w s .   S o m e   s m a l l  
 p o s i t i o n i n g   e r r o r s   -   u s u a l l y   w i t h   W i n d o w   p o s i t i o n i n g   -   o c c u r   o n   t h e    
 M a c i n t o s h   p l a t f o r m .   D u e   t o   b u g s   i n   N e t s c a p e   4 . x ,   p o p u l a t i n g   t h e   p o p u p    
 w i n d o w   w i t h   < S T Y L E >   t a g s   m a y   c a u s e   e r r o r s .  
  
 U S A G E :  
 / /   C r e a t e   a n   o b j e c t   f o r   a   W I N D O W   p o p u p  
 v a r   w i n   =   n e w   P o p u p W i n d o w ( ) ;    
  
 / /   C r e a t e   a n   o b j e c t   f o r   a   D I V   w i n d o w   u s i n g   t h e   D I V   n a m e d   ' m y d i v '  
 v a r   w i n   =   n e w   P o p u p W i n d o w ( ' m y d i v ' ) ;    
  
 / /   S e t   t h e   w i n d o w   t o   a u t o m a t i c a l l y   h i d e   i t s e l f   w h e n   t h e   u s e r   c l i c k s    
 / /   a n y w h e r e   e l s e   o n   t h e   p a g e   e x c e p t   t h e   p o p u p  
 w i n . a u t o H i d e ( ) ;    
  
 / /   S h o w   t h e   w i n d o w   r e l a t i v e   t o   t h e   a n c h o r   n a m e   p a s s e d   i n  
 w i n . s h o w P o p u p ( a n c h o r n a m e ) ;  
  
 / /   H i d e   t h e   p o p u p  
 w i n . h i d e P o p u p ( ) ;  
  
 / /   S e t   t h e   s i z e   o f   t h e   p o p u p   w i n d o w   ( o n l y   a p p l i e s   t o   W I N D O W   p o p u p s  
 w i n . s e t S i z e ( w i d t h , h e i g h t ) ;  
  
 / /   P o p u l a t e   t h e   c o n t e n t s   o f   t h e   p o p u p   w i n d o w   t h a t   w i l l   b e   s h o w n .   I f   y o u    
 / /   c h a n g e   t h e   c o n t e n t s   w h i l e   i t   i s   d i s p l a y e d ,   y o u   w i l l   n e e d   t o   r e f r e s h ( )  
 w i n . p o p u l a t e ( s t r i n g ) ;  
  
 / /   s e t   t h e   U R L   o f   t h e   w i n d o w ,   r a t h e r   t h a n   p o p u l a t i n g   i t s   c o n t e n t s  
 / /   m a n u a l l y  
 w i n . s e t U r l ( " h t t p : / / w w w . s i t e . c o m / " ) ;  
  
 / /   R e f r e s h   t h e   c o n t e n t s   o f   t h e   p o p u p  
 w i n . r e f r e s h ( ) ;  
  
 / /   S p e c i f y   h o w   m a n y   p i x e l s   t o   t h e   r i g h t   o f   t h e   a n c h o r   t h e   p o p u p   w i l l   a p p e a r  
 w i n . o f f s e t X   =   5 0 ;  
  
 / /   S p e c i f y   h o w   m a n y   p i x e l s   b e l o w   t h e   a n c h o r   t h e   p o p u p   w i l l   a p p e a r  
 w i n . o f f s e t Y   =   1 0 0 ;  
  
 N O T E S :  
 1 )   R e q u i r e s   t h e   f u n c t i o n s   i n   A n c h o r P o s i t i o n . j s  
  
 2 )   Y o u r   a n c h o r   t a g   M U S T   c o n t a i n   b o t h   N A M E   a n d   I D   a t t r i b u t e s   w h i c h   a r e   t h e    
       s a m e .   F o r   e x a m p l e :  
       < A   N A M E = " t e s t "   I D = " t e s t " >   < / A >  
  
 3 )   T h e r e   m u s t   b e   a t   l e a s t   a   s p a c e   b e t w e e n   < A >   < / A >   f o r   I E 5 . 5   t o   s e e   t h e    
       a n c h o r   t a g   c o r r e c t l y .   D o   n o t   d o   < A > < / A >   w i t h   n o   s p a c e .  
  
 4 )   W h e n   a   P o p u p W i n d o w   o b j e c t   i s   c r e a t e d ,   a   h a n d l e r   f o r   ' o n m o u s e u p '   i s  
       a t t a c h e d   t o   a n y   e v e n t   h a n d l e r   y o u   m a y   h a v e   a l r e a d y   d e f i n e d .   D o   N O T   d e f i n e  
       a n   e v e n t   h a n d l e r   f o r   ' o n m o u s e u p '   a f t e r   y o u   d e f i n e   a   P o p u p W i n d o w   o b j e c t   o r  
       t h e   a u t o H i d e ( )   w i l l   n o t   w o r k   c o r r e c t l y .  
 * /    
  
 / /   S e t   t h e   p o s i t i o n   o f   t h e   p o p u p   w i n d o w   b a s e d   o n   t h e   a n c h o r  
 f u n c t i o n   P o p u p W i n d o w _ g e t X Y P o s i t i o n ( a n c h o r n a m e )   {  
 	 v a r   c o o r d i n a t e s ;  
 	 i f   ( t h i s . t y p e   = =   " W I N D O W " )   {  
 	 	 c o o r d i n a t e s   =   g e t A n c h o r W i n d o w P o s i t i o n ( a n c h o r n a m e ) ;  
 	 	 }  
 	 e l s e   {  
 	 	 c o o r d i n a t e s   =   g e t A n c h o r P o s i t i o n ( a n c h o r n a m e ) ;  
 	 	 }  
 	 t h i s . x   =   c o o r d i n a t e s . x ;  
 	 t h i s . y   =   c o o r d i n a t e s . y ;  
 	 }  
 / /   S e t   w i d t h / h e i g h t   o f   D I V / p o p u p   w i n d o w  
 f u n c t i o n   P o p u p W i n d o w _ s e t S i z e ( w i d t h , h e i g h t )   {  
 	 t h i s . w i d t h   =   w i d t h ;  
 	 t h i s . h e i g h t   =   h e i g h t ;  
 	 }  
 / /   F i l l   t h e   w i n d o w   w i t h   c o n t e n t s  
 f u n c t i o n   P o p u p W i n d o w _ p o p u l a t e ( c o n t e n t s )   {  
 	 t h i s . c o n t e n t s   =   c o n t e n t s ;  
 	 t h i s . p o p u l a t e d   =   f a l s e ;  
 	 }  
 / /   S e t   t h e   U R L   t o   g o   t o  
 f u n c t i o n   P o p u p W i n d o w _ s e t U r l ( u r l )   {  
 	 t h i s . u r l   =   u r l ;  
 	 }  
 / /   S e t   t h e   w i n d o w   p o p u p   p r o p e r t i e s  
 f u n c t i o n   P o p u p W i n d o w _ s e t W i n d o w P r o p e r t i e s ( p r o p s )   {  
 	 t h i s . w i n d o w P r o p e r t i e s   =   p r o p s ;  
 	 }  
 / /   R e f r e s h   t h e   d i s p l a y e d   c o n t e n t s   o f   t h e   p o p u p  
 f u n c t i o n   P o p u p W i n d o w _ r e f r e s h ( )   {  
 	 i f   ( t h i s . d i v N a m e   ! =   n u l l )   {  
 	 	 / /   r e f r e s h   t h e   D I V   o b j e c t  
 	 	 i f   ( t h i s . u s e _ g e b i )   {  
 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( t h i s . d i v N a m e ) . i n n e r H T M L   =   t h i s . c o n t e n t s ;  
 	 	 	 }  
 	 	 e l s e   i f   ( t h i s . u s e _ c s s )   {    
 	 	 	 d o c u m e n t . a l l [ t h i s . d i v N a m e ] . i n n e r H T M L   =   t h i s . c o n t e n t s ;  
 	 	 	 }  
 	 	 e l s e   i f   ( t h i s . u s e _ l a y e r s )   {    
 	 	 	 v a r   d   =   d o c u m e n t . l a y e r s [ t h i s . d i v N a m e ] ;    
 	 	 	 d . d o c u m e n t . o p e n ( ) ;  
 	 	 	 d . d o c u m e n t . w r i t e l n ( t h i s . c o n t e n t s ) ;  
 	 	 	 d . d o c u m e n t . c l o s e ( ) ;  
 	 	 	 }  
 	 	 }  
 	 e l s e   {  
 	 	 i f   ( t h i s . p o p u p W i n d o w   ! =   n u l l   & &   ! t h i s . p o p u p W i n d o w . c l o s e d )   {  
 	 	 	 i f   ( t h i s . u r l ! = " " )   {  
 	 	 	 	 t h i s . p o p u p W i n d o w . l o c a t i o n . h r e f = t h i s . u r l ;  
 	 	 	 	 }  
 	 	 	 e l s e   {  
 	 	 	 	 t h i s . p o p u p W i n d o w . d o c u m e n t . o p e n ( ) ;  
 	 	 	 	 t h i s . p o p u p W i n d o w . d o c u m e n t . w r i t e l n ( t h i s . c o n t e n t s ) ;  
 	 	 	 	 t h i s . p o p u p W i n d o w . d o c u m e n t . c l o s e ( ) ;  
 	 	 	 }  
 	 	 	 t h i s . p o p u p W i n d o w . f o c u s ( ) ;  
 	 	 	 }  
 	 	 }  
 	 }  
 / /   P o s i t i o n   a n d   s h o w   t h e   p o p u p ,   r e l a t i v e   t o   a n   a n c h o r   o b j e c t  
 f u n c t i o n   P o p u p W i n d o w _ s h o w P o p u p ( a n c h o r n a m e )   {  
 	 t h i s . g e t X Y P o s i t i o n ( a n c h o r n a m e ) ;  
 / / 	 t h i s . x   + =   t h i s . o f f s e t X ;  
 / / 	 t h i s . y   + =   t h i s . o f f s e t Y ;  
 	 i f   ( ! t h i s . p o p u l a t e d   & &   ( t h i s . c o n t e n t s   ! =   " " ) )   {  
 	 	 t h i s . p o p u l a t e d   =   t r u e ;  
 	 	 t h i s . r e f r e s h ( ) ;  
 	 	 }  
 	 i f   ( t h i s . d i v N a m e   ! =   n u l l )   {  
 	 	 / /   S h o w   t h e   D I V   o b j e c t  
 	 	 i f   ( t h i s . u s e _ g e b i )   {  
 / / 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( t h i s . d i v N a m e ) . s t y l e . l e f t   =   t h i s . x   +   " p x " ;  
 / / 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( t h i s . d i v N a m e ) . s t y l e . t o p   =   t h i s . y   +   " p x " ;  
 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( t h i s . d i v N a m e ) . s t y l e . v i s i b i l i t y   =   " v i s i b l e " ;  
 	 	 	 }  
 	 	 e l s e   i f   ( t h i s . u s e _ c s s )   {  
 / / 	 	 	 d o c u m e n t . a l l [ t h i s . d i v N a m e ] . s t y l e . l e f t   =   t h i s . x ;  
 / / 	 	 	 d o c u m e n t . a l l [ t h i s . d i v N a m e ] . s t y l e . t o p   =   t h i s . y ;  
 	 	 	 d o c u m e n t . a l l [ t h i s . d i v N a m e ] . s t y l e . v i s i b i l i t y   =   " v i s i b l e " ;  
 	 	 	 }  
 	 	 e l s e   i f   ( t h i s . u s e _ l a y e r s )   {  
 / / 	 	 	 d o c u m e n t . l a y e r s [ t h i s . d i v N a m e ] . l e f t   =   t h i s . x ;  
 / / 	 	 	 d o c u m e n t . l a y e r s [ t h i s . d i v N a m e ] . t o p   =   t h i s . y ;  
 	 	 	 d o c u m e n t . l a y e r s [ t h i s . d i v N a m e ] . v i s i b i l i t y   =   " v i s i b l e " ;  
 	 	 	 }  
 	 	 }  
 	 e l s e   {  
 	 	 i f   ( t h i s . p o p u p W i n d o w   = =   n u l l   | |   t h i s . p o p u p W i n d o w . c l o s e d )   {  
 	 	 	 / /   I f   t h e   p o p u p   w i n d o w   w i l l   g o   o f f - s c r e e n ,   m o v e   i t   s o   i t   d o e s n ' t  
 	 	 	 i f   ( t h i s . x < 0 )   {   t h i s . x = 0 ;   }  
 	 	 	 i f   ( t h i s . y < 0 )   {   t h i s . y = 0 ;   }  
 	 	 	 i f   ( s c r e e n   & &   s c r e e n . a v a i l H e i g h t )   {  
 	 	 	 	 i f   ( ( t h i s . y   +   t h i s . h e i g h t )   >   s c r e e n . a v a i l H e i g h t )   {  
 	 	 	 	 	 t h i s . y   =   s c r e e n . a v a i l H e i g h t   -   t h i s . h e i g h t ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 i f   ( s c r e e n   & &   s c r e e n . a v a i l W i d t h )   {  
 	 	 	 	 i f   ( ( t h i s . x   +   t h i s . w i d t h )   >   s c r e e n . a v a i l W i d t h )   {  
 	 	 	 	 	 t h i s . x   =   s c r e e n . a v a i l W i d t h   -   t h i s . w i d t h ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 v a r   a v o i d A b o u t B l a n k   =   w i n d o w . o p e r a   | |   (   d o c u m e n t . l a y e r s   & &   ! n a v i g a t o r . m i m e T y p e s [ ' * ' ]   )   | |   n a v i g a t o r . v e n d o r   = =   ' K D E '   | |   (   d o c u m e n t . c h i l d N o d e s   & &   ! d o c u m e n t . a l l   & &   ! n a v i g a t o r . t a i n t E n a b l e d   ) ;  
 	 	 	 t h i s . p o p u p W i n d o w   =   w i n d o w . o p e n ( a v o i d A b o u t B l a n k ? " " : " a b o u t : b l a n k " , " w i n d o w _ " + a n c h o r n a m e , t h i s . w i n d o w P r o p e r t i e s + " , w i d t h = " + t h i s . w i d t h + " , h e i g h t = " + t h i s . h e i g h t + " , s c r e e n X = " + t h i s . x + " , l e f t = " + t h i s . x + " , s c r e e n Y = " + t h i s . y + " , t o p = " + t h i s . y + " " ) ;  
 	 	 	 }  
 	 	 t h i s . r e f r e s h ( ) ;  
 	 	 }  
 	 }  
 / /   H i d e   t h e   p o p u p  
 f u n c t i o n   P o p u p W i n d o w _ h i d e P o p u p ( )   {  
 	 i f   ( t h i s . d i v N a m e   ! =   n u l l )   {  
 	 	 i f   ( t h i s . u s e _ g e b i )   {  
 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( t h i s . d i v N a m e ) . s t y l e . v i s i b i l i t y   =   " h i d d e n " ;  
 	 	 	 }  
 	 	 e l s e   i f   ( t h i s . u s e _ c s s )   {  
 	 	 	 d o c u m e n t . a l l [ t h i s . d i v N a m e ] . s t y l e . v i s i b i l i t y   =   " h i d d e n " ;  
 	 	 	 }  
 	 	 e l s e   i f   ( t h i s . u s e _ l a y e r s )   {  
 	 	 	 d o c u m e n t . l a y e r s [ t h i s . d i v N a m e ] . v i s i b i l i t y   =   " h i d d e n " ;  
 	 	 	 }  
 	 	 }  
 	 e l s e   {  
 	 	 i f   ( t h i s . p o p u p W i n d o w   & &   ! t h i s . p o p u p W i n d o w . c l o s e d )   {  
 	 	 	 t h i s . p o p u p W i n d o w . c l o s e ( ) ;  
 	 	 	 t h i s . p o p u p W i n d o w   =   n u l l ;  
 	 	 	 }  
 	 	 }  
 	 }  
 / /   P a s s   a n   e v e n t   a n d   r e t u r n   w h e t h e r   o r   n o t   i t   w a s   t h e   p o p u p   D I V   t h a t   w a s   c l i c k e d  
 f u n c t i o n   P o p u p W i n d o w _ i s C l i c k e d ( e )   {  
 	 i f   ( t h i s . d i v N a m e   ! =   n u l l )   {  
 	 	 i f   ( t h i s . u s e _ l a y e r s )   {  
 	 	 	 v a r   c l i c k X   =   e . p a g e X ;  
 	 	 	 v a r   c l i c k Y   =   e . p a g e Y ;  
 	 	 	 v a r   t   =   d o c u m e n t . l a y e r s [ t h i s . d i v N a m e ] ;  
 	 	 	 i f   ( ( c l i c k X   >   t . l e f t )   & &   ( c l i c k X   <   t . l e f t + t . c l i p . w i d t h )   & &   ( c l i c k Y   >   t . t o p )   & &   ( c l i c k Y   <   t . t o p + t . c l i p . h e i g h t ) )   {  
 	 	 	 	 r e t u r n   t r u e ;  
 	 	 	 	 }  
 	 	 	 e l s e   {   r e t u r n   f a l s e ;   }  
 	 	 	 }  
 	 	 e l s e   i f   ( d o c u m e n t . a l l )   {   / /   N e e d   t o   h a r d - c o d e   t h i s   t o   t r a p   I E   f o r   e r r o r - h a n d l i n g  
 	 	 	 v a r   t   =   w i n d o w . e v e n t . s r c E l e m e n t ;  
 	 	 	 w h i l e   ( t . p a r e n t E l e m e n t   ! =   n u l l )   {  
 	 	 	 	 i f   ( t . i d = = t h i s . d i v N a m e )   {  
 	 	 	 	 	 r e t u r n   t r u e ;  
 	 	 	 	 	 }  
 	 	 	 	 t   =   t . p a r e n t E l e m e n t ;  
 	 	 	 	 }  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 e l s e   i f   ( t h i s . u s e _ g e b i   & &   e )   {  
 	 	 	 v a r   t   =   e . o r i g i n a l T a r g e t ;  
 	 	 	 w h i l e   ( t . p a r e n t N o d e   ! =   n u l l )   {  
 	 	 	 	 i f   ( t . i d = = t h i s . d i v N a m e )   {  
 	 	 	 	 	 r e t u r n   t r u e ;  
 	 	 	 	 	 }  
 	 	 	 	 t   =   t . p a r e n t N o d e ;  
 	 	 	 	 }  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 r e t u r n   f a l s e ;  
 	 }  
  
 / /   C h e c k   a n   o n M o u s e D o w n   e v e n t   t o   s e e   i f   w e   s h o u l d   h i d e  
 f u n c t i o n   P o p u p W i n d o w _ h i d e I f N o t C l i c k e d ( e )   {  
 	 i f   ( t h i s . a u t o H i d e E n a b l e d   & &   ! t h i s . i s C l i c k e d ( e ) )   {  
 	 	 t h i s . h i d e P o p u p ( ) ;  
 	 	 }  
 	 }  
 / /   C a l l   t h i s   t o   m a k e   t h e   D I V   d i s a b l e   a u t o m a t i c a l l y   w h e n   m o u s e   i s   c l i c k e d   o u t s i d e   i t  
 f u n c t i o n   P o p u p W i n d o w _ a u t o H i d e ( )   {  
 	 t h i s . a u t o H i d e E n a b l e d   =   t r u e ;  
 	 }  
 / /   T h i s   g l o b a l   f u n c t i o n   c h e c k s   a l l   P o p u p W i n d o w   o b j e c t s   o n m o u s e u p   t o   s e e   i f   t h e y   s h o u l d   b e   h i d d e n  
 f u n c t i o n   P o p u p W i n d o w _ h i d e P o p u p W i n d o w s ( e )   {  
 	 f o r   ( v a r   i = 0 ;   i < p o p u p W i n d o w O b j e c t s . l e n g t h ;   i + + )   {  
 	 	 i f   ( p o p u p W i n d o w O b j e c t s [ i ]   ! =   n u l l )   {  
 	 	 	 v a r   p   =   p o p u p W i n d o w O b j e c t s [ i ] ;  
 	 	 	 p . h i d e I f N o t C l i c k e d ( e ) ;  
 	 	 	 }  
 	 	 }  
 	 }  
 / /   R u n   t h i s   i m m e d i a t e l y   t o   a t t a c h   t h e   e v e n t   l i s t e n e r  
 f u n c t i o n   P o p u p W i n d o w _ a t t a c h L i s t e n e r ( )   {  
 	 i f   ( d o c u m e n t . l a y e r s )   {  
 	 	 d o c u m e n t . c a p t u r e E v e n t s ( E v e n t . M O U S E U P ) ;  
 	 	 }  
 	 w i n d o w . p o p u p W i n d o w O l d E v e n t L i s t e n e r   =   d o c u m e n t . o n m o u s e u p ;  
 	 i f   ( w i n d o w . p o p u p W i n d o w O l d E v e n t L i s t e n e r   ! =   n u l l )   {  
 	 	 d o c u m e n t . o n m o u s e u p   =   n e w   F u n c t i o n ( " w i n d o w . p o p u p W i n d o w O l d E v e n t L i s t e n e r ( ) ;   P o p u p W i n d o w _ h i d e P o p u p W i n d o w s ( ) ; " ) ;  
 	 	 }  
 	 e l s e   {  
 	 	 d o c u m e n t . o n m o u s e u p   =   P o p u p W i n d o w _ h i d e P o p u p W i n d o w s ;  
 	 	 }  
 	 }  
 / /   C O N S T R U C T O R   f o r   t h e   P o p u p W i n d o w   o b j e c t  
 / /   P a s s   i t   a   D I V   n a m e   t o   u s e   a   D H T M L   p o p u p ,   o t h e r w i s e   w i l l   d e f a u l t   t o   w i n d o w   p o p u p  
 f u n c t i o n   P o p u p W i n d o w ( )   {  
 	 i f   ( ! w i n d o w . p o p u p W i n d o w I n d e x )   {   w i n d o w . p o p u p W i n d o w I n d e x   =   0 ;   }  
 	 i f   ( ! w i n d o w . p o p u p W i n d o w O b j e c t s )   {   w i n d o w . p o p u p W i n d o w O b j e c t s   =   n e w   A r r a y ( ) ;   }  
 	 i f   ( ! w i n d o w . l i s t e n e r A t t a c h e d )   {  
 	 	 w i n d o w . l i s t e n e r A t t a c h e d   =   t r u e ;  
 	 	 P o p u p W i n d o w _ a t t a c h L i s t e n e r ( ) ;  
 	 	 }  
 	 t h i s . i n d e x   =   p o p u p W i n d o w I n d e x + + ;  
 	 p o p u p W i n d o w O b j e c t s [ t h i s . i n d e x ]   =   t h i s ;  
 	 t h i s . d i v N a m e   =   n u l l ;  
 	 t h i s . p o p u p W i n d o w   =   n u l l ;  
 	 t h i s . w i d t h = 0 ;  
 	 t h i s . h e i g h t = 0 ;  
 	 t h i s . p o p u l a t e d   =   f a l s e ;  
 	 t h i s . v i s i b l e   =   f a l s e ;  
 	 t h i s . a u t o H i d e E n a b l e d   =   f a l s e ;  
 	  
 	 t h i s . c o n t e n t s   =   " " ;  
 	 t h i s . u r l = " " ;  
 	 t h i s . w i n d o w P r o p e r t i e s = " t o o l b a r = n o , l o c a t i o n = n o , s t a t u s = n o , m e n u b a r = n o , s c r o l l b a r s = a u t o , r e s i z a b l e , a l w a y s R a i s e d , d e p e n d e n t , t i t l e b a r = n o " ;  
 	 i f   ( a r g u m e n t s . l e n g t h > 0 )   {  
 	 	 t h i s . t y p e = " D I V " ;  
 	 	 t h i s . d i v N a m e   =   a r g u m e n t s [ 0 ] ;  
 	 	 }  
 	 e l s e   {  
 	 	 t h i s . t y p e = " W I N D O W " ;  
 	 	 }  
 	 t h i s . u s e _ g e b i   =   f a l s e ;  
 	 t h i s . u s e _ c s s   =   f a l s e ;  
 	 t h i s . u s e _ l a y e r s   =   f a l s e ;  
 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d )   {   t h i s . u s e _ g e b i   =   t r u e ;   }  
 	 e l s e   i f   ( d o c u m e n t . a l l )   {   t h i s . u s e _ c s s   =   t r u e ;   }  
 	 e l s e   i f   ( d o c u m e n t . l a y e r s )   {   t h i s . u s e _ l a y e r s   =   t r u e ;   }  
 	 e l s e   {   t h i s . t y p e   =   " W I N D O W " ;   }  
 	 t h i s . o f f s e t X   =   0 ;  
 	 t h i s . o f f s e t Y   =   0 ;  
 	 / /   M e t h o d   m a p p i n g s  
 	 t h i s . g e t X Y P o s i t i o n   =   P o p u p W i n d o w _ g e t X Y P o s i t i o n ;  
 	 t h i s . p o p u l a t e   =   P o p u p W i n d o w _ p o p u l a t e ;  
 	 t h i s . s e t U r l   =   P o p u p W i n d o w _ s e t U r l ;  
 	 t h i s . s e t W i n d o w P r o p e r t i e s   =   P o p u p W i n d o w _ s e t W i n d o w P r o p e r t i e s ;  
 	 t h i s . r e f r e s h   =   P o p u p W i n d o w _ r e f r e s h ;  
 	 t h i s . s h o w P o p u p   =   P o p u p W i n d o w _ s h o w P o p u p ;  
 	 t h i s . h i d e P o p u p   =   P o p u p W i n d o w _ h i d e P o p u p ;  
 	 t h i s . s e t S i z e   =   P o p u p W i n d o w _ s e t S i z e ;  
 	 t h i s . i s C l i c k e d   =   P o p u p W i n d o w _ i s C l i c k e d ;  
 	 t h i s . a u t o H i d e   =   P o p u p W i n d o w _ a u t o H i d e ;  
 	 t h i s . h i d e I f N o t C l i c k e d   =   P o p u p W i n d o w _ h i d e I f N o t C l i c k e d ;  
 	 }  
  
 / *   S O U R C E   F I L E :   C a l e n d a r P o p u p . j s   * /  
  
 / /   H I S T O R Y  
 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / /   F e b   7 ,   2 0 0 5 :   F i x e d   a   C S S   s t y l e s   t o   u s e   p x   u n i t  
 / /   M a r c h   2 9 ,   2 0 0 4 :   A d d e d   c h e c k   i n   s e l e c t ( )   m e t h o d   f o r   t h e   f o r m   f i e l d  
 / /             b e i n g   d i s a b l e d .   I f   i t   i s ,   j u s t   r e t u r n   a n d   d o n ' t   d o   a n y t h i n g .  
 / /   M a r c h   2 4 ,   2 0 0 4 :   F i x e d   b u g   -   w h e n   m o n t h   n a m e   a n d   a b b r e v i a t i o n s   w e r e  
 / /             c h a n g e d ,   d a t e   f o r m a t   s t i l l   u s e d   o r i g i n a l   v a l u e s .  
 / /   J a n u a r y   2 6 ,   2 0 0 4 :   A d d e d   s u p p o r t   f o r   d r o p - d o w n   m o n t h   a n d   y e a r  
 / /             n a v i g a t i o n   ( T h a n k s   t o   C h r i s   R e i d   f o r   t h e   i d e a )  
 / /   S e p t e m b e r   2 2 ,   2 0 0 3 :   F i x e d   a   m i n o r   p r o b l e m   i n   Y E A R   c a l e n d a r   w i t h  
 / /             C S S   p r e f i x .  
 / /   A u g u s t   1 9 ,   2 0 0 3 :   R e n a m e d   t h e   f u n c t i o n   t o   g e t   s t y l e s ,   a n d   m a d e   i t  
 / /             w o r k   c o r r e c t l y   w i t h o u t   a n   o b j e c t   r e f e r e n c e  
 / /   A u g u s t   1 8 ,   2 0 0 3 :   C h a n g e d   s h o w Y e a r N a v i g a t i o n   a n d    
 / /             s h o w Y e a r N a v i g a t i o n I n p u t   t o   o p t i o n a l l y   t a k e   a n   a r g u m e n t   o f  
 / /             t r u e   o r   f a l s e  
 / /   J u l y   3 1 ,   2 0 0 3 :   A d d e d   t e x t   i n p u t   o p t i o n   f o r   y e a r   n a v i g a t i o n .  
 / /             A d d e d   a   p e r - c a l e n d a r   C S S   p r e f i x   o p t i o n   t o   o p t i o n a l l y   u s e    
 / /             d i f f e r e n t   s t y l e s   f o r   d i f f e r e n t   c a l e n d a r s .  
 / /   J u l y   2 9 ,   2 0 0 3 :   F i x e d   b u g   c a u s i n g   t h e   T o d a y   l i n k   t o   b e   c l i c k a b l e    
 / /             e v e n   t h o u g h   t o d a y   f a l l s   i n   a   d i s a b l e d   d a t e   r a n g e .  
 / /             C h a n g e d   f o r m a t t i n g   t o   u s e   p u r e   C S S ,   a l l o w i n g   g r e a t e r   c o n t r o l  
 / /             o v e r   l o o k - a n d - f e e l   o p t i o n s .  
 / /   J u n e   1 1 ,   2 0 0 3 :   F i x e d   b u g   c a u s i n g   t h e   T o d a y   l i n k   t o   b e   u n s e l e c t a b l e  
 / /             u n d e r   c e r t a i n   c a s e s   w h e n   s o m e   d a y s   o f   w e e k   a r e   d i s a b l e d  
 / /   M a r c h   1 4 ,   2 0 0 3 :   A d d e d   a b i l i t y   t o   d i s a b l e   i n d i v i d u a l   d a t e s   o r   d a t e  
 / /             r a n g e s ,   d i s p l a y   a s   l i g h t   g r a y   a n d   s t r i k e - t h r o u g h  
 / /   M a r c h   1 4 ,   2 0 0 3 :   R e m o v e d   d e p e n d e n c y   o n   g r a y p i x e l . g i f   a n d   i n s t e a d    
 / / /           u s e   t a b l e   b o r d e r   c o l o r i n g  
 / /   M a r c h   1 2 ,   2 0 0 3 :   M o d i f i e d   s h o w C a l e n d a r ( )   f u n c t i o n   t o   a l l o w   o p t i o n a l  
 / /             s t a r t - d a t e   p a r a m e t e r  
 / /   M a r c h   1 1 ,   2 0 0 3 :   M o d i f i e d   s e l e c t ( )   f u n c t i o n   t o   a l l o w   o p t i o n a l  
 / /             s t a r t - d a t e   p a r a m e t e r  
 / *    
 D E S C R I P T I O N :   T h i s   o b j e c t   i m p l e m e n t s   a   p o p u p   c a l e n d a r   t o   a l l o w   t h e   u s e r   t o  
 s e l e c t   a   d a t e ,   m o n t h ,   q u a r t e r ,   o r   y e a r .  
  
 C O M P A T A B I L I T Y :   W o r k s   w i t h   N e t s c a p e   4 . x ,   6 . x ,   I E   5 . x   o n   W i n d o w s .   S o m e   s m a l l  
 p o s i t i o n i n g   e r r o r s   -   u s u a l l y   w i t h   W i n d o w   p o s i t i o n i n g   -   o c c u r   o n   t h e    
 M a c i n t o s h   p l a t f o r m .  
 T h e   c a l e n d a r   c a n   b e   m o d i f i e d   t o   w o r k   f o r   a n y   l o c a t i o n   i n   t h e   w o r l d   b y    
 c h a n g i n g   w h i c h   w e e k d a y   i s   d i s p l a y e d   a s   t h e   f i r s t   c o l u m n ,   c h a n g i n g   t h e   m o n t h  
 n a m e s ,   a n d   c h a n g i n g   t h e   c o l u m n   h e a d e r s   f o r   e a c h   d a y .  
  
 U S A G E :  
 / /   C r e a t e   a   n e w   C a l e n d a r P o p u p   o b j e c t   o f   t y p e   W I N D O W  
 v a r   c a l   =   n e w   C a l e n d a r P o p u p ( ) ;    
  
 / /   C r e a t e   a   n e w   C a l e n d a r P o p u p   o b j e c t   o f   t y p e   D I V   u s i n g   t h e   D I V   n a m e d   ' m y d i v '  
 v a r   c a l   =   n e w   C a l e n d a r P o p u p ( ' m y d i v ' ) ;    
  
 / /   E a s y   m e t h o d   t o   l i n k   t h e   p o p u p   c a l e n d a r   w i t h   a n   i n p u t   b o x .    
 c a l . s e l e c t ( i n p u t O b j e c t ,   a n c h o r n a m e ,   d a t e F o r m a t ) ;  
 / /   S a m e   m e t h o d ,   b u t   p a s s i n g   a   d e f a u l t   d a t e   o t h e r   t h a n   t h e   f i e l d ' s   c u r r e n t   v a l u e  
 c a l . s e l e c t ( i n p u t O b j e c t ,   a n c h o r n a m e ,   d a t e F o r m a t ,   ' 0 1 / 0 2 / 2 0 0 0 ' ) ;  
 / /   T h i s   i s   a n   e x a m p l e   c a l l   t o   t h e   p o p u p   c a l e n d a r   f r o m   a   l i n k   t o   p o p u l a t e   a n    
 / /   i n p u t   b o x .   N o t e   t h a t   t o   u s e   t h i s ,   d a t e . j s   m u s t   a l s o   b e   i n c l u d e d ! !  
 < A   H R E F = " # "   o n C l i c k = " c a l . s e l e c t ( d o c u m e n t . f o r m s [ 0 ] . d a t e , ' a n c h o r n a m e ' , ' M M / d d / y y y y ' ) ;   r e t u r n   f a l s e ; " > S e l e c t < / A >  
  
 / /   S e t   t h e   t y p e   o f   d a t e   s e l e c t   t o   b e   u s e d .   B y   d e f a u l t   i t   i s   ' d a t e ' .  
 c a l . s e t D i s p l a y T y p e ( t y p e ) ;  
  
 / /   W h e n   a   d a t e ,   m o n t h ,   q u a r t e r ,   o r   y e a r   i s   c l i c k e d ,   a   f u n c t i o n   i s   c a l l e d   a n d  
 / /   p a s s e d   t h e   d e t a i l s .   Y o u   m u s t   w r i t e   t h i s   f u n c t i o n ,   a n d   t e l l   t h e   c a l e n d a r  
 / /   p o p u p   w h a t   t h e   f u n c t i o n   n a m e   i s .  
 / /   F u n c t i o n   t o   b e   c a l l e d   f o r   ' d a t e '   s e l e c t   r e c e i v e s   y ,   m ,   d  
 c a l . s e t R e t u r n F u n c t i o n ( f u n c t i o n n a m e ) ;  
 / /   F u n c t i o n   t o   b e   c a l l e d   f o r   ' m o n t h '   s e l e c t   r e c e i v e s   y ,   m  
 c a l . s e t R e t u r n M o n t h F u n c t i o n ( f u n c t i o n n a m e ) ;  
 / /   F u n c t i o n   t o   b e   c a l l e d   f o r   ' q u a r t e r '   s e l e c t   r e c e i v e s   y ,   q  
 c a l . s e t R e t u r n Q u a r t e r F u n c t i o n ( f u n c t i o n n a m e ) ;  
 / /   F u n c t i o n   t o   b e   c a l l e d   f o r   ' y e a r '   s e l e c t   r e c e i v e s   y  
 c a l . s e t R e t u r n Y e a r F u n c t i o n ( f u n c t i o n n a m e ) ;  
  
 / /   S h o w   t h e   c a l e n d a r   r e l a t i v e   t o   a   g i v e n   a n c h o r  
 c a l . s h o w C a l e n d a r ( a n c h o r n a m e ) ;  
  
 / /   H i d e   t h e   c a l e n d a r .   T h e   c a l e n d a r   i s   s e t   t o   a u t o H i d e   a u t o m a t i c a l l y  
 c a l . h i d e C a l e n d a r ( ) ;  
  
 / /   S e t   t h e   m o n t h   n a m e s   t o   b e   u s e d .   D e f a u l t   a r e   E n g l i s h   m o n t h   n a m e s  
 c a l . s e t M o n t h N a m e s ( " J a n u a r y " , " F e b r u a r y " , " M a r c h " , . . . ) ;  
  
 / /   S e t   t h e   m o n t h   a b b r e v i a t i o n s   t o   b e   u s e d .   D e f a u l t   a r e   E n g l i s h   m o n t h   a b b r e v i a t i o n s  
 c a l . s e t M o n t h A b b r e v i a t i o n s ( " J a n " , " F e b " , " M a r " , . . . ) ;  
  
 / /   S h o w   n a v i g a t i o n   f o r   c h a n g i n g   b y   t h e   y e a r ,   n o t   j u s t   o n e   m o n t h   a t   a   t i m e  
 c a l . s h o w Y e a r N a v i g a t i o n ( ) ;  
  
 / /   S h o w   m o n t h   a n d   y e a r   d r o p d o w n s ,   f o r   q u i c k e r   s e l e c t i o n   o f   m o n t h   o f   d a t e s  
 c a l . s h o w N a v i g a t i o n D r o p d o w n s ( ) ;  
  
 / /   S e t   t h e   t e x t   t o   b e   u s e d   a b o v e   e a c h   d a y   c o l u m n .   T h e   d a y s   s t a r t   w i t h    
 / /   s u n d a y   r e g a r d l e s s   o f   t h e   v a l u e   o f   W e e k S t a r t D a y  
 c a l . s e t D a y H e a d e r s ( " S " , " M " , " T " , . . . ) ;  
  
 / /   S e t   t h e   d a y   f o r   t h e   f i r s t   c o l u m n   i n   t h e   c a l e n d a r   g r i d .   B y   d e f a u l t   t h i s  
 / /   i s   S u n d a y   ( 0 )   b u t   i t   m a y   b e   c h a n g e d   t o   f i t   t h e   c o n v e n t i o n s   o f   o t h e r  
 / /   c o u n t r i e s .  
 c a l . s e t W e e k S t a r t D a y ( 1 ) ;   / /   w e e k   i s   M o n d a y   -   S u n d a y  
  
 / /   S e t   t h e   w e e k d a y s   w h i c h   s h o u l d   b e   d i s a b l e d   i n   t h e   ' d a t e '   s e l e c t   p o p u p .   Y o u   c a n  
 / /   t h e n   a l l o w   s o m e o n e   t o   o n l y   s e l e c t   w e e k   e n d   d a t e s ,   o r   T u e d a y s ,   f o r   e x a m p l e  
 c a l . s e t D i s a b l e d W e e k D a y s ( 0 , 1 ) ;   / /   T o   d i s a b l e   s e l e c t i n g   t h e   1 s t   o r   2 n d   d a y s   o f   t h e   w e e k  
  
 / /   S e l e c t i v e l y   d i s a b l e   i n d i v i d u a l   d a y s   o r   d a t e   r a n g e s .   D i s a b l e d   d a y s   w i l l   n o t  
 / /   b e   c l i c k a b l e ,   a n d   s h o w   a s   s t r i k e - t h r o u g h   t e x t   o n   c u r r e n t   b r o w s e r s .  
 / /   D a t e   f o r m a t   i s   a n y   f o r m a t   r e c o g n i z e d   b y   p a r s e D a t e ( )   i n   d a t e . j s  
 / /   P a s s   a   s i n g l e   d a t e   t o   d i s a b l e :  
 c a l . a d d D i s a b l e d D a t e s ( " 2 0 0 3 - 0 1 - 0 1 " ) ;  
 / /   P a s s   n u l l   a s   t h e   f i r s t   p a r a m e t e r   t o   m e a n   " a n y t h i n g   u p   t o   a n d   i n c l u d i n g "   t h e  
 / /   p a s s e d   d a t e :  
 c a l . a d d D i s a b l e d D a t e s ( n u l l ,   " 0 1 / 0 2 / 0 3 " ) ;  
 / /   P a s s   n u l l   a s   t h e   s e c o n d   p a r a m e t e r   t o   m e a n   " i n c l u d i n g   t h e   p a s s e d   d a t e   a n d  
 / /   a n y t h i n g   a f t e r   i t :  
 c a l . a d d D i s a b l e d D a t e s ( " J a n   0 1 ,   2 0 0 3 " ,   n u l l ) ;  
 / /   P a s s   t w o   d a t e s   t o   d i s a b l e   a l l   d a t e s   i n b e t w e e n   a n d   i n c l u d i n g   t h e   t w o  
 c a l . a d d D i s a b l e d D a t e s ( " J a n u a r y   0 1 ,   2 0 0 3 " ,   " D e c   3 1 ,   2 0 0 3 " ) ;  
  
 / /   W h e n   t h e   ' y e a r '   s e l e c t   i s   d i s p l a y e d ,   s e t   t h e   n u m b e r   o f   y e a r s   b a c k   f r o m   t h e    
 / /   c u r r e n t   y e a r   t o   s t a r t   l i s t i n g   y e a r s .   D e f a u l t   i s   2 .  
 / /   T h i s   i s   a l s o   u s e d   f o r   y e a r   d r o p - d o w n ,   t o   d e c i d e   h o w   m a n y   y e a r s   + / -   t o   d i s p l a y  
 c a l . s e t Y e a r S e l e c t S t a r t O f f s e t ( 2 ) ;  
  
 / /   T e x t   f o r   t h e   w o r d   " T o d a y "   a p p e a r i n g   o n   t h e   c a l e n d a r  
 c a l . s e t T o d a y T e x t ( " $Æ˜²" ) ;  
  
 / /   T h e   c a l e n d a r   u s e s   C S S   c l a s s e s   f o r   f o r m a t t i n g .   I f   y o u   w a n t   y o u r   c a l e n d a r   t o  
 / /   h a v e   u n i q u e   s t y l e s ,   y o u   c a n   s e t   t h e   p r e f i x   t h a t   w i l l   b e   a d d e d   t o   a l l   t h e  
 / /   c l a s s e s   i n   t h e   o u t p u t .  
 / /   F o r   e x a m p l e ,   n o r m a l   o u t p u t   m a y   h a v e   t h i s :  
 / /           < S P A N   C L A S S = " c p T o d a y T e x t D i s a b l e d " > T o d a y < S P A N >  
 / /   B u t   i f   y o u   s e t   t h e   p r e f i x   l i k e   t h i s :  
 c a l . s e t C s s P r e f i x ( " T e s t " ) ;  
 / /   T h e   o u t p u t   w i l l   t h e n   l o o k   l i k e :  
 / /           < S P A N   C L A S S = " T e s t c p T o d a y T e x t D i s a b l e d " > T o d a y < S P A N >  
 / /   A n d   y o u   c a n   d e f i n e   t h a t   s t y l e   s o m e w h e r e   i n   y o u r   p a g e .  
  
 / /   W h e n   u s i n g   Y e a r   n a v i g a t i o n ,   y o u   c a n   m a k e   t h e   y e a r   b e   a n   i n p u t   b o x ,   s o  
 / /   t h e   u s e r   c a n   m a n u a l l y   c h a n g e   i t   a n d   j u m p   t o   a n y   y e a r  
 c a l . s h o w Y e a r N a v i g a t i o n I n p u t ( ) ;  
  
 / /   S e t   t h e   c a l e n d a r   o f f s e t   t o   b e   d i f f e r e n t   t h a n   t h e   d e f a u l t .   B y   d e f a u l t   i t  
 / /   w i l l   a p p e a r   j u s t   b e l o w   a n d   t o   t h e   r i g h t   o f   t h e   a n c h o r n a m e .   S o   i f   y o u   h a v e  
 / /   a   t e x t   b o x   w h e r e   t h e   d a t e   w i l l   g o   a n d   a n d   a n c h o r   i m m e d i a t e l y   a f t e r   t h e  
 / /   t e x t   b o x ,   t h e   c a l e n d a r   w i l l   d i s p l a y   i m m e d i a t e l y   u n d e r   t h e   t e x t   b o x .  
 c a l . o f f s e t X   =   2 0 ;  
 c a l . o f f s e t Y   =   2 0 ;  
  
 N O T E S :  
 1 )   R e q u i r e s   t h e   f u n c t i o n s   i n   A n c h o r P o s i t i o n . j s   a n d   P o p u p W i n d o w . j s  
  
 2 )   Y o u r   a n c h o r   t a g   M U S T   c o n t a i n   b o t h   N A M E   a n d   I D   a t t r i b u t e s   w h i c h   a r e   t h e    
       s a m e .   F o r   e x a m p l e :  
       < A   N A M E = " t e s t "   I D = " t e s t " >   < / A >  
  
 3 )   T h e r e   m u s t   b e   a t   l e a s t   a   s p a c e   b e t w e e n   < A >   < / A >   f o r   I E 5 . 5   t o   s e e   t h e    
       a n c h o r   t a g   c o r r e c t l y .   D o   n o t   d o   < A > < / A >   w i t h   n o   s p a c e .  
  
 4 )   W h e n   a   C a l e n d a r P o p u p   o b j e c t   i s   c r e a t e d ,   a   h a n d l e r   f o r   ' o n m o u s e u p '   i s  
       a t t a c h e d   t o   a n y   e v e n t   h a n d l e r   y o u   m a y   h a v e   a l r e a d y   d e f i n e d .   D o   N O T   d e f i n e  
       a n   e v e n t   h a n d l e r   f o r   ' o n m o u s e u p '   a f t e r   y o u   d e f i n e   a   C a l e n d a r P o p u p   o b j e c t    
       o r   t h e   a u t o H i d e ( )   w i l l   n o t   w o r k   c o r r e c t l y .  
        
 5 )   T h e   c a l e n d a r   p o p u p   d i s p l a y   u s e s   s t y l e   s h e e t s   t o   m a k e   i t   l o o k   n i c e .  
  
 * /    
  
 / /   C O N S T R U C T O R   f o r   t h e   C a l e n d a r P o p u p   O b j e c t  
 f u n c t i o n   C a l e n d a r P o p u p ( )   {  
 	 v a r   c ;  
 	 i f   ( a r g u m e n t s . l e n g t h > 0 )   {  
 	 	 c   =   n e w   P o p u p W i n d o w ( a r g u m e n t s [ 0 ] ) ;  
 	 	 }  
 	 e l s e   {  
 	 	 c   =   n e w   P o p u p W i n d o w ( ) ;  
 	 	 c . s e t S i z e ( 1 5 0 , 1 7 5 ) ;  
 	 	 }  
 	 c . o f f s e t X   =   - 1 5 2 ;  
 	 c . o f f s e t Y   =   2 5 ;  
 	 c . a u t o H i d e ( ) ;  
 	 / /   C a l e n d a r - s p e c i f i c   p r o p e r t i e s  
 	 c . m o n t h N a m e s   =   n e w   A r r a y ( ' 1 ' , ' 2 ' , ' 3 ' , ' 4 ' , ' 5 ' , ' 6 ' , ' 7 ' , ' 8 ' , ' 9 ' , ' 1 0 ' , ' 1 1 ' , ' 1 2 ' ) ;  
 	 c . m o n t h A b b r e v i a t i o n s   =   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 " ) ;  
 	 c . d a y H e a d e r s   =   n e w   A r r a y ( " S " , " M " , " T " , " W " , " T " , " F " , " S " ) ;  
 	 c . r e t u r n F u n c t i o n   =   " C P _ t m p R e t u r n F u n c t i o n " ;  
 	 c . r e t u r n M o n t h F u n c t i o n   =   " C P _ t m p R e t u r n M o n t h F u n c t i o n " ;  
 	 c . r e t u r n Q u a r t e r F u n c t i o n   =   " C P _ t m p R e t u r n Q u a r t e r F u n c t i o n " ;  
 	 c . r e t u r n Y e a r F u n c t i o n   =   " C P _ t m p R e t u r n Y e a r F u n c t i o n " ;  
 	 c . w e e k S t a r t D a y   =   0 ;  
 	 c . i s S h o w Y e a r N a v i g a t i o n   =   f a l s e ;  
 	 c . d i s p l a y T y p e   =   " d a t e " ;  
 	 c . d i s a b l e d W e e k D a y s   =   n e w   O b j e c t ( ) ;  
 	 c . d i s a b l e d D a t e s E x p r e s s i o n   =   " " ;  
 	 c . y e a r S e l e c t S t a r t O f f s e t   =   2 ;  
 	 c . c u r r e n t D a t e   =   n u l l ;  
 	 c . t o d a y T e x t = " $Æ˜²" ;  
 	 c . c s s P r e f i x = " " ;  
 	 c . i s S h o w N a v i g a t i o n D r o p d o w n s = f a l s e ;  
 	 c . i s S h o w Y e a r N a v i g a t i o n I n p u t = f a l s e ;  
 	 w i n d o w . C P _ c a l e n d a r O b j e c t   =   n u l l ;  
 	 w i n d o w . C P _ t a r g e t I n p u t   =   n u l l ;  
 	 w i n d o w . C P _ s i b l i n g I n p u t   =   n u l l ;  
 	 c . s i b l i n g I n p u t   =   n u l l ;  
 	 w i n d o w . C P _ d a t e F o r m a t   =   " M M / d d / y y y y " ;  
 	 / /   M e t h o d   m a p p i n g s  
 	 c . c o p y M o n t h N a m e s T o W i n d o w   =   C P _ c o p y M o n t h N a m e s T o W i n d o w ;  
 	 c . s e t R e t u r n F u n c t i o n   =   C P _ s e t R e t u r n F u n c t i o n ;  
 	 c . s e t R e t u r n M o n t h F u n c t i o n   =   C P _ s e t R e t u r n M o n t h F u n c t i o n ;  
 	 c . s e t R e t u r n Q u a r t e r F u n c t i o n   =   C P _ s e t R e t u r n Q u a r t e r F u n c t i o n ;  
 	 c . s e t R e t u r n Y e a r F u n c t i o n   =   C P _ s e t R e t u r n Y e a r F u n c t i o n ;  
 	 c . s e t M o n t h N a m e s   =   C P _ s e t M o n t h N a m e s ;  
 	 c . s e t M o n t h A b b r e v i a t i o n s   =   C P _ s e t M o n t h A b b r e v i a t i o n s ;  
 	 c . s e t D a y H e a d e r s   =   C P _ s e t D a y H e a d e r s ;  
 	 c . s e t W e e k S t a r t D a y   =   C P _ s e t W e e k S t a r t D a y ;  
 	 c . s e t D i s p l a y T y p e   =   C P _ s e t D i s p l a y T y p e ;  
 	 c . s e t D i s a b l e d W e e k D a y s   =   C P _ s e t D i s a b l e d W e e k D a y s ;  
 	 c . a d d D i s a b l e d D a t e s   =   C P _ a d d D i s a b l e d D a t e s ;  
 	 c . s e t Y e a r S e l e c t S t a r t O f f s e t   =   C P _ s e t Y e a r S e l e c t S t a r t O f f s e t ;  
 	 c . s e t T o d a y T e x t   =   C P _ s e t T o d a y T e x t ;  
 	 c . s h o w Y e a r N a v i g a t i o n   =   C P _ s h o w Y e a r N a v i g a t i o n ;  
 	 c . s h o w C a l e n d a r   =   C P _ s h o w C a l e n d a r ;  
 	 c . h i d e C a l e n d a r   =   C P _ h i d e C a l e n d a r ;  
 	 c . g e t S t y l e s   =   g e t C a l e n d a r S t y l e s ;  
 	 c . r e f r e s h C a l e n d a r   =   C P _ r e f r e s h C a l e n d a r ;  
 	 c . g e t C a l e n d a r   =   C P _ g e t C a l e n d a r ;  
 	 c . s e l e c t   =   C P _ s e l e c t ;  
 	 c . s e t C s s P r e f i x   =   C P _ s e t C s s P r e f i x ;  
 	 c . s h o w N a v i g a t i o n D r o p d o w n s   =   C P _ s h o w N a v i g a t i o n D r o p d o w n s ;  
 	 c . s h o w Y e a r N a v i g a t i o n I n p u t   =   C P _ s h o w Y e a r N a v i g a t i o n I n p u t ;  
 	 c . c o p y M o n t h N a m e s T o W i n d o w ( ) ;  
 	 / /   R e t u r n   t h e   o b j e c t  
 	 r e t u r n   c ;  
 	 }  
 f u n c t i o n   C P _ c o p y M o n t h N a m e s T o W i n d o w ( )   {  
  
 	 / /   C o p y   t h e s e   v a l u e s   o v e r   t o   t h e   d a t e . j s    
 	 i f   ( t y p e o f ( w i n d o w . M O N T H _ N A M E S ) ! = " u n d e f i n e d "   & &   w i n d o w . M O N T H _ N A M E S ! = n u l l )   {  
 	 	 w i n d o w . M O N T H _ N A M E S   =   n e w   A r r a y ( ) ;  
 	 	 f o r   ( v a r   i = 0 ;   i < t h i s . m o n t h N a m e s . l e n g t h ;   i + + )   {  
 	 	 	 w i n d o w . M O N T H _ N A M E S [ w i n d o w . M O N T H _ N A M E S . l e n g t h ]   =   t h i s . m o n t h N a m e s [ i ] ;  
 	 	 }  
 	 	 f o r   ( v a r   i = 0 ;   i < t h i s . m o n t h A b b r e v i a t i o n s . l e n g t h ;   i + + )   {  
 	 	 	 w i n d o w . M O N T H _ N A M E S [ w i n d o w . M O N T H _ N A M E S . l e n g t h ]   =   t h i s . m o n t h A b b r e v i a t i o n s [ i ] ;  
 	 	 }  
 	 }  
 }  
 / /   T e m p o r a r y   d e f a u l t   f u n c t i o n s   t o   b e   c a l l e d   w h e n   i t e m s   c l i c k e d ,   s o   n o   e r r o r   i s   t h r o w n  
 f u n c t i o n   C P _ t m p R e t u r n F u n c t i o n ( y , m , d )   {    
 	 i f   ( w i n d o w . C P _ t a r g e t I n p u t ! = n u l l )   {  
 	 	 v a r   d t   =   n e w   D a t e ( y , m - 1 , d , 0 , 0 , 0 ) ;  
 	 	 v a r   o l d _ d a t e   =   w i n d o w . C P _ t a r g e t I n p u t . v a l u e ;  
 	 	 o l d _ d a t e   =   g e t D a t e F r o m F o r m a t ( o l d _ d a t e ,   w i n d o w . C P _ d a t e F o r m a t ) ;  
 	 	 i f   ( w i n d o w . C P _ c a l e n d a r O b j e c t ! = n u l l )   {   w i n d o w . C P _ c a l e n d a r O b j e c t . c o p y M o n t h N a m e s T o W i n d o w ( ) ;   }  
 	 	 w i n d o w . C P _ t a r g e t I n p u t . v a l u e   =   f o r m a t D a t e ( d t , w i n d o w . C P _ d a t e F o r m a t ) ;  
 	 	 i f   ( w i n d o w . C P _ s i b l i n g I n p u t   ! = n u l l )  
 	 	 { 	  
 	 	 	 v a r   t o _ d a t e   =   g e t D a t e F r o m F o r m a t ( w i n d o w . C P _ s i b l i n g I n p u t . v a l u e ,   w i n d o w . C P _ d a t e F o r m a t ) ;  
 	 	 	 t o _ d a t e   =   n e w   D a t e ( t o _ d a t e ) ;  
  
 	 	 	 v a r   d i f f   =   t o _ d a t e   -   o l d _ d a t e ;  
 	 	 	 v a r   n e w _ d a t e ;  
 	 	 	 i f ( d i f f   = =   0 )   n e w _ d a t e   =   N u m b e r ( d t )   +   8 6 4 0 0 0 0 0 ;  
 	 	 	 e l s e   n e w _ d a t e   =   N u m b e r ( d t )   +   N u m b e r ( d i f f ) ;  
  
 	 	 	  
 / / 	 	 	 a l e r t ( ' d t :   '   +   N u m b e r ( d t )   +   ' \ n   t o _ d a t e :   '   +   N u m b e r ( t o _ d a t e )   +   ' \ n   d i f f :   '   +   d i f f / 8 6 4 0 0 0 0 0   +   ' \ n   n e w _ d a t e :   '   +   n e w _ d a t e ) ;  
  
 	 	 	 n e w _ d a t e   =   n e w   D a t e ( n e w _ d a t e ) ;  
  
 / / 	 	 	 a l e r t ( ' N e w :   '   +   n e w _ d a t e ) 	  
  
 / * 	 	 	 a l e r t ( f o r m a t D a t e ( n e w _ d a t e , w i n d o w . C P _ d a t e F o r m a t ) ) ; * /  
 	 	 	  
 	 	 	 w i n d o w . C P _ s i b l i n g I n p u t . v a l u e   =   f o r m a t D a t e ( n e w _ d a t e , w i n d o w . C P _ d a t e F o r m a t ) ;  
 	 	 	 w i n d o w . C P _ s i b l i n g I n p u t   =   n u l l ;  
 	 	 }  
  
 	 	 }  
 	 e l s e   {  
 	 	 a l e r t ( ' U s e   s e t R e t u r n F u n c t i o n ( )   t o   d e f i n e   w h i c h   f u n c t i o n   w i l l   g e t   t h e   c l i c k e d   r e s u l t s ! ' ) ;    
 	 	 }  
 	 }  
 f u n c t i o n   C P _ t m p R e t u r n M o n t h F u n c t i o n ( y , m )   {    
 	 a l e r t ( ' U s e   s e t R e t u r n M o n t h F u n c t i o n ( )   t o   d e f i n e   w h i c h   f u n c t i o n   w i l l   g e t   t h e   c l i c k e d   r e s u l t s ! \ n Y o u   c l i c k e d :   y e a r = ' + y + '   ,   m o n t h = ' + m ) ;    
 	 }  
 f u n c t i o n   C P _ t m p R e t u r n Q u a r t e r F u n c t i o n ( y , q )   {    
 	 a l e r t ( ' U s e   s e t R e t u r n Q u a r t e r F u n c t i o n ( )   t o   d e f i n e   w h i c h   f u n c t i o n   w i l l   g e t   t h e   c l i c k e d   r e s u l t s ! \ n Y o u   c l i c k e d :   y e a r = ' + y + '   ,   q u a r t e r = ' + q ) ;    
 	 }  
 f u n c t i o n   C P _ t m p R e t u r n Y e a r F u n c t i o n ( y )   {    
 	 a l e r t ( ' U s e   s e t R e t u r n Y e a r F u n c t i o n ( )   t o   d e f i n e   w h i c h   f u n c t i o n   w i l l   g e t   t h e   c l i c k e d   r e s u l t s ! \ n Y o u   c l i c k e d :   y e a r = ' + y ) ;    
 	 }  
  
 / /   S e t   t h e   n a m e   o f   t h e   f u n c t i o n s   t o   c a l l   t o   g e t   t h e   c l i c k e d   i t e m  
 f u n c t i o n   C P _ s e t R e t u r n F u n c t i o n ( n a m e )   {   t h i s . r e t u r n F u n c t i o n   =   n a m e ;   }  
 f u n c t i o n   C P _ s e t R e t u r n M o n t h F u n c t i o n ( n a m e )   {   t h i s . r e t u r n M o n t h F u n c t i o n   =   n a m e ;   }  
 f u n c t i o n   C P _ s e t R e t u r n Q u a r t e r F u n c t i o n ( n a m e )   {   t h i s . r e t u r n Q u a r t e r F u n c t i o n   =   n a m e ;   }  
 f u n c t i o n   C P _ s e t R e t u r n Y e a r F u n c t i o n ( n a m e )   {   t h i s . r e t u r n Y e a r F u n c t i o n   =   n a m e ;   }  
  
 / /   O v e r - r i d e   t h e   b u i l t - i n   m o n t h   n a m e s  
 f u n c t i o n   C P _ s e t M o n t h N a m e s ( )   {  
 	 f o r   ( v a r   i = 0 ;   i < a r g u m e n t s . l e n g t h ;   i + + )   {   t h i s . m o n t h N a m e s [ i ]   =   a r g u m e n t s [ i ] ;   }  
 	 t h i s . c o p y M o n t h N a m e s T o W i n d o w ( ) ;  
 	 }  
  
 / /   O v e r - r i d e   t h e   b u i l t - i n   m o n t h   a b b r e v i a t i o n s  
 f u n c t i o n   C P _ s e t M o n t h A b b r e v i a t i o n s ( )   {  
 	 f o r   ( v a r   i = 0 ;   i < a r g u m e n t s . l e n g t h ;   i + + )   {   t h i s . m o n t h A b b r e v i a t i o n s [ i ]   =   a r g u m e n t s [ i ] ;   }  
 	 t h i s . c o p y M o n t h N a m e s T o W i n d o w ( ) ;  
 	 }  
  
 / /   O v e r - r i d e   t h e   b u i l t - i n   c o l u m n   h e a d e r s   f o r   e a c h   d a y  
 f u n c t i o n   C P _ s e t D a y H e a d e r s ( )   {  
 	 f o r   ( v a r   i = 0 ;   i < a r g u m e n t s . l e n g t h ;   i + + )   {   t h i s . d a y H e a d e r s [ i ]   =   a r g u m e n t s [ i ] ;   }  
 	 }  
  
 / /   S e t   t h e   d a y   o f   t h e   w e e k   ( 0 - 7 )   t h a t   t h e   c a l e n d a r   d i s p l a y   s t a r t s   o n  
 / /   T h i s   i s   f o r   c o u n t r i e s   o t h e r   t h a n   t h e   U S   w h o s e   c a l e n d a r   d i s p l a y s   s t a r t   o n   M o n d a y ( 1 ) ,   f o r   e x a m p l e  
 f u n c t i o n   C P _ s e t W e e k S t a r t D a y ( d a y )   {   t h i s . w e e k S t a r t D a y   =   d a y ;   }  
  
 / /   S h o w   n e x t / l a s t   y e a r   n a v i g a t i o n   l i n k s  
 f u n c t i o n   C P _ s h o w Y e a r N a v i g a t i o n ( )   {   t h i s . i s S h o w Y e a r N a v i g a t i o n   =   ( a r g u m e n t s . l e n g t h > 0 ) ? a r g u m e n t s [ 0 ] : t r u e ;   }  
  
 / /   W h i c h   t y p e   o f   c a l e n d a r   t o   d i s p l a y  
 f u n c t i o n   C P _ s e t D i s p l a y T y p e ( t y p e )   {  
 	 i f   ( t y p e ! = " d a t e " & & t y p e ! = " w e e k - e n d " & & t y p e ! = " m o n t h " & & t y p e ! = " q u a r t e r " & & t y p e ! = " y e a r " )   {   a l e r t ( " I n v a l i d   d i s p l a y   t y p e !   M u s t   b e   o n e   o f :   d a t e , w e e k - e n d , m o n t h , q u a r t e r , y e a r " ) ;   r e t u r n   f a l s e ;   }  
 	 t h i s . d i s p l a y T y p e = t y p e ;  
 	 }  
  
 / /   H o w   m a n y   y e a r s   b a c k   t o   s t a r t   b y   d e f a u l t   f o r   y e a r   d i s p l a y  
 f u n c t i o n   C P _ s e t Y e a r S e l e c t S t a r t O f f s e t ( n u m )   {   t h i s . y e a r S e l e c t S t a r t O f f s e t = n u m ;   }  
  
 / /   S e t   w h i c h   w e e k d a y s   s h o u l d   n o t   b e   c l i c k a b l e  
 f u n c t i o n   C P _ s e t D i s a b l e d W e e k D a y s ( )   {  
 	 t h i s . d i s a b l e d W e e k D a y s   =   n e w   O b j e c t ( ) ;  
 	 f o r   ( v a r   i = 0 ;   i < a r g u m e n t s . l e n g t h ;   i + + )   {   t h i s . d i s a b l e d W e e k D a y s [ a r g u m e n t s [ i ] ]   =   t r u e ;   }  
 	 }  
 	  
 / /   D i s a b l e   i n d i v i d u a l   d a t e s   o r   r a n g e s  
 / /   B u i l d s   a n   i n t e r n a l   l o g i c a l   t e s t   w h i c h   i s   r u n   v i a   e v a l ( )   f o r   e f f i c i e n c y  
 f u n c t i o n   C P _ a d d D i s a b l e d D a t e s ( s t a r t ,   e n d )   {  
 	 i f   ( a r g u m e n t s . l e n g t h = = 1 )   {   e n d = s t a r t ;   }  
 	 i f   ( s t a r t = = n u l l   & &   e n d = = n u l l )   {   r e t u r n ;   }  
 	 i f   ( t h i s . d i s a b l e d D a t e s E x p r e s s i o n ! = " " )   {   t h i s . d i s a b l e d D a t e s E x p r e s s i o n + =   " | | " ;   }  
 	 i f   ( s t a r t ! = n u l l )   {   s t a r t   =   p a r s e D a t e ( s t a r t ) ;   s t a r t = " " + s t a r t . g e t F u l l Y e a r ( ) + L Z ( s t a r t . g e t M o n t h ( ) + 1 ) + L Z ( s t a r t . g e t D a t e ( ) ) ; }  
 	 i f   ( e n d ! = n u l l )   {   e n d = p a r s e D a t e ( e n d ) ;   e n d = " " + e n d . g e t F u l l Y e a r ( ) + L Z ( e n d . g e t M o n t h ( ) + 1 ) + L Z ( e n d . g e t D a t e ( ) ) ; }  
 	 i f   ( s t a r t = = n u l l )   {   t h i s . d i s a b l e d D a t e s E x p r e s s i o n + = " ( d s < = " + e n d + " ) " ;   }  
 	 e l s e   i f   ( e n d     = = n u l l )   {   t h i s . d i s a b l e d D a t e s E x p r e s s i o n + = " ( d s > = " + s t a r t + " ) " ;   }  
 	 e l s e   {   t h i s . d i s a b l e d D a t e s E x p r e s s i o n + = " ( d s > = " + s t a r t + " & & d s < = " + e n d + " ) " ;   }  
 	 }  
 	  
 / /   S e t   t h e   t e x t   t o   u s e   f o r   t h e   " T o d a y "   l i n k  
 f u n c t i o n   C P _ s e t T o d a y T e x t ( t e x t )   {  
 	 t h i s . t o d a y T e x t   =   t e x t ;  
 	 }  
  
 / /   S e t   t h e   p r e f i x   t o   b e   a d d e d   t o   a l l   C S S   c l a s s e s   w h e n   w r i t i n g   o u t p u t  
 f u n c t i o n   C P _ s e t C s s P r e f i x ( v a l )   {    
 	 t h i s . c s s P r e f i x   =   v a l ;    
 	 }  
  
 / /   S h o w   t h e   n a v i g a t i o n   a s   a n   d r o p d o w n s   t h a t   c a n   b e   m a n u a l l y   c h a n g e d  
 f u n c t i o n   C P _ s h o w N a v i g a t i o n D r o p d o w n s ( )   {   t h i s . i s S h o w N a v i g a t i o n D r o p d o w n s   =   ( a r g u m e n t s . l e n g t h > 0 ) ? a r g u m e n t s [ 0 ] : t r u e ;   }  
  
 / /   S h o w   t h e   y e a r   n a v i g a t i o n   a s   a n   i n p u t   b o x   t h a t   c a n   b e   m a n u a l l y   c h a n g e d  
 f u n c t i o n   C P _ s h o w Y e a r N a v i g a t i o n I n p u t ( )   {   t h i s . i s S h o w Y e a r N a v i g a t i o n I n p u t   =   ( a r g u m e n t s . l e n g t h > 0 ) ? a r g u m e n t s [ 0 ] : t r u e ;   }  
  
 / /   H i d e   a   c a l e n d a r   o b j e c t  
 f u n c t i o n   C P _ h i d e C a l e n d a r ( )   {  
 	 i f   ( a r g u m e n t s . l e n g t h   >   0 )   {   w i n d o w . p o p u p W i n d o w O b j e c t s [ a r g u m e n t s [ 0 ] ] . h i d e P o p u p ( ) ;   }  
 	 e l s e   {   t h i s . h i d e P o p u p ( ) ;   }  
 	 }  
  
 / /   R e f r e s h   t h e   c o n t e n t s   o f   t h e   c a l e n d a r   d i s p l a y  
 f u n c t i o n   C P _ r e f r e s h C a l e n d a r ( i n d e x )   {  
 	 v a r   c a l O b j e c t   =   w i n d o w . p o p u p W i n d o w O b j e c t s [ i n d e x ] ;  
 	 i f   ( a r g u m e n t s . l e n g t h > 1 )   {    
 	 	 c a l O b j e c t . p o p u l a t e ( c a l O b j e c t . g e t C a l e n d a r ( a r g u m e n t s [ 1 ] , a r g u m e n t s [ 2 ] , a r g u m e n t s [ 3 ] , a r g u m e n t s [ 4 ] , a r g u m e n t s [ 5 ] ) ) ;  
 	 	 }  
 	 e l s e   {  
 	 	 c a l O b j e c t . p o p u l a t e ( c a l O b j e c t . g e t C a l e n d a r ( ) ) ;  
 	 	 }  
 	 c a l O b j e c t . r e f r e s h ( ) ;  
 	 }  
  
 / /   P o p u l a t e   t h e   c a l e n d a r   a n d   d i s p l a y   i t  
 f u n c t i o n   C P _ s h o w C a l e n d a r ( a n c h o r n a m e )   {  
 	 i f   ( a r g u m e n t s . l e n g t h > 1 )   {  
 	 	 i f   ( a r g u m e n t s [ 1 ] = = n u l l | | a r g u m e n t s [ 1 ] = = " " )   {  
 	 	 	 t h i s . c u r r e n t D a t e = n e w   D a t e ( ) ;  
 	 	 	 }  
 	 	 e l s e   {  
 	 	 	 t h i s . c u r r e n t D a t e = n e w   D a t e ( p a r s e D a t e ( a r g u m e n t s [ 1 ] ) ) ;  
 	 	 	 }  
 	 	 }  
 	 t h i s . p o p u l a t e ( t h i s . g e t C a l e n d a r ( ) ) ;  
 	 t h i s . s h o w P o p u p ( a n c h o r n a m e ) ;  
 	 }  
  
 / /   S i m p l e   m e t h o d   t o   i n t e r f a c e   p o p u p   c a l e n d a r   w i t h   a   t e x t - e n t r y   b o x  
 f u n c t i o n   C P _ s e l e c t ( i n p u t o b j ,   l i n k n a m e ,   f o r m a t )   {  
 	 v a r   s e l e c t e d D a t e = ( a r g u m e n t s . l e n g t h > 3 ) ? a r g u m e n t s [ 3 ] : n u l l ;  
 	 i f   ( ! w i n d o w . g e t D a t e F r o m F o r m a t )   {  
 	 	 a l e r t ( " c a l e n d a r . s e l e c t :   T o   u s e   t h i s   m e t h o d   y o u   m u s t   a l s o   i n c l u d e   ' d a t e . j s '   f o r   d a t e   f o r m a t t i n g " ) ;  
 	 	 r e t u r n ;  
 	 	 }  
 	 i f   ( t h i s . d i s p l a y T y p e ! = " d a t e " & & t h i s . d i s p l a y T y p e ! = " w e e k - e n d " )   {  
 	 	 a l e r t ( " c a l e n d a r . s e l e c t :   T h i s   f u n c t i o n   c a n   o n l y   b e   u s e d   w i t h   d i s p l a y T y p e   ' d a t e '   o r   ' w e e k - e n d ' " ) ;  
 	 	 r e t u r n ;  
 	 	 }  
 	 i f   ( i n p u t o b j . t y p e ! = " t e x t "   & &   i n p u t o b j . t y p e ! = " h i d d e n "   & &   i n p u t o b j . t y p e ! = " t e x t a r e a " )   {    
 	 	 a l e r t ( " c a l e n d a r . s e l e c t :   I n p u t   o b j e c t   p a s s e d   i s   n o t   a   v a l i d   f o r m   i n p u t   o b j e c t " ) ;    
 	 	 w i n d o w . C P _ t a r g e t I n p u t = n u l l ;  
 	 	 r e t u r n ;  
 	 	 }  
 	 i f   ( i n p u t o b j . d i s a b l e d )   {   r e t u r n ;   }   / /   C a n ' t   u s e   c a l e n d a r   i n p u t   o n   d i s a b l e d   f o r m   i n p u t !  
 	 w i n d o w . C P _ t a r g e t I n p u t   =   i n p u t o b j ;  
 	 i f ( t h i s . s i b l i n g I n p u t   ! =   n u l l )   w i n d o w . C P _ s i b l i n g I n p u t   =   $ ( t h i s . s i b l i n g I n p u t ) ;  
  
 	 w i n d o w . C P _ c a l e n d a r O b j e c t   =   t h i s ;  
 	 t h i s . c u r r e n t D a t e = n u l l ;  
 	 v a r   t i m e = 0 ;  
 	 i f   ( s e l e c t e d D a t e ! = n u l l )   {  
 	 	 t i m e   =   g e t D a t e F r o m F o r m a t ( s e l e c t e d D a t e , f o r m a t )  
 	 	 }  
 	 e l s e   i f   ( i n p u t o b j . v a l u e ! = " " )   {  
 	 	 t i m e   =   g e t D a t e F r o m F o r m a t ( i n p u t o b j . v a l u e , f o r m a t ) ;  
 	 	 }  
 	 i f   ( s e l e c t e d D a t e ! = n u l l   | |   i n p u t o b j . v a l u e ! = " " )   {  
 	 	 i f   ( t i m e = = 0 )   {   t h i s . c u r r e n t D a t e = n u l l ;   }  
 	 	 e l s e   {   t h i s . c u r r e n t D a t e = n e w   D a t e ( t i m e ) ;   }  
 	 	 }  
 	 w i n d o w . C P _ d a t e F o r m a t   =   f o r m a t ;  
 	 t h i s . s h o w C a l e n d a r ( l i n k n a m e ) ;  
 	 }  
 	  
 / /   G e t   s t y l e   b l o c k   n e e d e d   t o   d i s p l a y   t h e   c a l e n d a r   c o r r e c t l y  
 f u n c t i o n   g e t C a l e n d a r S t y l e s ( )   {  
 	 v a r   r e s u l t   =   " " ;  
 	 v a r   p   =   " " ;  
 	 i f   ( t h i s ! = n u l l   & &   t y p e o f ( t h i s . c s s P r e f i x ) ! = " u n d e f i n e d "   & &   t h i s . c s s P r e f i x ! = n u l l   & &   t h i s . c s s P r e f i x ! = " " )   {   p = t h i s . c s s P r e f i x ;   }  
 	 r e s u l t   + =   " < S T Y L E > \ n " ;  
 	 r e s u l t   + =   " . " + p + " c p Y e a r N a v i g a t i o n , . " + p + " c p M o n t h N a v i g a t i o n   {   b a c k g r o u n d - c o l o r : # C 0 C 0 C 0 ;   t e x t - a l i g n : c e n t e r ;   v e r t i c a l - a l i g n : c e n t e r ;   t e x t - d e c o r a t i o n : n o n e ;   c o l o r : # 0 0 0 0 0 0 ;   f o n t - w e i g h t : b o l d ;   } \ n " ;  
 	 r e s u l t   + =   " . " + p + " c p D a y C o l u m n H e a d e r ,   . " + p + " c p Y e a r N a v i g a t i o n , . " + p + " c p M o n t h N a v i g a t i o n , . " + p + " c p C u r r e n t M o n t h D a t e , . " + p + " c p C u r r e n t M o n t h D a t e D i s a b l e d , . " + p + " c p O t h e r M o n t h D a t e , . " + p + " c p O t h e r M o n t h D a t e D i s a b l e d , . " + p + " c p C u r r e n t D a t e , . " + p + " c p C u r r e n t D a t e D i s a b l e d , . " + p + " c p T o d a y T e x t , . " + p + " c p T o d a y T e x t D i s a b l e d , . " + p + " c p T e x t   {   f o n t - f a m i l y : a r i a l ;   f o n t - s i z e : 8 p t ;   } \ n " ;  
 	 r e s u l t   + =   " T D . " + p + " c p D a y C o l u m n H e a d e r   {   t e x t - a l i g n : r i g h t ;   b o r d e r : s o l i d   t h i n   # C 0 C 0 C 0 ; b o r d e r - w i d t h : 0 p x   0 p x   1 p x   0 p x ;   } \ n " ;  
 	 r e s u l t   + =   " . " + p + " c p C u r r e n t M o n t h D a t e ,   . " + p + " c p O t h e r M o n t h D a t e ,   . " + p + " c p C u r r e n t D a t e     {   t e x t - a l i g n : r i g h t ;   t e x t - d e c o r a t i o n : n o n e ;   } \ n " ;  
 	 r e s u l t   + =   " . " + p + " c p C u r r e n t M o n t h D a t e D i s a b l e d ,   . " + p + " c p O t h e r M o n t h D a t e D i s a b l e d ,   . " + p + " c p C u r r e n t D a t e D i s a b l e d   {   c o l o r : # D 0 D 0 D 0 ;   t e x t - a l i g n : r i g h t ;   t e x t - d e c o r a t i o n : l i n e - t h r o u g h ;   } \ n " ;  
 	 r e s u l t   + =   " . " + p + " c p C u r r e n t M o n t h D a t e ,   . c p C u r r e n t D a t e   {   c o l o r : # 0 0 0 0 0 0 ;   } \ n " ;  
 	 r e s u l t   + =   " . " + p + " c p O t h e r M o n t h D a t e   {   c o l o r : # 8 0 8 0 8 0 ;   } \ n " ;  
 	 r e s u l t   + =   " T D . " + p + " c p C u r r e n t D a t e   {   c o l o r : w h i t e ;   b a c k g r o u n d - c o l o r :   # C 0 C 0 C 0 ;   b o r d e r - w i d t h : 1 p x ;   b o r d e r : s o l i d   t h i n   # 8 0 0 0 0 0 ;   } \ n " ;  
 	 r e s u l t   + =   " T D . " + p + " c p C u r r e n t D a t e D i s a b l e d   {   b o r d e r - w i d t h : 1 p x ;   b o r d e r : s o l i d   t h i n   # F F A A A A ;   } \ n " ;  
 	 r e s u l t   + =   " T D . " + p + " c p T o d a y T e x t ,   T D . " + p + " c p T o d a y T e x t D i s a b l e d   {   b o r d e r : s o l i d   t h i n   # C 0 C 0 C 0 ;   b o r d e r - w i d t h : 1 p x   0 p x   0 p x   0 p x ; } \ n " ;  
 	 r e s u l t   + =   " A . " + p + " c p T o d a y T e x t ,   S P A N . " + p + " c p T o d a y T e x t D i s a b l e d   {   h e i g h t : 2 0 p x ;   } \ n " ;  
 	 r e s u l t   + =   " A . " + p + " c p T o d a y T e x t   {   c o l o r : b l a c k ;   } \ n " ;  
 	 r e s u l t   + =   " . " + p + " c p T o d a y T e x t D i s a b l e d   {   c o l o r : # D 0 D 0 D 0 ;   } \ n " ;  
 	 r e s u l t   + =   " . " + p + " c p B o r d e r   {   b o r d e r : s o l i d   t h i n   # 8 0 8 0 8 0 ;   } \ n " ;  
 	 r e s u l t   + =   " < / S T Y L E > \ n " ;  
 	 r e t u r n   r e s u l t ;  
 	 }  
  
 / /   R e t u r n   a   s t r i n g   c o n t a i n i n g   a l l   t h e   c a l e n d a r   c o d e   t o   b e   d i s p l a y e d  
 f u n c t i o n   C P _ g e t C a l e n d a r ( )   {  
 	 v a r   n o w   =   n e w   D a t e ( ) ;  
 	 / /   R e f e r e n c e   t o   w i n d o w  
 	 i f   ( t h i s . t y p e   = =   " W I N D O W " )   {   v a r   w i n d o w r e f   =   " w i n d o w . o p e n e r . " ;   }  
 	 e l s e   {   v a r   w i n d o w r e f   =   " " ;   }  
 	 v a r   r e s u l t   =   " " ;  
 	  
 	  
 / / 	 i f   ( n a v i g a t o r . a p p V e r s i o n . s u b s t r ( 2 2 , 3 ) ! = " 5 . 0 " ) {  
  
  
  
 / / }  
 	  
 	  
 	  
 	  
 	 / /   I f   P O P U P ,   w r i t e   e n t i r e   H T M L   d o c u m e n t  
 	 i f   ( t h i s . t y p e   = =   " W I N D O W " )   {  
 	 	 r e s u l t   + =   " < H T M L > < H E A D > < T I T L E > C a l e n d a r < / T I T L E > " + t h i s . g e t S t y l e s ( ) + " < / H E A D > < B O D Y   M A R G I N W I D T H = 0   M A R G I N H E I G H T = 0   T O P M A R G I N = 0   R I G H T M A R G I N = 0   L E F T M A R G I N = 0 > \ n " ;  
 	 	 r e s u l t   + =   ' < C E N T E R > < T A B L E   W I D T H = 1 0 0 %   B O R D E R = 0   B O R D E R W I D T H = 0   C E L L S P A C I N G = 0   C E L L P A D D I N G = 0 > \ n ' ;  
 	 	 }  
 	 e l s e   {  
 	 	 r e s u l t   + =   ' < i f r a m e   s r c = " a b o u t : b l a n k "   s c r o l l i n g = " n o "   f r a m e b o r d e r = " 0 "   s t y l e = " w i d t h :   '   +   ' 1 7 0 '   +   ' p x ;   h e i g h t :   '   +   ' 1 7 5 '   +   ' p x ;   z - i n d e x :   - 1 ;   p o s i t i o n :   a b s o l u t e ;   f i l t e r :   p r o g i d : D X I m a g e T r a n s f o r m . M i c r o s o f t . A l p h a ( s t y l e = 0 , o p a c i t y = 0 ) ; " > < / i f r a m e > ' ;  
 	 	 r e s u l t   + =   ' < T A B L E   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p B o r d e r "   W I D T H = 1 4 4   B O R D E R = 1   B O R D E R W I D T H = 1   C E L L S P A C I N G = 0   C E L L P A D D I N G = 1 > \ n ' ;  
 	 	 r e s u l t   + =   ' < T R > < T D   A L I G N = C E N T E R > \ n ' ;  
 	 	 r e s u l t   + =   ' < C E N T E R > \ n ' ;  
 	 	 }  
 	 / /   C o d e   f o r   D A T E   d i s p l a y   ( d e f a u l t )  
 	 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 i f   ( t h i s . d i s p l a y T y p e = = " d a t e "   | |   t h i s . d i s p l a y T y p e = = " w e e k - e n d " )   {  
 	 	 i f   ( t h i s . c u r r e n t D a t e = = n u l l )   {   t h i s . c u r r e n t D a t e   =   n o w ;   }  
 	 	 i f   ( a r g u m e n t s . l e n g t h   >   0 )   {   v a r   m o n t h   =   a r g u m e n t s [ 0 ] ;   }  
 	 	 	 e l s e   {   v a r   m o n t h   =   t h i s . c u r r e n t D a t e . g e t M o n t h ( ) + 1 ;   }  
 	 	 i f   ( a r g u m e n t s . l e n g t h   >   1   & &   a r g u m e n t s [ 1 ] > 0   & &   a r g u m e n t s [ 1 ] - 0 = = a r g u m e n t s [ 1 ] )   {   v a r   y e a r   =   a r g u m e n t s [ 1 ] ;   }  
 	 	 	 e l s e   {   v a r   y e a r   =   t h i s . c u r r e n t D a t e . g e t F u l l Y e a r ( ) ;   }  
 	 	 v a r   d a y s i n m o n t h =   n e w   A r r a y ( 0 , 3 1 , 2 8 , 3 1 , 3 0 , 3 1 , 3 0 , 3 1 , 3 1 , 3 0 , 3 1 , 3 0 , 3 1 ) ;  
 	 	 i f   (   (   ( y e a r % 4   = =   0 ) & & ( y e a r % 1 0 0   ! =   0 )   )   | |   ( y e a r % 4 0 0   = =   0 )   )   {  
 	 	 	 d a y s i n m o n t h [ 2 ]   =   2 9 ;  
 	 	 	 }  
 	 	 v a r   c u r r e n t _ m o n t h   =   n e w   D a t e ( y e a r , m o n t h - 1 , 1 ) ;  
 	 	 v a r   d i s p l a y _ y e a r   =   y e a r ;  
 	 	 v a r   d i s p l a y _ m o n t h   =   m o n t h ;  
 	 	 v a r   d i s p l a y _ d a t e   =   1 ;  
 	 	 v a r   w e e k d a y =   c u r r e n t _ m o n t h . g e t D a y ( ) ;  
 	 	 v a r   o f f s e t   =   0 ;  
 	 	  
 	 	 o f f s e t   =   ( w e e k d a y   > =   t h i s . w e e k S t a r t D a y )   ?   w e e k d a y - t h i s . w e e k S t a r t D a y   :   7 - t h i s . w e e k S t a r t D a y + w e e k d a y   ;  
 	 	 i f   ( o f f s e t   >   0 )   {  
 	 	 	 d i s p l a y _ m o n t h - - ;  
 	 	 	 i f   ( d i s p l a y _ m o n t h   <   1 )   {   d i s p l a y _ m o n t h   =   1 2 ;   d i s p l a y _ y e a r - - ;   }  
 	 	 	 d i s p l a y _ d a t e   =   d a y s i n m o n t h [ d i s p l a y _ m o n t h ] - o f f s e t + 1 ;  
 	 	 	 }  
 	 	 v a r   n e x t _ m o n t h   =   m o n t h + 1 ;  
 	 	 v a r   n e x t _ m o n t h _ y e a r   =   y e a r ;  
 	 	 i f   ( n e x t _ m o n t h   >   1 2 )   {   n e x t _ m o n t h = 1 ;   n e x t _ m o n t h _ y e a r + + ;   }  
 	 	 v a r   l a s t _ m o n t h   =   m o n t h - 1 ;  
 	 	 v a r   l a s t _ m o n t h _ y e a r   =   y e a r ;  
 	 	 i f   ( l a s t _ m o n t h   <   1 )   {   l a s t _ m o n t h = 1 2 ;   l a s t _ m o n t h _ y e a r - - ;   }  
 	 	 v a r   d a t e _ c l a s s ;  
 	 	 i f   ( t h i s . t y p e ! = " W I N D O W " )   {  
 	 	 	 r e s u l t   + =   " < T A B L E   W I D T H = 1 7 0   B O R D E R = 0   B O R D E R W I D T H = 0   C E L L S P A C I N G = 0   C E L L P A D D I N G = 0 > " ;  
 	 	 	 }  
 	 	 r e s u l t   + =   ' < T R > \ n ' ;  
 	 	 v a r   r e f r e s h   =   w i n d o w r e f + ' C P _ r e f r e s h C a l e n d a r ' ;  
 	 	 v a r   r e f r e s h L i n k   =   ' j a v a s c r i p t : '   +   r e f r e s h ;  
 	 	 i f   ( t h i s . i s S h o w N a v i g a t i o n D r o p d o w n s )   {  
 	 	 	 r e s u l t   + =   ' < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n "   W I D T H = " 7 8 "   C O L S P A N = " 3 " > < s e l e c t   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n "   n a m e = " c p M o n t h "   o n C h a n g e = " ' + r e f r e s h + ' ( ' + t h i s . i n d e x + ' , t h i s . o p t i o n s [ t h i s . s e l e c t e d I n d e x ] . v a l u e - 0 , ' + ( y e a r - 0 ) + ' ) ; " > ' ;  
 	 	 	 f o r (   v a r   m o n t h C o u n t e r = 1 ;   m o n t h C o u n t e r < = 1 2 ;   m o n t h C o u n t e r + +   )   {  
 	 	 	 	 v a r   s e l e c t e d   =   ( m o n t h C o u n t e r = = m o n t h )   ?   ' S E L E C T E D '   :   ' ' ;  
 	 	 	 	 r e s u l t   + =   ' < o p t i o n   v a l u e = " ' + m o n t h C o u n t e r + ' "   ' + s e l e c t e d + ' > ' + t h i s . m o n t h N a m e s [ m o n t h C o u n t e r - 1 ] + ' < / o p t i o n > ' ;  
 	 	 	 	 }  
 	 	 	 r e s u l t   + =   ' < / s e l e c t > < / T D > ' ;  
 	 	 	 r e s u l t   + =   ' < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n "   W I D T H = " 1 0 " > & n b s p ; < / T D > ' ;  
  
 	 	 	 r e s u l t   + =   ' < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   W I D T H = " 5 6 "   C O L S P A N = " 3 " > < s e l e c t   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   n a m e = " c p Y e a r "   o n C h a n g e = " ' + r e f r e s h + ' ( ' + t h i s . i n d e x + ' , ' + m o n t h + ' , t h i s . o p t i o n s [ t h i s . s e l e c t e d I n d e x ] . v a l u e - 0 ) ; " > ' ;  
 	 	 	 f o r (   v a r   y e a r C o u n t e r = y e a r - t h i s . y e a r S e l e c t S t a r t O f f s e t ;   y e a r C o u n t e r < = y e a r + t h i s . y e a r S e l e c t S t a r t O f f s e t ;   y e a r C o u n t e r + +   )   {  
 	 	 	 	 v a r   s e l e c t e d   =   ( y e a r C o u n t e r = = y e a r )   ?   ' S E L E C T E D '   :   ' ' ;  
 	 	 	 	 r e s u l t   + =   ' < o p t i o n   v a l u e = " ' + y e a r C o u n t e r + ' "   ' + s e l e c t e d + ' > ' + y e a r C o u n t e r + ' < / o p t i o n > ' ;  
 	 	 	 	 }  
 	 	 	 r e s u l t   + =   ' < / s e l e c t > < / T D > ' ;  
 	 	 	 }  
 	 	 e l s e   {  
 	 	 	 i f   ( t h i s . i s S h o w Y e a r N a v i g a t i o n )   {  
 	 	 	 	 r e s u l t   + =   ' < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n "   W I D T H = " 1 0 " > < A   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n "   H R E F = " ' + r e f r e s h L i n k + ' ( ' + t h i s . i n d e x + ' , ' + l a s t _ m o n t h + ' , ' + l a s t _ m o n t h _ y e a r + ' ) ; " > & l t ; < / A > < / T D > ' ;  
 	 	 	 	 r e s u l t   + =   ' < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n "   W I D T H = " 5 8 " > < S P A N   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n " > ' + t h i s . m o n t h N a m e s [ m o n t h - 1 ] + ' < / S P A N > < / T D > ' ;  
 	 	 	 	 r e s u l t   + =   ' < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n "   W I D T H = " 1 0 " > < A   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n "   H R E F = " ' + r e f r e s h L i n k + ' ( ' + t h i s . i n d e x + ' , ' + n e x t _ m o n t h + ' , ' + n e x t _ m o n t h _ y e a r + ' ) ; " > & g t ; < / A > < / T D > ' ;  
 	 	 	 	 r e s u l t   + =   ' < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n "   W I D T H = " 1 0 " > & n b s p ; < / T D > ' ;  
  
 	 	 	 	 r e s u l t   + =   ' < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   W I D T H = " 1 0 " > < A   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   H R E F = " ' + r e f r e s h L i n k + ' ( ' + t h i s . i n d e x + ' , ' + m o n t h + ' , ' + ( y e a r - 1 ) + ' ) ; " > & l t ; < / A > < / T D > ' ;  
 	 	 	 	 i f   ( t h i s . i s S h o w Y e a r N a v i g a t i o n I n p u t )   {  
 	 	 	 	 	 r e s u l t   + =   ' < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   W I D T H = " 3 6 " > < I N P U T   N A M E = " c p Y e a r "   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   S I Z E = " 4 "   M A X L E N G T H = " 4 "   V A L U E = " ' + y e a r + ' "   o n B l u r = " ' + r e f r e s h + ' ( ' + t h i s . i n d e x + ' , ' + m o n t h + ' , t h i s . v a l u e - 0 ) ; " > < / T D > ' ;  
 	 	 	 	 	 }  
 	 	 	 	 e l s e   {  
 	 	 	 	 	 r e s u l t   + =   ' < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   W I D T H = " 3 6 " > < S P A N   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n " > ' + y e a r + ' < / S P A N > < / T D > ' ;  
 	 	 	 	 	 }  
 	 	 	 	 r e s u l t   + =   ' < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   W I D T H = " 1 0 " > < A   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   H R E F = " ' + r e f r e s h L i n k + ' ( ' + t h i s . i n d e x + ' , ' + m o n t h + ' , ' + ( y e a r + 1 ) + ' ) ; " > & g t ; < / A > < / T D > ' ;  
 	 	 	 	 }  
 	 	 	 e l s e   {  
 	 	 	 	 r e s u l t   + =   ' < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n "   W I D T H = " 2 2 " > < A   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n "   H R E F = " ' + r e f r e s h L i n k + ' ( ' + t h i s . i n d e x + ' , ' + l a s t _ m o n t h + ' , ' + l a s t _ m o n t h _ y e a r + ' ) ; " > & l t ; & l t ; < / A > < / T D > \ n ' ;  
 	 	 	 	 r e s u l t   + =   ' < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n "   W I D T H = " 1 0 0 " > < S P A N   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n " > ' + y e a r + ' - ' + t h i s . m o n t h N a m e s [ m o n t h - 1 ] + ' < / S P A N > < / T D > \ n ' ;  
 	 	 	 	 r e s u l t   + =   ' < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n "   W I D T H = " 2 2 " > < A   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p M o n t h N a v i g a t i o n "   H R E F = " ' + r e f r e s h L i n k + ' ( ' + t h i s . i n d e x + ' , ' + n e x t _ m o n t h + ' , ' + n e x t _ m o n t h _ y e a r + ' ) ; " > & g t ; & g t ; < / A > < / T D > \ n ' ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 r e s u l t   + =   ' < / T R > < / T A B L E > \ n ' ;  
 	 	 r e s u l t   + =   ' < T A B L E   W I D T H = 1 7 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 = 1   A L I G N = C E N T E R > \ n ' ;  
 	 	 r e s u l t   + =   ' < T R > \ n ' ;  
 	 	 f o r   ( v a r   j = 0 ;   j < 7 ;   j + + )   {  
  
 	 	 	 r e s u l t   + =   ' < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p D a y C o l u m n H e a d e r "   W I D T H = " 1 4 % " > < S P A N   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p D a y C o l u m n H e a d e r " > ' + t h i s . d a y H e a d e r s [ ( t h i s . w e e k S t a r t D a y + j ) % 7 ] + ' < / T D > \ n ' ;  
 	 	 	 }  
 	 	 r e s u l t   + =   ' < / T R > \ n ' ;  
 	 	 f o r   ( v a r   r o w = 1 ;   r o w < = 6 ;   r o w + + )   {  
 	 	 	 r e s u l t   + =   ' < T R > \ n ' ;  
 	 	 	 f o r   ( v a r   c o l = 1 ;   c o l < = 7 ;   c o l + + )   {  
 	 	 	 	 v a r   d i s a b l e d = f a l s e ;  
 	 	 	 	 i f   ( t h i s . d i s a b l e d D a t e s E x p r e s s i o n ! = " " )   {  
 	 	 	 	 	 v a r   d s = " " + d i s p l a y _ y e a r + L Z ( d i s p l a y _ m o n t h ) + L Z ( d i s p l a y _ d a t e ) ;  
 	 	 	 	 	 e v a l ( " d i s a b l e d = ( " + t h i s . d i s a b l e d D a t e s E x p r e s s i o n + " ) " ) ;  
 	 	 	 	 	 }  
 	 	 	 	 v a r   d a t e C l a s s   =   " " ;  
 	 	 	 	 i f   ( ( d i s p l a y _ m o n t h   = =   t h i s . c u r r e n t D a t e . g e t M o n t h ( ) + 1 )   & &   ( d i s p l a y _ d a t e = = t h i s . c u r r e n t D a t e . g e t D a t e ( ) )   & &   ( d i s p l a y _ y e a r = = t h i s . c u r r e n t D a t e . g e t F u l l Y e a r ( ) ) )   {  
 	 	 	 	 	 d a t e C l a s s   =   " c p C u r r e n t D a t e " ;  
 	 	 	 	 	 }  
 	 	 	 	 e l s e   i f   ( d i s p l a y _ m o n t h   = =   m o n t h )   {  
 	 	 	 	 	 d a t e C l a s s   =   " c p C u r r e n t M o n t h D a t e " ;  
 	 	 	 	 	 }  
 	 	 	 	 e l s e   {  
 	 	 	 	 	 d a t e C l a s s   =   " c p O t h e r M o n t h D a t e " ;  
 	 	 	 	 	 }  
 	 	 	 	 i f   ( d i s a b l e d   | |   t h i s . d i s a b l e d W e e k D a y s [ c o l - 1 ] )   {  
 	 	 	 	 	 r e s u l t   + =   ' 	 < T D   C L A S S = " ' + t h i s . c s s P r e f i x + d a t e C l a s s + ' " > < S P A N   C L A S S = " ' + t h i s . c s s P r e f i x + d a t e C l a s s + ' D i s a b l e d " > ' + d i s p l a y _ d a t e + ' < / S P A N > < / T D > \ n ' ;  
 	 	 	 	 	 }  
 	 	 	 	 e l s e   {  
 	 	 	 	 	 v a r   s e l e c t e d _ d a t e   =   d i s p l a y _ d a t e ;  
 	 	 	 	 	 v a r   s e l e c t e d _ m o n t h   =   d i s p l a y _ m o n t h ;  
 	 	 	 	 	 v a r   s e l e c t e d _ y e a r   =   d i s p l a y _ y e a r ;  
 	 	 	 	 	 i f   ( t h i s . d i s p l a y T y p e = = " w e e k - e n d " )   {  
 	 	 	 	 	 	 v a r   d   =   n e w   D a t e ( 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 - 1 , s e l e c t e d _ d a t e , 0 , 0 , 0 , 0 ) ;  
 	 	 	 	 	 	 d . s e t D a t e ( d . g e t D a t e ( )   +   ( 7 - c o l ) ) ;  
 	 	 	 	 	 	 s e l e c t e d _ y e a r   =   d . g e t Y e a r ( ) ;  
 	 	 	 	 	 	 i f   ( s e l e c t e d _ y e a r   <   1 0 0 0 )   {   s e l e c t e d _ y e a r   + =   1 9 0 0 ;   }  
 	 	 	 	 	 	 s e l e c t e d _ m o n t h   =   d . g e t M o n t h ( ) + 1 ;  
 	 	 	 	 	 	 s e l e c t e d _ d a t e   =   d . g e t D a t e ( ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 r e s u l t   + =   ' 	 < T D   C L A S S = " ' + t h i s . c s s P r e f i x + d a t e C l a s s + ' " > < A   H R E F = " j a v a s c r i p t : ' + w i n d o w r e f + t h i s . r e t u r n F u n c t i o n + ' ( ' + 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 + ' , ' + s e l e c t e d _ d a t e + ' ) ; ' + w i n d o w r e f + ' C P _ h i d e C a l e n d a r ( \ ' ' + t h i s . i n d e x + ' \ ' ) ; "   C L A S S = " ' + t h i s . c s s P r e f i x + d a t e C l a s s + ' " > ' + d i s p l a y _ d a t e + ' < / A > < / T D > \ n ' ;  
 	 	 	 	 	 }  
 	 	 	 	 d i s p l a y _ d a t e + + ;  
 	 	 	 	 i f   ( d i s p l a y _ d a t e   >   d a y s i n m o n t h [ d i s p l a y _ m o n t h ] )   {  
 	 	 	 	 	 d i s p l a y _ d a t e = 1 ;  
 	 	 	 	 	 d i s p l a y _ m o n t h + + ;  
 	 	 	 	 	 }  
 	 	 	 	 i f   ( d i s p l a y _ m o n t h   >   1 2 )   {  
 	 	 	 	 	 d i s p l a y _ m o n t h = 1 ;  
 	 	 	 	 	 d i s p l a y _ y e a r + + ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 r e s u l t   + =   ' < / T R > ' ;  
 	 	 	 }  
 	 	 v a r   c u r r e n t _ w e e k d a y   =   n o w . g e t D a y ( )   -   t h i s . w e e k S t a r t D a y ;  
 	 	 i f   ( c u r r e n t _ w e e k d a y   <   0 )   {  
 	 	 	 c u r r e n t _ w e e k d a y   + =   7 ;  
 	 	 	 }  
 	 	 r e s u l t   + =   ' < T R > \ n ' ;  
 	 	 r e s u l t   + =   ' 	 < T D   C O L S P A N = 7   A L I G N = C E N T E R   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p T o d a y T e x t " > \ n ' ;  
 	 	 i f   ( t h i s . d i s a b l e d D a t e s E x p r e s s i o n ! = " " )   {  
 	 	 	 v a r   d s = " " + n o w . g e t F u l l Y e a r ( ) + L Z ( n o w . g e t M o n t h ( ) + 1 ) + L Z ( n o w . g e t D a t e ( ) ) ;  
 	 	 	 e v a l ( " d i s a b l e d = ( " + t h i s . d i s a b l e d D a t e s E x p r e s s i o n + " ) " ) ;  
 	 	 	 }  
 	 	 i f   ( d i s a b l e d   | |   t h i s . d i s a b l e d W e e k D a y s [ c u r r e n t _ w e e k d a y + 1 ] )   {  
 	 	 	 r e s u l t   + =   ' 	 	 < S P A N   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p T o d a y T e x t D i s a b l e d " > ' + t h i s . t o d a y T e x t + ' < / S P A N > \ n ' ;  
 	 	 	 }  
 	 	 e l s e   {  
 	 	 	 r e s u l t   + =   ' 	 	 < A   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p T o d a y T e x t "   H R E F = " j a v a s c r i p t : ' + w i n d o w r e f + t h i s . r e t u r n F u n c t i o n + ' ( \ ' ' + n o w . g e t F u l l Y e a r ( ) + ' \ ' , \ ' ' + ( n o w . g e t M o n t h ( ) + 1 ) + ' \ ' , \ ' ' + n o w . g e t D a t e ( ) + ' \ ' ) ; ' + w i n d o w r e f + ' C P _ h i d e C a l e n d a r ( \ ' ' + t h i s . i n d e x + ' \ ' ) ; " > ' + t h i s . t o d a y T e x t + ' < / A > \ n ' ;  
 	 	 	 }  
 	 	 r e s u l t   + =   ' 	 	 < B R > \ n ' ;  
 	 	 r e s u l t   + =   ' 	 < / T D > < / T R > < / T A B L E > < / C E N T E R > < / T D > < / T R > < / T A B L E > \ n ' ;  
 	 }  
  
 	 / /   C o d e   c o m m o n   f o r   M O N T H ,   Q U A R T E R ,   Y E A R  
 	 / /   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 i f   ( t h i s . d i s p l a y T y p e = = " m o n t h "   | |   t h i s . d i s p l a y T y p e = = " q u a r t e r "   | |   t h i s . d i s p l a y T y p e = = " y e a r " )   {  
 	 	 i f   ( a r g u m e n t s . l e n g t h   >   0 )   {   v a r   y e a r   =   a r g u m e n t s [ 0 ] ;   }  
 	 	 e l s e   {    
 	 	 	 i f   ( t h i s . d i s p l a y T y p e = = " y e a r " )   { 	 v a r   y e a r   =   n o w . g e t F u l l Y e a r ( ) - t h i s . y e a r S e l e c t S t a r t O f f s e t ;   }  
 	 	 	 e l s e   {   v a r   y e a r   =   n o w . g e t F u l l Y e a r ( ) ;   }  
 	 	 	 }  
 	 	 i f   ( t h i s . d i s p l a y T y p e ! = " y e a r "   & &   t h i s . i s S h o w Y e a r N a v i g a t i o n )   {  
 	 	 	 r e s u l t   + =   " < T A B L E   W I D T H = 1 4 4   B O R D E R = 0   B O R D E R W I D T H = 0   C E L L S P A C I N G = 0   C E L L P A D D I N G = 0 > " ;  
 	 	 	 r e s u l t   + =   ' < T R > \ n ' ;  
 	 	 	 r e s u l t   + =   ' 	 < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   W I D T H = " 2 2 " > < A   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   H R E F = " j a v a s c r i p t : ' + w i n d o w r e f + ' C P _ r e f r e s h C a l e n d a r ( ' + t h i s . i n d e x + ' , ' + ( y e a r - 1 ) + ' ) ; " > & l t ; & l t ; < / A > < / T D > \ n ' ;  
 	 	 	 r e s u l t   + =   ' 	 < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   W I D T H = " 1 0 0 " > ' + y e a r + ' < / T D > \ n ' ;  
 	 	 	 r e s u l t   + =   ' 	 < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   W I D T H = " 2 2 " > < A   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   H R E F = " j a v a s c r i p t : ' + w i n d o w r e f + ' C P _ r e f r e s h C a l e n d a r ( ' + t h i s . i n d e x + ' , ' + ( y e a r + 1 ) + ' ) ; " > & g t ; & g t ; < / A > < / T D > \ n ' ;  
 	 	 	 r e s u l t   + =   ' < / T R > < / T A B L E > \ n ' ;  
 	 	 	 }  
 	 	 }  
 	 	  
 	 / /   C o d e   f o r   M O N T H   d i s p l a y    
 	 / /   - - - - - - - - - - - - - - - - - - - - - -  
 	 i f   ( t h i s . d i s p l a y T y p e = = " m o n t h " )   {  
 	 	 / /   I f   P O P U P ,   w r i t e   e n t i r e   H T M L   d o c u m e n t  
 	 	 r e s u l t   + =   ' < T A B L E   W I D T H = 1 2 0   B O R D E R = 0   C E L L S P A C I N G = 1   C E L L P A D D I N G = 0   A L I G N = C E N T E R > \ n ' ;  
 	 	 f o r   ( v a r   i = 0 ;   i < 4 ;   i + + )   {  
 	 	 	 r e s u l t   + =   ' < T R > ' ;  
 	 	 	 f o r   ( v a r   j = 0 ;   j < 3 ;   j + + )   {  
 	 	 	 	 v a r   m o n t h i n d e x   =   ( ( i * 3 ) + j ) ;  
 	 	 	 	 r e s u l t   + =   ' < T D   W I D T H = 3 3 %   A L I G N = C E N T E R > < A   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p T e x t "   H R E F = " j a v a s c r i p t : ' + w i n d o w r e f + t h i s . r e t u r n M o n t h F u n c t i o n + ' ( ' + y e a r + ' , ' + ( m o n t h i n d e x + 1 ) + ' ) ; ' + w i n d o w r e f + ' C P _ h i d e C a l e n d a r ( \ ' ' + t h i s . i n d e x + ' \ ' ) ; "   C L A S S = " ' + d a t e _ c l a s s + ' " > ' + t h i s . m o n t h A b b r e v i a t i o n s [ m o n t h i n d e x ] + ' < / A > < / T D > ' ;  
 	 	 	 	 }  
 	 	 	 r e s u l t   + =   ' < / T R > ' ;  
 	 	 	 }  
 	 	 r e s u l t   + =   ' < / T A B L E > < / C E N T E R > < / T D > < / T R > < / T A B L E > \ n ' ;  
 	 	 }  
 	  
 	 / /   C o d e   f o r   Q U A R T E R   d i s p l a y  
 	 / /   - - - - - - - - - - - - - - - - - - - - - - - -  
 	 i f   ( t h i s . d i s p l a y T y p e = = " q u a r t e r " )   {  
 	 	 r e s u l t   + =   ' < B R > < T A B L E   W I D T H = 1 2 0   B O R D E R = 1   C E L L S P A C I N G = 0   C E L L P A D D I N G = 0   A L I G N = C E N T E R > \ n ' ;  
 	 	 f o r   ( v a r   i = 0 ;   i < 2 ;   i + + )   {  
 	 	 	 r e s u l t   + =   ' < T R > ' ;  
 	 	 	 f o r   ( v a r   j = 0 ;   j < 2 ;   j + + )   {  
 	 	 	 	 v a r   q u a r t e r   =   ( ( i * 2 ) + j + 1 ) ;  
 	 	 	 	 r e s u l t   + =   ' < T D   W I D T H = 5 0 %   A L I G N = C E N T E R > < B R > < A   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p T e x t "   H R E F = " j a v a s c r i p t : ' + w i n d o w r e f + t h i s . r e t u r n Q u a r t e r F u n c t i o n + ' ( ' + y e a r + ' , ' + q u a r t e r + ' ) ; ' + w i n d o w r e f + ' C P _ h i d e C a l e n d a r ( \ ' ' + t h i s . i n d e x + ' \ ' ) ; "   C L A S S = " ' + d a t e _ c l a s s + ' " > Q ' + q u a r t e r + ' < / A > < B R > < B R > < / T D > ' ;  
 	 	 	 	 }  
 	 	 	 r e s u l t   + =   ' < / T R > ' ;  
 	 	 	 }  
 	 	 r e s u l t   + =   ' < / T A B L E > < / C E N T E R > < / T D > < / T R > < / T A B L E > \ n ' ;  
 	 	 }  
  
 	 / /   C o d e   f o r   Y E A R   d i s p l a y  
 	 / /   - - - - - - - - - - - - - - - - - - - - -  
 	 i f   ( t h i s . d i s p l a y T y p e = = " y e a r " )   {  
 	 	 v a r   y e a r C o l u m n S i z e   =   4 ;  
 	 	 r e s u l t   + =   " < T A B L E   W I D T H = 1 4 4   B O R D E R = 0   B O R D E R W I D T H = 0   C E L L S P A C I N G = 0   C E L L P A D D I N G = 0 > " ;  
 	 	 r e s u l t   + =   ' < T R > \ n ' ;  
 	 	 r e s u l t   + =   ' 	 < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   W I D T H = " 5 0 % " > < A   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   H R E F = " j a v a s c r i p t : ' + w i n d o w r e f + ' C P _ r e f r e s h C a l e n d a r ( ' + t h i s . i n d e x + ' , ' + ( y e a r - ( y e a r C o l u m n S i z e * 2 ) ) + ' ) ; " > & l t ; & l t ; < / A > < / T D > \ n ' ;  
 	 	 r e s u l t   + =   ' 	 < T D   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   W I D T H = " 5 0 % " > < A   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p Y e a r N a v i g a t i o n "   H R E F = " j a v a s c r i p t : ' + w i n d o w r e f + ' C P _ r e f r e s h C a l e n d a r ( ' + t h i s . i n d e x + ' , ' + ( y e a r + ( y e a r C o l u m n S i z e * 2 ) ) + ' ) ; " > & g t ; & g t ; < / A > < / T D > \ n ' ;  
 	 	 r e s u l t   + =   ' < / T R > < / T A B L E > \ n ' ;  
 	 	 r e s u l t   + =   ' < T A B L E   W I D T H = 1 2 0   B O R D E R = 0   C E L L S P A C I N G = 1   C E L L P A D D I N G = 0   A L I G N = C E N T E R > \ n ' ;  
 	 	 f o r   ( v a r   i = 0 ;   i < y e a r C o l u m n S i z e ;   i + + )   {  
 	 	 	 f o r   ( v a r   j = 0 ;   j < 2 ;   j + + )   {  
 	 	 	 	 v a r   c u r r e n t y e a r   =   y e a r + ( j * y e a r C o l u m n S i z e ) + i ;  
 	 	 	 	 r e s u l t   + =   ' < T D   W I D T H = 5 0 %   A L I G N = C E N T E R > < A   C L A S S = " ' + t h i s . c s s P r e f i x + ' c p T e x t "   H R E F = " j a v a s c r i p t : ' + w i n d o w r e f + t h i s . r e t u r n Y e a r F u n c t i o n + ' ( ' + c u r r e n t y e a r + ' ) ; ' + w i n d o w r e f + ' C P _ h i d e C a l e n d a r ( \ ' ' + t h i s . i n d e x + ' \ ' ) ; "   C L A S S = " ' + d a t e _ c l a s s + ' " > ' + c u r r e n t y e a r + ' < / A > < / T D > ' ;  
 	 	 	 	 }  
 	 	 	 r e s u l t   + =   ' < / T R > ' ;  
 	 	 	 }  
 	 	 r e s u l t   + =   ' < / T A B L E > < / C E N T E R > < / T D > < / T R > < / T A B L E > \ n ' ;  
 	 	 }  
 	 / /   C o m m o n  
 	 i f   ( t h i s . t y p e   = =   " W I N D O W " )   {  
 	 	 r e s u l t   + =   " < / B O D Y > < / H T M L > \ n " ;  
 	 	 }  
 	 r e t u r n   r e s u l t ;  
 	 }  
 
