function Buscador(){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 Buscar() {
	q = document.getElementById('valor').value;
	c = document.getElementById('resultados');
	ajax = Buscador();
	ajax.open("GET","procesar.php?q="+q);
	ajax.onreadystatechange=function() {
		if (ajax.readyState == 4) {
			c.innerHTML = ajax.responseText;
		}
	}
	ajax.send(null)
}
function Editar(q) {
	c = document.getElementById('resultados');
	ajax = Buscador();
	ajax.open("GET","editar.php?q="+q);
	ajax.onreadystatechange=function() {
		if (ajax.readyState == 4) {
			c.innerHTML = ajax.responseText;
		}
	}
	ajax.send(null)
}
function GuardarEdicion(q) {
	c = document.getElementById('resultados');
	a = document.getElementById('grado').value;
b = document.getElementById('nombre').value;
d = document.getElementById('curso').value;
e = document.getElementById('division').value;
f = document.getElementById('dni').value;
g = document.getElementById('dom').value;
h = document.getElementById('ddn').value;
i = document.getElementById('telefono').value;
j = document.getElementById('celular').value;
k = document.getElementById('email').value;
l = document.getElementById('padre').value;
m = document.getElementById('dnipadre').value;
n = document.getElementById('celpadre').value;
o = document.getElementById('mailpadre').value;
p = document.getElementById('ocupapadre').value;
ñ = document.getElementById('madre').value;
r = document.getElementById('dnimadre').value;
s = document.getElementById('celmadre').value;
t = document.getElementById('mailmadre').value;
u = document.getElementById('ocupamadre').value;
v = document.getElementById('tutor').value;
w = document.getElementById('fecnac').value;
x = document.getElementById('lugnac').value;
y = document.getElementById('nacion').value;
z = document.getElementById('religion').value;
	ajax = Buscador();
        ajax.open("GET","guardar.php?id="+q+"&a="+a+"&b="+b+"&d="+d+"&e="+e+"&f="+f+"&g="+g+"&h="+h+"&i="+i+"&j="+j+"&k="+k+"&l="+l+"&m="+m+"&o="+o+"&p="+p+"&ñ="+ñ+"&r="+r+"&s="+s+"&t="+t+"&u="+u+"&v="+v+"&w="+w+"&x="+x+"&y="+y+"&z="+z);
	ajax.onreadystatechange=function() {
		if (ajax.readyState == 4) {
			c.innerHTML = ajax.responseText;
		}
	}
	ajax.send(null)
}
function Eliminar(q) {
	c = document.getElementById('resultados');
	ajax = Buscador();
	ajax.open("GET","eliminar.php?q="+q);
	ajax.onreadystatechange=function() {
		if (ajax.readyState == 4) {
			c.innerHTML = ajax.responseText;
		}
	}
	ajax.send(null)
}
function Confirmar(q) {
	c = confirm('¿Realmente desea eliminar el registro?');
	if (c) {
		Eliminar(q);
	} else {
		return false;
	}
}
