wrapAJAXClass = function(){
	var obj = this;
	this.method = 'GET';
	this.url = 'index.php?';
	this.sendContent = null;
	this.header = {h:'Content-Type',v:'application/x-www-form-urlencoded'};
	this.req = false;
	this.setResponse = 'XML';
	this.req = function(){
		var req = false;
		try{
			req = new XMLHttpRequest();
		}catch(err1){
			try{
		    	req = new ActiveXObject("Msxml2.XMLHTTP");
			}catch(err2){
				try{
					req = new ActiveXObject("Microsoft.XMLHTTP");
				}catch(err3){
					req = false;
				}
			}
		}
		return req;
	}();
	this.typeResponse = function(_res){
		var res = new String(_res);
		switch(res.toUpperCase()){
			case 'TEXT':
				this.setResponse = 'TEXT';
			break;
			default:
				this.setResponse = 'XML';
		}
	}
	this.set = function(_url,_method,_header,_sendContent){
		obj = this;
		this.url = _url;
		this.method = (_method != '')?_method:this.method;
		if(this.method != 'GET'){
			this.header = (_header != '')?_header:this.header;
			var sC = '';
			for(var i=0;i<_sendContent.length;i++){
				switch(i){
					case 0:{
						sC += (new String(_sendContent[i].n))+'='+encodeURI(new String(_sendContent[i].v));
						break;
					}
					default:{
						sC += '&'+(new String(_sendContent[i].n))+'='+encodeURI(new String(_sendContent[i].v));
					}
				}
			}
			this.sendContent = (sC != '')?sC:this.sendContent;
		}
		this.create();
	}
	this.create = function(){
		try{
			obj.req.open(obj.method,encodeURI(obj.url),true);
			if(obj.sendContent != null){
				obj.req.setRequestHeader(obj.header.h,obj.header.v);
			}
			obj.req.onreadystatechange = this.readyStateChange;
			obj.req.send(obj.sendContent);
		}catch(err){
			var objReq = this.req;
			var obj = this;
			objReq.open(obj.method,encodeURI(obj.url),true);
			if(obj.sendContent != null){
				objReq.setRequestHeader(obj.header.h,obj.header.v);
			}
			objReq.onreadystatechange = function(){
				if(objReq.readyState == 4){
					if(objReq.status == 200){
						if(obj.setResponse == 'XML'){
							obj.exitData(objReq.responseXML);
						}else if(obj.setResponse == 'TEXT'){
							obj.exitData(objReq.responseText);
						}
					}else{
						obj.statusReq(objReq.status);
					}
				}else{
					obj.readyState(objReq);
				}
			}
			objReq.send(obj.sendContent);
		}
	}
	this.readyState = function(req){}
	this.statusReq = function(req){}
	this.readyStateChange = function(){
			if(obj.req.readyState == 4){
				if(obj.req.status == 200){
					if(obj.setResponse == 'XML'){
						obj.exitData(obj.req.responseXML);
					}else if(obj.setResponse == 'TEXT'){
						obj.exitData(obj.req.responseText);
					}
				}else{
					obj.statusReq(obj.req.status);
				}
			}else{
				obj.readyState(obj.req);
			}
	}
	this.exitData = function(_resData){}
}
