// Call of remote data via xmlHttpRequest

function dataServent()
{};

dataServent.prototype.initialize = function()
{
    try {
        // Mozilla / Safari
        this._xh = new XMLHttpRequest();
    } catch (e) {
        // Explorer
        var _ieModel = new Array(
        'MSXML2.XMLHTTP.5.0',
        'MSXML2.XMLHTTP.4.0',
        'MSXML2.XMLHTTP.3.0',
        'MSXML2.XMLHTTP',
        'Microsoft.XMLHTTP'
        );
        var success = false;
        for (var i=0;i < _ieModel.length && !success; i++)
        {
            try {
                this._xh = new ActiveXObject(_ieModel[i]);
                success = true;
            } catch (e) {
                // Manage the exceptions
            }
        }
        if ( !success )
        {
            // Manage the exceptions, while alert
            return false;
        }
        return true;
    }
}

dataServent.prototype.occupy = function()
{
    beenActual = this._xh.readyState;
    return (beenActual && (beenActual < 4));
}

dataServent.prototype.process = function()
{
    if (this._xh.readyState == 4 && this._xh.status == 200)
    {
        this.processdo = true;
    }
}

dataServent.prototype.sending = function(urlget,data)
{
    if (!this._xh)
    {
        this.initialize();
    }
    if (!this.occupy())
    {
        this._xh.open("GET",urlget,false);
        this._xh.send(data);
        if (this._xh.readyState == 4 && this._xh.status == 200)
        {
            return this._xh.responseText;
        }
    }
    return false;
}

// Rapid access for making changes
function _gr(reqseccion,divcont)
{
    remote = new dataServent;
    nt = remote.sending(reqseccion,"");
    document.getElementById(divcont).innerHTML = nt;
}

function countLinking(group_id,path)
{
    remote = new dataServent;
    nt = remote.sending(path+'sitebuilder/ajax-linking.php?group_id='+group_id);
}