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 enviaCodigo(){

  var contenedor;
  var calle;
  var numero;
  var comuna;

	contenedor = document.getElementById('codigo_postal');
	calle= document.getElementById('Id_calle').value;
	numero= document.getElementById('Id_numero').value;
	comuna= document.getElementById('Id_comuna').value;

	ajax=nuevoAjax();
	contenedor.innerHTML = '<p style="text-align:center;"><img src="../../../codigo_postal/invita_amigo/proceso2.gif"/></p>'; 
	ajax.open("POST", "av-modules/microservicios/busca_zipcode/envia_codigo.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText
       		}
	}

	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("calle="+calle+"&numero="+numero+"&comuna="+comuna)
}
