// JavaScript Document
function myajax()
{
	//建構子
	this.xmlHttp;
	if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}else if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (!xmlHttp) {
		alert('您使用的瀏覽器不支援 XMLHTTP 物件');
		return false;
	}else{
		this.xmlHttp = xmlHttp;
	}
}

myajax.prototype.getRequest=function(url,par)
{
	//var url= this.url + '?key=' + this.key + '&com=' + this.fCom + '&ID=' + this.id.value+'&ts='+new Date().getTime();
	this.sendRequest(url,par);
}

myajax.prototype.sendRequest=function(url,par)
{	
	var pointer=this;
	this.xmlHttp.open('POST',url,true);
	this.xmlHttp.onreadystatechange=function(){pointer.catchXML();};
	this.xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	this.xmlHttp.send(par);
}

myajax.prototype.catchXML=function()
{
	if (this.xmlHttp.readyState==4)
	{
		if(this.selectxml == true)
			xml=this.xmlHttp.responseXML;
		else
			xml=this.xmlHttp.responseText;
		if (this.xmlHttp.status == 200) {
    		//this.xmlDoc = getNodeContent(xml,'product');
			callback_onload = this.myfun;	//回傳函數
			callback_onload(xml,this.field);//回傳值,物件id
		}else{
			alert(this.xmlHttp.status);
		}
	}
}