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