var xhttp_Request, xhttp_TimeoutHl, xhttp_FuncSuccess, xhttp_FuncFail, xhttp_URL;
var xhttp_IsWorking = false;
function xhttp_GetData(url, successFunc, failFunc)
{
    if (xhttp_IsWorking)
        xhttp_Request.abort();
    if (window.XMLHttpRequest)
        xhttp_Request = new XMLHttpRequest();
    else if (window.ActiveXObject)
        xhttp_Request = new ActiveXObject("Microsoft.XMLHTTP");
    else
    {
        failFunc();
        return;
    }
    xhttp_IsWorking = true;
    xhttp_FuncSuccess = successFunc;
    xhttp_FuncFail = failFunc;
    xhttp_Request.onreadystatechange = xhttp_StateChange;
    xhttp_URL = url;
    xhttp_Request.open('GET', url, 'true');
    xhttp_Request.send(null);
    xhttp_TimeoutHl = setTimeout('xhttp_Abort()', 30000);
}
function xhttp_StateChange()
{
    if (xhttp_Request.readyState != 4)
        return;
    clearTimeout(xhttp_TimeoutHl);
    xhttp_IsWorking = false;
    if (200 != xhttp_Request.status)
    {
        if (xhttp_FuncFail)
            xhttp_FuncFail(xhttp_Request.responseText);
    }
    else
    {
        if (xhttp_FuncSuccess)
            xhttp_FuncSuccess(xhttp_Request.responseText);
    }
}
function xhttp_Abort()
{
    xhttp_IsWorking = false;
    xhttp_Request.abort();
    xhttp_FuncFail();
}
function xhttp_GET(url, onGetDataSuccess, onGetDataFail)
{
    xhttp_GetData(url, onGetDataSuccess, onGetDataFail);
}
