var GetContent = function(action) {
	this.action = action;
	this.message = "";
	this.responseState = 0;
	this.getResponse = function() {
		return this.response;
	};
	this.isReady = function() {
		if(this.responseState == 4)
			return true;
		return false;
	}
		
};

GetContent.prototype.sendPost = function(form) {
	var aParams = new Array();
	for(var i =0; i <form.elements.length; i++) {
		var sParam = encodeURIComponent(form.elements[i].name);
		sParam += "=";
		sParam += encodeURIComponent(form.elements[i].value);
		aParams.push(sParam);
	}
	var parametr = aParams.join("&");
	var xhr = XmlObject.createRequest();	
    xhr.open("POST", form.action, true);
    var othis = this;
    xhr.onreadystatechange = function() {
    	switch(xhr.readyState) {
    		case 0:
	    	case 1:
	    		break;
	    	case 2:
	    		break;
	    	case 3:
	    		break;
	    	case 4:
	    		othis.responseState = 4;
	    		if(xhr.status == 200) {	    			
		            othis.response = xhr.responseText;
	        	} else {
	        	}
	    		break;
	    	default : 
    	}

    };
    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xhr.setRequestHeader("Cache-Control", "no-cache");
    xhr.send(parametr);
};
GetContent.prototype.sendPostFromArray = function(sendTable) {
	var aParams = new Array();
	for(var i =0; i <sendTable.length; i++) {
		var sParam = encodeURIComponent(sendTable[i].name);
		sParam += "=";
		sParam += encodeURIComponent(sendTable[i].value);
		aParams.push(sParam);
	}
	var parametr = aParams.join("&");
	var xhr = XmlObject.createRequest();	
    xhr.open("POST", this.action, true);
    var othis = this;
    xhr.onreadystatechange = function() {
    	switch(xhr.readyState) {
    		case 0:
	    	case 1:
	    		break;
	    	case 2:
	    		break;
	    	case 3:
	    		break;
	    	case 4:
	    		othis.responseState = 4;
	    		if(xhr.status == 200) {	    			
		            othis.response = xhr.responseText;
	        	} else {
	        	}
	    		break;
	    	default : 
    	}

    };
    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xhr.setRequestHeader("Cache-Control", "no-cache");
    xhr.send(parametr);
};

GetContent.prototype.send = function() {
	
	var xhr = XmlObject.createRequest();	
    xhr.open("GET", this.action, true);
    var othis = this;
    xhr.onreadystatechange = function() {
    	switch(xhr.readyState) {
    		case 0:
	    	case 1:
	    		break;
	    	case 2:
	    		break;
	    	case 3:
	    		break;
	    	case 4:
	    		othis.responseState = 4;
	    		if(xhr.status == 200) {	    			
		            othis.response = xhr.responseText;
	        	} else {
	        	}
	    		break;
	    	default : 
    	}

    };
    xhr.setRequestHeader("Cache-Control", "no-cache");
    xhr.send(null);
};


