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