function nuevoAjax(){ 
	var xmlhttp=false; 
	try { 
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e){ 
		try	{ 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) {
			xmlhttp=false;
		}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp=new XMLHttpRequest();
	} 
	return xmlhttp; 
}

function cercarPobl(selPobl, selProv, idForm, idi){
	// alert(selPobl+", "+selProv+", "+idForm+", "+idi);
	if (idForm==''){ idForm="form1"; }
	var selectOrig=document[idForm][selProv];
	var selectDestino= document[idForm][selPobl];
	var modSelects= document.getElementById('modSelects');
	
	selectDestino.value = _carregant_pobla_;
	var valorInput = selectOrig.value;
	//
	// selectDestino.length=0;
	// var nuevaOpcion=document.createElement("option");
	//  nuevaOpcion.value=0;
	//  nuevaOpcion.innerHTML="...";
	// selectDestino.appendChild(nuevaOpcion);
	//
	/* if (valorInput==0){
		selectDestino.length=0;
		var nuevaOpcion=document.createElement("option");
		nuevaOpcion.value=0;
		nuevaOpcion.innerHTML=_seleccioni_prov_;
		selectDestino.appendChild(nuevaOpcion);
	} else {*/
		var ajax=nuevoAjax();
		//capa.innerHTML="<span class=Verd10_ffffffB>Cercan DNI...</span>";
		ajax.open("POST", "includes/cercarPobl_process.php", true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send("d="+valorInput+"&idInput="+selectDestino.name);
	
		ajax.onreadystatechange=function(){
			if (ajax.readyState==4){
				modSelects.innerHTML= ajax.responseText;
				// alert(ajax.responseText);
			}
		}
	// }
}
