function verificar_formulario_cambio_clave(formulario_cambio_clave) {

  // Verificacion de la contraseña
	var claveAnterior = formulario_cambio_clave.txtClaveAnterior;
    var clave = formulario_cambio_clave.txtClaveNueva.value;
    var clave2 = formulario_cambio_clave.txtClaveNueva2.value;

    if (claveAnterior.value == "") {
      alert("Escriba su \"Contraseña\" anterior.");
      formulario_cambio_clave.txtClaveAnterior.focus();
      return (false);
    }

    if (clave.length < 6) {
      alert("Escriba por lo menos seis (6) caracteres en el campo \"Contraseña Nueva\".");
      formulario_cambio_clave.txtClaveNueva.focus();
      return (false);
    } 

    if (clave2.length < 6) {
      alert("Escriba por lo menos seis (6) caracteres en el campo \"Reescribir Contraseña\".");
      formulario_cambio_clave.txtClaveNueva2.focus();
      return (false);
    } 

    if (clave != clave2) {
      formulario_cambio_clave.txtClaveNueva.value = "";
      formulario_cambio_clave.txtClaveNueva2.value = "";
      alert("Las contraseñas no concuerdan por favor vuelva a escribirlas.");
      formulario_cambio_clave.txtClaveNueva.focus();
      return (false);
    } 

	// Encriptacion de la Clave
    formulario_cambio_clave.txtClaveAnterior.value = md5_vm_test(claveAnterior.value);
	formulario_cambio_clave.txtClaveNueva.value = md5_vm_test(clave);
	formulario_cambio_clave.txtClaveNueva2.value = "";
	
    return (true);

}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_formulario_acceso(formulario_acceso) {
  var email;
  if (formulario_acceso.txtCorreo.value == "") {
    alert("Escriba su Correo.");
    formulario_acceso.txtCorreo.focus();
    return (false);
  }
  email = emailCheck(formulario_acceso.txtCorreo.value);
  if (email) {
    if (formulario_acceso.txtClave.value == "") {
      alert("Escriba su Contraseña.");
      formulario_acceso.txtClave.focus();
      return (false);
    }
    
  	// Encriptacion de la Clave y seteo del campo oculto
    formulario_acceso.txtClave.value = md5_vm_test(formulario_acceso.txtClave.value);
        
    return (true);
  } else {
    formulario_acceso.txtCorreo.focus();
    return (false);
  }
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_letras(valor) {
    var check_letras_OK = "ABCDEFGHIJKLMNÑ‘OPQRSTUVWXYZ abcdefghijklmnñopqrstuvwxyzáéíóú";
    var check_Str_letras = valor;
    var allValid = true;
    for (i = 0; i < check_Str_letras.length; i++) {
      ch = check_Str_letras.charAt(i);
      for (j = 0; j < check_letras_OK.length; j++)
        if (ch == check_letras_OK.charAt(j))
          break;
      if (j == check_letras_OK.length) {
        allValid = false;
        break;
      }
    }
    if (allValid) {
      return (true);
    } else {
      return (false);    
    } 
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_numeros(valor) {
    var check_numeros_OK = "0123456789";
    var check_Str_numeros = valor;
    var allValid = true;
    for (i = 0; i < check_Str_numeros.length; i++) {
      ch = check_Str_numeros.charAt(i);
      for (j = 0; j < check_numeros_OK.length; j++)
        if (ch == check_numeros_OK.charAt(j))
          break;
      if (j == check_numeros_OK.length) {
        allValid = false;
        break;
      }
    }
    if (allValid) {
      return (true);
    } else {
      return (false);    
    } 
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_campos(formulario_registro) {

// Validacion de todos los campos
  if ((formulario_registro.txtCorreo.value == "") || (formulario_registro.txtNombres.value == "") || (formulario_registro.txtApellidos.value == "") || (formulario_registro.txtCedula.value == "") || (formulario_registro.txtClave.value == "") || (formulario_registro.txtClave2.value == "")) {
    alert("Debe llenar todos los campos del formulario.");
    return (false);
  }

  var email = emailCheck(formulario_registro.txtCorreo.value);
// Validacion del correo electronico
  if (email) {

  // Verificacion del campo Nombres
    if (!verificar_letras(formulario_registro.txtNombres.value)) {
      alert("Escriba solo letras en el campo \"Nombres\".");
      formulario_registro.txtNombres.focus();
      return (false);
    } 

  // Verificacion del campo Apellidos
    if (!verificar_letras(formulario_registro.txtApellidos.value)) {
      alert("Escriba solo letras en el campo \"Apellidos\".");
      formulario_registro.txtApellidos.focus();
      return (false);
    } 

  // Verificacion del campo Cedula
    if (!verificar_numeros(formulario_registro.txtCedula.value)) {
      alert("Escriba solo números en el campo \"Cédula\".");
      formulario_registro.txtCedula.focus();
      return (false);
    } 

  // Verificacion de la contraseña
    var clave = formulario_registro.txtClave.value;
    var clave2 = formulario_registro.txtClave2.value;

    if (clave.length < 6) {
      alert("Escriba por lo menos seis (6) caracteres en el campo \"Contraseña\".");
      formulario_registro.txtClave.focus();
      return (false);
    } 

    if (clave2.length < 6) {
      alert("Escriba por lo menos seis (6) caracteres en el campo \"Reescribir Contraseña\".");
      formulario_registro.txtClave2.focus();
      return (false);
    } 

    if (clave != clave2) {
      formulario_registro.txtClave.value = "";
      formulario_registro.txtClave2.value = "";
      alert("Las contraseñas no concuerdan por favor vuelva a escribirlas.");
      formulario_registro.txtClave.focus();
      return (false);
    } 

	// Encriptacion de la Clave
    formulario_registro.txtClave.value = md5_vm_test(clave);
	formulario_registro.txtClave2.value = "";
    return (true);

  } else {
    formulario_registro.txtCorreo.focus();
    return (false);
  }

}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_correo(formulario_correo) {
  var email;
  email = emailCheck(formulario_correo.txtCorreo.value);
  if (email) {
    return (true);
  } else {
    return (false);
  }
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_formulario_datos_personales_externo(documento) {
var formulario_modificacion_datos = documento.frmDatosPersonales;

// Validacion de los campos del fielset Informacion General
  if ((formulario_modificacion_datos.txtNombres.value == "") || (formulario_modificacion_datos.txtApellidos.value == "") || (formulario_modificacion_datos.seNacionalidad.value == "0") || (formulario_modificacion_datos.txtCedula.value == "") || (formulario_modificacion_datos.seSexo.value == "0") || (formulario_modificacion_datos.seEdoCivil.value == "0") || (formulario_modificacion_datos.txtFechaNacimiento.value == "") || (formulario_modificacion_datos.txtLugarNacimiento.value == "")) {
    alert("Debe llenar todos los campos relacionados a la \"Información General\" del formulario.");
    return (false);
  }

  if (formulario_modificacion_datos.seNacionalidad.value == "E") {
  	if (formulario_modificacion_datos.txtFechaNacionalizacion.value == "" || formulario_modificacion_datos.txtNumeroGaceta.value == "") {
      	alert("Debe llenar todos los campos relacionados a la \"Información General\" del formulario.");
	    return (false);
  	}

	if (revisarFecha(formulario_modificacion_datos.txtFechaNacionalizacion.value, '26/01/2009')==false) {
      	    alert("La Fecha de Nacionalización no puede ser mayor a la Fecha Actúal.");
	    return (false);
  	}
  }
	 
// Verificacion del campo Nombres
    if (!verificar_letras(formulario_modificacion_datos.txtNombres.value)) {
      alert("Escriba solo letras en el campo \"Nombre(s)\".");
      formulario_modificacion_datos.txtNombres.focus();
      return (false);
    } 

// Verificacion del campo Apellidos
    if (!verificar_letras(formulario_modificacion_datos.txtApellidos.value)) {
      alert("Escriba solo letras en el campo \"Apellido(s)\".");
      formulario_modificacion_datos.txtApellidos.focus();
      return (false);
    } 

// Verificacion del campo Cédula
    if (!verificar_numeros(formulario_modificacion_datos.txtCedula.value)) {
      alert("Escriba solo números en el campo \"Cédula\".");
      formulario_modificacion_datos.txtCedula.focus();
      return (false);
    } 
    
// Verificacion de los datos de la nacionalidad
	if(formulario_modificacion_datos.seNacionalidad.value == "E"){
	    if (!verificar_numeros(formulario_modificacion_datos.txtNumeroGaceta.value)) {
	      alert("Escriba solo números en el campo \"Número de Gaceta\".");
	      formulario_modificacion_datos.txtNumeroGaceta.focus();
	      return (false);
	    } 
    }

// Validacion de las carga de la Fotografia
  if (formulario_modificacion_datos.rbtOtraFotoS.checked && formulario_modificacion_datos.fileArchivo.value == '') {
    alert("Ud ha seleccionado el agregar una nueva Fotografía, por favor suministre la ruta donde esta ubicada la Fotografía.");
    return (false);
  }


// Validacion de los campos del fielset Informacion de Residencia
  if ((formulario_modificacion_datos.sePais.value == "R2") && ((formulario_modificacion_datos.seEstado.value == "0") || (formulario_modificacion_datos.seMunicipio.value == "0") || (formulario_modificacion_datos.seCiudad.value == "0") || (formulario_modificacion_datos.seParroquia.value == "0") || (formulario_modificacion_datos.taDireccion.value == ""))) {
    alert("Debe llenar todos los campos relacionados a la \"Información de Residencia\" del formulario.");
    return (false);
  }
  if ((formulario_modificacion_datos.sePais.value == "0")) {
    alert("Debe llenar todos los campos relacionados a la \"Información de Residencia\" del formulario.");
    return (false);
  }  
    
       
// Verificacion del campo Traslado
    if (document.getElementById("rbtTrasladoSI").checked) {  
    	if (formulario_modificacion_datos.seEstadoTraslado.value=="") {
	        alert("Seleccione un estado a donde usted este dispuesto a trasladarse para trabajar.");
	    	formulario_modificacion_datos.seEstadoTraslado.focus();
	      	return (false);
	    } 
    } 

// Verificacion de los contactos agregados
	for(i=1;i<=formulario_modificacion_datos.cantidad_contactos.value;i++){
		if(documento.getElementById("txtTextoContacto"+i).value == "" || documento.getElementById("seTipoContacto"+i).selectedIndex == 0){
			alert("Debe seleccionar y llenar los campos relacionados a el contácto "+i);
			return (false);
		}
	}	

      return (true);

}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_formulario_datos_personales_interno(documento) {
var formulario_modificacion_datos = documento.frmDatosPersonales;

// Validacion de los campos del fielset Informacion General
  if (formulario_modificacion_datos.txtNombres.value == "" || formulario_modificacion_datos.txtApellidos.value == "" || formulario_modificacion_datos.txtCedula.value == "") {
    alert("Debe llenar todos los obligatorios relacionados a la \"Información General\" del formulario.");
    return (false);
  }

// Verificacion del campo Nombres
    if (!verificar_letras(formulario_modificacion_datos.txtNombres.value)) {
      alert("Escriba solo letras en el campo \"Nombres\".");
      formulario_modificacion_datos.txtNombres.focus();
      return (false);
    } 

// Verificacion del campo Apellidos
    if (!verificar_letras(formulario_modificacion_datos.txtApellidos.value)) {
      alert("Escriba solo letras en el campo \"Apellidos\".");
      formulario_modificacion_datos.txtApellidos.focus();
      return (false);
    } 

// Verificacion del campo Cédula
    if (!verificar_numeros(formulario_modificacion_datos.txtCedula.value)) {
      alert("Escriba solo números en el campo \"Cédula\".");
      formulario_modificacion_datos.txtCedula.focus();
      return (false);
    } 
    
// Verificacion de los datos de la nacionalidad
	if(formulario_modificacion_datos.seNacionalidad.value == "E"){
	    if (!verificar_numeros(formulario_modificacion_datos.txtNumeroGaceta.value)) {
	      alert("Escriba solo números en el campo \"Número de Gaceta\".");
	      formulario_modificacion_datos.txtNumeroGaceta.focus();
	      return (false);
	    } 
    }

// Validacion de las carga de la Fotografia
  if (formulario_modificacion_datos.rbtOtraFotoS.checked && formulario_modificacion_datos.fileArchivo.value == '') {
    alert("Ud ha seleccionado el agregar una nueva Fotografía, por favor suministre la ruta donde esta ubicada la Fotografía.");
    return (false);
  }


// Validacion de los campos del fielset Informacion de Residencia
  if ((formulario_modificacion_datos.sePais.value == "0")) {
    alert("Debe llenar todos los campos relacionados a la \"Información de Residencia\" del formulario.");
    return (false);
  }
        
// Verificacion del campo Traslado
    if (document.getElementById("rbtTrasladoSI").checked) {  
    	if (formulario_modificacion_datos.seEstadoTraslado.value=="") {
	        alert("Seleccione un estado a donde usted este dispuesto a trasladarse para trabajar.");
	    	formulario_modificacion_datos.seEstadoTraslado.focus();
	      	return (false);
	    } 
    } 

// Verificacion de los contactos agregados
	for(i=1;i<=formulario_modificacion_datos.cantidad_contactos.value;i++){
		if(documento.getElementById("txtTextoContacto"+i).value == "" || documento.getElementById("seTipoContacto"+i).selectedIndex == 0){
			alert("Debe seleccionar y llenar los campos relacionados a el contácto "+i);
			return (false);
		}
	}	

// Verificacion de los datos de la informacion de referencia
	if(document.getElementById("rbtReferidoSI").checked){
		if (formulario_modificacion_datos.txtNombreReferencia.value == "") {
	      alert("Coloque el Nombre de la Persona que hace referencia a esta Resumen Curricular.");
	      formulario_modificacion_datos.txtNombreReferencia.focus();
	      return (false);
	    } 	  
		if (formulario_modificacion_datos.seDireccion.value == "") {
	      alert("Seleccione la dirección donde pertenece la persona que hacer referencia al Resumen Curricular.");
	      formulario_modificacion_datos.seDireccion.focus();
	      return (false);
	    } 
		if (formulario_modificacion_datos.taObservacion.value == "") {
	      alert("Escriba las observaciones de la Referencia.");
	      formulario_modificacion_datos.taObservacion.focus();
	      return (false);
	    }  
    }

      return (true);

}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_formulario_estudios(documento) {
var formulario_estudios_formales = documento.frmDatosAcademicos;
var i = 0;

// Verificacion 
	for(indice=1;indice<=formulario_estudios_formales.cantidad_IA.value;indice++){
		i=indice;
		// Verificacion del Nivel Academico
		if(documento.getElementById("rbtOtroNA"+i).checked){
			if(documento.getElementById("txtOtroNA"+i).value == 0){
				alert("Debe llenar el campo relacionado a la Otro Nivel Académico\n(Formación Académica Número "+i+")");
				documento.getElementById("txtOtroNA"+i).focus();
				return (false);
			}				
		} else {
			if(documento.getElementById("seNivelAcademico"+i).value == 0){
				alert("Debe selecionar el campo Nivel Académico\n(Formación Académica Número "+i+")");
				documento.getElementById("seNivelAcademico"+i).focus();
				return (false);				
			}
		}
		// Verificacion del Instituto de Formacion Academica
		if(documento.getElementById("rbtOtroIFA"+i).checked){
			if(documento.getElementById("txtOtroIFA"+i).value == 0){
				alert("Debe llenar el campo relacionado a la Otro Instituto de Formación Académica\n(Formación Académica Número "+i+")");
				documento.getElementById("txtOtroIFA"+i).focus();
				return (false);
			}				
		} else {
			if(documento.getElementById("seIFAcademica"+i).value == 0){
				alert("Debe selecionar el campo Instituto de Formación Académica\n(Formación Académica Número "+i+")");
				documento.getElementById("seIFAcademica"+i).focus();
				return (false);				
			}
		}
		// Verificacion de la Carrera
		if(documento.getElementById("rbtOtraCarrera"+i).checked){
			if(documento.getElementById("txtOtraCarrera"+i).value == 0){
				alert("Debe llenar el campo relacionado a la Otra Carrera\n(Formación Académica Número "+i+")");
				documento.getElementById("txtOtraCarrera"+i).focus();
				return (false);
			}				
		} else {
			if(documento.getElementById("seCarrera"+i).value == 0){
				alert("Debe selecionar el campo Carrera\n(Formación Académica Número "+i+")");
				documento.getElementById("seCarrera"+i).focus();
				return (false);				
			}
		}
		// Verificacion si es o no graduado
		var a = documento.getElementsByName("rbtGraduado"+i);
		if(a[0].checked){
			if(!(documento.getElementById("rbtCertificacionSI"+i).checked || documento.getElementById("rbtCertificacionNO"+i).checked || documento.getElementById("rbtCertificacionOT"+i).checked)){
				alert("¡Debe seleccionar la Certificación!\n(Formación Académica Número "+i+")");
				return (false);
			}
			var b = documento.getElementsByName("rbtCertificacion"+i);
			if(b[0].checked){
				if(!(documento.getElementById("rbtRegistroSI"+i).checked || documento.getElementById("rbtRegistroNO"+i).checked || documento.getElementById("rbtRegistroOT"+i).checked)){
					alert("¡Debe seleccionar el Registro!\n(Formación Académica Número "+i+")");
					return (false);
				}
			}			
			if(!(documento.getElementById("rbtRevalidaSI"+i).checked || documento.getElementById("rbtRevalidaNO"+i).checked || documento.getElementById("rbtRevalidaOT"+i).checked)){
				alert("¡Debe seleccionar la Reválida!\n(Formación Académica Número "+i+")");
				return (false);
			}
		}
		if(a[1].checked){
			if(documento.getElementById("txtUltimoGrado"+i).value != ""){
				if (!verificar_numeros(documento.getElementById("txtUltimoGrado"+i).value)) {
	   				alert("Escriba solo números en el campo Último Grado Alcanzado\n(Formación Académica Número "+i+")");
	   				documento.getElementById("txtUltimoGrado"+i).focus();
			    	return (false);
			   	}
			   	if(documento.getElementById("seDuracion"+i).value == 0){
					alert("Debe seleccionar el campo Duración\n(Formación Académica Número "+i+")");
					documento.getElementById("seDuracion"+i).focus();
					return (false);				
				}		
			}
			

		}
	}
    return (true);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_formulario_datos_cursos_externo(documento) {
var formulario_datos_cursos = documento.frmDatosCursos;
var i = 0;
// Verificacion 
	for(indice=1;indice<=formulario_datos_cursos.cantidad_cursos.value;indice++){
		i=indice;
		if(documento.getElementById("rbtOtroIC"+i).checked){
			if(documento.getElementById("txtOtroIC"+i).value == "" || documento.getElementById("txtDenominacion"+i).value == "" || documento.getElementById("txtDuracion"+i).value == "" || documento.getElementById("seDuracion"+i).selectedIndex == "0" || documento.getElementById("txtFecha"+i).value == ""){
				alert("Debe seleccionar y llenar los campos obligatorios relacionados a el Curso Número "+i);
				return (false);
			}
			if(documento.getElementById("txtDuracion"+i).value!=""){
				if (!verificar_numeros(documento.getElementById("txtDuracion"+i).value)) {
	      			alert("Escriba solo números en el campo \"Duración\".");
	      			documento.getElementById("txtDuracion"+i).focus();
				    return (false);
			   	} else {
			   		if(documento.getElementById("seDuracion"+i).selectedIndex == 0){
			   			alert("Seleccione un período de la lista en el campo \"Período\".");
			   			documento.getElementById("seDuracion"+i).focus();
				    	return (false);
			   		}		   	
			   	}
			}	   					
		} else {
			if(documento.getElementById("txtDenominacion"+i).value == "" || documento.getElementById("txtDuracion"+i).value == "" || documento.getElementById("seDuracion"+i).selectedIndex == "0" || documento.getElementById("txtFecha"+i).value == ""){
				alert("Debe seleccionar y llenar los campos obligatorios relacionados a el Curso Número "+i);
				return (false);				
			}
			if(documento.getElementById("txtDuracion"+i).value!=""){
				if (!verificar_numeros(documento.getElementById("txtDuracion"+i).value)) {
	      			alert("Escriba solo números en el campo \"Duración\".");
	      			documento.getElementById("txtDuracion"+i).focus();
				    return (false);
			   	} else {
			   		if(documento.getElementById("seDuracion"+i).selectedIndex == 0){
			   			alert("Seleccione un período de la lista en el campo \"Período\".");
			   			documento.getElementById("seDuracion"+i).focus();
				    	return (false);
				    }
			   	}
		   	}
		   	
		}
	}
    return (true);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_formulario_datos_cursos_interno(documento) {
var formulario_datos_cursos = documento.frmDatosCursos;
var i = 0;
// Verificacion 
	for(indice=1;indice<=formulario_datos_cursos.cantidad_cursos.value;indice++){
		i=indice;
		if(documento.getElementById("rbtOtroIC"+i).checked){
			if(documento.getElementById("txtOtroIC"+i).value == "" || documento.getElementById("txtDenominacion"+i).value == ""  || !(documento.getElementById("rbtCertificacionSI"+i).checked || documento.getElementById("rbtCertificacionNO"+i).checked || documento.getElementById("rbtCertificacionOT"+i).checked)){
				alert("Debe seleccionar y llenar los campos obligatorios relacionados a el Curso Número "+i);
				return (false);
			}
			if(documento.getElementById("txtDuracion"+i).value!=""){
				if (!verificar_numeros(documento.getElementById("txtDuracion"+i).value)) {
	      			alert("Escriba solo números en el campo \"Duración\".");
	      			documento.getElementById("txtDuracion"+i).focus();
				    return (false);
			   	} else {
			   		if(documento.getElementById("seDuracion"+i).selectedIndex == 0){
			   			alert("Seleccione un período de la lista en el campo \"Período\".");
			   			documento.getElementById("seDuracion"+i).focus();
				    	return (false);
			   		}		   	
			   	}
			}	   					
		} else {
			if(documento.getElementById("txtDenominacion"+i).value == "" || !(documento.getElementById("rbtCertificacionSI"+i).checked || documento.getElementById("rbtCertificacionNO"+i).checked || documento.getElementById("rbtCertificacionOT"+i).checked)){
				alert("Debe seleccionar y llenar los campos obligatorios relacionados a el Curso Número "+i);
				return (false);				
			}
			if(documento.getElementById("txtDuracion"+i).value!=""){
				if (!verificar_numeros(documento.getElementById("txtDuracion"+i).value)) {
	      			alert("Escriba solo números en el campo \"Duración\".");
	      			documento.getElementById("txtDuracion"+i).focus();
				    return (false);
			   	} else {
			   		if(documento.getElementById("seDuracion"+i).selectedIndex == 0){
			   			alert("Seleccione un período de la lista en el campo \"Período\".");
			   			documento.getElementById("seDuracion"+i).focus();
				    	return (false);
				    }
			   	}
		   	}
		   	
		}
	}
    return (true);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_formulario_datos_asociaciones_externo(documento) {
var formulario_datos_asociaciones = documento.frmColegiosAsociaciones;

// Verificacion 
	for(i=1;i<=formulario_datos_asociaciones.cantidad_colegiaturas.value;i++){
		if(documento.getElementById("rbtOtroCA"+i).checked){
			if(documento.getElementById("txtOtroCA"+i).value == "" || documento.getElementById("txtFecha"+i).value == ""){
				alert("Debe seleccionar y llenar los campos relacionados a la Colegiatura Número "+i);
				return (false);
			}		
		} else {
			if(documento.getElementById("txtFecha"+i).value == ""){
				alert("Debe seleccionar y llenar los campos relacionados a la Colegiatura Número "+i);
				return (false);
			}
		}
	}	
    return (true);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_formulario_datos_asociaciones_interno(documento) {
var formulario_datos_asociaciones = documento.frmColegiosAsociaciones;

// Verificacion 
	for(i=1;i<=formulario_datos_asociaciones.cantidad_colegiaturas.value;i++){
		if(documento.getElementById("rbtOtroCA"+i).checked){
			if(documento.getElementById("txtOtroCA"+i).value == ""){
				alert("Debe seleccionar y llenar los campos relacionados a la Colegiatura Número "+i);
				return (false);
			}		
		}
	}	
    return (true);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_formulario_experiencias(documento) {
var formulario_experiencias_laborales = documento.frmExperienciaLaboral;
var i = 0;

// Verificacion 
	for(indice=1;indice<=formulario_experiencias_laborales.cantidad_ILaboral.value;indice++){
		i=indice;
		if(documento.getElementById("rbtOtraEmpresa"+i).checked){
			// Anterior: if(documento.getElementById("seRamaEmpresa"+i).value == 0 || documento.getElementById("txtOtraEmpresa"+i).value == "" || documento.getElementById("txtCargo"+i).value == "" || documento.getElementById("txtFuncion"+i).value == "" || documento.getElementById("txtFechaIngreso"+i).value == "" || documento.getElementById("txtFechaEgreso"+i).value == "" || documento.getElementById("txtSueldo"+i).value == "" || documento.getElementById("txtMotivoEgreso"+i).value == "" || !(documento.getElementById("rbtCertificacionSI"+i).checked || documento.getElementById("rbtCertificacionNO"+i).checked) || documento.getElementById("txtNombreJefe"+i).value == "" || documento.getElementById("txtApellidoJefe"+i).value == "" || documento.getElementById("txtCargoJefe"+i).value == "" || documento.getElementById("seTipoContacto"+i).value == 0 || documento.getElementById("txtTextoContacto"+i).value == ""){
			if(documento.getElementById("seRamaEmpresa"+i).value == 0 || documento.getElementById("txtOtraEmpresa"+i).value == "" || documento.getElementById("txtCargo"+i).value == "" || !(documento.getElementById("rbtCertificadoCarreraSI"+i).checked || documento.getElementById("rbtCertificadoCarreraNO"+i).checked || documento.getElementById("rbtCertificadoCarreraOT"+i).checked)){
				alert("Debe seleccionar y llenar los campos relacionados a la Experiencia Laboral Número "+i);
				return (false);
			}
			
			if(documento.getElementById("txtFechaIngreso"+i).value != "" && documento.getElementById("txtFechaEgreso"+i).value != ""){
				// Fecha de Ingreso
				var date1 = documento.getElementById("txtFechaIngreso"+i).value;
				var array1 = date1.split("/");
				// Fecha de Egreso
				var date2 = documento.getElementById("txtFechaEgreso"+i).value;
				var array2 = date2.split("/");
				if(array1[2]>array2[2]){
					alert("La Fecha de Ingreso a la Empresa no puede ser mayor a la Fecha de Egreso en la Experiencia Laboral Número "+i);
					return (false);
				}else{
					if(array1[1]>array2[1] && array1[2]==array2[2]){
						alert("La Fecha de Ingreso a la Empresa no puede ser mayor a la Fecha de Egreso en la Experiencia Laboral Número "+i);
						return (false);
					}else{
						if(array1[0]>array2[0] && array1[1]==array2[1] && array1[2]==array2[2]){
							alert("La Fecha de Ingreso a la Empresa no puede ser mayor a la Fecha de Egreso en la Experiencia Laboral Número "+i);
							return (false);
						}				
					}
				}
			}
			
			if (!verificar_numeros(documento.getElementById("txtSueldo"+i).value)) {
      			alert("Escriba solo números en el campo \"Sueldo\".");
			    return (false);
		   	}
		   	if (!verificar_numeros(documento.getElementById("txtNumeroCertificado"+i).value)) {
      			alert("Escriba solo números en el campo \"Número de Certificado de Carrera\".");
			    return (false);
		   	} 
		} else {
			// Anterior: if(documento.getElementById("seRamaEmpresa"+i).value == 0 || documento.getElementById("seEmpresa"+i).value == -1 || documento.getElementById("txtCargo"+i).value == "" || documento.getElementById("txtFuncion"+i).value == "" || documento.getElementById("txtFechaIngreso"+i).value == "" || documento.getElementById("txtFechaEgreso"+i).value == "" || documento.getElementById("txtSueldo"+i).value == "" || documento.getElementById("txtMotivoEgreso"+i).value == "" || !(documento.getElementById("rbtCertificacionSI"+i).checked || documento.getElementById("rbtCertificacionNO"+i).checked) || documento.getElementById("txtNombreJefe"+i).value == "" || documento.getElementById("txtApellidoJefe"+i).value == "" || documento.getElementById("txtCargoJefe"+i).value == "" || documento.getElementById("seTipoContacto"+i).value == 0 || documento.getElementById("txtTextoContacto"+i).value == ""){
			if(documento.getElementById("seRamaEmpresa"+i).value == 0 || documento.getElementById("seEmpresa"+i).value == "" || documento.getElementById("txtCargo"+i).value == "" || !(documento.getElementById("rbtCertificadoCarreraSI"+i).checked || documento.getElementById("rbtCertificadoCarreraNO"+i).checked || documento.getElementById("rbtCertificadoCarreraOT"+i).checked)){
				alert("Debe seleccionar y llenar los campos relacionados a la Experiencia Laboral Número "+i);
				return (false);				
			}
			
			if(documento.getElementById("txtFechaIngreso"+i).value != "" && documento.getElementById("txtFechaEgreso"+i).value != ""){
				// Fecha de Ingreso
				var date1 = documento.getElementById("txtFechaIngreso"+i).value;
				var array1 = date1.split("/");
				// Fecha de Egreso
				var date2 = documento.getElementById("txtFechaEgreso"+i).value;
				var array2 = date2.split("/");
				if(array1[2]>array2[2]){
					alert("La Fecha de Ingreso a la Empresa no puede ser mayor a la Fecha de Egreso en la Experiencia Laboral Número "+i);
					return (false);
				}else{
					if(array1[1]>array2[1] && array1[2]==array2[2]){
						alert("La Fecha de Ingreso a la Empresa no puede ser mayor a la Fecha de Egreso en la Experiencia Laboral Número "+i);
						return (false);
					}else{
						if(array1[0]>array2[0] && array1[1]==array2[1] && array1[2]==array2[2]){
							alert("La Fecha de Ingreso a la Empresa no puede ser mayor a la Fecha de Egreso en la Experiencia Laboral Número "+i);
							return (false);
						}				
					}
				}
			}
			
			if (!verificar_numeros(documento.getElementById("txtSueldo"+i).value)) {
      			alert("Escriba solo números en el campo \"Sueldo\".");
			    return (false);
		   	} 
		   	if (!verificar_numeros(documento.getElementById("txtNumeroCertificado"+i).value)) {
      			alert("Escriba solo números en el campo \"Número de Certificado de Carrera\".");
			    return (false);
		   	}
		   	
			if(!(documento.getElementById("txtNombreJefe"+i).value == "" && documento.getElementById("txtApellidoJefe"+i).value == "" && documento.getElementById("txtCargoJefe"+i).value == "")){
				if(documento.getElementById("txtNombreJefe"+i).value == "" || documento.getElementById("txtApellidoJefe"+i).value == "" || documento.getElementById("txtCargoJefe"+i).value == ""){
					alert("Si desea introducir los Datos del Jefe / Supervissor debe introducir como minimo el Nombre, Apellido y Cargo relacionados a la Experiencia Laboral Número "+i);
					return (false);
				}
			}
		   	
		}
	}
    return (true);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_formulario_experiencias_operador(documento) {
var formulario_experiencias_laborales = documento.frmExperienciaLaboral;
var i = 0;

// Verificacion 
	for(indice=1;indice<=formulario_experiencias_laborales.cantidad_ILaboral.value;indice++){
		i=indice;
		if(documento.getElementById("rbtOtraEmpresa"+i).checked){
			// Anterior: if(documento.getElementById("seRamaEmpresa"+i).value == 0 || documento.getElementById("txtOtraEmpresa"+i).value == "" || documento.getElementById("txtCargo"+i).value == "" || documento.getElementById("txtFuncion"+i).value == "" || documento.getElementById("txtFechaIngreso"+i).value == "" || documento.getElementById("txtFechaEgreso"+i).value == "" || documento.getElementById("txtSueldo"+i).value == "" || documento.getElementById("txtMotivoEgreso"+i).value == "" || !(documento.getElementById("rbtCertificacionSI"+i).checked || documento.getElementById("rbtCertificacionNO"+i).checked) || documento.getElementById("txtNombreJefe"+i).value == "" || documento.getElementById("txtApellidoJefe"+i).value == "" || documento.getElementById("txtCargoJefe"+i).value == "" || documento.getElementById("seTipoContacto"+i).value == 0 || documento.getElementById("txtTextoContacto"+i).value == ""){
			if(documento.getElementById("seRamaEmpresa"+i).value == 0 || documento.getElementById("txtOtraEmpresa"+i).value == "" || documento.getElementById("txtCargo"+i).value == "" || !(documento.getElementById("rbtCertificacionSI"+i).checked || documento.getElementById("rbtCertificacionNO"+i).checked || documento.getElementById("rbtCertificacionOT"+i).checked) || !(documento.getElementById("rbtCertificadoCarreraSI"+i).checked || documento.getElementById("rbtCertificadoCarreraNO"+i).checked || documento.getElementById("rbtCertificadoCarreraOT"+i).checked)){
				alert("Debe seleccionar y llenar los campos relacionados a la Experiencia Laboral Número "+i);
				return (false);
			}
			
			if(documento.getElementById("txtFechaIngreso"+i).value != "" && documento.getElementById("txtFechaEgreso"+i).value != ""){
				// Fecha de Ingreso
				var date1 = documento.getElementById("txtFechaIngreso"+i).value;
				var array1 = date1.split("/");
				// Fecha de Egreso
				var date2 = documento.getElementById("txtFechaEgreso"+i).value;
				var array2 = date2.split("/");

				if(array1.length==3 && array2.length==3){
					if(array1[2]>array2[2]){
						alert("La Fecha de Ingreso a la Empresa no puede ser mayor a la Fecha de Egreso en la Experiencia Laboral Número "+i);
						return (false);
					}else{
						if(array1[1]>array2[1] && array1[2]==array2[2]){
							alert("La Fecha de Ingreso a la Empresa no puede ser mayor a la Fecha de Egreso en la Experiencia Laboral Número "+i);
							return (false);
						}else{
							if(array1[0]>array2[0] && array1[1]==array2[1] && array1[2]==array2[2]){
								alert("La Fecha de Ingreso a la Empresa no puede ser mayor a la Fecha de Egreso en la Experiencia Laboral Número "+i);
								return (false);
							}				
						}
					}
				}
			}
			
			if (!verificar_numeros(documento.getElementById("txtSueldo"+i).value)) {
      			alert("Escriba solo números en el campo \"Sueldo\".");
			    return (false);
		   	}
		   	if (!verificar_numeros(documento.getElementById("txtNumeroCertificado"+i).value)) {
      			alert("Escriba solo números en el campo \"Número de Certificado de Carrera\".");
			    return (false);
		   	} 
		} else {
			// Anterior: if(documento.getElementById("seRamaEmpresa"+i).value == 0 || documento.getElementById("seEmpresa"+i).value == -1 || documento.getElementById("txtCargo"+i).value == "" || documento.getElementById("txtFuncion"+i).value == "" || documento.getElementById("txtFechaIngreso"+i).value == "" || documento.getElementById("txtFechaEgreso"+i).value == "" || documento.getElementById("txtSueldo"+i).value == "" || documento.getElementById("txtMotivoEgreso"+i).value == "" || !(documento.getElementById("rbtCertificacionSI"+i).checked || documento.getElementById("rbtCertificacionNO"+i).checked) || documento.getElementById("txtNombreJefe"+i).value == "" || documento.getElementById("txtApellidoJefe"+i).value == "" || documento.getElementById("txtCargoJefe"+i).value == "" || documento.getElementById("seTipoContacto"+i).value == 0 || documento.getElementById("txtTextoContacto"+i).value == ""){
			if(documento.getElementById("seRamaEmpresa"+i).value == 0 || documento.getElementById("seEmpresa"+i).value == "" || documento.getElementById("txtCargo"+i).value == "" || !(documento.getElementById("rbtCertificacionSI"+i).checked || documento.getElementById("rbtCertificacionNO"+i).checked || documento.getElementById("rbtCertificacionOT"+i).checked) || !(documento.getElementById("rbtCertificadoCarreraSI"+i).checked || documento.getElementById("rbtCertificadoCarreraNO"+i).checked || documento.getElementById("rbtCertificadoCarreraOT"+i).checked)){
				alert("Debe seleccionar y llenar los campos relacionados a la Experiencia Laboral Número "+i);
				return (false);				
			}
			
			if(documento.getElementById("txtFechaIngreso"+i).value != "" && documento.getElementById("txtFechaEgreso"+i).value != ""){
				// Fecha de Ingreso
				var date1 = documento.getElementById("txtFechaIngreso"+i).value;
				var array1 = date1.split("/");
				// Fecha de Egreso
				var date2 = documento.getElementById("txtFechaEgreso"+i).value;
				var array2 = date2.split("/");

				if(array1.length==3 && array2.length==3){
					if(array1[2]>array2[2]){
						alert("La Fecha de Ingreso a la Empresa no puede ser mayor a la Fecha de Egreso en la Experiencia Laboral Número "+i);
						return (false);
					}else{
						if(array1[1]>array2[1] && array1[2]==array2[2]){
							alert("La Fecha de Ingreso a la Empresa no puede ser mayor a la Fecha de Egreso en la Experiencia Laboral Número "+i);
							return (false);
						}else{
							if(array1[0]>array2[0] && array1[1]==array2[1] && array1[2]==array2[2]){
								alert("La Fecha de Ingreso a la Empresa no puede ser mayor a la Fecha de Egreso en la Experiencia Laboral Número "+i);
								return (false);
							}				
						}
					}
				}
			}
			
			if (!verificar_numeros(documento.getElementById("txtSueldo"+i).value)) {
      			alert("Escriba solo números en el campo \"Sueldo\".");
			    return (false);
		   	} 
		   	if (!verificar_numeros(documento.getElementById("txtNumeroCertificado"+i).value)) {
      			alert("Escriba solo números en el campo \"Número de Certificado de Carrera\".");
			    return (false);
		   	} 
		   	
		   	if(!(documento.getElementById("txtNombreJefe"+i).value == "" && documento.getElementById("txtApellidoJefe"+i).value == "" && documento.getElementById("txtCargoJefe"+i).value == "")){
				if(documento.getElementById("txtNombreJefe"+i).value == "" || documento.getElementById("txtApellidoJefe"+i).value == "" || documento.getElementById("txtCargoJefe"+i).value == ""){
					alert("Si desea introducir los Datos del Jefe / Supervissor debe introducir como minimo el Nombre, Apellido y Cargo relacionados a la Experiencia Laboral Número "+i);
					return (false);
				}
			}
		}
	}
    return (true);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_formulario_busqueda_usuario(documento) {
var formulario_busqueda_usuario = documento.frmBuscarUsuario;

// Verificacion del campo Correo
    if (formulario_busqueda_usuario.txtCorreo.value=="") {
      alert("Por favor llene el campo \"Correo Electrónico\".");
      formulario_busqueda_usuario.txtCorreo.focus();
      return (false);
    }

var email = emailCheck(formulario_busqueda_usuario.txtCorreo.value);
// Validacion del correo electronico
    if (email) {
  	  return (true);
    } else {
      formulario_busqueda_usuario.txtCorreo.focus();
      return (false);
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_formulario_usuario(documento) {
var formulario_usuario = documento.frmDatosUsuario;

// Validacion de los campos del fielset Informacion General
  if ((formulario_usuario.txtCorreo.value == "") || (formulario_usuario.txtNombres.value == "") || (formulario_usuario.txtApellidos.value == "") || (formulario_usuario.txtCedula.value == "") || (formulario_usuario.sePerfil.value == "0")) {
    alert("Debe llenar todos los campos del formulario.");
    return (false);
  }

var email = emailCheck(formulario_usuario.txtCorreo.value);
// Validacion del correo electronico
  if (!email) {
    formulario_usuario.txtCorreo.focus();
  	return (false);
  }

// Verificacion del campo Nombres
    if (!verificar_letras(formulario_usuario.txtNombres.value)) {
      alert("Escriba solo letras en el campo \"Nombres\".");
      formulario_usuario.txtNombres.focus();
      return (false);
    } 

// Verificacion del campo Apellidos
    if (!verificar_letras(formulario_usuario.txtApellidos.value)) {
      alert("Escriba solo letras en el campo \"Apellidos\".");
      formulario_usuario.txtApellidos.focus();
      return (false);
    } 

// Verificacion del campo Cédula
    if (!verificar_numeros(formulario_usuario.txtCedula.value)) {
      alert("Escriba solo números en el campo \"Cédula\".");
      formulario_usuario.txtCedula.focus();
      return (false);
    } 

      return (true);

}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_formulario_modificacion_usuario(documento) {
var formulario_usuario = documento.frmDatosUsuario;

// Validacion de los campos del fielset Informacion General
  if ((formulario_usuario.txtNombres.value == "") || (formulario_usuario.txtApellidos.value == "") || (formulario_usuario.txtCedula.value == "") || (formulario_usuario.sePerfil.value == "0")) {
    alert("Debe llenar todos los campos del formulario.");
    return (false);
  }

// Verificacion del campo Nombres
    if (!verificar_letras(formulario_usuario.txtNombres.value)) {
      alert("Escriba solo letras en el campo \"Nombres\".");
      formulario_usuario.txtNombres.focus();
      return (false);
    } 

// Verificacion del campo Apellidos
    if (!verificar_letras(formulario_usuario.txtApellidos.value)) {
      alert("Escriba solo letras en el campo \"Apellidos\".");
      formulario_usuario.txtApellidos.focus();
      return (false);
    } 

// Verificacion del campo Cédula
    if (!verificar_numeros(formulario_usuario.txtCedula.value)) {
      alert("Escriba solo números en el campo \"Cédula\".");
      formulario_usuario.txtCedula.focus();
      return (false);
    } 

      return (true);

}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_formulario_insercion_busqueda(formulario) {
  if (formulario.txtCorreo.value == "") {
    alert("Escriba su Correo.");
    formulario.txtCorreo.focus();
    return (false);
  }
  return emailCheck(formulario.txtCorreo.value);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verificar_formulario_insercion_cv(documento) {
var formulario_usuario = documento.frmInsertarCV;

  if (documento.getElementById("rbtCorreoSI").checked) {  
	// Validacion de todos los campos 
  	if ((formulario_usuario.txtNombres.value == "") || (formulario_usuario.txtApellidos.value == "") || (formulario_usuario.txtCorreo.value == "") || (formulario_usuario.txtCedula.value == "")) {
        alert("Debe llenar todos los campos del formulario.");
    	return (false);
    }  
  }else{
    // Validacion de todos los campos 
    if ((formulario_usuario.txtNombres.value == "") || (formulario_usuario.txtApellidos.value == "") || (formulario_usuario.txtCedula.value == "")) {
    	alert("Debe llenar todos los campos del formulario.");
    	return (false);
    } 
  }  

// Verificacion del campo Nombres
    if (!verificar_letras(formulario_usuario.txtNombres.value)) {
      alert("Escriba solo letras en el campo \"Nombres\".");
      formulario_usuario.txtNombres.focus();
      return (false);
    } 

// Verificacion del campo Apellidos
    if (!verificar_letras(formulario_usuario.txtApellidos.value)) {
      alert("Escriba solo letras en el campo \"Apellidos\".");
      formulario_usuario.txtApellidos.focus();
      return (false);
    } 

// Verificacion del campo Cedula
    if (!verificar_numeros(formulario_usuario.txtCedula.value)) {
      alert("Escriba solo números en el campo \"Cédula\".");
      formulario_usuario.txtCedula.focus();
      return (false);
    } 

// Validacion de los campos del fielset Informacion General
  if (documento.getElementById("rbtCorreoSI").checked) {  
	var email = emailCheck(formulario_usuario.txtCorreo.value);
	// Validacion del correo electronico
	if (!email) {
		formulario_usuario.txtCorreo.focus();
	  	return (false);
	}  
  }
  
  return (true);

}






function revisarFecha(fecha,fechaactual){
	// Fecha
	var date1 = fecha;
	var array1 = date1.split("/");				
	// Fecha ACTUAL
	var date3 = fechaactual;
	var array3 = date3.split("/");			
	// Revisando que la Fecha no sea mayor a la Fecha Actual
	if(array1[2]>array3[2]){
		return (false);
	}else{
		if(array1[1]>array3[1] && array1[2]==array3[2]){
			return (false);
		}else{
			if(array1[0]>array3[0] && array1[1]==array3[1] && array1[2]==array3[2]){
				return (false);
			}
		}
	}
	return (true);
}	