﻿//If you modify this....make sure you reflect those changes in /scripts/SessionHandler.js
function AjaxHandler(){
    this.xHTTP;
    this.connected = false; 
    
    this.createConnection = function(){
        try
        { 
            this.xHTTP=new XMLHttpRequest();  
        }
        catch (e)
        {
            try
            {
                this.xHTTP=new ActiveXObject("Msxml2.XMLHTTP");    
            }
            catch (e)
            {    
                try
                {      
                    this.xHTTP=new ActiveXObject("Microsoft.XMLHTTP");      
                }
                catch (e)
                {      
                    alert("Your browser does not support AJAX! Please upgrade your browser or switch to an AJAX compliant browser.");      
                    return null;      
                }    
            }  
        }
        this.connected = true;
        return this.xHTTP;
    }
    
    this.makeRequest = function(url, callBckFn){
        try
        {
            if (!this.connected){ alert('You are not currently connected. Please connect first.'); return false; }
            //specify the function that will handle the return values
            this.xHTTP.onreadystatechange = callBckFn;
           
            this.xHTTP.open("GET",url,true);
            this.xHTTP.send(null);  
        }catch(e){ }
    };
    
    
}