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