var xhttp_Request, xhttp_TimeoutHl, xhttp_FuncSuccess, xhttp_FuncFail;
var xhttp_IsWorking = false, xhttp_Timeout = 30000;
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_Request.open('GET', url, 'true');
    xhttp_Request.send(null);
    xhttp_TimeoutHl = setTimeout('xhttp_Abort()', xhttp_Timeout);
}
function xhttp_StateChange()
{
    if (!xhttp_Request ||
        xhttp_Request.readyState != 4)
        return;
    clearTimeout(xhttp_TimeoutHl);
    xhttp_IsWorking = false;
    var data = xhttp_Request.responseText;
    if (200 != xhttp_Request.status)
    {
        if (xhttp_FuncFail)
            eval(xhttp_FuncFail);
    }
    else if (xhttp_FuncSuccess)
        eval(xhttp_FuncSuccess);
}
function xhttp_Abort()
{
    xhttp_IsWorking = false;
    xhttp_Request.abort();
    xhttp_FuncFail();
}
