function cboPaisChange(cboPais, cboDepartamento, cboProvincia, cboDistrito, CodDptoSeleccionado){
	objSelectRemoveElements(cboDepartamento);
	objSelectRemoveElements(cboProvincia);
	objSelectRemoveElements(cboDistrito);
//	cboPais.options[cboPais.selectedIndex].value="208";
	if (cboPais.options[cboPais.selectedIndex].value == "208") {
		addOptionsToSelectFromArrays(cboDepartamento, arrDepartamentoValor, arrDepartamentoTexto, 1, 25, CodDptoSeleccionado);
	} else {
		addOptionToSelect(cboDepartamento, "00", " - - - - - - - - - - - - - - - - ");
	}
	
	addOptionToSelect(cboProvincia, "00", " - - - - - - - - - - - - - - - - ");
	addOptionToSelect(cboDistrito, "00", " - - - - - - - - - - - - - - - - ");
}

function cboDepartamentoChange(cboDepartamento, cboProvincia, cboDistrito, CodProvSeleccionada){
	objSelectRemoveElements(cboProvincia);
	objSelectRemoveElements(cboDistrito);	
	
	var cboDepartamentoValue = cboDepartamento.options[cboDepartamento.selectedIndex].value;
	
	if ((cboDepartamentoValue != "-1") && (cboDepartamentoValue != "00")){
		var iStart = -1;
		var iEnd = -1;
		var iPos = -1;
		for (var i=0; i<arrProvinciaRangos.length; i++) {
			if (arrDepartamentoValor[i] == cboDepartamentoValue) {
				iPos = arrProvinciaRangos[i].indexOf("/");
				iStart = arrProvinciaRangos[i].substring(0, iPos);
				iEnd = arrProvinciaRangos[i].substring(iPos + 1, arrProvinciaRangos[i].length);
			}
		}
		addOptionsToSelectFromArrays(cboProvincia, arrProvinciaValor, arrProvinciaTexto, iStart, iEnd, CodProvSeleccionada);
	} else {
		addOptionToSelect(cboProvincia, "00", " - - - - - - - - - - - - - - - - ");
	}

	addOptionToSelect(cboDistrito, "00", " - - - - - - - - - - - - - - - - ");
}

function cboProvinciaChange(cboDepartamento, cboProvincia, cboDistrito, CodDistSeleccionado){
	objSelectRemoveElements(cboDistrito);	
	
	var cboDepartamentoValue = cboDepartamento.options[cboDepartamento.selectedIndex].value;
	var cboProvinciaValue = cboProvincia.options[cboProvincia.selectedIndex].value;
	var iarrStart = -1;
	var iarrEnd = -1;
	var iPos = -1;
	
	if ((cboProvinciaValue != "-1") && (cboProvinciaValue != "00")){
	
		for (var i=0; i<arrProvinciaRangos.length; i++) {
			if (arrDepartamentoValor[i] == cboDepartamentoValue) {
				iPos = arrProvinciaRangos[i].indexOf("/");
				iarrStart = arrProvinciaRangos[i].substring(0, iPos);
				iarrEnd = arrProvinciaRangos[i].substring(iPos + 1, arrProvinciaRangos[i].length);			
			}
		}
	
		var iStart = -1;
		var iEnd = -1;
		iPos = -1;
	
		for (var i=iarrStart-1; i<iarrEnd; i++) {
			if (arrProvinciaValor[i] == cboProvinciaValue) {
				iPos = arrDistritoRangos[i].indexOf("/");
				iStart = arrDistritoRangos[i].substring(0, iPos);
				iEnd = arrDistritoRangos[i].substring(iPos + 1, arrDistritoRangos[i].length);
			}
		}

		addOptionsToSelectFromArrays(cboDistrito, arrDistritoValor, arrDistritoTexto, iStart, iEnd, CodDistSeleccionado);
	} else {
		addOptionToSelect(cboDistrito, "00", " - - - - - - - - - - - - - - - - ");
	}
}

function rdoDLProvinciaClick(CodProvincia, strValor) {
	objSelectRemoveElements(document.frmMostrarSolicitudPreInscripcion.cboDLDistrito);
	if (CodProvincia == "1") {
		addOptionsToSelectFromArrays(document.frmMostrarSolicitudPreInscripcion.cboDLDistrito, arrDistritoValor, arrDistritoTexto, 1325, 1367, strValor);
	} else {
		addOptionsToSelectFromArrays(document.frmMostrarSolicitudPreInscripcion.cboDLDistrito, arrDistritoValor, arrDistritoTexto, 674, 679, strValor);
	}
}


function frmMostrarSolicitudPreInscripcion_Cancelar() {
	redireccionarInicio();
}

function frmMostrarSolicitudPreInscripcion_Finalizar() {
	if (frmMostrarSolicitudPreInscripcion_Validar()) {
		document.frmMostrarSolicitudPreInscripcion.hdnFinalizar.value = "1";
		document.frmMostrarSolicitudPreInscripcion.submit();
	}
}

function cboAnoCuartoSecundariaChange() {
	document.frmMostrarSolicitudPreInscripcion.cboAnoTerceroSecundaria.selectedIndex = 	document.frmMostrarSolicitudPreInscripcion.cboAnoCuartoSecundaria.selectedIndex + 1;
}

function cboAnoQuintoSecundariaChange() {
	document.frmMostrarSolicitudPreInscripcion.cboAnoCuartoSecundaria.selectedIndex = 	document.frmMostrarSolicitudPreInscripcion.cboAnoQuintoSecundaria.selectedIndex + 1;
	cboAnoCuartoSecundariaChange();
	/*
	if ((document.frmMostrarSolicitudPreInscripcion.cboAnoQuintoSecundaria[document.frmMostrarSolicitudPreInscripcion.cboAnoQuintoSecundaria.selectedIndex].value != "2007") && (document.frmMostrarSolicitudPreInscripcion.cboAnoQuintoSecundaria[document.frmMostrarSolicitudPreInscripcion.cboAnoQuintoSecundaria.selectedIndex].value != "1900")) {
		alert("La inscripción para el examen de admisión para egresados se realizará en Febrero. Por favor acérquese a Orientación al Postulante (Pabellón H, primer piso) para mayor información.");
    	document.frmMostrarSolicitudPreInscripcion.cboAnoQuintoSecundaria.focus();
    	return false;
  	}*/	
}

function limpiarColegio(hdnCodColegio, txtNombreColegio) {
	hdnCodColegio.value ="-1";
	txtNombreColegio.value ="";
}

function copiarColegio(hdnCodColegio1, txtNombreColegio1, hdnCodColegio2, txtNombreColegio2) {
	hdnCodColegio2.value = hdnCodColegio1.value;
	txtNombreColegio2.value = txtNombreColegio1.value;
}

function limpiarInstituto() {
	document.frmMostrarSolicitudPreInscripcion.hdnCodInstitucion.value ="";
	document.frmMostrarSolicitudPreInscripcion.txtInstitucion.value ="";
}

function limpiarUniversidad() {
	document.frmMostrarSolicitudPreInscripcion.hdnCodUniversidad.value ="";
	document.frmMostrarSolicitudPreInscripcion.txtNombreUniversidad.value ="";
}

function cboModalidadAdmision_Change() {
	var iCodModalidadAdmision = document.frmMostrarSolicitudPreInscripcion.cboModalidadAdmision[document.frmMostrarSolicitudPreInscripcion.cboModalidadAdmision.selectedIndex].value;
//	if (iCodModalidadAdmision != -1) {
		window.open("/portalUL/gaad/pp/servlets/ComandoMostrarListadoDocumentosXPostulante?cboModalidadAdmision=" + iCodModalidadAdmision, "ifrListadoDocumentos");
//	}
}

function GrabarForm(){
  var theForm = document.frmMostrarSolicitudPreInscripcion;  
  return confirm("¿Está seguro de continuar?.");
//  if (v.exec()){    
  //  if (validaDireccion()){
    //  theForm.hddGrabar.value = theForm.btnGrabar.value;
      //theForm.method = "POST";
//      th/eForm.action = "form.html";
  //    theForm.submit();
    //}
  
}
function verifica()
{
  	var theForm = document.frminscripcion;  
	var i;
	var valor;
	var re;
	re=0;
	if (theForm.txtapepaterno.value=="" || theForm.txtapematerno.value=="" || theForm.txtnombre.value=="" || theForm.txtemail.value=="" || theForm.txttelefono.value=="" || theForm.Via.value=="" || theForm.txtdireccion.value=="" || theForm.cboLNDistrito.value=="-1" || theForm.cboLNDistrito.value=="00")
	{
		//for (i=0; i<=40 ; i++)
		//{
			valor = "p" & "2";
		//	if (theform.key(valor).value == "0" )
		//	{
			//	re=1;
		//	}
					
		//}
//	if (re==1)
	//{
 	return confirm("Ingrese los campos obligatorio (*) ");
	//theForm.Dia.value=="" || theForm.Mes.value=="" || theForm.Anio.value=="" ||
	//}
	}
	else
	{
		//return confirm("Enviar confirmacion");
		//theForm.hddGrabar.value = theForm.btnGrabar.value;
    	theForm.method = "post";
	    theForm.action = "testvocacional.asp";
		theForm.submit();
		//	return confirm("Correcto (*) ");
	}	
}

function limpiar()
{
	  	var theForm = document.frmMostrarSolicitudPreInscripcion;
		theForm.reset();
		
}

