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