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