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