function xmlhttpPost(strURL,parameters,change_field) {
	var xmlHttpReq = false;
	var depth;
	if (window.XMLHttpRequest) { // Mozilla, Safari, IE 7...
		xmlHttpReq = new XMLHttpRequest();
		if (navigator.appName.indexOf('Microsoft') != -1){
			depth=1;
		}else{
			depth=0;
		}
		if (xmlHttpReq.overrideMimeType) {
			// set type accordingly to anticipated content type
			xmlHttpReq.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
		try {
			xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
			depth=1;
		} catch (e) {
			try {
				xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
				depth=1;
			} catch (e) {}
		}
	}
	xmlHttpReq.open('POST', strURL, true);
	xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttpReq.setRequestHeader("Content-length", parameters.length);
	xmlHttpReq.setRequestHeader("Connection", "close");
	xmlHttpReq.send(parameters);

	xmlHttpReq.onreadystatechange = function() {
		if (xmlHttpReq.readyState == 4) {
			if (xmlHttpReq.status == 200) {
				return set_options(xmlHttpReq,change_field,depth);
			}
		}
	}
}


function rebuild_spon_contact(field,change_field){
	vars=field.name+"="+field.value;
	if (typeof(field.value) != 'undefined'){
		if (field.value!=''){
			text=xmlhttpPost("/ajax.php?type=spon_contact",vars,change_field);
		}
	}
}
function rebuild_cont_contact(field,change_field){
	vars=field.name+"="+field.value;
	if (typeof(field.value) != 'undefined'){
		if (field.value!=''){
			text=xmlhttpPost("/ajax.php?type=cont_contact",vars,change_field);
		}
	}
}
function set_options(response,change_field,depth){
	obj=document.getElementById(change_field);
	//alert('inner=>'+obj.innerHTML);
	for (i = (obj.options.length-1); i >= 0; i--){
		obj.options[i]=null;
	}
	//alert('response=>'+response.responseText);
	count=response.responseXML.documentElement.attributes[0].value;
	obj.options[0]=new Option('Choose One','');
	for (x=0; x<=count-1; x++){
		if (depth==0){
			//Netscape
			var person_id=response.responseXML.childNodes[depth].childNodes[x].childNodes[0].childNodes[0].textContent;
			var first_name=response.responseXML.childNodes[depth].childNodes[x].childNodes[0].childNodes[1].textContent;
			var last_name=response.responseXML.childNodes[depth].childNodes[x].childNodes[0].childNodes[2].textContent;	
		}else{
			//IE..
			var person_id=response.responseXML.childNodes[depth].childNodes[x].childNodes[0].childNodes[0].text;
			var first_name=response.responseXML.childNodes[depth].childNodes[x].childNodes[0].childNodes[1].text;
			var last_name=response.responseXML.childNodes[depth].childNodes[x].childNodes[0].childNodes[2].text;
		}
		obj.options[x+1]=new Option(last_name+', '+first_name,person_id);

	}
}