	function GetXmlHttpObject(){
		var xmlHttp=null;

		try {xmlHttp=new XMLHttpRequest();} // Firefox, Opera 8.0+, Safari
  		catch (e){
			try {xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");} // Internet Explorer
			catch (e){
				try {xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");} // Internet Explorer 5.5
	  			catch (e) {xmlHttp=null;}
	  		}
	  	}

		if (xmlHttp==null) {alert ("Your browser does not support AJAX!");}
	  	return xmlHttp;
	}

	//------------------------------------------------------------------------------------------------

	var fld = "";
	var mtd = "";

	function ajax(fn,q,m,f,msg){
		if (q=="") return;
		xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) {return;}

		mtd = m;
		fld = f;

		if (mtd=="span") {document.getElementById(fld).innerHTML=msg;}
		if (mtd=="span2") {
			document.getElementById(fld).innerHTML=msg+"\n"+
				"<input type='hidden' name='qids' id='qids' value=''/>\n"+
				"<input type='hidden' value='0' id='sd' name='sd' />\n"+
				"<input type='hidden' value='0' id='dop' name='dop' />\n"+
				"<input type='hidden' value='0' id='dofoc' name='dofoc' />\n"+
				"<input type='hidden' value='43' id='pc' name='pc' />\n"+
				"";
			;
		}
		var url="__ajax.php";

		url=url+"?fn="+fn;
		url=url+"&m="+m;
		url=url+"&f="+f;
		url=url+"&q="+q;
		url=url+"&seed="+Math.random();
		xmlHttp.onreadystatechange=ajaxResponse;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}

	function ajaxResponse()  {
		if (xmlHttp.readyState==4) {
			if (mtd=="eval") {eval(xmlHttp.responseText);}
			if (mtd=="span") {document.getElementById(fld).innerHTML=xmlHttp.responseText;}
			if (mtd=="span2") {document.getElementById(fld).innerHTML=xmlHttp.responseText;}
			if (mtd=="field") {document.getElementById(fld).value=xmlHttp.responseText;}

			if (gebi('btnquote')!=null) {
				if (xmlHttp.responseText.indexOf("Product Cost")!=-1) {
					gebi('btnquote').disabled=false;
				}
			}
		}
	}
