// JavaScript Document
// Aqui valido el formulario del nuevo articulo, no les copie todas las funciones porque son demasiadas.
function Activo(){
var serialemp = document.getElementById("serialemp");
var serial = document.getElementById("serial");
var descripcion = document.getElementById("descripcion");
var proveedor = document.getElementById("proveedor");
var ubicacion = document.getElementById("ubicacion");
var area = document.getElementById("area");
var factura = document.getElementById("factura");
var fecha_adq = document.getElementById("fecha_adq");
var fecha_gar = document.getElementById("fecha_gar");
var cantidad = document.getElementById("cantidad");
var precio = document.getElementById("precio");
var estado = document.getElementById("estado");
var ci_responsable = document.getElementById("ci_responsable");
var nombre_responsable = document.getElementById("nombre_responsable");
var ci_usuario = document.getElementById("ci_usuario");
var nombre_usuario = document.getElementById("nombre_usuario");

// Check each input in the order that it appears in the form!
if(notEmpty(serialemp, "Por favor ingrese algun serial empresarial para el activo") && isNumeric(serialemp,"Por favor ingrese sólo números para el serial empresarial"))
	{
	if(isSerialEmp(serialemp,"Por favor ingrese un serial empresarial válido, no debe tener ni más ni menos de 7 caracteres"))
		{
		if(notEmpty(serial, "Por favor ingrese el serial del artículo, en caso no tener, coloque N/A"))
			{
			if(notEmpty(descripcion, "Por favor ingrese una descripción del artículo/activo"))
				{
				if(madeSelectionProveedor(proveedor, "Por favor seleccione un proveedor"))
					{
					if(madeSelectionUbicacion(ubicacion, "Por favor seleccione una ubicación"))
						{
						if(madeSelectionArea(area, "Por favor seleccione un Area"))
							{
							if(notEmpty(factura,"Ingrese el número o código de Factura"))
								{
								if(fecha(fecha_adq,"Por favor haga clic en el cuadro de texto de Fecha de Adquisición para seleccionar una fecha"))
									{
									if(fecha(fecha_gar,"Por favor haga clic en el cuadro de texto de Fecha de Vencimiento de Garantía para seleccionar una fecha"))
										{
											if (notEmpty(cantidad,"Por favor ingrese la cantidad del(de los) artículo(s)") && isNumeric(cantidad,"Sólo son aceptados números para la cantidad"))
											{
												if (notEmpty(precio,"Por favor ingrese el precio del(de los) artículo(s)") && isNumeric(precio,"Sólo son aceptados números para el precio, Ej: 106.45 "))
													{
													if (madeSelectionEstado(estado, "Por favor seleccione un estado"))
														{
														if (madeSelectionResponsable(ci_responsable, "Por favor seleccione una persona Responsable"))
															{
															if (notEmpty (nombre_responsable, "Por favor seleccione una persona Responsable"))
																{
																if (madeSelectionUsuario(ci_usuario, "Por favor seleccione la persona usuario(a)"))
																	{
																	if (notEmpty(nombre_usuario,"Por favor seleccione la persona usuario(a)"))
																		{
																		return true;
																		}
																	}
																}
															}
														}
													}
												}		
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
return false;
}

function Proveedor(){
// Make quick references to our fields
var rif1 = document.getElementById("rif1");
var rif2 = document.getElementById("rif2");
var rif3 = document.getElementById("rif3");
var nombre = document.getElementById("nombre");
var especialidad = document.getElementById("especialidad");
var direccion = document.getElementById("direccion");
var telefono = document.getElementById("telefono");
var fax = document.getElementById("fax");
var contacto = document.getElementById("contacto");
var celular = document.getElementById("celular");
var correo = document.getElementById("correo");

if (notEmpty(rif2, "Por favor ingrese la segunda parte del Rif") && isNumeric(rif2,"Por favor ingrese sólo números para el rif"))
{
	if (isRif2(rif2, "Debe ingresar 8 caracteres para la segunda parte del Rif"))
	{
		if (notEmpty(rif3,"Por favor ingrese la última parte del Rif") && isNumeric(rif3,"Por favor ingrese sólo números para el rif"))
		{
			if (notEmpty(nombre, "Por favor ingrese el nombre del proveedor"))
			{
				if(madeSelectionEspecialidad(especialidad,"Por favor seleccione alguna especialidad"))
				{
					if(notEmpty(direccion,"Por favor ingrese la dirección del Proveedor"))
					{
						if(notEmpty(telefono,"Por favor ingrese algún teléfono del proveedor") && isNumeric(telefono,"Por favor sólo ingrese números para el teléfono"))
						{
							if(isTel(telefono,"Los teléfonos deben tener 11 caracteres"))
							{
								if(notEmpty(fax,"Por favor ingrese algún número de fax, en caso de no tener colocar once (11) ceros (0)"))
								{
									if(isNumeric(fax,"Por favor sólo ingrese números para el Fax") && isTel(fax,"El número de fax debe tener 11 caracteres"))
									{
										if(notEmpty(contacto,"Por favor ingrese una persona de contacto en caso de no tener colocar: NO APLICA"))
										{
											if(notEmpty(celular,"Por favor ingrese algún número de celular, en caso de no tener colocar once (11) ceros (0)"))
											{
												if(isNumeric(celular,"Por favor sólo ingrese números para el Celular") && isTel(celular,"El número de Celular debe tener 11 caracteres"))
												{
													if(notEmpty(correo,"Por favor ingrese algún correo, en caso de no aplicar coloque: NO@HAY.COM") && emailValidator(correo,"Por favor ingres un correo valido, en caso de no aplicar coloque: NO@HAY.COM"))
													{
return true;
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
}
return false;
}


function Ubicacion(){
// Make quick references to our fields
var ubicacion = document.getElementById("ubicacion");

if(notEmpty(ubicacion,"Por favor ingrese alguna ubicación"))
	{
	return true;
	}
return false;
}

function EnvioCorreo()
{
var i = <?php echo $cantidad; ?>;	
var cantidad = new Array();
var medida = new Array();
var descripcion = new Array();
for(i = 0; i < cant; i++){
	cantidad[i] = document.getElementById("cantidad_"+i).value;
	medida[i] = document.getElementById("medida_"+i).value;
	descripcion[i] = document.getElementById("descripcion_"+i).value;
	
if (notEmpty(cantidad[i],"Por favor ingrese una cantidad") && isNumeric(cantidad[i],"La cantidad debe ser un número"))
{
	if (notEmpty(descripcion[i],"Por favor ingrese alguna descripción del artículo a pedir"))
	{
		return true;
	}
}
return false;

}
}

function Area(){
var area = document.getElementById("area");

if(notEmpty(area,"Por favor introduzca algún area"))
	{
	return true;
	}
return false;
}

function Especialidad(){
var especialidad = document.getElementById("especialidad");

if (notEmpty(especialidad,"Por favor ingrese alguna especialidad"))
	{
	return true;
	}
return false;
}

function Responsable()
{
// Make quick references to our fields	
var cedula = document.getElementById("cedula2");
var nombre = document.getElementById("nombre");
var cargo = document.getElementById("cargo");

if (notEmpty(cedula,"Por favor ingrese un número de cédula") && isNumeric(cedula,"Por favor sólo ingrese números para la cédula"))
{
	if (notEmpty(nombre,"Por favor ingrese algún nombre"))
	{
		if (notEmpty(cargo,"por favor ingrese algún cargo"))
		{
			return true;
		}
	}
}
return false;
}

function Usuario()
{
var usuario = document.getElementById("usuario");
var clave = document.getElementById("clave");
var nivel = document.getElementById("nivel");

if(notEmpty(usuario,"Por favor ingrese un nombre de usuario") && emailValidator(usuario,"Por favor ingrese un correo válido"))
{
	if(notEmpty(clave,"Por favor ingrese una clave") && isRif2(clave,"La clave debe tener 8 caracteres"))
	{
		if(madeSelectionNivel(nivel,"Por favor seleccione el nivel del usuario"))
		{
	return true;
		}
	}
}
return false;
}

function Orden()
{
var codigo = document.getElementById("serial_emp");
var descripcion = document.getElementById("descripcion");
var serial = document.getElementById("serial");
var proveedor = document.getElementById("proveedor");
var direccion = document.getElementById("direccion");
var telefono = document.getElementById("telefono");
var motivo = document.getElementById("motivo_salida");
var fecha_sal = document.getElementById("fecha_salida");
var cedula = document.getElementById("ci_salida");
var nombre = document.getElementById("nombre_salida");

if (madeSelectionActivo(codigo,"Por favor seleccione algun activo por código"))
{
	if (madeSelectionProveedor(proveedor,"Por favor seleccione un proveedor"))
	{
		if (madeSelectionMotivo(motivo,"Por favor seleccione el motivo de salida del artículo"))
		{
			if (fecha(fecha_sal,"Por favor haga clic sobre el campo de texto para seleccionar la fecha de salida del artículo"))
			{
				if (notEmpty(cedula,"Por favor ingrese un número de cedula") && isNumeric (cedula,"La cedula solo pueden ser números"))
				{
					if (notEmpty(nombre,"Por favor ingrese algún nombre de la persona que da salida al artículo"))
					{
						return true;	
					}
				}
			}
		}
	}
}
return false;
}
function Ingreso()
{
var usuario = document.getElementById("usuario");
var clave = document.getElementById("password");


if(notEmpty(usuario,"Por favor ingrese un nombre de usuario") && emailValidator(usuario,"Por favor ingrese un correo válido"))
{
	if(notEmpty(clave,"Por favor ingrese una clave") && isRif2(clave,"La clave debe tener 8 caracteres"))
	{
	return true;
	}
}
return false;
}

function envia_correo(){
var nombre = document.getElementById("nombre");
var correo = document.getElementById("correo");
var password = document.getElementById("password");
var cantidad = document.getElementById("cantidad");

if (notEmpty (nombre,"Por favor ingrese su nombre o el de la persona que va a enviar el correo"))
{
	if (notEmpty (correo,"Por favor ingrese su correo") && emailValidator(correo,"Por favor ingrese un correo válido"))
	{
		if (notEmpty(password,"Por favor ingrese el password de su correo") && isAlphanumeric(password,"Por favor ingrese una clave válida"))
		{
			if (notEmpty(cantidad,"Por favor ingrese la cantidad de artículos a pedir") && isNumeric(cantidad,"Sólo puede ingresar números en la cantidad"))
			{
	return true;
			}
		}
	}
}
return false;
}

function Entrega()
{
var activo = document.getElementById("serial_emp_2");
var descripcion = document.getElementById("descripcion");
var serial = document.getElementById("serial");
var fecha = document.getElementById("fecha_entrada");
var cedula = document.getElementById("ci_receptor");

if (madeSelectionActivo(activo,"Por favor seleccione un activo de la lista"))
{
	if (notEmpty(serial,"Debe seleccionar un activo valido para poder realizar la nota de entrega, en caso de no existir, debe verificar que tenga su respectiva orden de salida"))
	{
		if (fecha(fecha,"Por favor haga clic sobre el campo de texto para seleccionar una fecha"))
		{
			if(madeSelectionReceptor(cedula,"Por favor seleccione la persona receptora"))
			{
			return true;	
			}
		}
	}
}
return false;
}

function Requisicion()
{
var cedula = document.getElementById("cedula2");
var nombre = document.getElementById("nombre_solicitante");
var correo = document.getElementById("correo_solicitante");
var fecha2 = document.getElementById("fecha_solicitante");
var cantidad = document.getElementById("cantidad");
if (notEmpty(cedula,"Por favor ingrese alguna cedula") && isNumeric(cedula,"La cedula solo puede contener números"))
{
	if (notEmpty(nombre,"Por favor introduzca el nombre del solicitante"))
	{
		if (notEmpty(correo,"Por favor ingrese algun correo del solicitante") && emailValidator(correo,"Por favor ingrese un correo valido"))
		{
			if (fecha(fecha2,"Por favor haga clic en el campo de texto para seleccionar la fecha de solicitud"))
			{
				if (notEmpty(cantidad,"Por favor ingrese la cantidad de artículos a solicitar") && isNumeric(cantidad,"Sólo puede ingresar números para la cantidad de artículos a solicitar"))
				{
				return true;
				}
			}
		}
	}
}
return false;
}
function notEmpty(elem, helperMsg)
{
	if(elem.value.length == 0)
	{
		alert(helperMsg);
		elem.focus(); // Devuelvo al usuario al input
		return false;
	}
	return true;
}

function isSerialEmp(elem, helperMsg)
{
	if(elem.value.length != 7)
	{
		alert(helperMsg);
		elem.focus(); // Devuelvo al usuario al input
		return false;
	}
	return true;
}

function isRif2(elem, helperMsg)
{
	if(elem.value.length != 8)
	{
		alert(helperMsg);
		elem.focus(); // Devuelvo al usuario al input
		return false;
	}
	return true;
}

function isRif3(elem, helperMsg)
{
	if(elem.value.length != 1)
	{
		alert(helperMsg);
		elem.focus(); // Devuelvo al usuario al input
		return false;
	}
	return true;
}

function isTel(elem, helperMsg)
{
	if(elem.value.length != 11)
	{
		alert(helperMsg);
		elem.focus(); // Devuelvo al usuario al input
		return false;
	}
	return true;
}

function isNumeric(elem, helperMsg)
{
	var numericExpression = /^[0-9]+$/;
	if(elem.value.match(numericExpression))
	{
		return true;
	}
	else
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}


function isAlphabet(elem, helperMsg)
{
	var alphaExp = /^[a-zA-Z]+$/;
	if(elem.value.match(alphaExp))
	{
		return true;
	}
	else
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}



function isAlphanumeric(elem, helperMsg)
{
	var alphaExp = /^[0-9a-zA-Z]+$/;
	if(elem.value.match(alphaExp))
	{
		return true;
	}
	else
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isTelnumber(elem, helperMsg)
{
	var uInput = elem.value;
	if(uInput.length == 11)
	{
		return true;
	}
	else
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isRifnumber1(elem, helperMsg)
{
	var uInput = elem.value;
	if(uInput.length == 8)
	{
		return true;
	}
	else
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}


function isRifnumber2(elem, helperMsg)
{
	var uInput = elem.value;
	if(uInput.length == 1)
	{
		return true;
	}
	else
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function lengthRestriction(elem, min, max)
{
	var uInput = elem.value;
	if(uInput.length >= min && uInput.length <= max)
	{
		return true;
	}
	else
	{
		alert("Por favor ingrese entre " +min+ " y " +max+ " caracteres");
		elem.focus();
		return false;
	}
}

function madeSelectionEspecialidad(elem, helperMsg)
{
	if(elem.value == "Seleccione Especialidad")
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function madeSelectionReceptor(elem, helperMsg)
{
	if(elem.value == "Seleccione Receptor")
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function madeSelectionNivel(elem, helperMsg)
{
	if(elem.value == "Seleccione Nivel")
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function madeSelectionProveedor(elem, helperMsg)
{
	if(elem.value == "Seleccione Proveedor")
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function madeSelectionMotivo(elem, helperMsg)
{
	if(elem.value == "Seleccione Motivo")
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function madeSelectionActivo(elem, helperMsg)
{
	if(elem.value == "Seleccione Activo")
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function fecha(elem, helperMsg)
{
	if(elem.value == "Haga clic aquí para escoger fecha.")
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function madeSelectionUbicacion(elem, helperMsg)
{
	if(elem.value == "Seleccione Ubicación")
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function madeSelectionArea(elem, helperMsg)
{
	if(elem.value == "Seleccione Area")
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function madeSelectionResponsable(elem, helperMsg)
{
	if(elem.value == "Seleccione Responsable")
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function madeSelectionUsuario(elem, helperMsg)
{
	if(elem.value == "Seleccione Usuario")
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function madeSelectionEstado(elem, helperMsg)
{
	if(elem.value == "Seleccione Estado")
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function emailValidator(elem, helperMsg)
{
	var correoexp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	if(elem.value.match(correoexp))
	{
		return true;
	}
	else
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function ajaxFunction(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Su navegador no soporta AJAX, por favor hable con sistemas");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('nombre_responsable');
			ajaxDisplay.value = ajaxRequest.responseText; 
		}
	}
	var ci_responsable = document.getElementById('ci_responsable').value;
	var queryString = "?ci_responsable=" + ci_responsable;
	ajaxRequest.open("GET", "../../AJAX/ci_responsable.php" + queryString, true);
	ajaxRequest.send(null); 
}

function ajaxFunction2(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Su navegador no soporta AJAX, por favor hable con sistemas");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('nombre_usuario');
			ajaxDisplay.value = ajaxRequest.responseText; 
		}
	}
	var ci_usuario = document.getElementById('ci_usuario').value;
	var queryString = "?ci_usuario=" + ci_usuario;
	ajaxRequest.open("GET", "../../AJAX/ci_usuario.php" + queryString, true);
	ajaxRequest.send(null); 
}


function ajaxFunction3(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Su navegador no soporta AJAX, por favor hable con sistemas");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay1 = document.getElementById('descripcion');
			var ajaxDisplay2 = document.getElementById('serial');
			var resultado = ajaxRequest.responseText; 
			if (resultado != '--')
			{
				var resul = resultado.split('--');
				ajaxDisplay1.value = resul[0];
				ajaxDisplay2.value = resul[1];
			}
			else
			{
				ajaxDisplay1.value = "";
				ajaxDisplay2.value = "";
			}
		}
	}
	var activo = document.getElementById('serial_emp').value;
	var queryString = "?activo=" + activo;
	ajaxRequest.open("GET", "../../AJAX/activo2.php" + queryString, true);
	ajaxRequest.send(null); 
}

function ajaxFunction4(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Su navegador no soporta AJAX, por favor hable con sistemas");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay1 = document.getElementById('direccion');
			var ajaxDisplay2 = document.getElementById('telefono');
			var resultado = ajaxRequest.responseText; 
			if (resultado != '--')
			{
				var resul = resultado.split('--');
				ajaxDisplay1.value = resul[0];
				ajaxDisplay2.value = resul[1];
			}
			else
			{
				ajaxDisplay1.value = "";
				ajaxDisplay2.value = "";
			}
		}
	}
	var proveedor = document.getElementById('proveedor').value;
	var queryString = "?proveedor=" + proveedor;
	ajaxRequest.open("GET", "../../AJAX/proveedor.php" + queryString, true);
	ajaxRequest.send(null); 
}

function ajaxFunction5(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Su navegador no soporta AJAX, por favor hable con sistemas");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay1 = document.getElementById('descripcion');
			var ajaxDisplay2 = document.getElementById('serial');
			var ajaxDisplay3 = document.getElementById('proveedor');
			var ajaxDisplay4 = document.getElementById('direccion');
			var ajaxDisplay5 = document.getElementById('telefono');
			var resultado = ajaxRequest.responseText; 
			if (resultado != '--')
			{
				var resul = resultado.split('--');
				ajaxDisplay1.value = resul[0];
				ajaxDisplay2.value = resul[1];
				ajaxDisplay3.value = resul[2];
				ajaxDisplay4.value = resul[3];
				ajaxDisplay5.value = resul[4];
			}
			else
			{
				ajaxDisplay1.value = "";
				ajaxDisplay2.value = "";
				ajaxDisplay3.value = "";
				ajaxDisplay4.value = "";
				ajaxDisplay5.value = "";
			}
		}
	}
	var activo = document.getElementById('serial_emp_2').value;
	var queryString = "?activo=" + activo;
	ajaxRequest.open("GET", "../../AJAX/activo.php" + queryString, true);
	ajaxRequest.send(null); 
}

function ajaxFunction6(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Su navegador no soporta AJAX, por favor hable con sistemas");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('nombre_receptor');
			ajaxDisplay.value = ajaxRequest.responseText; 
		}
	}
	var ci_receptor = document.getElementById('ci_receptor').value;
	var queryString = "?ci_receptor=" + ci_receptor;
	ajaxRequest.open("GET", "../../AJAX/ci_responsable2.php" + queryString, true);
	ajaxRequest.send(null); 
}
