		//{
		//	if(XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200)
		//	{
          //      return  response = XMLHttpRequestObject;
          //      nazwa(response);
              //  var commands = response.getElementsByTagName('osoba');
              //  var polecenia;
              //  for(var i=0; i <  commands.length; i++) {
              //      alert('imie -> ' + getNodeValue(commands[i], 'imie') + '\nnazwisko -> ' + getNodeValue(commands[i], 'nazwisko'));
              //  }

		//		delete XMLHttpRequestObject;
		//		XMLHttpRequestObject = false;
        //        return response;
		//	}
		//}

function getNodeValue(parent, tagName) {var node = parent.getElementsByTagName(tagName)[0];return (node && node.firstChild) ? node.firstChild.nodeValue : false;}
//function getNodeValue(obj,tag) { return obj.getElementsByTagName(tag)[0].firstChild.nodeValue; }


function FactoryXMLHttpRequest() {
    if(window.XMLHttpRequest) {
        return new XMLHttpRequest();
    } else if(window.ActiveXObject) {
        var msxmls = new Array(
            'Msxml2.HMLHTTP.5.0',
            'Msxml2.HMLHTTP.4.0',
            'Msxml2.HMLHTTP.3.0',
            'Msxml2.HMLHTTP',
            'Microsoft.XMLHTTP');
        for(var i = 0; i<msxmls.length; i++) {
            try {
                return new ActiveXObject(msxmls[i]);
            } catch(e) {
            }
        }
    }
}

function SPJAjax() {
    this._xmlhttp = new FactoryXMLHttpRequest();
}

function SPJAjax_get(url) {
    var instance = this;
    this._xmlhttp.open('GET',url, true);
    this._xmlhttp.onreadystatechange = function() {
        switch(instance._xmlhttp.readyState) {
            case 1:
                instance.loading();
                break;

            case 2:
                instance.loaded();
                break;

            case 3:
                instance.interactive();
                break;

            case 4:
                instance.complete(
                    instance._xmlhttp.status,
                    instance._xmlhttp.statusText,
                    instance._xmlhttp.responseText,
                    instance._xmlhttp.responseXML
                );
                break;
        }
    }
    this._xmlhttp.send(null);
}

function SPJAjax_post(url,param_keys,param_values) {
    var instance = this;
    this._xmlhttp.open('POST',url, true);
    this._xmlhttp.onreadystatechange = function() {
        switch(instance._xmlhttp.readyState) {
            case 1:
                instance.loading();
                break;

            case 2:
                instance.loaded();
                break;

            case 3:
                instance.interactive();
                break;

            case 4:
                instance.complete(
                    instance._xmlhttp.status,
                    instance._xmlhttp.statusText,
                    instance._xmlhttp.responseText,
                    instance._xmlhttp.responseXML
                );
                break;
        }
    }
    this._xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    if(param_keys === undefined || param_values === undefined) {
        this._xmlhttp.send(null);
    } else {
        var params = '';
        for(var i = 0; i<param_keys.length;i++) {
            params += param_keys[i] + '=' + param_values[i] + '&';
        }
        this._xmlhttp.send(params);
    }
}

function SPJAjax_loading() {
}

function SPJAjax_loaded() {
}

function SPJAjax_interactive() {
}

function SPJAjax_complete(status, statusText, responseText, responseXML) {
}

SPJAjax.prototype.loading = SPJAjax_loading;
SPJAjax.prototype.loaded = SPJAjax_loaded;
SPJAjax.prototype.interactive = SPJAjax_interactive;
SPJAjax.prototype.complete = SPJAjax_complete;

SPJAjax.prototype.get = SPJAjax_get;
SPJAjax.prototype.post = SPJAjax_post;
