
/* INTERFACE DE USUARIO */
var PROYECTO = "CENSO ECONOMMICO 2009";
var TITULO = "--";
var DERECHO_AUTOR = "Copyright © INEI CENSOS NACIONALES - 2009. Derechos Reservados";


var NIVEL_DPTO = "dpto";
var NIVEL_PROV = "prov";
var NIVEL_DIST = "dist";

function getCliente(){
	if (!top.oCliente) {
		top.oCliente = new cliente();
		//alert("iniciando cliente");
	}
	return top.oCliente;
}


function iniciar () {
	//oCliente = new cliente();
	oCliente = getCliente();
  oCliente.iniciar();
}

function iniciarCuerpo () {
  //oCliente = new cliente();
	oCliente = getCliente();
	oCliente.iniciarCuerpo();
}

function cerrar(){
	//parent.document.location.href="pd_login.asp";
	window.close();
}

function validarNumero (texto) {
	var numero = "0123456789"
	var respuesta = true;
	var caracter;
	
	for (var i = 0; i < texto.length; i++) {
		caracter = texto.substring(i, i + 1);
		if (numero.indexOf(caracter) == "-1") respuesta = false;
	}
	return respuesta;
}

function iniciarMenu (menu) {
  //oCliente = new cliente();
	//oCliente = getCliente();
	//oCliente.iniciarMenu();
	var oDiv = document.getElementById("divNavegacion");
  var html = "";
	html = "<table width='100%'>";
	html += "<tr><td class='navegacion'>" + aMenu[parseInt(menu)][4] + "</td></tr>";
	html += "</table>";
	oDiv.innerHTML = html;
}

function iniciarOpcion (menu) {
	var oDiv = document.getElementById("divOpcion");
  var html = "";
	html = "<table width='100%'>";
	html += "<tr><td class='navegacion'>" + aMenu[parseInt(menu)][4] + "</td></tr>";
	html += "</table>";
	oDiv.innerHTML = html;
}

function enviarEliminacion(operacion) {
 
  if (operacion =="2") {		
		if(!confirm('¿Desea eliminar?')) return false;	
	}		
	document.getElementById("txtOper").value=operacion;
	document.frmMiForm.submit();	
}
function enviarPreseleccion(operacion) {
 
  if (operacion =="2") {		
		if(!confirm('¿Desea preseleccionar al personal?')) return false;	
	}		
	document.getElementById("txtOper").value=operacion;
	document.frmMiForm.submit();	
}
function enviarSeleccion(operacion) {
 
  if (operacion =="2") {		
		if(!confirm('¿Desea seleccionar al personal?')) return false;	
	}		
	document.getElementById("txtOper").value=operacion;
	document.frmMiForm.submit();	
}
function enviarCriterio (operacion) {
  if (operacion =="1") {
		if (document.form1.cboReporte.value == "") {
			alert("Seleccione tipo de reporte");
			document.form1.cboReporte.focus();
			return false;
		}
		if (document.form1.txtFecIni.value == "") {
			alert("Seleccione una fecha inicial");
			document.form1.txtFecIni.focus();
			return false;
		}
		if (document.form1.txtFecFin.value == "") {
			alert("Seleccione uan fecha final");
			document.form1.txtFecFin.focus();
			return false;
		}
	}
	document.getElementById("txtOper").value=operacion;
	document.getElementById("txtTurno").value=document.form1.cboTurno[document.form1.cboTurno.selectedIndex].text;
	document.getElementById("txtGrupo").value=document.form1.cboGrupo[document.form1.cboGrupo.selectedIndex].text;
	document.getElementById("txtArea").value=document.form1.cboArea[document.form1.cboArea.selectedIndex].text;
	document.form1.submit();
}

function calcular (objeto) {
	if (objeto.checked) {
		//alert("seleccionado");
		document.form1.txtSeleccion.value = parseInt(document.form1.txtSeleccion.value)+1;
	} else {
		//alert("no seleccionado");
		document.form1.txtSeleccion.value = parseInt(document.form1.txtSeleccion.value)-1;
	}
}

function cambiarEstado(objeto){
	if (objeto.checked) {
		objeto.value="1";
	} else {
		objeto.value="0";
	}
}

function contarChk(){
	var total = 0;
	if (parseInt(document.getElementById("txtNro").value) > 1) {
		for (var i = 0; i < document.frmMiForm.chkPre.length; i++) {
			if(document.frmMiForm.chkPre[i].checked==true) total++;
		}
	} else {
		if (document.frmMiForm.chkPre.checked==true) total++;
	}
	document.getElementById("txtSeleccion").value=total;
	return total;
}

function contarChkS(){
	var total = 0;
	if (parseInt(document.getElementById("txtNro").value) > 1) {
		for (var i = 0; i < document.frmMiForm.chkSel.length; i++) {
			if(document.frmMiForm.chkSel[i].checked==true) total++;
		}
	} else {
		if (document.frmMiForm.chkSel.checked==true) total++;
	}
	document.getElementById("txtSeleccion").value=total;
	return total;
}
function contarChkE(){
	var total = 0;
	if (parseInt(document.getElementById("txtNro").value) > 1) {
		for (var i = 0; i < document.frmMiForm.chkElim.length; i++) {
			if(document.frmMiForm.chkElim[i].checked==true) total++;
		}
	} else {
		if (document.frmMiForm.chkElim.checked==true) total++;
	}
	document.getElementById("txtSeleccion").value=total;
	return total;
}

function seleccionarChk(){
	if (parseInt(document.getElementById("txtNro").value) > 1) {
		for (var i = 0; i < document.frmMiForm.chkElim.length; i++) {
			if (document.frmMiForm.chkTodo.checked==true) {
				document.frmMiForm.chkElim[i].checked = true;
			} else {
				document.frmMiForm.chkElim[i].checked = false;
			}
		}
	} else {
		if (document.frmMiForm.chkTodo.checked==true) {
			document.frmMiForm.chkElim.checked = true;
		} else {
			document.frmMiForm.chkElim.checked = false;
		}
	}
	if (document.frmMiForm.chkTodo.checked==true) {
		document.frmMiForm.txtSeleccion.value = document.frmMiForm.txtNro.value;
	} else {
		document.frmMiForm.txtSeleccion.value = 0;
	}	
}

function seleccionarChkPre(){
	if (parseInt(document.getElementById("txtNro").value) > 1) {
		for (var i = 0; i < document.frmMiForm.chkPre.length; i++) {
			if (document.frmMiForm.chkTodo.checked==true) {
				document.frmMiForm.chkPre[i].checked = true;
			} else {
				document.frmMiForm.chkPre[i].checked = false;
			}
		}
	} else {
		if (document.frmMiForm.chkTodo.checked==true) {
			document.frmMiForm.chkPre.checked = true;
		} else {
			document.frmMiForm.chkPre.checked = false;
		}
	}
	if (document.frmMiForm.chkTodo.checked==true) {
		document.frmMiForm.txtSeleccion.value = document.frmMiForm.txtNro.value;
	} else {
		document.frmMiForm.txtSeleccion.value = 0;
	}	
}
function seleccionarChkSel(){
	if (parseInt(document.getElementById("txtNro").value) > 1) {
		for (var i = 0; i < document.frmMiForm.chkSel.length; i++) {
			if (document.frmMiForm.chkTodoS.checked==true) {
				document.frmMiForm.chkSel[i].checked = true;
			} else {
				document.frmMiForm.chkSel[i].checked = false;
			}
		}
	} else {
		if (document.frmMiForm.chkTodoS.checked==true) {
			document.frmMiForm.chkSel.checked = true;
		} else {
			document.frmMiForm.chkSel.checked = false;
		}
	}
	if (document.frmMiForm.chkTodoS.checked==true) {
		document.frmMiForm.txtSeleccion.value = document.frmMiForm.txtNro.value;
	} else {
		document.frmMiForm.txtSeleccion.value = 0;
	}	
}
function VerificaReporte()
{
	if(document.frmMiForm.cboReporte.value == 2){
		document.getElementById('mfechas').style.display='block';
	}else
	{ document.getElementById('mfechas').style.display='none';		
		}
}
function enviarInscripcion1() 
{	
	if (document.frmMiForm.cboReporte.value == "") {
		alert("Seleccione un reporte");
		document.frmMiForm.cboReporte.focus();
		return false;
	}
	if (document.frmMiForm.cmbCargo.value == "") {
		alert("Seleccione el Cargo");
		document.frmMiForm.cmbCargo.focus();
		return false;
	}
	if (document.frmMiForm.cboReporte.value == "2") {
		if (document.frmMiForm.txtFecIni.value == "") {
			alert("Seleccione una fecha inicial");
			document.frmMiForm.txtFecIni.focus();
			return false;
		}
		if (document.frmMiForm.txtFecFin.value == "") {
			alert("Seleccione una fecha final");
			document.frmMiForm.txtFecFin.focus();
			return false;
		}
	}
	document.getElementById("txtOper").value=1;
    document.getElementById('txtDptoD').value=document.getElementById('txtDpto1').value;
	document.getElementById('txtProvD').value=document.getElementById('txtProv1').value;
	document.getElementById('txtDistD').value=document.getElementById('txtDist1').value;
	document.frmMiForm.submit();
}
function enviarInscripcion2() {
	document.getElementById('txtDptoD').value=document.getElementById('txtDpto1').value;
	document.getElementById('txtProvD').value=document.getElementById('txtProv1').value;
	document.getElementById('txtDistD').value=document.getElementById('txtDist1').value;
	document.frmMiForm.submit();
}
function enviarConsultas() 
{	
	if (document.frmMiForm.cboReporte.value == "") {
		alert("Seleccione un reporte");
		document.frmMiForm.cboReporte.focus();
		return false;
	}	
	document.getElementById("txtOper").value=1;
    document.getElementById('txtDptoD').value=document.getElementById('txtDpto1').value;
	document.getElementById('txtProvD').value=document.getElementById('txtProv1').value;
	document.getElementById('txtDistD').value=document.getElementById('txtDist1').value;
	document.frmMiForm.submit();
}
function EnviarAPreseleccionar() {
	if (document.frmMiForm.cmbProfesion.value == "") {
		alert("Seleccione la Profesión");
		document.frmMiForm.cmbProfesion.focus();
		return false;
	}
	if (document.frmMiForm.txtDpto1.value == "") {
			alert("Seleccione el departamento");
			document.frmMiForm.txtDpto1.focus();
			return false;
	}
	if (document.frmMiForm.txtProv1.value == "") {
			alert("Seleccione la provincia");
			document.frmMiForm.txtProv1.focus();
			return false;
	}
	if (document.frmMiForm.txtDist1.value == "") {
			alert("Seleccione el distrito");
			document.frmMiForm.txtDist1.focus();
			return false;
	}
	document.getElementById('txtDptoD').value=document.getElementById('txtDpto1').value;
	document.getElementById('txtProvD').value=document.getElementById('txtProv1').value;
	document.getElementById('txtDistD').value=document.getElementById('txtDist1').value;
	document.frmMiForm.submit();
}
function EnviarASeleccionar() {
	if (document.frmMiForm.cmbProfesion.value == "") {
		alert("Seleccione la Profesión");
		document.frmMiForm.cmbProfesion.focus();
		return false;
	}
	if (document.frmMiForm.txtDpto1.value == "") {
			alert("Seleccione el departamento");
			document.frmMiForm.txtDpto1.focus();
			return false;
	}
	if (document.frmMiForm.txtProv1.value == "") {
			alert("Seleccione la provincia");
			document.frmMiForm.txtProv1.focus();
			return false;
	}
	if (document.frmMiForm.txtDist1.value == "") {
			alert("Seleccione el distrito");
			document.frmMiForm.txtDist1.focus();
			return false;
	}
	document.getElementById('txtDptoD').value=document.getElementById('txtDpto1').value;
	document.getElementById('txtProvD').value=document.getElementById('txtProv1').value;
	document.getElementById('txtDistD').value=document.getElementById('txtDist1').value;
	document.frmMiForm.submit();
}

function enviarInscripcion() {
	
	/*if (document.form1.cboPuesto.value == "") {
		alert("Seleccione Puesto");
		document.form1.cboPuesto.focus();
		return false;
	}
	if (document.form1.cboReporte.value == "") {
		alert("Seleccione un reporte");
		document.form1.cboReporte.focus();
		return false;
	}
	if (document.form1.cboReporte.value == "2") {
		if (document.form1.txtFecIni.value == "") {
			alert("Seleccione una fecha inicial");
			document.form1.txtFecIni.focus();
			return false;
		}
		if (document.form1.txtFecFin.value == "") {
			alert("Seleccione una fecha final");
			document.form1.txtFecFin.focus();
			return false;
		}
	}*/
	
	//if (document.form1.cboReporte.value == "2") {
		r = document.form1.cboReporte.value;
		fi = document.form1.txtFecIni.value;
		ff = document.form1.txtFecFin.value;
		p = document.form1.cboPuesto.value;
		alert("reporte");
		alert(r);
		
		pagina = "pd_ficha_reporteXLS.asp?cboReporte=" + r + "&txtFecIni=" + fi + "&txtFecFin=" + ff + "&puesto=" + p;
		win = window.open(pagina,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=400,height=260,top=0,left=0');
	//} else {
	//	document.form1.submit();
	//}
}

function exportar(menu){
	if (menu=="1") {
		p = document.form1.txtParm.value;
		pagina = "pd_preseleccionXLS.asp" + p;
	}
	if (menu=="3") {
		p = document.form1.txtParm.value;
		pagina = "pd_seleccionXLS.asp" + p;
	}
	
	if (menu=="4" || menu=="5") {
		r = document.form1.cboReporte.value;
		fi = document.form1.txtFecIni.value;
		ff = document.form1.txtFecFin.value;
		t = document.form1.cboTurno.value;
		g = document.form1.cboGrupo.value;
		a = document.form1.cboArea.value;
		tt = document.form1.txtTurno.value;
		gt = document.form1.txtGrupo.value;
		at = document.form1.txtArea.value;
		
		if (menu=="4") pagina = "pd_produccion_reporteXLS.asp";
		if (menu=="5") pagina = "pd_asistencia_reporteXLS.asp";
		pagina = pagina + "?cboReporte=" + r + "&txtFecIni=" + fi + "&txtFecFin=" + ff + "&cboTurno=" + t + "&cboGrupo=" + g + "&cboArea=" + a + "&txtTurno=" + tt + "&txtGrupo=" + gt + "&txtArea=" + at;
	}
	
	if (menu=="6") {
		if (document.form1.cboPuesto.value == "") {
			alert("Seleccione Puesto");
			document.form1.cboPuesto.focus();
			return false;
		}
		p = document.form1.cboPuesto.value;
		pagina = "pd_ficha_reporteXLS.asp?puesto=" + p;
	}
	
	if (menu=="7") {
		l = document.form1.txtLog.value;
		pagina = "pd_eval_pracXLS.asp?nrolog=" + l;
	}
	
	if (menu=="8") {
		if (document.form1.cboPuesto.value == "") {
			alert("Seleccione Puesto");
			document.form1.cboPuesto.focus();
			return false;
		}
		//l = document.form1.txtLog.value;
		//pagina = "pd_eval_prac_reporteXLS.asp?nrolog=" + l;
		p = document.form1.cboPuesto.value;
		pagina = "pd_eval_reporteXLS.asp?puesto=" + p;
	}
	
	if (menu=="9") {
		p = document.form1.txtParm.value;		
		pagina = "pd_preseleccion_reporteXLS.asp" + p;		
		
	}
	if (menu=="10") {	
		p = document.form1.txtParm.value;		
		pagina = "pd_seleccion_reporteXLS.asp" + p;		
	}
	if (menu=="11") {
		l = document.form1.txtLog.value;
		fi = document.form1.txtFecIni.value;
		ff = document.form1.txtFecFin.value;
		pagina = "pd_produccionXLS.asp?nrolog=" + l + "&txtFecIni=" + fi + "&txtFecFin=" + ff;
	}
	if (menu=="12") {
		fi = document.form1.txtFecIni.value;
		ff = document.form1.txtFecFin.value;
		pagina = "pd_asistencia_autoXLS.asp?txtFecIni=" + fi + "&txtFecFin=" + ff;
	}
	if (menu=="13") {
		p = document.form1.txtParm.value;
		pagina = "pd_preseleccionINEIXLS.asp" + p;
	}
	if (menu=="14") {
		p = document.form1.txtParm.value;
		pagina = "pd_ficha_reporteXLS.asp" + p;
	}
	
	if (menu=="16") {
		p = document.frmMiForm.txtParm.value;
		pagina = "pd_ficha_reporteXLS.asp" + p;
	}
	
	win = window.open(pagina,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=400,height=260,top=0,left=0');
}

function exportarE(){
	reporte = document.frmMiForm.txtRep.value;	
	if(reporte == '1'){
	   	p = document.frmMiForm.txtParm.value;	
	    pagina = "pd_preseleccionadosXLS.asp" + p;
	}else{
		p = document.frmMiForm.txtParm.value;	
		pagina = "pd_seleccionadosXLS.asp" + p;		
	}		
	win = window.open(pagina,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=400,height=260,top=0,left=0');
}

function iniciarMenu (menu) {
  //oCliente = new cliente();
	//oCliente = getCliente();
	//oCliente.iniciarMenu();
	var oDiv = document.getElementById("divNavegacion");
  var html = "";
	html = "<table width='100%'>";
	html += "<tr><td class='navegacion'>" + aMenu[parseInt(menu)][4] + "</td></tr>";
	html += "</table>";
	oDiv.innerHTML = html;
}

function iniciarOpcion (menu) {
	var oDiv = document.getElementById("divOpcion");
  var html = "";
	html = "<table width='100%'>";
	html += "<tr><td class='navegacion'>" + aMenu[parseInt(menu)][4] + "</td></tr>";
	html += "</table>";
	oDiv.innerHTML = html;
}

function cambiarMenu (menu) {
	var oMenu = null;
	var pagina = "";
	
	for (var i = 0; i < aMenu.length; i++) {
		oMenu = document.getElementById("menu" + i);
		
		if (aMenu[i][0] == menu) {
			oMenu.style.color = "#ffd700";
			pagina = aMenu[i][3];
		} else {
			oMenu.style.color = "white";
		}
	}
	oCliente.menu = menu;
	ventana = window.open(pagina, 'body')
}


function enviarConsulta (operacion) {
	if (operacion =="1") {
		if (document.form1.txtApePaterno.value == "") {
			alert("Ingrese Apellido Paterno");
			document.form1.txtApePaterno.focus();
			return false;
		}
		if (document.form1.txtApePaterno.length < 3) {
			alert("Ingrese Apellido Paterno de por lo menos 3 letras");
			document.form1.txtApePaterno.focus();
			return false;
		}
		if (document.form1.txtApeMaterno.value == "") {
			alert("Ingrese Apellido Materno");
			document.form1.txtApeMaterno.focus();
			return false;
		}
		if (document.form1.txtApeMaterno.length < 3) {
			alert("Ingrese Apellido Materno de por lo menos 3 letras");
			document.form1.txtApeMaterno.focus();
			return false;
		}		
		if (document.form1.txtNombre.value == "") {
			alert("Ingrese Nombre");
			document.form1.txtNombre.focus();
			return false;
		}
		if (document.form1.txtNombre.length < 2) {
			alert("Ingrese Nombre de por lo menos 2 letras");
			document.form1.txtNombre.focus();
			return false;
		}
	}
	if (operacion =="2") {
		
		if (document.form1.txtDNI.value == "" || document.form1.txtDNI.value.length < 8) {
			alert("Ingrese número de DNI válido");
			document.form1.txtDNI.focus();
			return false;
		}
	}
	if (operacion =="3") {
		
		if (document.form1.txtCODIGO.value == "" || document.form1.txtCODIGO.value.length < 12) {
			alert("Ingrese número de CODIGO válido");
			document.form1.txtCODIGO.focus();
			return false;
		}
	}
		
	document.getElementById("txtOpcion").value=operacion;
	document.getElementById("txtOper").value="1";
	document.form1.submit();
}
	
 function AbrirPag(pag){	
   switch (pag)
   { case 1:window.location ="pd_ficha_provydistrit.asp";
     break;
     case 2:window.location ="pd_ficha_instructdep.asp";
	 break;
     case 3:window.location ="pd_ficha_brigadayemp.asp";   
	 break;
   }  	
		
}

function enviarFicha1(operacion) {
	if (operacion =="1") {
		if (document.frmMiForm.txtDpto1.value == "") {
			alert("Seleccione el departamento de inscripción");
			document.frmMiForm.txtDpto1.focus();
			return false;
		}
		if (document.frmMiForm.txtProv1.value == "" || document.frmMiForm.txtProv1.value == 99) {
			alert("Seleccione la provincia de inscripción");
			document.frmMiForm.txtProv1.focus();
			return false;
		}
		if (document.frmMiForm.txtDist1.value == "" || document.frmMiForm.txtProv1.value == 99) {
			alert("Seleccione el distrito de inscripción");
			document.frmMiForm.txtDist1.focus();
			return false;
		}
		if (document.frmMiForm.txtApePaterno.value.length < 2) {
			alert("Ingrese Apellido Paterno válido");
			document.frmMiForm.txtApePaterno.focus();
			return false;
		}
		if (document.frmMiForm.txtApeMaterno.value == "") {
			alert("Ingrese Apellido Materno");
			document.frmMiForm.txtApeMaterno.focus();
			return false;
		}
		if (document.frmMiForm.txtApeMaterno.value.length < 2) {
			alert("Ingrese Apellido Materno válido");
			document.frmMiForm.txtApeMaterno.focus();
			return false;
		}
		if (document.frmMiForm.txtNombre.value == "") {
			alert("Ingrese Nombre");
			document.frmMiForm.txtNombre.focus();
			return false;
		}
		if (document.frmMiForm.txtNombre.value.length < 2) {
			alert("Ingrese Nombre válido");
			document.frmMiForm.txtNombre.focus();
			return false;
		}
		if (document.frmMiForm.cmbSexo.value == "") {
			alert("Seleccione su sexo");
			document.frmMiForm.cmbSexo.focus();
			return false;
		}		
		if (document.frmMiForm.txtDNI.value == "" || document.frmMiForm.txtDNI.value.length < 8) {
			alert("Ingrese número de DNI válido");
			document.frmMiForm.txtDNI.focus();
			return false;
		}
		if (!validarNumero(document.frmMiForm.txtDNI.value)) {
			alert("Ingrese número de DNI válido");
			document.frmMiForm.txtDNI.focus();
			return false;
		}
		/*if (document.frmMiForm.txtTelefono.value == "" && document.frmMiForm.txtCelular.value == "" ) {
			alert("Ingrese algún número telefonico para comunicarse con usted.");
			document.frmMiForm.txtTelefono.focus();
			return false;
		}*/		
	
		if (document.frmMiForm.cmbTipovia.value == "") {
			alert("Seleccione tipo de vía");
			document.frmMiForm.cmbTipovia.focus();
			return false;
		}
		if (document.frmMiForm.txtNomVia.value == "") {
			alert("Ingrese el nombre de la vía donde reside");
			document.frmMiForm.txtNomVia.focus();
			return false;
		}			
		if (document.frmMiForm.txtDpto2.value != "1") {
			if (document.frmMiForm.txtDpto2.value == "") {
				alert("Seleccione departamento de residencia");
				document.frmMiForm.txtDpto2.focus();
				return false;
			}
		}		
		if (document.frmMiForm.txtProv2.value == "" || document.frmMiForm.txtProv2.value == 99) {
			alert("Seleccione provincia de residencia");
			document.frmMiForm.txtProv2.focus();
			return false;
		}
		if (document.frmMiForm.txtDist2.value == "" || document.frmMiForm.txtDist2.value == 99) {
			alert("Seleccione distrito de residencia");
			document.frmMiForm.txtDist2.focus();
			return false;
		}
		if (document.frmMiForm.cmbCargo.value == "") {
			alert("Seleccione el cargo al que postula");
			document.frmMiForm.cmbCargo.focus();
			return false;
		}
		if (document.frmMiForm.cmbNivel.value == "") {
			alert("Seleccione nivel educativo");
			document.frmMiForm.cmbNivel.focus();
			return false;
		}
		if (document.frmMiForm.cmbProfesion.value == "") {
			alert("Seleccione profesión");
			document.frmMiForm.cmbProfesion.focus();
			return false;
		}
		if (document.frmMiForm.txtExpCensosAnio.value == "" && document.frmMiForm.txtExpCensosMeses.value == "" ) {
			alert("Ingrese su experiencia en organización de actividades estadísticas en Censos y/o encuestas (años o meses)");
			document.frmMiForm.txtExpCensosAnio.focus();
			return false;
		}
	
		if (document.frmMiForm.txtExpSupAnio.value == "" && document.frmMiForm.txtExpSupMeses.value == "" ) {
			alert("Ingrese su experiencia como Supervisor, Empadronador o Encuestador en Censos y/o encuestas (años o meses)");
			document.frmMiForm.txtExpSupAnio.focus();
			return false;
		}
	
		if (document.frmMiForm.txtExpEquipAnio.value == "" && document.frmMiForm.txtExpEquipMeses.value == "" ) {
			alert("Ingrese su experiencia en la conduccion de equipos de trabajo (años o meses)");
			document.frmMiForm.txtExpEquipAnio.focus();
			return false;
		}
		if (document.frmMiForm.txtExpCapacAnio.value == "" && document.frmMiForm.txtExpCapacMeses.value == "" ) {
			alert("Ingrese su experiencia en actividades de capacitación (años o meses)");
			document.frmMiForm.txtExpCapacAnio.focus();
			return false;
		}

		if (document.frmMiForm.cmbVeracidad.value == "") {
			alert("Seleccione veracidad de datos");
			document.frmMiForm.cmbVeracidad.focus();
			return false;
		}	
		
		document.getElementById("txtOper").value=operacion;
	}
	document.frmMiForm.submit();
}
function enviarFicha3(operacion) {
	if (operacion =="1") {
		if (document.frmMiForm.txtDpto1.value == "") {
			alert("Seleccione el departamento de inscripción");
			document.frmMiForm.txtDpto1.focus();
			return false;
		}
		if (document.frmMiForm.txtProv1.value == "" || document.frmMiForm.txtProv1.value == "99") {
			alert("Seleccione la provincia de inscripción");
			document.frmMiForm.txtProv1.focus();
			return false;
		}
		if (document.frmMiForm.txtDist1.value == "" || document.frmMiForm.txtDist1.value == "99") {
			alert("Seleccione el distrito de inscripción");
			document.frmMiForm.txtDist1.focus();
			return false;
		}
		if (document.frmMiForm.txtApePaterno.value.length < 2) {
			alert("Ingrese Apellido Paterno válido");
			document.frmMiForm.txtApePaterno.focus();
			return false;
		}
		if (document.frmMiForm.txtApeMaterno.value == "") {
			alert("Ingrese Apellido Materno");
			document.frmMiForm.txtApeMaterno.focus();
			return false;
		}
		if (document.frmMiForm.txtApeMaterno.value.length < 2) {
			alert("Ingrese Apellido Materno válido");
			document.frmMiForm.txtApeMaterno.focus();
			return false;
		}
		if (document.frmMiForm.txtNombre.value == "") {
			alert("Ingrese Nombre");
			document.frmMiForm.txtNombre.focus();
			return false;
		}
		if (document.frmMiForm.txtNombre.value.length < 2) {
			alert("Ingrese Nombre válido");
			document.frmMiForm.txtNombre.focus();
			return false;
		}
		if (document.frmMiForm.txtDNI.value == "" || document.frmMiForm.txtDNI.value.length < 8) {
			alert("Ingrese número de DNI válido");
			document.frmMiForm.txtDNI.focus();
			return false;
		}
		if (!validarNumero(document.frmMiForm.txtDNI.value)) {
			alert("Ingrese número de DNI válido");
			document.frmMiForm.txtDNI.focus();
			return false;
		}
		if (document.frmMiForm.txtECivil.value == "") {
			alert("Seleccione estado civil");
			document.frmMiForm.txtECivil.focus();
			return false;
		}
		if (document.frmMiForm.cmbSexo.value == "") {
			alert("Seleccione su sexo");
			document.frmMiForm.cmbSexo.focus();
			return false;
		}		
	/*	if (document.frmMiForm.txtTelefono.value == "" && document.frmMiForm.txtCelular.value == "" ) {
			alert("Ingrese algún número telefonico para comunicarse con usted.");
			document.frmMiForm.txtTelefono.focus();
			return false;
		}	*/
		
		oDia = document.getElementById("txtDia");
		oMes = document.getElementById("txtMes");
		oAnio = document.getElementById("txtAnio");
		
		if (oDia.value.length < 2) {
			alert("Ingrese Dia de nacimiento válido");
			oDia.focus();
			return false;
		}
		if (oMes.value.length < 2) {
			alert("Ingrese Mes de nacimiento válido");
			oMes.focus();
			return false;
		}
		if (oMes.value == "00" || oMes.value > "12") {
			alert("Ingrese Mes de nacimiento válido");
			oMes.focus();
			return false;
		}
		if (parseInt(oMes.value) == 1 || parseInt(oMes.value) == 3 || parseInt(oMes.value) == 5 || parseInt(oMes.value) == 7 || parseInt(oMes.value) == 8 || parseInt(oMes.value) == 10 || parseInt(oMes.value) == 12) {
			if (parseInt(oDia.value) > 31) {
				alert("Ingrese Dia de nacimiento válido");
				oDia.focus();
				return false;
			}
		}
		if (parseInt(oMes.value) == 4 || parseInt(oMes.value) == 6 || parseInt(oMes.value) == 9 || parseInt(oMes.value) == 11) {
			if (parseInt(oDia.value) > 30) {
				alert("Ingrese Dia de nacimiento válido");
				oDia.focus();
				return false;
			}
		}
		if (oAnio.value.length < 4) {
			alert("Ingrese Año de nacimiento válido");
			oAnio.focus();
			return false;
		}
		if (parseInt(oAnio.value) > 1989) {
			alert("El año no corresponde a un mayor de edad");
			oAnio.focus();
			return false;
		}
		if (parseInt(oAnio.value) < 1930) {
			alert("Ingrese Año de nacimiento válido");
			oAnio.focus();
			return false;
		}
		
		if (parseInt(oMes.value) == 2) {
			if (parseInt(oAnio.value) % 4 == 0) {
				if (parseInt(oDia.value) > 29) {
					alert("Ingrese Dia de nacimiento válido");
					oDia.focus();
					return false;
				}
			} else {
				if (parseInt(oDia.value) > 28) {
					alert("Ingrese Dia de nacimiento válido");
					oDia.focus();
					return false;
				}
			}
		}
		
		if (!validarNumero(oDia.value)) {
			alert("Ingrese Dia de nacimiento válido");
			oDia.focus();
			return false;
		}
		if (!validarNumero(oMes.value)) {
			alert("Ingrese Mes de nacimiento válido");
			oMes.focus();
			return false;
		}
		if (!validarNumero(oAnio.value)) {
			alert("Ingrese Año de nacimiento válido");
			oAnio.focus();
			return false;
		}	
	
		if (document.frmMiForm.cmbTipovia.value == "") {
			alert("Seleccione tipo de vía");
			document.frmMiForm.cmbTipovia.focus();
			return false;
		}
		if (document.frmMiForm.txtNomVia.value == "") {
			alert("Ingrese el nombre de la vía donde reside");
			document.frmMiForm.txtNomVia.focus();
			return false;
		}			
		if (document.frmMiForm.txtDpto2.value == "" || document.frmMiForm.txtDpto2.value != "1") {
			if (document.frmMiForm.txtDpto2.value == "") {
				alert("Seleccione departamento de residencia");
				document.frmMiForm.txtDpto2.focus();
				return false;
			}
		}		
		if (document.frmMiForm.txtProv2.value == "" || document.frmMiForm.txtProv2.value == 99) {
			alert("Seleccione provincia de residencia");
			document.frmMiForm.txtProv2.focus();
			return false;
		}
		if (document.frmMiForm.txtDist2.value == "" || document.frmMiForm.txtDist2.value == 99) {
			alert("Seleccione distrito de residencia");
			document.frmMiForm.txtDist2.focus();
			return false;
		}
		if (document.frmMiForm.cmbCargo.value == "") {
			alert("Seleccione el cargo al que postula");
			document.frmMiForm.cmbCargo.focus();
			return false;
		}
		if (document.frmMiForm.cmbNivel.value == "") {
			alert("Seleccione nivel educativo");
			document.frmMiForm.cmbNivel.focus();
			return false;
		}
		if (document.frmMiForm.cmbProfesion.value == "") {
			alert("Seleccione especialidad");
			document.frmMiForm.cmbProfesion.focus();
			return false;
		}
		if (document.frmMiForm.txtExpEquipMeses.value == "") {
			alert("Ingrese su experiencia  en la conducción de equipos de trabajo");
			document.frmMiForm.txtExpEquipMeses.focus();
			return false;
		}
		if (document.frmMiForm.txtExpCapacMeses.value == "") {
			alert("Ingrese su experiencia en Capacitación");
			document.frmMiForm.txtExpCapacMeses.focus();
			return false;
		}	
		if (document.frmMiForm.cmbCargo.value == "2") {
			if (document.frmMiForm.txtQuechua.value == "" && document.frmMiForm.txtAwuajun.value == "" && document.frmMiForm.txtAymara.value == "" && document.frmMiForm.txtOtraLengua.value == "") {
				alert("Ingrese segunda lengua de dominio");
				document.frmMiForm.txtQuechua.focus();
				return false;
			}	
		}			
		if (document.frmMiForm.cmbVeracidad.value == "") {
			alert("Seleccione veracidad de datos");
			document.frmMiForm.cmbVeracidad.focus();
			return false;
		}	
		
		document.getElementById("txtOper").value=operacion;
	}
	document.frmMiForm.submit();
}
function enviarFicha4(operacion) {
	if (operacion =="1") {
		if (document.frmMiForm.txtDpto1.value == "") {
			alert("Seleccione el departamento de inscripción");
			document.frmMiForm.txtDpto1.focus();
			return false;
		}
		if (document.frmMiForm.txtProv1.value == "" || document.frmMiForm.txtProv1.value == "99") {
			alert("Seleccione la provincia de inscripción");
			document.frmMiForm.txtProv1.focus();
			return false;
		}
		dptt = document.frmMiForm.txtDpto1.value;
		prvc = document.frmMiForm.txtProv1.value;
		//alert(dptt);
		//alert(prvc);

		if (( dptt == 15 && prvc == 01) || (dptt == 04 && prvc == 01) || (dptt == 07 )) {
			if (document.frmMiForm.txtDist1.value == "" || document.frmMiForm.txtDist1.value == "99") {
				alert("Seleccione el distrito de inscripción");
				document.frmMiForm.txtDist1.focus();
				return false;
				}
		}
		if (document.frmMiForm.txtApePaterno.value.length < 2) {
			alert("Ingrese Apellido Paterno válido");
			document.frmMiForm.txtApePaterno.focus();
			return false;
		}
		if (document.frmMiForm.txtApeMaterno.value == "") {
			alert("Ingrese Apellido Materno");
			document.frmMiForm.txtApeMaterno.focus();
			return false;
		}
		if (document.frmMiForm.txtApeMaterno.value.length < 2) {
			alert("Ingrese Apellido Materno válido");
			document.frmMiForm.txtApeMaterno.focus();
			return false;
		}
		if (document.frmMiForm.txtNombre.value == "") {
			alert("Ingrese Nombre");
			document.frmMiForm.txtNombre.focus();
			return false;
		}
		if (document.frmMiForm.txtNombre.value.length < 2) {
			alert("Ingrese Nombre válido");
			document.frmMiForm.txtNombre.focus();
			return false;
		}
		if (document.frmMiForm.txtDNI.value == "" || document.frmMiForm.txtDNI.value.length < 8) {
			alert("Ingrese número de DNI válido");
			document.frmMiForm.txtDNI.focus();
			return false;
		}
		if (!validarNumero(document.frmMiForm.txtDNI.value)) {
			alert("Ingrese número de DNI válido");
			document.frmMiForm.txtDNI.focus();
			return false;
		}
		if (document.frmMiForm.txtECivil.value == "") {
			alert("Seleccione estado civil");
			document.frmMiForm.txtECivil.focus();
			return false;
		}
		if (document.frmMiForm.txtEmail1.value == "") {
			alert("Ingrese Email");
			document.frmMiForm.txtEmail1.focus();
			return false;
		}

			if (document.frmMiForm.txtEmail2.value == "") {
				alert("Ingrese Email");
				document.frmMiForm.txtEmail2.focus();
				return false;
			}

		if ((document.frmMiForm.txtTelefono.value == "") && (document.frmMiForm.txtCelular.value == "")){
			alert("Ingrese por lo menos un número de teléfono");
			document.frmMiForm.txtTelefono.focus();
			return false;
		}
		/*if (document.frmMiForm.txtCelular.value == "") {
			alert("Ingrese Número Celular");
			document.frmMiForm.txtCelular.focus();
			return false;
		}*/
		//alert(document.frmMiForm.cmbLeng.value);
		if (( dptt == 01 && prvc == 02 ) || ( dptt == 01 && prvc == 04 ) ||
			( dptt == 08 && prvc == 04 ) || ( dptt == 08 && prvc == 07 ) ||
			( dptt == 08 && prvc == 08 ) || ( dptt == 08 && prvc == 11 ) ||
			( dptt == 08 && prvc == 12 ) || ( dptt == 08 && prvc == 13 ) ||
			( dptt == 21 && prvc == 04 ) || ( dptt == 21 && prvc == 05 ) ||
			( dptt == 21 && prvc == 06 ) || ( dptt == 21 && prvc == 09 ) ||
			( dptt == 21 && prvc == 01 ) || ( dptt == 25 && prvc == 01 ) ||
			( dptt == 16 && prvc == 06 )  )  

  	 	{
	 		if (document.frmMiForm.cmbLeng.value == "99")
			{
			alert("Seleccione Lengua originaria");
			document.frmMiForm.cmbLeng.focus();
			return false;
			}
	 	
		}
		if (document.frmMiForm.cmbSexo.value == "") {
			alert("Seleccione su sexo");
			document.frmMiForm.cmbSexo.focus();
			return false;
		}		
		/*if (document.frmMiForm.txtTelefono.value == "" && document.frmMiForm.txtCelular.value == "" ) {
			alert("Ingrese algún número telefonico para comunicarse con usted.");
			document.frmMiForm.txtTelefono.focus();
			return false;
		}*/	
		
		oDia = document.getElementById("txtDia");
		oMes = document.getElementById("txtMes");
		oAnio = document.getElementById("txtAnio");
		
		if (oDia.value.length < 2) {
			alert("Ingrese Dia de nacimiento válido");
			oDia.focus();
			return false;
		}
		if (oMes.value.length < 2) {
			alert("Ingrese Mes de nacimiento válido");
			oMes.focus();
			return false;
		}
		if (oMes.value == "00" || oMes.value > "12") {
			alert("Ingrese Mes de nacimiento válido");
			oMes.focus();
			return false;
		}
		if (parseInt(oMes.value) == 1 || parseInt(oMes.value) == 3 || parseInt(oMes.value) == 5 || parseInt(oMes.value) == 7 || parseInt(oMes.value) == 8 || parseInt(oMes.value) == 10 || parseInt(oMes.value) == 12) {
			if (parseInt(oDia.value) > 31) {
				alert("Ingrese Dia de nacimiento válido");
				oDia.focus();
				return false;
			}
		}
		if (parseInt(oMes.value) == 4 || parseInt(oMes.value) == 6 || parseInt(oMes.value) == 9 || parseInt(oMes.value) == 11) {
			if (parseInt(oDia.value) > 30) {
				alert("Ingrese Dia de nacimiento válido");
				oDia.focus();
				return false;
			}
		}
		if (oAnio.value.length < 4) {
			alert("Ingrese Año de nacimiento válido");
			oAnio.focus();
			return false;
		}
		if (parseInt(oAnio.value) > 1991) {
			alert("El año no corresponde a un mayor de edad");
			oAnio.focus();
			return false;
		}
		if (parseInt(oAnio.value) < 1930) {
			alert("Ingrese Año de nacimiento válido");
			oAnio.focus();
			return false;
		}
		
		if (parseInt(oMes.value) == 2) {
			if (parseInt(oAnio.value) % 4 == 0) {
				if (parseInt(oDia.value) > 29) {
					alert("Ingrese Dia de nacimiento válido");
					oDia.focus();
					return false;
				}
			} else {
				if (parseInt(oDia.value) > 28) {
					alert("Ingrese Dia de nacimiento válido");
					oDia.focus();
					return false;
				}
			}
		}
		
		if (!validarNumero(oDia.value)) {
			alert("Ingrese Dia de nacimiento válido");
			oDia.focus();
			return false;
		}
		if (!validarNumero(oMes.value)) {
			alert("Ingrese Mes de nacimiento válido");
			oMes.focus();
			return false;
		}
		if (!validarNumero(oAnio.value)) {
			alert("Ingrese Año de nacimiento válido");
			oAnio.focus();
			return false;
		}	
	
		if (document.frmMiForm.cmbTipovia.value == "") {
			alert("Seleccione tipo de vía");
			document.frmMiForm.cmbTipovia.focus();
			return false;
		}
		if (document.frmMiForm.txtNomVia.value == "") {
			alert("Ingrese el nombre de la vía donde reside");
			document.frmMiForm.txtNomVia.focus();
			return false;
		}			
		if (document.frmMiForm.txtDpto2.value == "" || document.frmMiForm.txtDpto2.value != "1") {
			if (document.frmMiForm.txtDpto2.value == "") {
				alert("Seleccione departamento de residencia");
				document.frmMiForm.txtDpto2.focus();
				return false;
			}
		}		
		if (document.frmMiForm.txtProv2.value == "" || document.frmMiForm.txtProv2.value == 99) {
			alert("Seleccione provincia de residencia");
			document.frmMiForm.txtProv2.focus();
			return false;
		}
		if (document.frmMiForm.txtDist2.value == "" || document.frmMiForm.txtDist2.value == 99) {
			alert("Seleccione distrito de residencia");
			document.frmMiForm.txtDist2.focus();
			return false;
		}		
		if (document.frmMiForm.cmbNivel.value == "" || document.frmMiForm.txtDist2.value == 99) {
			alert("Seleccione nivel educativo");
			document.frmMiForm.cmbNivel.focus();
			return false;
		}
		if (document.frmMiForm.cmbProfesion.value == "") {
			alert("Seleccione especialidad");
			document.frmMiForm.cmbProfesion.focus();
			return false;
		}
		if (document.frmMiForm.cmbProfesion.value == 1 && document.frmMiForm.cmbNivelDocen.value == "" ) {
			alert("Seleccione nivel en docencia");
			document.frmMiForm.cmbNivelDocen.focus();
			return false;
		}/*else
		{   if (document.frmMiForm.cmbProfesion.value != 1 && document.frmMiForm.cmbNivelDocen.value == "" ) {
				alert("Seleccione proyectos en que participo");
				document.frmMiForm.cmbNivelDocen.focus();
				return false;
			}			
		}*/
		
		if (document.frmMiForm.cmbNivelDocen.value == "") {
			alert("Seleccione Nivel en Docencia");
			document.frmMiForm.cmbNivelDocen.focus();
			return false;
		}
		
		if (document.frmMiForm.cmbExpNin.value == "") {
			alert("Seleccione Proyectos dirigido a niños");
			document.frmMiForm.cmbExpNin.focus();
			return false;
		}
		
		if (document.frmMiForm.cmbInst.value == "") {
			alert("Seleccione Evaluacion de Instrumentos de Evaluacion del Rendimiento");
			document.frmMiForm.cmbInst.focus();
			return false;
		}

		
		if (document.frmMiForm.txtExpGenMeses.value >= 12 ) {
			alert("Ingrese experiencia general en meses menor a 12");
			document.frmMiForm.txtExpGenMeses.focus();
			return false;
		}
		if (document.frmMiForm.txtExpDocenMeses.value >= 12 ) {
			alert("Ingrese experiencia docencia en meses menor a 12");
			document.frmMiForm.txtExpGenMeses.focus();
			return false;
		}
		if (document.frmMiForm.txtExpEquipMeses.value >= 12 ) {
			alert("Ingrese experiencia en manejo de equipos en meses menor a 12");
			document.frmMiForm.txtExpGenMeses.focus();
			return false;
		}
		if (document.frmMiForm.txtExpCapacMeses.value >= 12 ) {
			alert("Ingrese experiencia en capacitación de grupos en meses menor a 12");
			document.frmMiForm.txtExpGenMeses.focus();
			return false;
		}		
		if (document.frmMiForm.cmbVeracidad.value == "") {
			alert("Seleccione veracidad de datos");
			document.frmMiForm.cmbVeracidad.focus();
			return false;
		}	
		if (document.frmMiForm.cmbVeracidad.value == 2) {
			alert("Seleccione SI en veracidad de datos");
			document.frmMiForm.cmbVeracidad.focus();
			return false;
		}	
		
		document.getElementById("txtOper").value=operacion;
	}
	document.frmMiForm.submit();
}
function AgregarTodos()
{
  if( window.document.frmMiForm.cmbNivelDocen != null)
  {   
	  if( window.document.frmMiForm.cmbProfesion.value == 1 )
	  {  
		 window.document.frmMiForm.cmbNivelDocen.options[0] = null;
		 window.document.frmMiForm.cmbNivelDocen.options.length = 4;  		 
		 varValue0 = "";
		 varValue1 = "1";
		 varValue2 = "2";
		 varValue3 = "3";
		 varText0  = "Seleccione...";
		 varText1  = "Inicial";
		 varText2  = "Primaria";
		 varText3  = "Secundaria";
		 varId    = "cmbNivelDocen";
		 //Generando los options
		 window.document.frmMiForm.cmbNivelDocen.options[0]       = new Option(varText0, varValue0);
		 window.document.frmMiForm.cmbNivelDocen.options[1]       = new Option(varText1, varValue1);
		 window.document.frmMiForm.cmbNivelDocen.options[2]       = new Option(varText2, varValue2);
		 window.document.frmMiForm.cmbNivelDocen.options[3]       = new Option(varText3, varValue3);
		 window.document.frmMiForm.cmbNivelDocen.options[1].id    = varId;		 
	  }  else {
	  if( window.document.frmMiForm.cmbProfesion.value != 1 )
	  {    	 
		 window.document.frmMiForm.cmbNivelDocen.options[0] = null;
		 window.document.frmMiForm.cmbNivelDocen.options.length = 3;  
		 varValue0 = "";
		 varValue1 = "4";
		 varValue2 = "5";	
		 varText0  = "Seleccione...";
		 varText1  = "Proyectos de formación";		
		 varText2  = "Proyectos dirigidos a infantes";
		 varId    = "cmbNivelDocen";
		 //Generando los options
		 window.document.frmMiForm.cmbNivelDocen.options[0]       = new Option(varText0, varValue0);
		 window.document.frmMiForm.cmbNivelDocen.options[4]       = new Option(varText1, varValue1);
		 window.document.frmMiForm.cmbNivelDocen.options[5]       = new Option(varText2, varValue2);		
		 window.document.frmMiForm.cmbNivelDocen.options[1].id    = varId;		 
	  }  
    }
  }  
}
function AgregarTodos2()
{ 
  if( window.document.frmMiForm.cmbNivelDocen != null)
  {   
	  if( window.document.frmMiForm.cmbProfesion.value == 1 )
	  {   document.getElementById('divMuestra1').style.display='block';
		  document.getElementById('divMuestra2').style.display='none';	
		  document.getElementById("cmbNivelDocen").selectedIndex=0;
	  }else
		{
		  document.getElementById('divMuestra2').style.display='block';
		  document.getElementById('divMuestra1').style.display='none';	
		  document.getElementById("cmbNivelDocen2").selectedIndex=0;
		}
  }
  
}

function Cambio()
{ 
  //alert(window.document.frmMiForm.cmbNivelDocen.value);  
	var x=document.getElementsByName("cmbNivelDocen").value;
	alert(x);
}

function AgregarTodos3()
{    
	  if( window.document.frmMiForm.cmbProfesion.value == 1 )
	  {   document.getElementById('divMuestra1').style.display='block';
		  document.getElementById('divMuestra2').style.display='none';	
		  document.getElementById("cmbNivelDocen").selectedIndex=0;
	  }else
		{
		  document.getElementById('divMuestra2').style.display='block';
		  document.getElementById('divMuestra1').style.display='none';	
		  document.getElementById("cmbNivelDocen2").selectedIndex=0;
		}

}

function imprimir()
{
if (window.print)
	window.print()
else
	alert("Su navegador no soporta esta opción.");
}
function enviarDatosMod(operacion) {
	if (operacion =="1") {
		if (document.frmMiForm.txtApePaternoM.value == "") {
			alert("Ingrese Apellido Paterno");
			document.frmMiForm.txtApePaternoM.focus();
			return false;
		}
		if (document.frmMiForm.txtApePaternoM.value.length < 2) {
			alert("Ingrese Apellido Paterno válido");
			document.frmMiForm.txtApePaternoM.focus();
			return false;
		}
		if (document.frmMiForm.txtApeMaternoM.value == "") {
			alert("Ingrese Apellido Materno");
			document.frmMiForm.txtApeMaternoM.focus();
			return false;
		}
		if (document.frmMiForm.txtApeMaternoM.value.length < 2) {
			alert("Ingrese Apellido Materno válido");
			document.frmMiForm.txtApeMaternoM.focus();
			return false;
		}
		if (document.frmMiForm.txtNombreM.value == "") {
			alert("Ingrese Nombre");
			document.frmMiForm.txtNombreM.focus();
			return false;
		}
		if (document.frmMiForm.txtNombreM.value.length < 2) {
			alert("Ingrese Nombre válido");
			document.frmMiForm.txtNombreM.focus();
			return false;
		}
		if (document.frmMiForm.txtDNIM.value == "" || document.frmMiForm.txtDNIM.value.length < 8) {
			alert("Ingrese número de DNI válido");
			document.frmMiForm.txtDNIM.focus();
			return false;
		}
		if (!validarNumero(document.frmMiForm.txtDNIM.value)) {
			alert("Ingrese número de DNI válido");
			document.frmMiForm.txtDNIM.focus();
			return false;
		}	
		document.getElementById("txtOper2").value=operacion;
	}
	document.frmMiForm.submit();
}

function Verifica1(opcion)
{ 
	if(opcion ==  "DNI")
	{		
	  /*document.getElementById('txtDNI').style.borderColor='#FF0000';
	  document.getElementById('txtApePaterno').style.borderColor='none'
	  document.getElementById('txtNombre').style.borderColor='none'*/
	  document.getElementById('req1').style.display='block';
	  document.getElementById('req2').style.display='none';
	  document.getElementById('req3').style.display='none';
	}else
	{
	  /*document.getElementById('txtDNI').style.borderColor='#FF0000'
	  /document.form1.txtDNI.style.borderColor='#FFFFFF';
	  document.form1.txtApePaterno.style.borderColor='#FF0000';
	  document.form1.txtNombre.style.borderColor='#FF0000';*/
	  document.getElementById('req1').style.display='none';
	  document.getElementById('req2').style.display='block';
	  document.getElementById('req3').style.display='block';
	}	
}
function calificarPostulante (operacion, ficha) {	
	document.getElementById("txtOper").value=operacion;
	
	if (operacion=="1") {
		for (var i=0;i<document.form1.rbOpcion.length;i++){
			if (document.form1.rbOpcion[i].checked){
				document.form1.txtOpcion.value = document.form1.rbOpcion[i].value;
			}
		}
		if (document.form1.txtOpcion.value=="1" && document.form1.txtDNI.value=="") {
			alert("Ingrese DNI");
			document.form1.txtDNI.focus();
			return false;
		}
		if (document.form1.txtOpcion.value=="2" && document.form1.txtApePaterno.value=="") {
			alert("Ingrese Apellido Paterno");
			document.form1.txtApePaterno.focus();
			return false;
		}
		if (document.form1.txtOpcion.value=="2" && document.form1.txtNombre.value=="") {
			alert("Ingrese Nombre");
			document.form1.txtNombre.focus();
			return false;
		}
	}
	if (operacion=="2") {
		document.form1.txtDNI.value = ficha;
	}
	if (operacion=="3") {
		for (var i=0;i<document.form1.rbFicha.length;i++){
			if (document.form1.rbFicha[i].checked){
				document.form1.txtFicha.value = document.form1.rbFicha[i].value;
			}
		}
		if (document.form1.txtFicha.value=="") {
			document.form1.txtFicha.value = document.form1.rbFicha.value;
		}
	}
	document.form1.submit();
}

function asignarPuntaje (psVariable, psValor) {
	var puntaje = 0;
	
	puesto = document.form1.txtPuesto.value;
	
	if (psVariable == 1) {// nivel
		if (psValor == 1) puntaje = 0;
		if (psValor == 2) puntaje = 1;
		if (psValor == 3) puntaje = 2;
		if (psValor == 4) puntaje = 3;
		if (psValor == 5) puntaje = 3;
		if (psValor == 6) puntaje = 4;
		if (psValor == 7) puntaje = 4;
		if (psValor == 8) puntaje = 5;
	}
	if (psVariable == 2) {//especialidad
		if (puesto == 1) {
			if (psValor == 1) puntaje = 5;
			if (psValor == 2) puntaje = 5;
			if (psValor == 3) puntaje = 4;
		} else {
			if (psValor == 1) puntaje = 5;
			if (psValor == 2) puntaje = 0;
			if (psValor == 3) puntaje = 2;
		}
	}
	if (psVariable == 3) {//Exp digit
		if (puesto == 1) {			
			if (psValor <= 3) puntaje = 2;
			if (psValor > 3 && psValor <= 12) puntaje = 3;
			if (psValor > 12 && psValor <= 36) puntaje = 5;
			if (psValor > 36) puntaje = 10;
		} else {
			if (psValor <= 3) puntaje = 2;
			if (psValor > 3 && psValor <= 12) puntaje = 3;
			if (psValor > 12 && psValor <= 36) puntaje = 4;
			if (psValor > 36) puntaje = 5;
		}
	}
	
	if (psVariable == 4) {// enf cronica
		if (psValor == 1) puntaje = 0;
		if (psValor == 2) puntaje = 5;
	}
	if (psVariable == 5) {//problemas visuales
		if (psValor == 1) puntaje = 0;
		if (psValor == 2) puntaje = 5;
	}
	if (psVariable == 6) {//exp operador
		if (puesto == 2) {
			if (psValor <= 3) puntaje = 2;
			if (psValor > 3 && psValor <= 12) puntaje = 3;
			if (psValor > 12 && psValor <= 36) puntaje = 4;
			if (psValor > 36) puntaje = 5;
		}
		if (puesto == 3) {
			if (psValor <= 3) puntaje = 2;
			if (psValor > 3 && psValor <= 12) puntaje = 3;
			if (psValor > 12 && psValor <= 36) puntaje = 5;
			if (psValor > 36) puntaje = 10;
		}
	}
	if (psVariable == 7) {//exp supervisor
		if (psValor <= 3) puntaje = 2;
		if (psValor > 3 && psValor <= 12) puntaje = 3;
		if (psValor > 12 && psValor <= 36) puntaje = 4;
		if (psValor > 36) puntaje = 5;
	}
	if (psVariable == 8) {// exp aux aux ofic
		if (psValor <= 3) puntaje = 2;
		if (psValor > 3 && psValor <= 12) puntaje = 3;
		if (psValor > 12 && psValor <= 36) puntaje = 4;
		if (psValor > 36) puntaje = 5;
	}
	if (psVariable == 9) {// turno pref
		if (psValor == 1) puntaje = 5;
		if (psValor == 2 || psValor == 3) puntaje = 1;
		if (psValor == 4 || psValor == 5) puntaje = 2;
		if (psValor == 6 || psValor == 7) puntaje = 4;
	}
	if (psVariable == 10) {// trab dom y feriados	 
		if (psValor == 1) 
		{ puntaje = 5;	}
		else 
		{ puntaje = 0;  }		
	}
	if (psVariable == 11) {// digito en inei
	  if (puesto == 1) {
		if (psValor == 1) puntaje = 10;
		else puntaje = 0;		
	  }else{
		  if (psValor == 1) puntaje = 5;
		else puntaje = 0;		
		  }
	}
	document.getElementById("txtPto" + psVariable).value = puntaje.toString();
	
	var total = 0;
	for (var i = 1; i <= 4; i++) {
		total += parseInt(cerar(document.getElementById("txtPto" + i).value));
	}
	if (puesto == 1) total += parseInt(cerar(document.getElementById("txtPto5").value));
	if (puesto == 2) total += parseInt(cerar(document.getElementById("txtPto6").value)) + parseInt(cerar(document.getElementById("txtPto7").value)) + parseInt(cerar(document.getElementById("txtPto8").value));
	if (puesto == 3) total += parseInt(cerar(document.getElementById("txtPto6").value)) + parseInt(cerar(document.getElementById("txtPto7").value));
	total += parseInt(cerar(document.getElementById("txtPto9").value)) + parseInt(cerar(document.getElementById("txtPto10").value)) + parseInt(cerar(document.getElementById("txtPto11").value));
	
	document.getElementById("txtPtoT").value = total.toString();
}
function asignarPuntajec (psVariable, psValor) {
	var puntaje = 0;
	
	puesto = document.form1.txtPuesto.value;
	
	if (psVariable == "1") {// nivel
		if (psValor == "1") puntaje = 0;
		if (psValor == "2") puntaje = 1;
		if (psValor == "3") puntaje = 2;
		if (psValor == "4") puntaje = 3;
		if (psValor == "5") puntaje = 3;
		if (psValor == "6") puntaje = 4;
		if (psValor == "7") puntaje = 4;
		if (psValor == "8") puntaje = 5;
	}
	if (psVariable == "2") {//especialidad
		if (puesto == "1") {
			if (psValor == "1") puntaje = 5;
			if (psValor == "2") puntaje = 5;
			if (psValor == "3") puntaje = 4;
		} else {
			if (psValor == "1") puntaje = 5;
			if (psValor == "2") puntaje = 0;
			if (psValor == "3") puntaje = 2;
		}
	}
	if (psVariable == "3") {//Exp digit
		if (puesto == "1") {
			if (psValor <= "3") puntaje = 2;
			if (psValor > "3" && psValor <= "12") puntaje = 3;
			if (psValor > "12" && psValor <= "36") puntaje = 5;
			if (psValor > "36") puntaje = 10;
		} else {
			if (psValor <= "3") puntaje = 2;
			if (psValor > "3" && psValor <= "12") puntaje = 3;
			if (psValor > "12" && psValor <= "36") puntaje = 4;
			if (psValor > "36") puntaje = 5;
		}
	}
	
	if (psVariable == "4") {// enf cronica
		if (psValor == "1") puntaje = 0;
		if (psValor == "2") puntaje = 5;
	}
	if (psVariable == "5") {//problemas visuales
		if (psValor == "1") puntaje = 0;
		if (psValor == "2") puntaje = 5;
	}
	if (psVariable == "6") {//exp operador
		if (puesto == "2") {
			if (psValor <= "3") puntaje = 2;
			if (psValor > "3" && psValor <= "12") puntaje = 3;
			if (psValor > "12" && psValor <= "36") puntaje = 4;
			if (psValor > "36") puntaje = 5;
		}
		if (puesto == "3") {
			if (psValor <= "3") puntaje = 2;
			if (psValor > "3" && psValor <= "12") puntaje = 3;
			if (psValor > "12" && psValor <= "36") puntaje = 5;
			if (psValor > "36") puntaje = 10;
		}
	}
	if (psVariable == "7") {//exp supervisor
		if (psValor <= "3") puntaje = 2;
		if (psValor > "3" && psValor <= "12") puntaje = 3;
		if (psValor > "12" && psValor <= "36") puntaje = 4;
		if (psValor > "36") puntaje = 5;
	}
	if (psVariable == "8") {// exp aux aux ofic
		if (psValor <= "3") puntaje = 2;
		if (psValor > "3" && psValor <= "12") puntaje = 3;
		if (psValor > "12" && psValor <= "36") puntaje = 4;
		if (psValor > "36") puntaje = 5;
	}
	document.getElementById("txtPto" + psVariable).value = puntaje.toString();
	
	var total = 0;
	for (var i = 1; i <= 4; i++) {
		total += parseInt(cerar(document.getElementById("txtPto" + i).value));
	}
	if (puesto == "1") total += parseInt(cerar(document.getElementById("txtPto5").value));
	if (puesto == "2") total += parseInt(cerar(document.getElementById("txtPto6").value)) + parseInt(cerar(document.getElementById("txtPto7").value)) + parseInt(cerar(document.getElementById("txtPto8").value));
	if (puesto == "3") total += parseInt(cerar(document.getElementById("txtPto6").value)) + parseInt(cerar(document.getElementById("txtPto7").value));
	total += parseInt(cerar(document.getElementById("txtPto9").value)) + parseInt(cerar(document.getElementById("txtPto10").value));;
	
	document.getElementById("txtPtoT").value = total.toString();
}


function sumarPuntaje(){
	puesto = document.form1.txtPuesto.value;
	var total = 0;
	for (var i = 1; i <= 4; i++) {
		total += parseInt(cerar(document.getElementById("txtPto" + i).value));
	}
	if (puesto == "1") total += parseInt(cerar(document.getElementById("txtPto5").value));
	if (puesto == "2") total += parseInt(cerar(document.getElementById("txtPto6").value)) + parseInt(cerar(document.getElementById("txtPto7").value)) + parseInt(cerar(document.getElementById("txtPto8").value));
	if (puesto == "3") total += parseInt(cerar(document.getElementById("txtPto6").value)) + parseInt(cerar(document.getElementById("txtPto7").value));
	total += parseInt(cerar(document.getElementById("txtPto9").value)) + parseInt(cerar(document.getElementById("txtPto10").value));;
	
	document.getElementById("txtPtoT").value = total.toString();
}

function cerar(numero){
   if(numero == null || numero == ""){ 
		numero = "0";
	}
	return numero;
}


function cambiarUbigeo (psNivel, psCodigo, psCombo) {
	if (psNivel == NIVEL_PROV) {
		document.getElementById("cboprov").options.length = 0;
		var newOption = new Option("Seleccione...", "");
		document.getElementById("cboprov").options[document.getElementById("cboprov").options.length] = newOption;
		document.getElementById("cbodist").options.length = 0;
		var newOption = new Option("Seleccione...", "");
		document.getElementById("cbodist").options[document.getElementById("cbodist").options.length] = newOption;
		
		if (psCodigo != "") {
			paData = aDatoPP;
			indiceUbigeo = psCodigo - 1;
			indiceInicial = parseInt(aDatoDD[indiceUbigeo][2]);
			indiceFinal =   parseInt(aDatoDD[indiceUbigeo][3]);
			inicio = 2;
			fin = 4;
		}
	}
		
	if (psNivel == NIVEL_DIST) {
		document.getElementById("cbodist").options.length = 0;
		var newOption = new Option("Seleccione...", "");
		document.getElementById("cbodist").options[document.getElementById("cbodist").options.length] = newOption;
		if (psCodigo != "") {
			paData = aDatoDI;
			if (psCodigo=="0701") {
				indiceInicial = 0;
				indiceFinal =   5;
			}
			if (psCodigo=="1501") {
				indiceInicial = 6;
				indiceFinal =   48;
			}
			inicio = 4;
			fin = 6;
		}
	}
	
	if (psCodigo != "") {
		oElemento = document.getElementById(psCombo);
		for (ind = indiceInicial; ind <= indiceFinal; ind++) {
			var newOption = new Option(paData[ind][0].substring(inicio, fin) + " " + paData[ind][1], paData[ind][0].substring(inicio, fin));
			oElemento.options[oElemento.options.length] = newOption;
		}
	}
}

function cambiarText (opcion,valor,objeto) {
	oObj = document.getElementById(objeto);
	if (opcion=="1") {
		if (valor=="3") {
			oObj.disabled = false;
			oObj.focus();
		} else {
			oObj.value = "";
			oObj.disabled = true;
		}
	}
	if (opcion=="2") {
		if (valor=="1") {
			oObj.disabled = false;
			document.frmMiForm.txtIneiAnio.disabled = false;
			document.frmMiForm.txtCargoInei.disabled = false;
			oObj.focus();
		} else {
			oObj.value = "";
			document.frmMiForm.txtIneiAnio.value = "";
			oObj.disabled = true;
			document.frmMiForm.txtCargoInei.disabled = true;
			document.frmMiForm.txtIneiAnio.disabled = true;
		}
	}
	if (opcion=="3") {
		if (valor=="1") {
			oObj.disabled = false;
			oObj.focus();
		} else {
			oObj.value = "";
			oObj.disabled = true;
		}
	}
}

/* OBJETO CLIENTE */

function cliente() {
  this.menu = "";
	this.dpto = "";
	this.prov = "";
	this.dist = "";
}

cliente.prototype.iniciar = function () {
	//this.setTitulo(PROYECTO, TITULO);
	//this.setMenu();
};

cliente.prototype.iniciarCuerpo = function () {
	//this.setDerechoAutor(DERECHO_AUTOR);
};
cliente.prototype.iniciarMenu = function () {
	this.setNavegacion('4');
	this.setCriterio();
	//this.setDerechoAutor(DERECHO_AUTOR);
};


cliente.prototype.setMenu = function () {
  var oDiv = document.getElementById("divMenu");
  var html = "";
	
	html = "<table width='100%'>";
	html += "<tr>";
	for (var i = 0; i < aMenu.length; i++) {
		html += "<td width='17%' class='menu'>";
		html += "<a href=\"javascript:cambiarMenu('" + aMenu[i][0] + "')\" onmouseover=\"window.status='" + aMenu[i][2] + "';return true;\" title='" + aMenu[i][2] + "' id='menu" + aMenu[i][0] + "' style=\"color: 'white'\">" + aMenu[i][1] + "</a>";
		html += "</td>";
  }
	html += "</tr>";
	html += "</table>";
	oDiv.innerHTML = html;
};

cliente.prototype.setNavegacion = function (menu) {
	var oDiv = document.getElementById("divNavegacion");
  var html = "";
	
	html = "<table width='100%'>";
	html += "<tr><td class='navegacion'>" + aMenu[parseInt(menu)][4] + "</td></tr>";
	html += "</table>";
	oDiv.innerHTML = html;
};

cliente.prototype.setDerechoAutor = function (derechoAutor) {
  var oDiv = document.getElementById("divDerechoAutor");
  var html = "";
	
	html = "<table width='100%'>";
	html += "<tr><td class='derechoAutor'>" + derechoAutor + "</td></tr>";
	html += "</table>";
	oDiv.innerHTML = html;
};

cliente.prototype.getHtmlUbigeo = function (psNivel, psCodigo, psCodigoActual, psDato, aDatoDD, aDatoPP, aDatoDI) {
	
	var html = "";
	var lsSelected = "";
	
	if (psCodigoActual == "00") return false;
	
	html = "<select id='cbo" + psNivel + "' name='cbo" + psNivel + "' class='e_combo' onChange=\"javascript:cambiarListaUbigeo('" + psNivel + "', this.value)\" style='width:180'>";
	html += "<option value=''>Seleccione</option>";
		
	if (psDato != "") {
		if (psNivel == NIVEL_DPTO) {
			paData = aDatoDD;
			indiceInicial = 0;
			indiceFinal = aDatoDD.length - 1;
			inicio = 0;
			fin = 2;
		}
		if (psNivel == NIVEL_PROV  && psCodigo != "") {
			
			paData = aDatoPP;
			//indiceUbigeo = parseInt(psCodigo) - 1;
			indiceUbigeo = psCodigo - 1;
			indiceInicial = parseInt(aDatoDD[indiceUbigeo][2]);
			indiceFinal =   parseInt(aDatoDD[indiceUbigeo][3]);
			inicio = 2;
			fin = 4;
		}
		if (psNivel == NIVEL_DIST && psCodigo != "") {
			paData = aDatoDI;
			indiceUbigeo = parseInt(psCodigo.substring(0, 2)) - 1;
			indiceInicial = parseInt(aDatoDD[indiceUbigeo][2]);
			indiceFinal =   parseInt(aDatoDD[indiceUbigeo][3]);
			
			for (var ind = indiceInicial; ind <= indiceFinal; ind++) {
				if (psCodigo == aDatoPP[ind][0]) indiceUbigeo = ind;
			}
			indiceInicial = parseInt(aDatoPP[indiceUbigeo][2]);
			indiceFinal =   parseInt(aDatoPP[indiceUbigeo][3]);
			inicio = 4;
			fin = 6;
		}
		
		//alert("indiceInicial " + indiceInicial + " indiceFinal " + indiceFinal);
		for (ind = indiceInicial; ind <= indiceFinal; ind++) {
			//alert(ind.toString());
			if (paData[ind][0].substring(inicio, fin) == psCodigoActual) {
				lsSelected = "selected=true";
			} else {
				lsSelected = "";
			}
			html += "<option value='" + paData[ind][0].substring(inicio, fin) + "' " + lsSelected + ">" + paData[ind][0].substring(inicio, fin) + " " + paData[ind][1] + "</option>";
		}
		
		//alert("psNivel " + psNivel + " psCodigo " + psCodigo);
		if (psCodigo == "00") {
			lsSelected = "selected=true";
		} else {
			lsSelected = "";
		}
	}
	html += "</select>";
	return html;
  //document.getElementById("div" + psNivel).innerHTML = html;
};

cliente.prototype.setListaUbigeo = function (nivel, codigo, aDatoDD, aDatoPP, aDatoDI) {
	var html = "";
	var lsDato = "";
	if (codigo!="" && codigo!="00") lsDato = "1";
	
	if (nivel==NIVEL_DPTO) this.dpto = codigo;
	if (nivel==NIVEL_PROV) this.prov = codigo;
	if (nivel==NIVEL_DIST) this.dist = codigo;
	
	if (nivel==NIVEL_DPTO) {
		html = this.getHtmlUbigeo(NIVEL_PROV, this.dpto, "", lsDato, aDatoDD, aDatoPP, aDatoDI);
		html = this.getHtmlUbigeo(NIVEL_DIST, "", "", "", aDatoDD, aDatoPP, aDatoDI);
	}
	if (nivel==NIVEL_PROV) {
		html = this.getHtmlUbigeo(NIVEL_DIST, this.dpto + this.prov, "", lsDato, aDatoDD, aDatoPP, aDatoDI);
	}
	return html;
};

// OTROS OBJETOS

var sUserAgent = navigator.userAgent;
  var isOpera = sUserAgent.indexOf("Opera") > -1;
  var isIE = sUserAgent.indexOf("compatible") > -1
	&& sUserAgent.indexOf("MSIE") > -1
	&& !isOpera;
  var isWin = (navigator.platform == "Win32") || (navigator.platform == "Windows");
  
  // funciones de FormUtil
  var FormUtil = new Object;

var EventUtil = new Object;
  
  EventUtil.formatEvent = function (oEvent) {
    if (isIE && isWin) {
      oEvent.charCode = (oEvent.type == "keypress") ? oEvent.keyCode : 0;
      oEvent.eventPhase = 2;
      oEvent.isChar = (oEvent.charCode > 0);
      oEvent.pageX = oEvent.clientX + document.body.scrollLeft;
      oEvent.pageY = oEvent.clientY + document.body.scrollTop;

      oEvent.preventDefault = function () {
        this.returnValue = false;
      };

      if (oEvent.type == "mouseout") {
        oEvent.relatedTarget = oEvent.toElement;
      } else if (oEvent.type == "mouseover") {
        oEvent.relatedTarget = oEvent.fromElement;
      }

      oEvent.stopPropagation = function () {
        this.cancelBubble = true;
      };

      oEvent.target = oEvent.srcElement;
      oEvent.time = (new Date).getTime();
    }
    return oEvent;
  };

/* OBJETO TextUtil */

var TextUtil = new Object;
  
TextUtil.allowChars = function (oTextbox, oEvent) {
  oEvent = EventUtil.formatEvent(oEvent);
  var sValidChars = oTextbox.getAttribute("validchars");
  var sChar = String.fromCharCode(oEvent.charCode);
  var bIsValidChar = sValidChars.indexOf(sChar) > -1;
  return bIsValidChar || oEvent.ctrlKey;
};
