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 enviarRegistro(){
	
	var nombre, edad, email;
	
	contenedor = document.getElementById('consultar');
	
	nombre = document.getElementById('nombre').value;
	edad = document.getElementById('edad').value;
	email = document.getElementById('email').value;
	
	ajax=nuevoAjax();
	contenedor.innerHTML = '<p style="text-align:center;"><img src="../../js/registro/proceso2.gif"/></p>'; 
	
	ajax.open("POST", "registro/envio_registro.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("nombre="+nombre+"&edad="+edad+"&email="+email)
	
	limpiar();
}

function limpiar(){
		document.registro.nombre.value="";
		document.registro.edad.value="";
		document.registro.email.value="";
		document.registro.nombre.focus();
}


function abrirRegistro()
{
  window.parent.location='index.php?registro';
}

