ÿþ/ /   c u s t o m   p e n a k i  
 / /   n e w   d e s i g n  
 v a r   v s p i r i t s _ c h a t _ c l i e n t   =   " p e n a k i - n e w d e s i g n - " ;  
  
 / * *  
 *   C O M M O N   D H T M L   F U N C T I O N S  
 *   T h e s e   a r e   h a n d y   f u n c t i o n s   I   u s e   a l l   t h e   t i m e .  
 *  
 *   B y   S e t h   B a n k s   ( w e b m a s t e r   a t   s u b i m a g e   d o t   c o m )  
 *   h t t p : / / w w w . s u b i m a g e . c o m /  
 *  
 *   U p   t o   d a t e   c o d e   c a n   b e   f o u n d   a t   h t t p : / / w w w . s u b i m a g e . c o m / d h t m l /  
 *  
 *   T h i s   c o d e   i s   f r e e   f o r   y o u   t o   u s e   a n y w h e r e ,   j u s t   k e e p   t h i s   c o m m e n t   b l o c k .  
 * /  
  
 / * *  
 *   X - b r o w s e r   e v e n t   h a n d l e r   a t t a c h m e n t   a n d   d e t a c h m e n t  
 *   T H :   S w i t c h e d   f i r s t   t r u e   t o   f a l s e   p e r   h t t p : / / w w w . o n l i n e t o o l s . o r g / a r t i c l e s / u n o b t r u s i v e j a v a s c r i p t / c h a p t e r 4 . h t m l  
 *  
 *   @ a r g u m e n t   o b j   -   t h e   o b j e c t   t o   a t t a c h   e v e n t   t o  
 *   @ a r g u m e n t   e v T y p e   -   n a m e   o f   t h e   e v e n t   -   D O N T   A D D   " o n " ,   p a s s   o n l y   " m o u s e o v e r " ,   e t c  
 *   @ a r g u m e n t   f n   -   f u n c t i o n   t o   c a l l  
 * /  
 f u n c t i o n   a d d E v e n t ( o b j ,   e v T y p e ,   f n )   {  
         i f   ( o b j . a d d E v e n t L i s t e n e r )   {  
                 o b j . a d d E v e n t L i s t e n e r ( e v T y p e ,   f n ,   f a l s e ) ;  
                 r e t u r n   t r u e ;  
         }   e l s e   i f   ( o b j . a t t a c h E v e n t )   {  
                 v a r   r   =   o b j . a t t a c h E v e n t ( " o n "   +   e v T y p e ,   f n ) ;  
                 r e t u r n   r ;  
         }   e l s e   {  
                 r e t u r n   f a l s e ;  
         }  
 }  
  
 / / f u n c t i o n   r e m o v e E v e n t ( o b j ,   e v T y p e ,   f n ,   u s e C a p t u r e ) {  
 / /     i f   ( o b j . r e m o v e E v e n t L i s t e n e r ) {  
 / /         o b j . r e m o v e E v e n t L i s t e n e r ( e v T y p e ,   f n ,   u s e C a p t u r e ) ;  
 / /         r e t u r n   t r u e ;  
 / /     }   e l s e   i f   ( o b j . d e t a c h E v e n t ) {  
 / /         v a r   r   =   o b j . d e t a c h E v e n t ( " o n " + e v T y p e ,   f n ) ;  
 / /         r e t u r n   r ;  
 / /     }   e l s e   {  
 / /         a l e r t ( " H a n d l e r   c o u l d   n o t   b e   r e m o v e d " ) ;  
 / /     }  
 / / }  
  
 / * *  
 *   C o d e   b e l o w   t a k e n   f r o m   -   h t t p : / / w w w . e v o l t . o r g / a r t i c l e / d o c u m e n t _ b o d y _ d o c t y p e _ s w i t c h i n g _ a n d _ m o r e / 1 7 / 3 0 6 5 5 /  
 *  
 *   M o d i f i e d   4 / 2 2 / 0 4   t o   w o r k   w i t h   O p e r a / M o z   ( b y   w e b m a s t e r   a t   s u b i m a g e   d o t   c o m )  
 *  
 *   G e t s   t h e   f u l l   w i d t h / h e i g h t   b e c a u s e   i t ' s   d i f f e r e n t   f o r   m o s t   b r o w s e r s .  
 * /  
 f u n c t i o n   g e t V i e w p o r t H e i g h t ( )   {  
         i f   ( w i n d o w . i n n e r H e i g h t   ! =   w i n d o w . u n d e f i n e d )   r e t u r n   w i n d o w . i n n e r H e i g h t ;  
         i f   ( d o c u m e n t . c o m p a t M o d e   = =   ' C S S 1 C o m p a t ' )   r e t u r n   d o c u m e n t . d o c u m e n t E l e m e n t . c l i e n t H e i g h t ;  
         i f   ( d o c u m e n t . b o d y )   r e t u r n   d o c u m e n t . b o d y . c l i e n t H e i g h t ;  
  
         r e t u r n   w i n d o w . u n d e f i n e d ;  
 }  
 f u n c t i o n   g e t V i e w p o r t W i d t h ( )   {  
         v a r   o f f s e t   =   1 7 ;  
         v a r   w i d t h   =   n u l l ;  
         i f   ( w i n d o w . i n n e r W i d t h   ! =   w i n d o w . u n d e f i n e d )   r e t u r n   w i n d o w . i n n e r W i d t h ;  
         i f   ( d o c u m e n t . c o m p a t M o d e   = =   ' C S S 1 C o m p a t ' )   r e t u r n   d o c u m e n t . d o c u m e n t E l e m e n t . c l i e n t W i d t h ;  
         i f   ( d o c u m e n t . b o d y )   r e t u r n   d o c u m e n t . b o d y . c l i e n t W i d t h ;  
 }  
  
 / * *  
 *   G e t s   t h e   r e a l   s c r o l l   t o p  
 * /  
 f u n c t i o n   g e t S c r o l l T o p ( )   {  
         i f   ( s e l f . p a g e Y O f f s e t )   / /   a l l   e x c e p t   E x p l o r e r  
         {  
                 r e t u r n   s e l f . p a g e Y O f f s e t ;  
         }  
         e l s e   i f   ( d o c u m e n t . d o c u m e n t E l e m e n t   & &   d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l T o p )  
         / /   E x p l o r e r   6   S t r i c t  
         {  
                 r e t u r n   d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l T o p ;  
         }  
         e l s e   i f   ( d o c u m e n t . b o d y )   / /   a l l   o t h e r   E x p l o r e r s  
         {  
                 r e t u r n   d o c u m e n t . b o d y . s c r o l l T o p ;  
         }  
 }  
 f u n c t i o n   g e t S c r o l l L e f t ( )   {  
         i f   ( s e l f . p a g e X O f f s e t )   / /   a l l   e x c e p t   E x p l o r e r  
         {  
                 r e t u r n   s e l f . p a g e X O f f s e t ;  
         }  
         e l s e   i f   ( d o c u m e n t . d o c u m e n t E l e m e n t   & &   d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l L e f t )  
         / /   E x p l o r e r   6   S t r i c t  
         {  
                 r e t u r n   d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l L e f t ;  
         }  
         e l s e   i f   ( d o c u m e n t . b o d y )   / /   a l l   o t h e r   E x p l o r e r s  
         {  
                 r e t u r n   d o c u m e n t . b o d y . s c r o l l L e f t ;  
         }  
 }  
  
 / * *  
 *   S U B M O D A L   v 1 . 6  
 *   U s e d   f o r   d i s p l a y i n g   D H T M L   o n l y   p o p u p s   i n s t e a d   o f   u s i n g   b u g g y   m o d a l   w i n d o w s .  
 *  
 *   B y   S u b i m a g e   L L C  
 *   h t t p : / / w w w . s u b i m a g e . c o m  
 *  
 *   C o n t r i b u t i o n s   b y :  
 *   	 E r i c   A n g e l   -   t a b   i n d e x   c o d e  
 *   	 S c o t t   -   h i d i n g / s h o w i n g   s e l e c t s   f o r   I E   u s e r s  
 * 	 T o d d   H u s s   -   i n s e r t i n g   m o d a l   d y n a m i c a l l y   a n d   a n c h o r   c l a s s e s  
 *  
 *   U p   t o   d a t e   c o d e   c a n   b e   f o u n d   a t   h t t p : / / s u b m o d a l . g o o g l e c o d e . c o m  
 * /  
  
 / /   P o p u p   c o d e  
 v a r   g P o p u p M a s k   =   n u l l ;  
 v a r   g P o p u p C o n t a i n e r   =   n u l l ;  
 v a r   g R e t u r n F u n c ;  
 v a r   g P o p u p I s S h o w n   =   f a l s e ;  
 v a r   g D e f a u l t P a g e   =   " / l o a d i n g . h t m l " ;  
 v a r   g H i d e S e l e c t s   =   f a l s e ;  
 v a r   g R e t u r n V a l   =   n u l l ;  
  
 v a r   g T a b I n d e x e s   =   n e w   A r r a y ( ) ;  
 / /   P r e - d e f i n e d   l i s t   o f   t a g s   w e   w a n t   t o   d i s a b l e / e n a b l e   t a b b i n g   i n t o  
 v a r   g T a b b a b l e T a g s   =   n e w   A r r a y ( " A " ,   " B U T T O N " ,   " T E X T A R E A " ,   " I N P U T " ,   " I F R A M E " ) ;  
  
 / /   I f   u s i n g   M o z i l l a   o r   F i r e f o x ,   u s e   T a b - k e y   t r a p .  
 i f   ( ! d o c u m e n t . a l l )   {  
         d o c u m e n t . o n k e y p r e s s   =   k e y D o w n H a n d l e r ;  
 }  
  
  
  
  
 / *   v i r t u a l   s p i r i t s   * /  
 v a r   a g e n t s t a t u s ;  
 v a r   a c t i v e p a g e   =   f a l s e ;  
 v a r   a c t i v e e x i t   =   f a l s e ;  
 v a r   a c t i v e t i m e r   =   f a l s e ;  
 v a r   a c t i v e b u t t o n   =   f a l s e ;  
 v a r   p r o a c t i v e M i n T i m e r   =   4 0 0 0 0 ;   / / c u s t o m   p e n a k i  
 v a r   e x i t M i n T i m e r   =   5 0 0 0 ;   / / c u s t o m   p e n a k i  
 v a r   t i t l e _ p a r a m ;  
 v a r   r e f e r r e r _ p a r a m ;  
 v a r   u r l _ p a r a m ;  
 v a r   t i m e I n t e r v a l ;  
 v a r   l o a d T i m e   =   n e w   D a t e ( ) ;  
 v a r   i n i t T i m e ;  
 v a r   e x i t T i m e ;  
 v a r   c h a t T i m e ;  
 v a r   c l o s e T i m e ;  
 v a r   p o s X   =   0 ;  
 v a r   p o s Y   =   2 0 0 ;  
 v a r   b r o w s e r ;  
 v a r   c o m b i i m a g e   =   " h t t p : / / w w w . v i r t u a l s p i r i t s . c o m / v s a / i m a g e s / c h a t - c o m b i - b l u e g r a y - e x p . p n g " ;   / /   p e n a k i  
  
 f u n c t i o n   i n i t A g e n t ( )   {  
  
         v a r   x   =   r e a d C o o k i e ( ' v s p i r i t s _ s t a t u s ' ) ;  
         i f   ( x )   {  
                 / /   a   c o o k i e   i s   w r i t t e n   i f   t h e   u s e r   h a s   b e e n   h a n d l e d  
                 / /   t h e   c o o k i e   i s   r e m o v e d   i f   t h e   u s e r   h a s   c l o s e d   t h e   c h a t   s c r e e n   a n d   i s   p e n d i n g  
                 a g e n t s t a t u s   =   x ;  
         }   e l s e   {  
                 a g e n t s t a t u s   =   " e m p t y " ;  
         }  
  
         i f   ( a g e n t s t a t u s   = =   " - 1 " )   {  
                 a g e n t s t a t u s   =   " e m p t y " ;  
         }  
  
         g e t c h a t p a r a m ( ) ;  
         v a r   t e m p r e f   =   g e t d o m a i n ( r e f e r r e r _ p a r a m ) ;  
         v a r   t e m p u r l   =   g e t d o m a i n ( u r l _ p a r a m ) ;  
  
         i f   ( a g e n t s t a t u s   = =   " e m p t y " )   {  
                 i f   ( t e m p r e f   = =   " " )   {  
                         c r e a t e C o o k i e ( " v s p i r i t s _ s t a t u s " ,   " p r o s p e c t " ,   1 ) ;   / /   w r i t e   t h e   c o o k i e  
                         a g e n t s t a t u s   =   " p r o s p e c t " ;  
                 }   e l s e   {  
                         i f   ( t e m p u r l   = =   t e m p r e f )   {  
                                 c r e a t e C o o k i e ( " v s p i r i t s _ s t a t u s " ,   " p r o s p e c t " ,   1 ) ;   / /   w r i t e   t h e   c o o k i e  
                                 a g e n t s t a t u s   =   " p r o s p e c t " ;  
                         }   e l s e   {  
                                 c r e a t e C o o k i e ( " v s p i r i t s _ s t a t u s " ,   " p r o s p e c t " ,   1 ) ;   / /   w r i t e   t h e   c o o k i e  
                                 a g e n t s t a t u s   =   " p r o s p e c t " ;  
                         }  
                 }  
         }  
  
  
  
  
         i f   ( a g e n t s t a t u s   = =   " e m p t y " )   {  
                 / /   s p e c i a l   d e m o   p a g e s  
                 i f   ( t e m p u r l . i n d e x O f ( " v i r t u a l s p i r i t s . c o m " )   ! =   - 1 )   {  
                         a g e n t s t a t u s   =   " p r o s p e c t " ;  
                         a c t i v e p a g e   =   t r u e ;  
                 }  
                 i f   ( t e m p u r l . i n d e x O f ( " l o c a l h o s t " )   ! =   - 1 )   {  
                         a g e n t s t a t u s   =   " p r o s p e c t " ;  
                         a c t i v e p a g e   =   t r u e ;  
                 }  
         }  
  
         f i l t e r p a g e s ( ) ;  
         s e t a c t i v e ( ) ;  
  
         i f   ( a c t i v e e x i t   | |   a c t i v e t i m e r   | |   a c t i v e b u t t o n )   {  
                 i n i t P o p u p ( ) ;  
                 / /   a b s o l u t e   t i m e r  
                 i n i t T i m e   =   n e w   D a t e ( ) ;  
                 t i m e I n t e r v a l   =   i n i t T i m e   -   l o a d T i m e ;   / /   t h e   t i m e   s i n c e   s t a r t   l o a d i n g   t i l l   t i m e r   i s   s t a r t e d  
                 i f   ( t i m e I n t e r v a l   >   p r o a c t i v e M i n T i m e r )   {   p r o a c t i v e M i n T i m e r   =   1 0 0 ;   }  
                 e l s e   {   p r o a c t i v e M i n T i m e r   =   p r o a c t i v e M i n T i m e r   -   t i m e I n t e r v a l ;   }  
                 i f   ( a c t i v e e x i t )   {   i n i t E x i t ( ) ;   }  
                 i f   ( a c t i v e b u t t o n )   {   s h o w B u t t o n ( ) ;   }  
                 i f   ( a c t i v e t i m e r )   {   s e t T i m e o u t ( ' p r o a c t i v e c h a t ( ) ' ,   p r o a c t i v e M i n T i m e r ) ;   }  
         }  
 }  
  
 f u n c t i o n   s e t a c t i v e ( )   {  
         i f   ( a c t i v e p a g e )   {  
                 i f   ( a g e n t s t a t u s   = =   " p r o s p e c t " )   {  
                         a c t i v e e x i t   =   t r u e ;   / /   c u s t o m   p e n a k i  
                         a c t i v e t i m e r   =   t r u e ;  
                         a c t i v e b u t t o n   =   t r u e ;   / /   c u s t o m   p e n a k i  
                 }  
                 i f   ( a g e n t s t a t u s   = =   " p e n d i n g " )   {  
                         a c t i v e e x i t   =   f a l s e ;  
                         a c t i v e t i m e r   =   f a l s e ;  
                         a c t i v e b u t t o n   =   t r u e ;  
                 }  
                 i f   ( a g e n t s t a t u s   = =   " i n p r o c e s s " )   {  
                         a c t i v e e x i t   =   f a l s e ;   / /   n e w   d e s i g n   f o r   n e x t   p a g e  
                         a c t i v e t i m e r   =   t r u e ;   / /   n e w   d e s i g n   f o r   n e x t   p a g e  
                         a c t i v e b u t t o n   =   t r u e ;  
                 }  
                 i f   ( a g e n t s t a t u s   = =   " h a n d l e d " )   {  
                         a c t i v e e x i t   =   f a l s e ;  
                         a c t i v e t i m e r   =   f a l s e ;  
                         a c t i v e b u t t o n   =   t r u e ;  
                 }  
                 i f   ( a g e n t s t a t u s   = =   " c l o s e d " )   {  
                         a c t i v e e x i t   =   f a l s e ;  
                         a c t i v e t i m e r   =   f a l s e ;  
                         a c t i v e b u t t o n   =   f a l s e ;  
                 }  
         }   e l s e   {  
                 a c t i v e e x i t   =   f a l s e ;  
                 a c t i v e t i m e r   =   f a l s e ;  
                 a c t i v e b u t t o n   =   f a l s e ;  
         }  
 }  
  
 f u n c t i o n   i n i t P o p u p ( )   {  
         / /   A d d   t h e   H T M L   t o   t h e   b o d y  
         t h e B o d y   =   d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( ' B O D Y ' ) [ 0 ] ;  
         p o p m a s k   =   d o c u m e n t . c r e a t e E l e m e n t ( ' d i v ' ) ;  
         p o p m a s k . i d   =   ' p o p u p M a s k ' ;  
         p o p c o n t   =   d o c u m e n t . c r e a t e E l e m e n t ( ' d i v ' ) ;  
         p o p c o n t . i d   =   ' p o p u p C o n t a i n e r ' ;  
         p o p c o n t . i n n e r H T M L   =   ' '   +  
 	 	 ' < d i v   i d = " p o p u p I n n e r " > '   +  
 	 	 	 ' < d i v   i d = " p o p u p T i t l e B a r " > '   +  
 	 	 	 	 ' < d i v   i d = " p o p u p T i t l e " > < / d i v > '   +  
 	 	 	 	 ' < d i v   i d = " p o p u p C o n t r o l s " > '   +  
 	 	 	 	 	 ' < i m g   s r c = " h t t p : / / w w w . v i r t u a l s p i r i t s . c o m / v s a / i m a g e s / c l o s e . p n g "   o n c l i c k = " s e t P e n d i n g ( ) ; h i d e P o p W i n ( f a l s e ) ; "   i d = " p o p C l o s e B o x "   / > '   +  
 	 	 	 	 ' < / d i v > '   +  
 	 	 	 ' < / d i v > '   +  
 	 	 	 ' < d i v   i d = " p r o a c t i v e " > < / d i v > '   +  
 	 	 ' < / d i v > ' ;  
  
         / /   c u s t o m   p e n a k i   o r a n g e  
  
         p o p b u t t o n   =   d o c u m e n t . c r e a t e E l e m e n t ( ' d i v ' ) ;  
         p o p b u t t o n . i d   =   ' p o p u p B u t t o n ' ;  
         / / p o p b u t t o n . i n n e r H T M L   =   ' < d i v   i d = " o p e n B u t t o n "   a l i g n = " r i g h t "   s t y l e = " b o r d e r : 0 p x   s o l i d   # 0 0 0 0 0 0 ; p o s i t i o n :   f i x e d ;   b o t t o m :   5 p x ;     l e f t :   1 0 p x ;   _ l e f t :   1 0 p x ;   _ p o s i t i o n : a b s o l u t e ;     _ t o p : e x p r e s s i o n ( d o c u m e n t . b o d y . s c r o l l T o p + d o c u m e n t . b o d y . c l i e n t H e i g h t - t h i s . c l i e n t H e i g h t - 5 ) ; d i r e c t i o n : l t r ; " > & n b s p ; < / d i v > ' ;  
         / / c u s t o m   p e n a k i   f o r   I E   i s s u e s  
         / / c u s t o m   p e n a k i   z - i n d e x : 9 0 0 ;  
         p o p b u t t o n . i n n e r H T M L   =   ' < d i v   i d = " o p e n B u t t o n "   a l i g n = " r i g h t "   s t y l e = " z - i n d e x : 9 0 0 ; b o r d e r : 0 p x   s o l i d   # 0 0 0 0 0 0 ; p o s i t i o n :   f i x e d ;   b o t t o m :   2 0 p x ;     l e f t :   1 0 p x ;   _ p o s i t i o n : a b s o l u t e ;   _ t o p :   e x p r e s s i o n ( o f f s e t P a r e n t . s c r o l l T o p + d o c u m e n t . d o c u m e n t E l e m e n t . o f f s e t H e i g h t - 1 8 0 ) ; d i r e c t i o n : l t r ; " > & n b s p ; < / d i v > ' ;  
  
         t h e B o d y . a p p e n d C h i l d ( p o p m a s k ) ;  
         t h e B o d y . a p p e n d C h i l d ( p o p c o n t ) ;  
         t h e B o d y . a p p e n d C h i l d ( p o p b u t t o n ) ;  
  
         g P o p u p M a s k   =   d o c u m e n t . g e t E l e m e n t B y I d ( " p o p u p M a s k " ) ;  
         g P o p u p C o n t a i n e r   =   d o c u m e n t . g e t E l e m e n t B y I d ( " p o p u p C o n t a i n e r " ) ;  
  
         / /   c h e c k   t o   s e e   i f   t h i s   i s   I E   v e r s i o n   6   o r   l o w e r .   h i d e   s e l e c t   b o x e s   i f   s o  
         / /   m a y b e   t h e y ' l l   f i x   t h i s   i n   v e r s i o n   7 ?  
         v a r   b r s V e r s i o n   =   p a r s e I n t ( w i n d o w . n a v i g a t o r . a p p V e r s i o n . c h a r A t ( 0 ) ,   1 0 ) ;  
         i f   ( b r s V e r s i o n   < =   6   & &   w i n d o w . 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 S I E " )   >   - 1 )   {  
                 / /   g H i d e S e l e c t s   =   t r u e ;  
         }  
  
         / / a l e r t ( " i n i t P o p u p " ) ;  
 }  
  
 g e t b r o w s e r ( ) ;  
 a d d E v e n t ( w i n d o w ,   " l o a d " ,   i n i t A g e n t ) ;  
  
 f u n c t i o n   i n i t E x i t ( )   {  
         d o c u m e n t . o n m o u s e m o v e   =   f u n c t i o n   ( e v t )   {  
                 i f   ( t y p e o f   e v t   = =   ' u n d e f i n e d ' )   {  
                         m y E v e n t   =   w i n d o w . e v e n t ;  
                 }  
                 e l s e   {  
                         m y E v e n t   =   e v t ;  
                 }  
  
                 i f   ( b r o w s e r   = =   " M S I E " )   {  
                         p o s X   =   m y E v e n t . c l i e n t X ;  
                         p o s Y   =   m y E v e n t . c l i e n t Y ;  
                 }  
                 i f   ( b r o w s e r   = =   " F F "   | |   b r o w s e r   = =   " C H "   | |   b r o w s e r   = =   " o t h e r " )   {  
                         p o s X   =   m y E v e n t . p a g e X   -   w i n d o w . p a g e X O f f s e t ;  
                         p o s Y   =   m y E v e n t . p a g e Y   -   w i n d o w . p a g e Y O f f s e t ;  
                 }  
  
                 / / d o c u m e n t . g e t E l e m e n t B y I d ( " o p e n B u t t o n " ) . i n n e r H T M L   =   " m o u s e :   "   + p o s Y ;  
                 i f   ( p o s Y   <   1 5 )   {  
                         / / a l e r t ( " m o u s e "   + p o s Y ) ;  
                         e x i t c h a t ( ) ;  
                 }  
         }  
 }  
  
  
 f u n c t i o n   e x i t c h a t ( )   {  
         i f   ( a c t i v e e x i t   = =   t r u e )   {  
                 e x i t T i m e   =   n e w   D a t e ( ) ;  
                 t i m e I n t e r v a l   =   e x i t T i m e   -   l o a d T i m e ;  
                 i f   ( t i m e I n t e r v a l   >   e x i t M i n T i m e r )   {  
                         / / c a l l   y o u r   l o g o u t   p a g e  
                         a c t i v e e x i t   =   f a l s e ;  
                         s t a r t c h a t ( " e x i t " ) ;  
                         i f   ( c o n f i r m ( ' àæÙÒ  ÔÐêè  ÞÞêÙß  Üêê  ÜÚ  ÞÙÓâ  àÕáã  ÕÔæâÔ' ) )   {  
                                 / / c o n t i n u e  
                         }  
                         e l s e   {  
                                 s e t P e n d i n g ( ) ;  
                                 h i d e P o p W i n ( f a l s e ) ;  
                         }  
                 }  
         }  
 }  
  
  
 f u n c t i o n   p r o a c t i v e c h a t ( )   {  
         i f   ( a c t i v e t i m e r   = =   t r u e )   {  
                 s t a r t c h a t ( " t i m e r " ) ;  
         }  
 }  
  
 f u n c t i o n   b u t t o n c h a t ( )   {  
         s t a r t c h a t ( " b u t t o n " ) ;  
 }  
  
  
 f u n c t i o n   s e t P e n d i n g ( )   {  
         / /   n e w   d e s i g n   -   i f   v i s i t o r   c l o s e s   t h e   c h a t ,   i t   i s   p e n d i n g   w i t h o u t   c o n s i d e r a t i o n   t o   t i m e i n t e r v a l  
         / /   c l o s e T i m e   =   n e w   D a t e ( ) ;  
         / /   t i m e I n t e r v a l   =   c l o s e T i m e   -   c h a t T i m e ;  
         / /   i f   ( t i m e I n t e r v a l   <   4 5 0 0 0 )   {  
         c r e a t e C o o k i e ( " v s p i r i t s _ s t a t u s " ,   " p e n d i n g " ,   1 ) ;   / /   w r i t e   t h e   c o o k i e  
         a g e n t s t a t u s   =   " p e n d i n g " ;  
         s e t a c t i v e ( ) ;  
         i f   ( a c t i v e b u t t o n )   {   s h o w B u t t o n ( ) ;   }  
 }  
  
 f u n c t i o n   s e t C l o s e d ( )   {  
         h i d e B u t t o n ( ) ;   / /   h i d e   t h e   b u t t o n   c h a t  
         c r e a t e C o o k i e ( " v s p i r i t s _ s t a t u s " ,   " c l o s e d " ,   1 ) ;   / /   w r i t e   t h e   c o o k i e  
         a g e n t s t a t u s   =   " c l o s e d " ;  
         s e t a c t i v e ( ) ;  
 }  
  
 f u n c t i o n   s h o w B u t t o n ( )   {  
         v a r   b u t t o n s t r ;  
         b u t t o n s t r   =   ' '   +  
 	 	 ' < a   h r e f = " # "   o n c l i c k = " b u t t o n c h a t ( ) ; r e t u r n   f a l s e ; " > < i m g   s r c = " '   +   c o m b i i m a g e   +   ' "   b o r d e r = " 0 "   / > < / a > '   +  
 	 	 ' < s p a n   s t y l e = " b o r d e r : 0 p x   s o l i d   # 0 0 0 0 0 0 ; p o s i t i o n :   a b s o l u t e ;   t o p : 0 p x ;   r i g h t : 0 p x ;   w i d t h :   3 0 p x ;   h e i g h t :   3 0 p x ; " > < a   h r e f = " # "   o n c l i c k = " s e t C l o s e d ( ) ; r e t u r n   f a l s e ; "   s t y l e = " t e x t - d e c o r a t i o n : n o n e " > & n b s p ; & n b s p ; & n b s p ; & n b s p ; & n b s p ; & n b s p ; < / a > < / s p a n > '   +  
 	 	 ' < s p a n   s t y l e = " p o s i t i o n :   a b s o l u t e ;   t o p : 1 2 5 p x ;   _ t o p : 1 3 0 p x ;   l e f t : 3 5 p x ; " > '   +  
 	 	 ' < i m g   b o r d e r = " 0 "   a l i g n = " a b s m i d d l e "   a l t = " "   s r c = " h t t p : / / w w w . v i r t u a l s p i r i t s . c o m / v s a / i m a g e s / b l i n k . g i f "   / >   '   +  
 	 	 ' < i m g   b o r d e r = " 0 "   a l i g n = " a b s m i d d l e "   a l t = " "   s r c = " h t t p : / / w w w . v i r t u a l s p i r i t s . c o m / v s a / i m a g e s / b u t t o n - t e x t . g i f "   / > '   +  
 	 	 ' < / s p a n > ' ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " o p e n B u t t o n " ) . i n n e r H T M L   =   b u t t o n s t r ;  
 }  
  
 f u n c t i o n   s h o w B u t t o n T i m e r ( )   {  
         v a r   b u t t o n s t r ;  
         b u t t o n s t r   =   ' '   +  
 	 	 ' < i m g   s r c = " '   +   c o m b i i m a g e   +   ' "   b o r d e r = " 0 "   / > '   +  
 	 	 ' < s p a n   s t y l e = " p o s i t i o n :   a b s o l u t e ;   t o p : 1 2 0 p x ;   _ t o p : 1 2 5 p x ;   r i g h t : 1 0 p x ; " > '   +  
 	 	 ' < i m g   b o r d e r = " 0 "   a l i g n = " a b s m i d d l e "   a l t = " "   w i d t h = " 2 5 "   h e i g h t = " 2 5 "   s r c = " h t t p : / / w w w . v i r t u a l s p i r i t s . c o m / v s a / i m a g e s / p r o g r e s s . g i f "   / >   '   +  
 	 	 ' < / s p a n > ' ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " o p e n B u t t o n " ) . i n n e r H T M L   =   b u t t o n s t r ;  
 }  
  
 f u n c t i o n   h i d e B u t t o n ( )   {  
         d o c u m e n t . g e t E l e m e n t B y I d ( " o p e n B u t t o n " ) . i n n e r H T M L   =   " & n b s p ; " ;  
 }  
  
 f u n c t i o n   g e t c h a t p a r a m ( )   {  
         t i t l e _ p a r a m   =   e n c o d e U R I ( d o c u m e n t . t i t l e ) ;  
         r e f e r r e r _ p a r a m   =   d o c u m e n t . r e f e r r e r ;  
         u r l _ p a r a m   =   l o c a t i o n . h r e f ;  
         u r l _ p a r a m   =   u r l _ p a r a m . t o L o w e r C a s e ( ) ;  
 }  
  
 f u n c t i o n   f i l t e r p a g e s ( )   {  
         t e m p s t r   =   u r l _ p a r a m . r e p l a c e ( " h t t p : / / " ,   " " ) ;  
         t e m p s t r   =   t e m p s t r . r e p l a c e ( " w w w . " ,   " " ) ;  
  
         / /   c u s t o m   p e n a k i . c o . i l  
         / /   t h i s   a l l o w s   t h e   c h a t   o n l y   o n   t h e   f o l l o w i n g   p a g e s  
         / /   s t r u c t u r e   i s   t o o   c o m p l e x  
         a c t i v e p a g e   =   t r u e ;   / /   a l l   p a g e s  
 }  
 f u n c t i o n   g e t d o m a i n ( u r l )   {  
         i f   ( u r l   ! =   " " )   {  
                 u r l   =   u r l . s p l i t ( / \ / + / g ) [ 1 ] ;  
         }  
         r e t u r n   u r l ;  
 }  
  
 f u n c t i o n   s t a r t c h a t ( l a u n c h e r )   {  
         c h a t T i m e   =   n e w   D a t e ( ) ;  
         t i m e I n t e r v a l   =   c h a t T i m e   -   l o a d T i m e ;  
         t r y   {  
                 s h o w B u t t o n T i m e r ( ) ;   / /   s h o w   t h e   b u t t o n   c h a t   a s   t i m e r  
                 / /   n e w   d e s i g n   -   r e c u r r i n g   c h a t  
                 c r e a t e C o o k i e ( " v s p i r i t s _ s t a t u s " ,   " i n p r o c e s s " ,   1 ) ;   / /   w r i t e   t h e   c o o k i e   f o r   n e x t   p a g e  
                 a g e n t s t a t u s   =   " h a n d l e d " ;  
                 s e t a c t i v e ( ) ;  
                 f i x _ f l a s h ( ) ;  
                 i f   ( l a u n c h e r   = =   " e x i t " )   {  
                         / /   e x i t   c h a t  
                         / /   n e w   d e s i g n   n o   o v e r l a y  
                         s h o w P o p W i n ( " h t t p : / / w w w . v i r t u a l s p i r i t s . c o m / v s a / "   +   v s p i r i t s _ c h a t _ c l i e n t   +   " v s a h e b r e w . a s p x ? l a u n c h e r = "   +   l a u n c h e r   +   " & l a u n c h e r t i m e = "   +   t i m e I n t e r v a l   +   " & r e f e r r e r = "   +   r e f e r r e r _ p a r a m   +   " & t i t l e = "   +   t i t l e _ p a r a m ,   5 0 0 ,   4 5 0 ,   n u l l ,   f a l s e ) ;  
                 }   e l s e   {  
                         / /   t i m e d   c h a t  
                         s h o w P o p W i n ( " h t t p : / / w w w . v i r t u a l s p i r i t s . c o m / v s a / "   +   v s p i r i t s _ c h a t _ c l i e n t   +   " v s a h e b r e w . a s p x ? l a u n c h e r = "   +   l a u n c h e r   +   " & l a u n c h e r t i m e = "   +   t i m e I n t e r v a l   +   " & r e f e r r e r = "   +   r e f e r r e r _ p a r a m   +   " & t i t l e = "   +   t i t l e _ p a r a m ,   5 0 0 ,   4 5 0 ,   n u l l ,   f a l s e ) ;  
                 }  
         }   c a t c h   ( e )   {  
                 / /   n o t h i n g  
                 / / a l e r t ( e ) ;  
         }  
 }  
  
  
 / * *  
 *   @ a r g u m e n t   w i d t h   -   i n t   i n   p i x e l s  
 *   @ a r g u m e n t   h e i g h t   -   i n t   i n   p i x e l s  
 *   @ a r g u m e n t   u r l   -   u r l   t o   d i s p l a y  
 *   @ a r g u m e n t   r e t u r n F u n c   -   f u n c t i o n   t o   c a l l   w h e n   r e t u r n i n g   t r u e   f r o m   t h e   w i n d o w .  
 *   @ a r g u m e n t   s h o w O v e r l a y   -   s h o w   t h e   b o d y   o v e r l a y  
 * /  
 f u n c t i o n   s h o w P o p W i n ( u r l ,   w i d t h ,   h e i g h t ,   r e t u r n F u n c ,   s h o w O v e r l a y )   {  
         / /   s h o w   o r   h i d e   t h e   w i n d o w   c l o s e   w i d g e t  
         d o c u m e n t . g e t E l e m e n t B y I d ( " p o p C l o s e B o x " ) . s t y l e . d i s p l a y   =   " n o n e " ;  
  
         g P o p u p I s S h o w n   =   t r u e ;  
         d i s a b l e T a b I n d e x e s ( ) ;  
  
         i f   ( s h o w O v e r l a y )   {  
                 g P o p u p M a s k . s t y l e . d i s p l a y   =   " b l o c k " ;  
         }  
  
         g P o p u p C o n t a i n e r . s t y l e . d i s p l a y   =   " b l o c k " ;  
         / /   c a l c u l a t e   w h e r e   t o   p l a c e   t h e   w i n d o w   o n   s c r e e n  
         c e n t e r P o p W i n ( w i d t h ,   h e i g h t ) ;  
         s e t M a s k S i z e ( ) ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " p r o a c t i v e " ) . i n n e r H T M L   =   " < i f r a m e   s r c = "   +   u r l   +   "   s t y l e = \ " w i d t h : 1 ; h e i g h t : 1 ; b a c k g r o u n d - c o l o r : t r a n s p a r e n t ; \ "   s c r o l l i n g = \ " n o \ "   f r a m e b o r d e r = \ " 0 \ "     i d = ' i f r a m e C o n t e n t '   n a m e = ' i f r a m e C o n t e n t "   +   M a t h . r o u n d ( M a t h . r a n d o m ( )   *   1 0 0 0 )   +   " '   a l l o w t r a n s p a r e n c y = \ " t r u e \ "   i d = \ " p o p u p F r a m e \ "   n a m e = \ " p o p u p F r a m e \ "   w i d t h = ' 1 '   h e i g h t = ' 1 '   o n l o a d = ' c u s t o m _ s h o w I f r a m e ( ) ; ' > < / i f r a m e > "  
  
         / /   f o r   I E  
         i f   ( g H i d e S e l e c t s   = =   t r u e )   {  
                 h i d e S e l e c t B o x e s ( ) ;  
         }  
  
 }  
  
 v a r   g i   =   0 ;  
 f u n c t i o n   c e n t e r P o p W i n ( w i d t h ,   h e i g h t )   {  
         i f   ( g P o p u p I s S h o w n   = =   t r u e )   {  
                 i f   ( w i d t h   = =   n u l l   | |   i s N a N ( w i d t h ) )   {  
                         w i d t h   =   g P o p u p C o n t a i n e r . o f f s e t W i d t h ;  
                 }  
                 i f   ( h e i g h t   = =   n u l l )   {  
                         h e i g h t   =   g P o p u p C o n t a i n e r . o f f s e t H e i g h t ;  
                 }  
  
                 / / v a r   t h e B o d y   =   d o c u m e n t . d o c u m e n t E l e m e n t ;  
                 v a r   t h e B o d y   =   d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( " B O D Y " ) [ 0 ] ;  
                 / / t h e B o d y . s t y l e . o v e r f l o w   =   " h i d d e n " ;  
                 / /   n e w   m o d e l  
                 / / v a r   s c T o p   =   p a r s e I n t ( g e t S c r o l l T o p ( ) , 1 0 ) ;  
                 v a r   s c T o p   =   p a r s e I n t ( g e t S c r o l l T o p ( ) ,   0 ) ;  
                 v a r   s c L e f t   =   p a r s e I n t ( t h e B o d y . s c r o l l L e f t ,   1 0 ) ;  
  
                 s e t M a s k S i z e ( ) ;  
  
                 / / w i n d o w . s t a t u s   =   g P o p u p M a s k . s t y l e . t o p   +   "   "   +   g P o p u p M a s k . s t y l e . l e f t   +   "   "   +   g i + + ;  
  
                 v a r   t i t l e B a r H e i g h t   =   p a r s e I n t ( d o c u m e n t . g e t E l e m e n t B y I d ( " p o p u p T i t l e B a r " ) . o f f s e t H e i g h t ,   1 0 ) ;  
  
                 v a r   f u l l H e i g h t   =   g e t V i e w p o r t H e i g h t ( ) ;  
                 v a r   f u l l W i d t h   =   g e t V i e w p o r t W i d t h ( ) ;  
  
                 / /   n e w   d e s i g n  
                 v a r   t o p t e m p   =   s c T o p   +   ( f u l l H e i g h t   -   ( h e i g h t   +   1 ) ) ;  
                 i f   ( t o p t e m p   <   s c T o p )   {   t o p t e m p   =   s c T o p ;   }  
                 / /   n e w   d e s i g n 	  
                 / /   b o t t o m   l e f t  
                 g P o p u p C o n t a i n e r . s t y l e . t o p   =   t o p t e m p   +   " p x " ;  
                 g P o p u p C o n t a i n e r . s t y l e . l e f t   =   ( s c L e f t   +   2 5 )   +   " p x " ;  
       }  
 }  
  
 a d d E v e n t ( w i n d o w ,   " r e s i z e " ,   c e n t e r P o p W i n ) ;  
 a d d E v e n t ( w i n d o w ,   " s c r o l l " ,   c e n t e r P o p W i n ) ;  
 w i n d o w . o n s c r o l l   =   c e n t e r P o p W i n ;  
  
  
 / * *  
 *   S e t s   t h e   s i z e   o f   t h e   p o p u p   m a s k .  
 *  
 * /  
 f u n c t i o n   s e t M a s k S i z e ( )   {  
         v a r   t h e B o d y   =   d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( " B O D Y " ) [ 0 ] ;  
         v a r   f u l l H e i g h t   =   g e t V i e w p o r t H e i g h t ( ) ;  
         v a r   f u l l W i d t h   =   g e t V i e w p o r t W i d t h ( ) ;  
  
         / /   D e t e r m i n e   w h a t ' s   b i g g e r ,   s c r o l l H e i g h t   o r   f u l l H e i g h t   /   w i d t h  
         i f   ( f u l l H e i g h t   >   t h e B o d y . s c r o l l H e i g h t )   {  
                 p o p H e i g h t   =   f u l l H e i g h t ;  
         }   e l s e   {  
                 p o p H e i g h t   =   t h e B o d y . s c r o l l H e i g h t ;  
         }  
  
         i f   ( f u l l W i d t h   >   t h e B o d y . s c r o l l W i d t h )   {  
                 p o p W i d t h   =   f u l l W i d t h ;  
         }   e l s e   {  
                 p o p W i d t h   =   t h e B o d y . s c r o l l W i d t h ;  
         }  
  
         g P o p u p M a s k . s t y l e . h e i g h t   =   p o p H e i g h t   +   " p x " ;  
         g P o p u p M a s k . s t y l e . w i d t h   =   p o p W i d t h   +   " p x " ;  
 }  
  
 / * *  
 *   @ a r g u m e n t   c a l l R e t u r n F u n c   -   b o o l   -   d e t e r m i n e s   i f   w e   c a l l   t h e   r e t u r n   f u n c t i o n   s p e c i f i e d  
 *   @ a r g u m e n t   r e t u r n V a l   -   a n y t h i n g   -   r e t u r n   v a l u e    
 * /  
 f u n c t i o n   h i d e P o p W i n ( c a l l R e t u r n F u n c )   {  
         g P o p u p I s S h o w n   =   f a l s e ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " p r o a c t i v e " ) . i n n e r H T M L   =   " & n b s p ; " ;  
         v a r   t h e B o d y   =   d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( " B O D Y " ) [ 0 ] ;  
         t h e B o d y . s t y l e . o v e r f l o w   =   " " ;  
         r e s t o r e T a b I n d e x e s ( ) ;  
         i f   ( g P o p u p M a s k   = =   n u l l )   {  
                 r e t u r n ;  
         }  
         g P o p u p M a s k . s t y l e . d i s p l a y   =   " n o n e " ;  
         g P o p u p C o n t a i n e r . s t y l e . d i s p l a y   =   " n o n e " ;  
         i f   ( c a l l R e t u r n F u n c   = =   t r u e   & &   g R e t u r n F u n c   ! =   n u l l )   {  
                 / /   S e t   t h e   r e t u r n   c o d e   t o   r u n   i n   a   t i m e o u t .  
                 / /   W a s   h a v i n g   i s s u e s   u s i n g   w i t h   a n   A j a x . R e q u e s t ( ) ;  
                 g R e t u r n V a l   =   w i n d o w . f r a m e s [ " p o p u p F r a m e " ] . r e t u r n V a l ;  
                 w i n d o w . s e t T i m e o u t ( ' g R e t u r n F u n c ( g R e t u r n V a l ) ; ' ,   1 ) ;  
         }  
  
         / /   d i s p l a y   a l l   s e l e c t   b o x e s  
         i f   ( g H i d e S e l e c t s   = =   t r u e )   {  
                 d i s p l a y S e l e c t B o x e s ( ) ;  
         }  
 }  
  
  
 / /   T a b   k e y   t r a p .   i f f   p o p u p   i s   s h o w n   a n d   k e y   w a s   [ T A B ] ,   s u p p r e s s   i t .  
 / /   @ a r g u m e n t   e   -   e v e n t   -   k e y b o a r d   e v e n t   t h a t   c a u s e d   t h i s   f u n c t i o n   t o   b e   c a l l e d .  
 f u n c t i o n   k e y D o w n H a n d l e r ( e )   {  
         i f   ( g P o p u p I s S h o w n   & &   e . k e y C o d e   = =   9 )   r e t u r n   f a l s e ;  
 }  
  
 / /   F o r   I E .     G o   t h r o u g h   p r e d e f i n e d   t a g s   a n d   d i s a b l e   t a b b i n g   i n t o   t h e m .  
 f u n c t i o n   d i s a b l e T a b I n d e x e s ( )   {  
         i f   ( d o c u m e n t . a l l )   {  
                 v a r   i   =   0 ;  
                 f o r   ( v a r   j   =   0 ;   j   <   g T a b b a b l e T a g s . l e n g t h ;   j + + )   {  
                         v a r   t a g E l e m e n t s   =   d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( g T a b b a b l e T a g s [ j ] ) ;  
                         f o r   ( v a r   k   =   0 ;   k   <   t a g E l e m e n t s . l e n g t h ;   k + + )   {  
                                 g T a b I n d e x e s [ i ]   =   t a g E l e m e n t s [ k ] . t a b I n d e x ;  
                                 t a g E l e m e n t s [ k ] . t a b I n d e x   =   " - 1 " ;  
                                 i + + ;  
                         }  
                 }  
         }  
 }  
  
 / /   F o r   I E .   R e s t o r e   t a b - i n d e x e s .  
 f u n c t i o n   r e s t o r e T a b I n d e x e s ( )   {  
         i f   ( d o c u m e n t . a l l )   {  
                 v a r   i   =   0 ;  
                 f o r   ( v a r   j   =   0 ;   j   <   g T a b b a b l e T a g s . l e n g t h ;   j + + )   {  
                         v a r   t a g E l e m e n t s   =   d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( g T a b b a b l e T a g s [ j ] ) ;  
                         f o r   ( v a r   k   =   0 ;   k   <   t a g E l e m e n t s . l e n g t h ;   k + + )   {  
                                 t a g E l e m e n t s [ k ] . t a b I n d e x   =   g T a b I n d e x e s [ i ] ;  
                                 t a g E l e m e n t s [ k ] . t a b E n a b l e d   =   t r u e ;  
                                 i + + ;  
                         }  
                 }  
         }  
 }  
  
  
 / * *  
 *   H i d e s   a l l   d r o p   d o w n   f o r m   s e l e c t   b o x e s   o n   t h e   s c r e e n   s o   t h e y   d o   n o t   a p p e a r   a b o v e   t h e   m a s k   l a y e r .  
 *   I E   h a s   a   p r o b l e m   w i t h   w a n t e d   s e l e c t   f o r m   t a g s   t o   a l w a y s   b e   t h e   t o p m o s t   z - i n d e x   o r   l a y e r  
 *  
 *   T h a n k s   f o r   t h e   c o d e   S c o t t !  
 * /  
 f u n c t i o n   h i d e S e l e c t B o x e s ( )   {  
         v a r   x   =   d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( " S E L E C T " ) ;  
  
         f o r   ( i   =   0 ;   x   & &   i   <   x . l e n g t h ;   i + + )   {  
                 x [ i ] . s t y l e . v i s i b i l i t y   =   " h i d d e n " ;  
         }  
 }  
  
 / * *  
 *   M a k e s   a l l   d r o p   d o w n   f o r m   s e l e c t   b o x e s   o n   t h e   s c r e e n   v i s i b l e   s o   t h e y   d o   n o t    
 *   r e a p p e a r   a f t e r   t h e   d i a l o g   i s   c l o s e d .  
 *    
 *   I E   h a s   a   p r o b l e m   w i t h   w a n t i n g   s e l e c t   f o r m   t a g s   t o   a l w a y s   b e   t h e    
 *   t o p m o s t   z - i n d e x   o r   l a y e r .  
 * /  
 f u n c t i o n   d i s p l a y S e l e c t B o x e s ( )   {  
         v a r   x   =   d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( " S E L E C T " ) ;  
  
         f o r   ( i   =   0 ;   x   & &   i   <   x . l e n g t h ;   i + + )   {  
                 x [ i ] . s t y l e . v i s i b i l i t y   =   " v i s i b l e " ;  
         }  
 }  
  
  
 / / h e l p e r   f u n c t i o n s   b e l o w  
 f u n c t i o n   c u s t o m _ s h o w I f r a m e ( )   {  
         / / j Q u e r y ( ' # p r o a c t i v e ' ) . s h o w ( ) ; / / s h o w   w i n d o w  
         / / p r o a c t i v e _ p o s i t i o n ( ) ;   / / p o s i t i o n   t h e   w i n d o w  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i f r a m e C o n t e n t " ) . s t y l e . d i s p l a y   =   " b l o c k " ;  
  
         / /   n e w   d e s i g n  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i f r a m e C o n t e n t " ) . s t y l e . w i d t h   =   " 3 1 0 p x " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i f r a m e C o n t e n t " ) . s t y l e . h e i g h t   =   " 4 0 0 p x " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " p o p u p T i t l e B a r " ) . s t y l e . w i d t h   =   " 3 1 0 p x " ;  
  
         d o c u m e n t . g e t E l e m e n t B y I d ( " p o p C l o s e B o x " ) . s t y l e . d i s p l a y   =   " b l o c k " ;  
         / / d o c u m e n t . g e t E l e m e n t B y I d ( " p o p u p T i t l e " ) . i n n e r H T M L   =   s t r T i t l e ;  
         c e n t e r P o p W i n ( ) ;  
         h i d e B u t t o n ( ) ;   / /   h i d e   t h e   b u t t o n  
 }  
  
 f u n c t i o n   c r e a t e C o o k i e ( n a m e ,   v a l u e ,   d a y s )   {  
         i f   ( d a y s )   {  
                 v a r   d a t e   =   n e w   D a t e ( ) ;  
                 d a t e . s e t T i m e ( d a t e . g e t T i m e ( )   +   ( d a y s   *   2 4   *   6 0   *   6 0   *   1 0 0 0 ) ) ;  
                 v a r   e x p i r e s   =   " ;   e x p i r e s = "   +   d a t e . t o G M T S t r i n g ( ) ;  
         }  
         e l s e   v a r   e x p i r e s   =   " " ;  
         d o c u m e n t . c o o k i e   =   n a m e   +   " = "   +   v a l u e   +   e x p i r e s   +   " ;   p a t h = / " ;  
 }  
  
 f u n c t i o n   r e a d C o o k i e ( n a m e )   {  
         v a r   n a m e E Q   =   n a m e   +   " = " ;  
         v a r   c a   =   d o c u m e n t . c o o k i e . s p l i t ( ' ; ' ) ;  
         f o r   ( v a r   i   =   0 ;   i   <   c a . l e n g t h ;   i + + )   {  
                 v a r   c   =   c a [ i ] ;  
                 w h i l e   ( c . c h a r A t ( 0 )   = =   '   ' )   c   =   c . s u b s t r i n g ( 1 ,   c . l e n g t h ) ;  
                 i f   ( c . i n d e x O f ( n a m e E Q )   = =   0 )   r e t u r n   c . s u b s t r i n g ( n a m e E Q . l e n g t h ,   c . l e n g t h ) ;  
         }  
         r e t u r n   n u l l ;  
 }  
  
 f u n c t i o n   e r a s e C o o k i e ( n a m e )   {  
         c r e a t e C o o k i e ( n a m e ,   " " ,   - 1 ) ;  
 }  
  
  
 f u n c t i o n   g e t b r o w s e r ( )   {  
         i f   ( 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 S I E ' )   ! =   - 1 )   {  
                 b r o w s e r   =   " M S I E " ;  
         }   e l s e   {  
                 i f   ( 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 ( ' F i r e f o x ' )   ! =   - 1 )   {  
                         b r o w s e r   =   " F F " ;  
                 }   e l s e   {  
                         i f   ( 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 ( ' C h r o m e ' )   ! =   - 1 )   {  
                                 b r o w s e r   =   " C H " ;  
                         }   e l s e   {  
                                 b r o w s e r   =   " o t h e r " ;  
                         }  
                 }    
         }  
         / / a l e r t ( b r o w s e r ) ;  
 }  
  
  
 / /   c u s t o m   p e n a k i  
 / /   f i x   f l a s h   b a n n e r  
 f u n c t i o n   f i x _ f l a s h ( )   {  
         / /   c u s t o m   f o r   c h r o m e   a n d   f o r   I E   9 . 0  
         i f   ( b r o w s e r   ! =   " C H "   & &   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 S I E   9 . ' )   = =   - 1 )   {  
                 / /   l o o p   t h r o u g h   e v e r y   e m b e d   t a g   o n   t h e   s i t e  
                 v a r   e m b e d s   =   d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( ' e m b e d ' ) ;  
                 f o r   ( i   =   0 ;   i   <   e m b e d s . l e n g t h ;   i + + )   {  
                         e m b e d   =   e m b e d s [ i ] ;  
                         v a r   n e w _ e m b e d ;  
                         / /   e v e r y t h i n g   b u t   F i r e f o x   &   K o n q u e r o r  
                         i f   ( e m b e d . o u t e r H T M L )   {  
                                 v a r   h t m l   =   e m b e d . o u t e r H T M L ;  
                                 / /   r e p l a c e   a n   e x i s t i n g   w m o d e   p a r a m e t e r  
                                 i f   ( h t m l . m a t c h ( / w m o d e \ s * = \ s * ( ' | " ) [ a - z A - Z ] + ( ' | " ) / i ) )  
                                         n e w _ e m b e d   =   h t m l . r e p l a c e ( / w m o d e \ s * = \ s * ( ' | " ) w i n d o w ( ' | " ) / i ,   " w m o d e = ' o p a q u e ' " ) ;  
                                 / /   a d d   a   n e w   w m o d e   p a r a m e t e r  
                                 e l s e  
                                         n e w _ e m b e d   =   h t m l . r e p l a c e ( / < e m b e d \ s / i ,   " < e m b e d   w m o d e = ' o p a q u e '   " ) ;  
                                 / /   r e p l a c e   t h e   o l d   e m b e d   o b j e c t   w i t h   t h e   f i x e d   v e r s i o n  
                                 e m b e d . i n s e r t A d j a c e n t H T M L ( ' b e f o r e B e g i n ' ,   n e w _ e m b e d ) ;  
                                 e m b e d . p a r e n t N o d e . r e m o v e C h i l d ( e m b e d ) ;  
                         }   e l s e   {  
                                 / /   c l o n e N o d e   i s   b u g g y   i n   s o m e   v e r s i o n s   o f   S a f a r i   &   O p e r a ,   b u t   w o r k s   f i n e   i n   F F  
                                 n e w _ e m b e d   =   e m b e d . c l o n e N o d e ( t r u e ) ;  
                                 i f   ( ! n e w _ e m b e d . g e t A t t r i b u t e ( ' w m o d e ' )   | |   n e w _ e m b e d . g e t A t t r i b u t e ( ' w m o d e ' ) . t o L o w e r C a s e ( )   = =   ' w i n d o w ' )  
                                         n e w _ e m b e d . s e t A t t r i b u t e ( ' w m o d e ' ,   ' o p a q u e ' ) ;  
                                 e m b e d . p a r e n t N o d e . r e p l a c e C h i l d ( n e w _ e m b e d ,   e m b e d ) ;  
                         }  
                 }  
                 / /   l o o p   t h r o u g h   e v e r y   o b j e c t   t a g   o n   t h e   s i t e  
                 v a r   o b j e c t s   =   d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( ' o b j e c t ' ) ;  
                 f o r   ( i   =   0 ;   i   <   o b j e c t s . l e n g t h ;   i + + )   {  
                         o b j e c t   =   o b j e c t s [ i ] ;  
                         v a r   n e w _ o b j e c t ;  
                         / /   o b j e c t   i s   a n   I E   s p e c i f i c   t a g   s o   w e   c a n   u s e   o u t e r H T M L   h e r e  
                         i f   ( o b j e c t . o u t e r H T M L )   {  
                                 v a r   h t m l   =   o b j e c t . o u t e r H T M L ;  
                                 / /   r e p l a c e   a n   e x i s t i n g   w m o d e   p a r a m e t e r  
                                 i f   ( h t m l . m a t c h ( / < p a r a m \ s + n a m e \ s * = \ s * ( ' | " ) w m o d e ( ' | " ) \ s + v a l u e \ s * = \ s * ( ' | " ) [ a - z A - Z ] + ( ' | " ) \ s * \ / ? \ > / i ) )  
                                         n e w _ o b j e c t   =   h t m l . r e p l a c e ( / < p a r a m \ s + n a m e \ s * = \ s * ( ' | " ) w m o d e ( ' | " ) \ s + v a l u e \ s * = \ s * ( ' | " ) w i n d o w ( ' | " ) \ s * \ / ? \ > / i ,   " < p a r a m   n a m e = ' w m o d e '   v a l u e = ' o p a q u e '   / > " ) ;  
                                 / /   a d d   a   n e w   w m o d e   p a r a m e t e r  
                                 e l s e  
                                         n e w _ o b j e c t   =   h t m l . r e p l a c e ( / < \ / o b j e c t \ > / i ,   " < p a r a m   n a m e = ' w m o d e '   v a l u e = ' o p a q u e '   / > \ n < / o b j e c t > " ) ;  
                                 / /   l o o p   t h r o u g h   e a c h   o f   t h e   p a r a m   t a g s  
                                 v a r   c h i l d r e n   =   o b j e c t . c h i l d N o d e s ;  
                                 f o r   ( j   =   0 ;   j   <   c h i l d r e n . l e n g t h ;   j + + )   {  
                                         i f   ( c h i l d r e n [ j ] . g e t A t t r i b u t e ( ' n a m e ' ) . m a t c h ( / f l a s h v a r s / i ) )   {  
                                                 n e w _ o b j e c t   =   h t m l . r e p l a c e ( / < p a r a m \ s + n a m e \ s * = \ s * ( ' | " ) f l a s h v a r s ( ' | " ) \ s + v a l u e \ s * = \ s * ( ' | " ) [ ^ ' " ] * ( ' | " ) \ s * \ / ? \ > / i ,   " < p a r a m   n a m e = ' f l a s h v a r s '   v a l u e = ' "   +   c h i l d r e n [ j ] . g e t A t t r i b u t e ( ' v a l u e ' )   +   " '   / > " ) ;  
                                         }  
                                 }  
                                 / /   r e p l a c e   t h e   o l d   e m b e d   o b j e c t   w i t h   t h e   f i x e d   v e r s i o n y  
                                 o b j e c t . i n s e r t A d j a c e n t H T M L ( ' b e f o r e B e g i n ' ,   n e w _ o b j e c t ) ;  
                                 o b j e c t . p a r e n t N o d e . r e m o v e C h i l d ( o b j e c t ) ;  
                         }  
                 }  
         }  
 }  
  
  
 
