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 cargarContenido(html){
	var contenedor;
	contenedor = document.getElementById('contenedor');
	ajax=nuevoAjax();
	ajax.open("GET", html,true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText
		}
	}
	ajax.send(null)
}

function cargarContenidoGET(url_rep, nac, ci)
{
	var contenedor;
	contenedor = document.getElementById('contenedor');
	
	ajax=nuevoAjax();
	ajax.open("GET", url_rep+"?nacionalidad="+nac+"&cedula="+ci,true);
	ajax.onreadystatechange=function()
	{
		if (ajax.readyState==4)
		{contenedor.innerHTML = ajax.responseText}
	}
	ajax.send(null)
	
}

function BuscaREP(url_rep, nac, ci)
{
	//Este script abre es espacio para mostrar el div
	opc_menu = document.getElementById("datos_registro_electoral");
	opc_menu.className = 'div_visible';
	
	if (isNaN(ci))
	{
		alert("Debe ingresar un número de Cédula válido");
	}
	else
	{
		mostrar_consulta_re();
		setTimeout(cargarContenidoGET(url_rep, nac, ci), 100);
	}
}

function mostrar_consulta_re()
{	var objid ="datos_registro_electoral";
	var head1 = document.getElementById(objid);
	
	if (navigator.userAgent.indexOf("Netscape6") != -1)
	{head1.style.visibility="visible";}
	else
	{head1.style.display="";}
}

function ocultar_consulta_re()
{	var objid = "datos_registro_electoral";
	var head1 = document.getElementById(objid);
	
	if (navigator.userAgent.indexOf("Netscape6") != -1)
	{head1.style.visibility="hidden";}
	else
	{head1.style.display="none";}
}
