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