	function objetoAjax(){
		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 eliminarDato(idempleado){
		divResultado = document.getElementById('resultado');

		var eliminar = confirm("De verdad desea eliminar este dato?")
		if ( eliminar ) {

			ajax=objetoAjax();

			ajax.open("GET", "eliminacion.php?idempleado="+idempleado);
			ajax.onreadystatechange=function() {
				if (ajax.readyState==4) {
					divResultado.innerHTML = ajax.responseText
				}
			}
			ajax.send(null)
		}
	}

	function SendReason(numid){

		divResultado = document.getElementById('then_'+numid);

		id_id = document.getElementById('id_'+numid);
		id_re = document.getElementById('reason_'+numid);
		
		idhidd = id_id.value;
		reason = id_re.value;
		/*
		idhidd = document.subs.id_+numid.value;
		reason = document.subs.reason_+numid.value;
		*/
		ajax=objetoAjax();

		ajax.open("POST", "php/bgproc.php",true);
		ajax.onreadystatechange=function() {
			if (ajax.readyState==4) {
				divResultado.innerHTML = ajax.responseText;				//LimpiarCampos();
			}
		}
		ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

		ajax.send("idreason="+idhidd+"&reason="+reason)
	}

	function LimpiarCampos(){
		document.nuevo_empleado.nombres.value="";
		document.nuevo_empleado.departamento.value="";
		document.nuevo_empleado.sueldo.value="";
		document.nuevo_empleado.nombres.focus();
	}
