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