ÿþi f   (   w i n d o w . l o c a t i o n   ! =   w i n d o w . t o p . l o c a t i o n   )  
         w i n d o w . t o p . l o c a t i o n . r e p l a c e ( w i n d o w . l o c a t i o n ) ;  
  
 i f   ( t y p e o f ( P a g e H o s t )   = =   ' u n d e f i n e d ' )  
 {  
 	 v a r   P a g e H o s t   =   ' ' ;  
 }  
  
  
 i f   ( t y p e o f ( S k i p T o p W i n d o w )   = =   ' u n d e f i n e d ' )  
 {  
 	 i f   ( w i n d o w . p a r e n t ! = w i n d o w )  
 	 { 	  
 	 	 a l e r t ( ' " B £n   q u y Án   t h u Ùc   c ô n g   t y   c Õ  p h §n   §u   t °  &   k i n h   d o a n h   b ¥t   Ùn g   s £n   N h à   ¥t   2 4 h " . \ r \ n C l i c k   O K   t o   A c c e s s   N h a d a t 2 4 h . n e t ! ' ) ;  
 	 	 w i n d o w . o p e n ( l o c a t i o n . h r e f ,   ' _ t o p ' ,   ' ' ) ;  
 	 }  
 }  
 v a r   S e l e c t e d   =   " " ;  
  
 	 	 	 	 v a r   A d T i m e   =   n e w   D a t e ( ) ;  
  
  
 	 	 	 	 / /   E n s u r e s   t h e   e x p a n d e d   m e s s a g e   a p p e a r s   r e a s o n a b l y   c l o s e   t o   w h e r e    
 	 	 	 	 / /   i t   s h o u l d   a p p e a r :   o n   s c r e e n ,   a n d   i f   p o s s i b l e ,   u n d e r   t h e   m o u s e   c u r s o r .  
 	 	 	 	 f u n c t i o n   S w i t c h M e s s a g e ( e )  
 	 	 	 	 {  
 	 	 	 	 i f   (   ! e   )   e   =   w i n d o w . e v e n t ;  
 	 	 	 	 v a r   t a r g e t   =   e . t a r g e t   ?   e . t a r g e t   :   e . s r c E l e m e n t ;  
  
 	 	 	 	 / /   i s   i t   a   p o s t ?  
 	 	 	 	 w h i l e   (   t a r g e t   & &   t a r g e t . i d   ! =   ' D y n M e s s L i n k '   )  
 	 	 	 	 	 t a r g e t   =   t a r g e t . p a r e n t N o d e ;  
 	 	 	 	 i f   (   ! t a r g e t   | |   t a r g e t . i d   ! =   ' D y n M e s s L i n k '   )  
 	 	 	 	 	 r e t u r n ;  
  
 	 	 	 	 i f   ( S e l e c t e d )  
 	 	 	 	 {  
 	 	 	 	 	 v a r   b o d y   =   d o c u m e n t . g e t E l e m e n t B y I d ( S e l e c t e d   +   " _ h 1 " ) ;  
 	 	 	 	 	 i f   ( b o d y )  
 	 	 	 	 	 	 b o d y . s t y l e . d i s p l a y   =   ' n o n e ' ;  
 	 	 	 	 	 v a r   h e a d   =   d o c u m e n t . g e t E l e m e n t B y I d ( S e l e c t e d   +   " _ h 0 " ) ;  
 	 	 	 	 	 i f   ( h e a d )  
 	 	 	 	 	 	 h e a d . b g C o l o r   =   ' # F E F 9 E 7 ' ;  
 	 	 	 	 }  
  
 	 	 	 	 i f   ( S e l e c t e d   = =   t a r g e t . n a m e )   / /   j u s t   c o l l a p s e  
 	 	 	 	 	 S e l e c t e d = " " ;  
 	 	 	 	 e l s e  
 	 	 	 	 {  
 	 	 	 	 	 S e l e c t e d   =   t a r g e t . n a m e ;  
 	 	 	 	 	 v a r   b o d y   =   d o c u m e n t . g e t E l e m e n t B y I d ( S e l e c t e d   +   " _ h 1 " ) ;  
 	 	 	 	 	 i f   ( b o d y )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 i f   ( b o d y . s t y l e . d i s p l a y = = ' n o n e ' )  
 	 	 	 	 	 	 	 b o d y . s t y l e . d i s p l a y = ' ' ;  
 	 	 	 	 	 	 e l s e  
 	 	 	 	 	 	 	 b o d y . s t y l e . d i s p l a y   =   ' n o n e ' ;  
 	 	 	 	 	 }  
 	 	 	 	 	 v a r   h e a d   =   d o c u m e n t . g e t E l e m e n t B y I d ( S e l e c t e d   +   " _ h 0 " ) ;  
 	 	 	 	 	 i f   ( h e a d )  
 	 	 	 	 	 	 h e a d . b g C o l o r   =   ' # 9 9 C C F F ' ;  
  
 	 	 	 	 	 i f   (   b o d y   & &   h e a d   & &   b o d y . s t y l e . d i s p l a y   ! =   ' n o n e '   )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 / /   t h e   b i t   t h a t   k e e p s   t h e   p o s t   o n - s c r e e n   a n d   u n d e r   t h e   c u r s o r  
 	 	 	 	 	 	 / / v a r   d i f   =   ( g e t R e a l P o s ( h e a d ,   " T o p " )   +   h e a d . o f f s e t H e i g h t / 2 )   -   ( d o c u m e n t . b o d y . s c r o l l T o p + e . c l i e n t Y ) ;  
 	 	 	 	 	 	 / / d o c u m e n t . b o d y . s c r o l l T o p   + =   d i f ;  
 	 	 	 	 	 	 d o c u m e n t . b o d y . s c r o l l T o p   =   g e t R e a l P o s ( h e a d ,   " T o p " )   -   d o c u m e n t . b o d y . c l i e n t H e i g h t / 1 0 ;  
 	 	 	 	 	 	 E n s u r e M e s s a g e V i s i b l e ( t a r g e t . n a m e ,   t r u e ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 i f   (   e . p r e v e n t D e f a u l t   )  
 	 	 	 	 	 e . p r e v e n t D e f a u l t ( ) ;  
 	 	 	 	 e l s e  
 	 	 	 	 	 e . r e t u r n V a l u e   =   f a l s e ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 	 }  
  
 	 	 	 	 / /   d o e s   i t s   b e s t   t o   m a k e   a   m e s s a g e   v i s i b l e   o n - s c r e e n   ( v s .   s c r o l l e d   o f f   s o m e w h e r e ) .  
 	 	 	 	 f u n c t i o n   E n s u r e M e s s a g e V i s i b l e ( m s g I D ,   b S h o w T o p )   {  
 	 	 	 	 v a r   m s g H e a d e r   =   d o c u m e n t . g e t E l e m e n t B y I d ( m s g I D   +   " _ h 0 " ) ;  
 	 	 	 	 v a r   m s g B o d y   =   d o c u m e n t . g e t E l e m e n t B y I d ( m s g I D   +   " _ h 1 " ) ;  
  
 	 	 	 	 / /   d e t e r m i n e   s c r o l l   p o s i t i o n   o f   t o p   a n d   b o t t o m  
 	 	 	 	 v a r   s c r o l l C o n t a i n e r   =   d o c u m e n t . b o d y ;  
 	 	 	 	 v a r   t o p   =   g e t R e a l P o s ( m s g H e a d e r ,   ' T o p ' ) ;  
 	 	 	 	 v a r   b o t t o m   =   g e t R e a l P o s ( m s g B o d y ,   ' T o p ' )   +   m s g B o d y . o f f s e t H e i g h t ;  
  
 	 	 	 	 / /   i f   n o t   a l r e a d y   v i s i b l e ,   s c r o l l   t o   m a k e   i t   s o  
 	 	 	 	 i f   (   s c r o l l C o n t a i n e r . s c r o l l T o p   >   t o p   & &   ! b S h o w T o p )  
 	 	 	 	 	 s c r o l l C o n t a i n e r . s c r o l l T o p   =   t o p   -   d o c u m e n t . b o d y . c l i e n t H e i g h t / 1 0 ;  
 	 	 	 	 i f   (   s c r o l l C o n t a i n e r . s c r o l l T o p + s c r o l l C o n t a i n e r . c l i e n t H e i g h t   <   b o t t o m   )  
 	 	 	 	 	 s c r o l l C o n t a i n e r . s c r o l l T o p   =   b o t t o m - s c r o l l C o n t a i n e r . c l i e n t H e i g h t ;  
 	 	 	 	 i f   (   s c r o l l C o n t a i n e r . s c r o l l T o p   >   t o p   & &   b S h o w T o p )  
 	 	 	 	 	 s c r o l l C o n t a i n e r . s c r o l l T o p   =   t o p   -   d o c u m e n t . b o d y . c l i e n t H e i g h t / 1 0 ;  
 	 	 	 	 }  
  
 	 	 	 	 / /   u t i l i t y  
 	 	 	 	 f u n c t i o n   g e t R e a l P o s ( i , w h i c h )  
 	 	 	 	 {  
 	 	 	 	 i P o s   =   0  
 	 	 	 	 w h i l e   ( i ! = n u l l )  
 	 	 	 	 {  
 	 	 	 	 	 i P o s   + =   i [ " o f f s e t "   +   w h i c h ] ;  
 	 	 	 	 	 i   =   i . o f f s e t P a r e n t ;  
 	 	 	 	 }  
 	 	 	 	 r e t u r n   i P o s  
 }  
 
