/****************************************
*
*/
function UaAjax(){
	this.httpObj;
}
/****************************************
*
*/
UaAjax.prototype.httpRequest = function(pObj){
	this.target_url = (pObj.url)?pObj.url:"";
	this.cbObj = (pObj.cbObj)?pObj.cbObj:null;
	this.callback = (pObj.callback)?pObj.callback:null;
	this.errCallback = (pObj.errCallback)?pObj.errCallback:null;
	this.enableCallback = (pObj.enableCallback)?pObj.enableCallback:null;
	this.method = (pObj.method)?pObj.method:"POST";
	this.sendData = (pObj.data)?pObj.data:"";
	this.isXML = (pObj.isXML)?pObj.isXML:false;
	var instance = this;

	try {
		if(window.XMLHttpRequest) {
			this.httpObj = new XMLHttpRequest();
		} else if(window.ActiveXObject) {
			this.httpObj = new ActiveXObject("Microsoft.XMLHTTP");
		} else {
			this.httpObj = false;
		}
	} catch(e) {
		this.httpObj = false;
	}
	if(! this.httpObj && this.enableCallback) {
		this.cbObj[this.enableCallback]();
		return false;
	}

	this.target_url += "?uardm="+Math.floor(Math.random()*10000);
	this.httpObj.open(this.method, this.target_url, true);
	var obj = this.httpObj;
	this.httpObj.onreadystatechange = function() {
		if (obj.readyState == 4) {
			if (obj.status == 200) {
				var res = (instance.isXML)?obj.responseXML:obj.responseText;
				if(instance.cbObj){
					instance.cbObj[instance.callback](res);
				}
			} else {
				if(instance.errCallback){
					if(instance.cbObj){
						instance.cbObj[instance.errCallback]();
					}
					//alert(obj.status + ' : ' + obj.statusText);
					return false;
				}
			}
		}
	}

	this.httpObj.send(this.sendData);
}
/****************************************
*
*/
UaAjax.prototype.httpObjGenerateFail = function(){
				if(this.cbObj && this.errCallback){
					this.cbObj[this.errCallback]("お使いのブラウザでは正しくサイトをご覧いただけません。詳しくはこのサイトについてをご覧ください。");
				}
	return false;
}

