﻿var microsoftXmlHttps = new Array("MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP");

function AJAX()
{
    if(typeof(XMLHttpRequest) != "undefined")
    {
        this.XmlHttp = new XMLHttpRequest();
    }
    else
    {
        for(var n=0;n<microsoftXmlHttps.length;n++)
        {
            try
            {
                this.XmlHttp = new ActiveXObject(microsoftXmlHttps[n]);
                break;
            }
            catch(ex)
            {
            }
        }
    }
}

AJAX.prototype.Post = function(url,data,callback)
{
	this.XmlHttp.open("POST", url, true);
	this.XmlHttp.onreadystatechange = callback;
	this.XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	return this.XmlHttp.send(data);
}

AJAX.prototype.Get = function(url,callback)
{
	this.XmlHttp.open("GET", url, true);
	this.XmlHttp.onreadystatechange = callback;
	return this.XmlHttp.send(null);
}

AJAX.prototype.IsReady = function()
{
    if(this.XmlHttp)
        if(this.XmlHttp.readyState == 4)
            if(this.XmlHttp.status == 200)
                return true;
    return false;
}

AJAX.prototype.ResponseText = function()
{
    if(this.IsReady)
        return this.XmlHttp.responseText;
    return "";
}

var ajax = new AJAX();

