/**
 * return a new XMLHttpRequest
 *
 * tested on : IE 6.0, Firefox 1.5, Opera 8.52, Konqueror 3.4.3, Netscape 7.1
 */


function newXMLHttpRequest()
{
    var xhr = false;

    /*@cc_on
        @if (@_jscript_version >= 5)
            try
            {
                xhr = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e)
            {
                try
                {
                    xhr = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e2)
                {
                    xhr = false
                }
            }
        @else
            xmlhttp = false;
        @end
    @*/

    if (!xhr && typeof XMLHttpRequest != 'undefined')
    {
        try
        {
            xhr = new XMLHttpRequest();
        }
        catch (e3)
        {
            xhr = false;
        }
    }
  
    
    
    return xhr;
}

function AjaxPost(address)
{
    var xhr  = newXMLHttpRequest();
    try
    {
        xhr.open("POST", address, true);
        xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); //force response content-type
        xhr.setRequestHeader("Cache-Control", "no-cache");
    }
    catch (exception)
    {
        alert("exception catch when trying to send ajax request !");
    }
    return xhr;
}

