/**
 * @namespace com.thesis.ajax.Connection
 * @author 钟军锐 August.R@263.net
 */

/** @id Connection */
function Connection(sURL){
	this.sURL = sURL;
	this.arrParam = new Array();
	this.sMethod = "POST";
	this.bEncode = false;
	this.bDecode = false;
	this.bCompress = false;
	this.bDecompress = false;
	if(typeof Connection._initialized == "undefined"){
		Connection._initialized = true;
		/** @id clearParams */
		Connection.prototype.clearParams = function(){
			delete this.arrParam;
			this.arrParam = new Array();
		};
		/** @id removeParam */
		Connection.prototype.removeParam = function(sParamName,sParamValue){
			for(var i=this.arrParam.length-1;i>-1;i--){
				if(this.arrParam[i].sParamName == sParamName){
					if((sParamValue && this.arrParam[i].sParamValue==sParamValue) || (typeof sParamValue == "undefined" )){
						this.arrParam.splice(i,1);
					}
				}
			}
		};
		/** @id addParam */
		Connection.prototype.addParam = function(sParamName,sParamValue,bUnique){
			if(bUnique){
				this.removeParam(sParamName);
			}
			this.arrParam.push({sParamName: sParamName, sParamValue: sParamValue});
		};
	}
}

