// JavaScript Document
  function valida_form()
  {
      var naci=document.frm_alumno.cbo_nacionalidad.selectedIndex;
	  if(dato_vacio(document.frm_alumno.txt_cedula.value))
	  {
	     if(naci==0)
		    alert("Ingrese el Número de Cédula.");
		  else
		    alert("Ingrese el Número de Pasaporte.");
	     document.frm_alumno.txt_cedula.focus();
		 return false;
	  }
	  if(naci==0)//valido cedula
	  {
	     if(!valida_cedula(document.frm_alumno.txt_cedula.value))
		 {
		    document.frm_alumno.txt_cedula.value="";
			document.frm_alumno.txt_cedula.focus();
			return false;
		 }
	  }
	  else//valido pasaporte
	  {
		 var pasaporte=document.frm_alumno.txt_cedula.value;
		 if(!valida_numero(pasaporte))
		 {
			alert("El Nº de Pasaporte debe ser numérico.");
			document.frm_alumno.txt_cedula.value="";
			document.frm_alumno.txt_cedula.focus();
			return false;
		 } 
		 if(pasaporte.length<9)
		 {
		    alert("El Nº de Pasaporte debe tener mínimo 9 digitos.");
			document.frm_alumno.txt_cedula.value="";
			document.frm_alumno.txt_cedula.focus();
			return false;
		 }
		 if(parseFloat(pasaporte)==0)
		 {
		    alert("El Nº de Pasaporte debe ser diferente a 0.");
			document.frm_alumno.txt_cedula.value="";
			document.frm_alumno.txt_cedula.focus();
			return false;
		 }
	  }
	  
	  if(dato_vacio(document.frm_alumno.txt_nombre.value))
	  {
	     alert("Ingrese sus Nombres.");
		 document.frm_alumno.txt_nombre.value="";
		 document.frm_alumno.txt_nombre.focus();
		 return false;
	  }
	  if(!valida_letras(document.frm_alumno.txt_nombre.value))
	  {
		 alert("Error al ingresar sus Nombres.");
		 document.frm_alumno.txt_nombre.value="";
		 document.frm_alumno.txt_nombre.focus();
		 return false;
	  }
	  
	  if(dato_vacio(document.frm_alumno.txt_apellido.value))
	  {
	     alert("Ingrese sus Apellidos.");
		 document.frm_alumno.txt_apellido.value="";
		 document.frm_alumno.txt_apellido.focus();
		 return false;
	  }
	  if(!valida_letras(document.frm_alumno.txt_apellido.value))
	  {
		 alert("Error al ingresar sus Apellidos.");
		 document.frm_alumno.txt_apellido.value="";
		 document.frm_alumno.txt_apellido.focus();
		 return false;
	  }
	  
	  if(document.frm_alumno.cbo_anio.selectedIndex==0)
	  {
	     alert("Seleccione el año de nacimiento.");
		 document.frm_alumno.cbo_anio.focus();
		 return false;
	  }
	  if(document.frm_alumno.cbo_mes.selectedIndex==0)
	  {
	     alert("Seleccione el mes de nacimiento.");
		 document.frm_alumno.cbo_mes.focus();
		 return false;
	  }
	  if(document.frm_alumno.cbo_dia.selectedIndex==0)
	  {
	     alert("Seleccione el día de nacimiento.");
		 document.frm_alumno.cbo_dia.focus();
		 return false;
	  }
	  if(!dato_vacio(document.frm_alumno.txt_libmil.value))
	  {
	     if(!valida_numero(document.frm_alumno.txt_libmil.value))
		 {
			alert("El Nº de libreta militar debe ser numérico.");
			document.frm_alumno.txt_libmil.value="";
			document.frm_alumno.txt_libmil.focus();
			return false;
		 }
	  }
	  
	  if(document.frm_alumno.cbo_paisn.selectedIndex==0)
	  {
	     alert("Seleccione el país de nacimiento.");
		 document.frm_alumno.cbo_paisn.focus();
		 return false;
	  }
	  if(document.frm_alumno.cbo_provn.selectedIndex==0 && document.frm_alumno.cbo_provn.options[document.frm_alumno.cbo_provn.selectedIndex].text!='NINGUNA')
	  {
	     alert("Seleccione la provincia de nacimiento.");
		 document.frm_alumno.cbo_provn.focus();
		 return false;
	  }
	  if(document.frm_alumno.cbo_ciudn.selectedIndex==0 && document.frm_alumno.cbo_ciudn.options[document.frm_alumno.cbo_ciudn.selectedIndex].text!='NINGUNA')
	  {
	     alert("Seleccione el cantón de nacimiento.");
		 document.frm_alumno.cbo_ciudn.focus();
		 return false;
	  }
	  if(document.frm_alumno.cbo_paisr.selectedIndex==0)
	  {
	     alert("Seleccione el país de residencia.");
		 document.frm_alumno.cbo_paisr.focus();
		 return false;
	  }
	  if(document.frm_alumno.cbo_provr.selectedIndex==0)
	  {
	     alert("Seleccione la provincia de residencia.");
		 document.frm_alumno.cbo_provr.focus();
		 return false;
	  }
	  if(document.frm_alumno.cbo_ciudr.selectedIndex==0)
	  {
	     alert("Seleccione el cantón de residencia.");
		 document.frm_alumno.cbo_ciudr.focus();
		 return false;
	  }
	  if(dato_vacio(document.frm_alumno.txt_direccion.value))
	  {
		  alert("Ingrese su dirección.");
		  document.frm_alumno.txt_direccion.value="";
		  document.frm_alumno.txt_direccion.focus();
		  return false;
	  }
	  if(!valida_texto(document.frm_alumno.txt_direccion.value))
	  {
		  alert("Error al ingresar su dirección.");
		  document.frm_alumno.txt_direccion.focus();
		  return false;
	  }
	  if(!dato_vacio(document.frm_alumno.txt_ncasa.value))
	  {
	      if(!valida_numero(document.frm_alumno.txt_ncasa.value))
		  {
		      alert("El número de casa debe ser numérico.");
			  document.frm_alumno.txt_ncasa.value="";
			  document.frm_alumno.txt_ncasa.focus();
			  return false;
		  }
		  if(parseFloat(document.frm_alumno.txt_ncasa.value)==0)
		  {
		      alert("El número de casa debe ser diferente de 0.");
			  document.frm_alumno.txt_ncasa.value="";
			  document.frm_alumno.txt_ncasa.focus();
			  return false;
		  }
	  }
	  
	  if(dato_vacio(document.frm_alumno.txt_telefono.value) && dato_vacio(document.frm_alumno.txt_celular1.value))
	  {
	      alert("Ingrese un número de teléfono fijo ó número de celular.");
		  document.frm_alumno.txt_telefono.focus();
		  return false;
	  }
	  
	  if(!dato_vacio(document.frm_alumno.txt_telefono.value))
	  {
		  if(!valida_telefono(document.frm_alumno.txt_telefono.value))
		  {
			  alert("Error al ingresar el número de teléfono.");
			  document.frm_alumno.txt_telefono.value="";
			  document.frm_alumno.txt_telefono.focus();
			  return false;
		  }
		  if(parseFloat(document.frm_alumno.txt_telefono.value)==0)
		  {
			  alert("El número de teléfono debe ser diferente a 0.");
			  document.frm_alumno.txt_telefono.value="";
			  document.frm_alumno.txt_telefono.focus();
			  return false;
		  } 
      }
	  if(!dato_vacio(document.frm_alumno.txt_email.value))
	  {
	      if(!valida_email(document.frm_alumno.txt_email.value))
		  {
			  alert("Error al ingresar su e-mail.");
			  document.frm_alumno.txt_email.focus();
			  return false;
		  }
	  }
	  
	  
	  /*if(dato_vacio(document.frm_alumno.txt_email.value))
	  {
	     alert("Ingrese su e-mail.");
		 document.frm_alumno.txt_email.value="";
		 document.frm_alumno.txt_email.focus();
		 return false;
	  }
	  if(!valida_email(document.frm_alumno.txt_email.value))
      {
		 alert("Error al ingresar su e-mail.");
		 document.frm_alumno.txt_email.focus();
		 return false;
	  }*/
	  if(!dato_vacio(document.frm_alumno.txt_celular1.value))
	  {  
	     if(!valida_numero(document.frm_alumno.txt_celular1.value))
	     {
		     alert("El Número de celular 1 debe ser numérico.");
		     document.frm_alumno.txt_celular1.value="";
		     document.frm_alumno.txt_celular1.focus();
		     return false;
	     }
	     if(document.frm_alumno.txt_celular1.value.length!=9)
	     {
	         alert("El número de celular 1 debe tener 9 dígitos.");
		     document.frm_alumno.txt_celular1.value="";
		     document.frm_alumno.txt_celular1.focus();
		     return false;
	     }
	     if(parseFloat(document.frm_alumno.txt_celular1.value)==0)
	     {
		     alert("El número de celular 1 no es válido.");
		     document.frm_alumno.txt_celular1.value="";
		     document.frm_alumno.txt_celular1.focus();
		     return false;
	     }
	     if(document.frm_alumno.cbo_oper1.selectedIndex==0)
	     {
		     alert("Seleccione una Operadora.");
		     document.frm_alumno.cbo_oper1.focus();
		     return false;
	     }
	  }
	  if(!dato_vacio(document.frm_alumno.txt_celular2.value))
	  {
		  if(!valida_numero(document.frm_alumno.txt_celular2.value))
		  {
			  alert("Error al ingresar el número de celular 2.");
			  document.frm_alumno.txt_celular2.value="";
			  document.frm_alumno.txt_celular2.focus();
			  return false;
		  }
		  if(document.frm_alumno.txt_celular2.value.length!=9)
		  {
			  alert("El número de celular 2 debe tener 9 dígitos.");
			  document.frm_alumno.txt_celular2.value="";
			  document.frm_alumno.txt_celular2.focus();
			  return false;
		  }
		  if(parseFloat(document.frm_alumno.txt_celular2.value)==0)
		  {
		      alert("El número de celular 2 no es válido.");
			  document.frm_alumno.txt_celular2.value="";
			  document.frm_alumno.txt_celular2.focus();
			  return false;
		  }
		  if(document.frm_alumno.cbo_oper2.selectedIndex==0)
		  {
		      alert("Seleccione una operadora para su celular 2.");
			  document.frm_alumno.cbo_oper2.focus();
			  return false;
		  }
	  }
	  else
	  {
		  if(document.frm_alumno.cbo_oper2.selectedIndex!=0)
		  {
			  alert("Ingrese el número de celular 2.");
			  document.frm_alumno.txt_celular2.value="";
			  document.frm_alumno.txt_celular2.focus();
			  return false;
		  }
	  }
	  //Validando datos academicos
	  if(document.frm_alumno.cbo_colegio.options[document.frm_alumno.cbo_colegio.selectedIndex].value==0)
	  {
	     alert("Seleccione el Colegio de procedencia.");
		 document.frm_alumno.cbo_colegio.focus();
		 return false;
	  }
	  if(document.frm_alumno.cbo_colegio.options[document.frm_alumno.cbo_colegio.selectedIndex].value==-1)
	  {
	     if(dato_vacio(document.frm_alumno.txt_colegio.value))
		 {
		    alert("Especifique su colegio de procedencia.");
			document.frm_alumno.txt_colegio.value="";
			document.frm_alumno.txt_colegio.focus();
			return false;
		 }
		 var colegio=document.frm_alumno.txt_colegio.value;
		 if(colegio.length<4)
		 {
		    alert("El nombre del Colegio debe tener mínino 4 caracteres.");
			document.frm_alumno.txt_colegio.value="";
			document.frm_alumno.txt_colegio.focus();
			return false;
		 }
		 if(!valida_alfanumerico(document.frm_alumno.txt_colegio.value))
		 {
		    alert("Error al ingresar el Colegio de procedencia.");
			document.frm_alumno.txt_colegio.value="";
			document.frm_alumno.txt_colegio.focus();
			return false;
		 }
	  }
	  
	  if(document.frm_alumno.cbo_titulob.options[document.frm_alumno.cbo_titulob.selectedIndex].value==0)
	  {
	     alert("Seleccione su Título de Bachiller.");
		 document.frm_alumno.cbo_titulob.focus();
		 return false;
	  }
	  if(document.frm_alumno.cbo_titulob.options[document.frm_alumno.cbo_titulob.selectedIndex].value==-1)
	  {
	     if(dato_vacio(document.frm_alumno.txt_titulo_bac.value))
		 {
		    alert("Especifique su Título de bachiller.");
			document.frm_alumno.txt_titulo_bac.value="";
			document.frm_alumno.txt_titulo_bac.focus();
			return false;
		 }
		 var titulo=document.frm_alumno.txt_titulo_bac.value;
		 if(titulo.length<10)
		 {
		    alert("El Título de bachiller debe tener mínino 10 caracteres.");
			document.frm_alumno.txt_titulo_bac.value="";
			document.frm_alumno.txt_titulo_bac.focus();
			return false;
		 }
		 if(!valida_alfanumerico(document.frm_alumno.txt_titulo_bac.value))
		 {
		    alert("Error al ingresar su Título de bachiller.");
			document.frm_alumno.txt_titulo_bac.value="";
			document.frm_alumno.txt_titulo_bac.focus();
			return false;
		 }
	  }
	  
	  if(document.frm_alumno.rbo_prof[0].checked)//Si está marcado SI
	  {
	     if(document.frm_alumno.cbo_universidad.options[document.frm_alumno.cbo_universidad.selectedIndex].value==0)
	     {
	        alert("Seleccione la Universidad de donde egreso o se graduó.");
		    document.frm_alumno.cbo_universidad.focus();
		    return false;
	     }
		 if(document.frm_alumno.cbo_universidad.options[document.frm_alumno.cbo_universidad.selectedIndex].value==-1)
	     {
	        if(dato_vacio(document.frm_alumno.txt_universidad.value))
		    {
		       alert("Especifique la Universidad de donde egresó o se graduó.");
			   document.frm_alumno.txt_universidad.value="";
			   document.frm_alumno.txt_universidad.focus();
			   return false;
		    }
		    var univ=document.frm_alumno.txt_universidad.value;
		    if(univ.length<10)
		    {
		       alert("El nombre de la Universidad debe tener mínino 10 caracteres.");
			   document.frm_alumno.txt_universidad.value="";
			   document.frm_alumno.txt_universidad.focus();
			   return false;
		    }
		    if(!valida_alfanumerico(document.frm_alumno.txt_universidad.value))
		    {
		       alert("Error al ingresar la Universidad.");
			   document.frm_alumno.txt_universidad.value="";
			   document.frm_alumno.txt_universidad.focus();
			   return false;
		    }
	     }	 
		 if(dato_vacio(document.frm_alumno.txt_carrera.value))
		 {
		    alert("Ingrese la carrera.");
			document.frm_alumno.txt_carrera.value="";
			document.frm_alumno.txt_carrera.focus();
			return false;
		 }
		 if(!valida_alfanumerico(document.frm_alumno.txt_carrera.value))
		 {
		    alert("Error al ingresar la carrera.");
			document.frm_alumno.txt_carrera.value="";
			document.frm_alumno.txt_carrera.focus();
			return false;
		 }
		 var carrera=document.frm_alumno.txt_carrera.value;
		 if(carrera.length<10)
		 {
		    alert("La carrera debe tener mínimo 10 caracteres");
			document.frm_alumno.txt_carrera.value="";
			document.frm_alumno.txt_carrera.focus();
			return false;
		 }
		 
	  }
	  var caso=document.frm_alumno.cbo_caso.options[document.frm_alumno.cbo_caso.selectedIndex].value;
	  if(caso!=0&&caso!=1)
	  {
	     if(dato_vacio(document.frm_alumno.txt_caso.value))
		 {
		     if(caso==2)
			   alert("Especifique su experiencia laboral.");
			  else
			   alert("Especifique sus cursos realizados.");
			 document.frm_alumno.txt_caso.value="";
			 document.frm_alumno.txt_caso.focus();
			 return false;
		 }
		 if(!valida_texto(document.frm_alumno.txt_caso.value))
		 {
		    if(caso==2)
			   alert("Error al ingresar su experiencia laboral.");
			  else
			   alert("Error al ingresar sus cursos realizados.");
			document.frm_alumno.txt_caso.value="";
			document.frm_alumno.txt_caso.focus();
			return false;
		 }
	  }
	  
	  if(document.frm_alumno.cbo_carrera_ins.selectedIndex==0)
	  {
	     alert("Seleccione la Carrera a la que desea preinscribirse.");
		 document.frm_alumno.cbo_carrera_ins.focus();
		 return false;
	  }
	  
	  if(document.frm_alumno.cbo_seccion.selectedIndex==0)
	  {
	     alert("Seleccione la Sección.");
		 document.frm_alumno.cbo_seccion.focus();
		 return false;
	  }
	  
	  if(dato_vacio(document.frm_alumno.txt_texto.value))
	  {
	     alert("Ingrese el texto de la imagen.");
		 document.frm_alumno.txt_texto.value="";
		 document.frm_alumno.txt_texto.focus();
		 return false;
	  }
	  
	  
	  
	  return true;
  }
  

  function contarcar(txt_dato,longitud)
  {
     var texto=txt_dato.value;
	 var valor=longitud-parseInt(texto.length);
	 if(valor>0)
	 {
		return true;
	 }
	 else
	 {
	    txt_dato.value=texto.substring(0,longitud);
		return false;
	 }
  }
  
  function dato_vacio(dato)
  {
      var car,l;
	  var band;
	  band=0;
	  l=dato.length;
	  for(i=0;i<l&&band!=1;i++)
	  {
	      car=dato.charAt(i);
		  if(car!=" ")
		  {
		      band=1;
		  }
	  }
	  if(!band)
	  {
		 return true;
	  }
	  return false;
   }
   function valida_texto(dato)//direccion,observacion, etc
   {
	   var tam,car;
	   tam=dato.length;
	   for(i=0;i<tam;i++)
	   {
	       car=dato.charAt(i);
		   car=car.toUpperCase();
		   if(!((car>="0"&&car<="9")||car==" "||(car>="A"&&car<="Z")||car=="@"||car=="Á"||car=="É"||car=="Í"||car=="Ó"||car=="Ú"||car=="Ñ"||car=="_"||car=="-"||car=="."||car==","||car=="/"||car==":"||car==";"||car=="\""||car=="("||car==")"||car=="+"||car=="#"||car=="º"))
		   {
		      alert("El caractér  "+dato.charAt(i)+"  no es válido.");
			  //alert("El dato debe ser alfanumérico");
			  return false;
		   }
	   }
	   return true;
     }
	 function valida_telefono(dato)//solo telefonos convencionales
     {
       var tam,car;
	   tam=dato.length;
	   for(i=0;i<tam;i++)
	   {
	       car=dato.charAt(i);
		   car=car.toUpperCase();
		   if(!((car>="0"&&car<="9")||car==" "||car=="("||car==")"||car=="-"||car=="["||car=="]"))
		   {
		      //alert("El dato debe ser alfanumérico");
			  return false;
		   }
	   }
	   return true;
     }
	 function valida_numero(dato)//solo digitos del 0 al 9
     {
	    var tam,car;
	    tam=dato.length;
	    for(i=0;i<tam;i++)
	    {
	       car=dato.charAt(i);
		   if(!(car>="0"&&car<="9"))
		   {
		      //alert("El dato debe ser numérico");
			  return false;
		   }
	    }
	    return true;
     }
	 function valida_letras(dato)//para nombres propios
     {
       var tam,car;
	   tam=dato.length;
	   for(i=0;i<tam;i++)
	   {
	       car=dato.charAt(i);
		   car=car.toUpperCase();
		   //if(!((car>='A'&& car<='Z')||car==" "||car=="Á"||car=="É"||car=="Í"||car=="Ó"||car=="Ú"||car=="Ñ"))
		   if(!((car>='A'&& car<='Z')||car==" "||car=="Ñ"))
		   {
		      //alert("El dato debe ser alfabético");
			  return false;
		   }
	   }
	   return true;
     }
	 function valida_cedula(dato)//solo número de cédula
   {
       var tam;
	   var band;
	   tam=dato.length;
	   if(tam==10)
	   {   
	       dv=dato.charAt(9);
		   suma=0;
		   for(i=0;i<=8;i++)
		   {
		      dig=parseInt(dato.charAt(i));
			  if(i%2==0)
			     dig=dig*2;
			   else
			     dig=dig*1;
			  aux=dig.toString();	 
			  if(dig>9)
			     dig=parseInt(aux.charAt(0))+parseInt(aux.charAt(1));
			  suma+=dig;	 
		   }
		   c=Math.floor(suma/10);
           if(suma%10==0)
		      verif=(c*10)-suma;
			 else
			  verif=((c+1)*10)-suma;
		   if(verif==parseInt(dv))
		   {
		       band=true;
			   if(dato.length>10)
			   {
			     /* ruc=dato.substr(10,3);
				  if(ruc!="001")
				  {
				     alert("Error al ingresar el Ruc");
					 band=false;
			      }*/
				  alert("El número de cédula debe tener 10 dígitos.");
				  band=false;
			   }
			   else
			   {
			      var rell='';
				  for(i=0;i<10;i++)
				  {
				     digito=String(i);
					 rell='';
					 for(lim=1;lim<=10;lim++)rell+=digito;
					 if(parseFloat(rell)==parseFloat(dato))
					 {
					    alert("El número de cédula es incorrecto.");
						band=false;
					 }
				  }
			   }
		   } 
		   else
		   {
		       band=false;
			   alert("El Nº de cédula es incorrecto.");
		   }  
	   }
	   else
	   {
	       band=false;
		   alert("El número de cédula debe tener 10 dígitos.");
	   }
	   return band;	  
   }
   
   function caracteres_email(dato)
   {
      tam=dato.length;
	  for(i=0;i<tam;i++)
	  {
	      car=dato.charAt(i);
		  car=car.toUpperCase();
		  if(!((car>='A'&& car<='Z')||(car>='0'&&car<='9')||car=="_"||car=="-"||car=="."||car=="@"))
		  {
			   //alert("Error al ingresar el email.");//cuando tienen caracteres no validos
			   alert("El caractér  "+dato.charAt(i)+"  no es válido.");
			   return false;
		  }
	   }
	   return true;
   }
   
   function valida_email(dato)
   {
	     if(caracteres_email(dato))
		 {
		 var c,cl,pa,ca,cp;
		 c="";
		 cl=pa=ca=cp=0;
		 lon=dato.length;
		 for(i=0;i<lon;i++)
		 {
		    c=dato.charAt(i);
			if(c!='@'&&c!='.')
			{
			   cl++;
			}
			else
			{
			   if(cl<4)
			   {
			      //El nombre de usuario debe tener 4 caracteres minimo
				  return false;
			   }
			   //else
			   if(c=='@')
			   {
			      ca++;
				  pa=i;
				  //alert("arrorba");
			   }
			   if(c=='.')
			   {
			      cp++;
			   }
			}
		 }
		 if(ca>1)
		 {
		     //alert("Solo 1 @");
			 return false;
		 }
		 if(ca==0)
		 {
		      //alert("Ponga un @");
			  return false;
		 }
		 if(cp==0)
		 {
		      //alert("Ponga los puntos");
			  return false;
		 }
		 parte=1;cl=0;
		 for(i=pa+1;i<lon;i++)
		 {
		    c=dato.charAt(i);
			if(c!='.')
			{
			   cl++;
			}
			else
			{
			   if(parte==1)
			   {
			      if(cl<3)
				  {
				    // alert("Error de dominio");
					 return false;
				  }
				  else
				  {
				     parte++;
					 cl=0;
				  }
			   }
			   else
			   {
			      if(cl<2)
				  {
				     //alert("Error de tipo de organizacion");
					 return false;
				  }
				  else
				  {
				  
				  }
			   }
			}
		 }
		 if(parte>1&&cl<2)
		 {
		     return false;
		 }
		 return true;
		 }
		 else
		 {
		 return false;
		 }
	 }
	 function valida_usuario(dato)
   {
       var tam,car;
	   tam=dato.length;
	   if(tam<4)
	   {
	      alert("El nombre de usuario debe tener mínimo 4 caracteres");
		  return false;
	   }
	   car=dato.charAt(0);
	   car=car.toUpperCase();
	   if(!((car>='A'&&car<='Z')||car=='Ñ'))
	   {
	      alert("El nombre de usuario debe comenzar por una letra.");
		  return false;
	   }
	   else
	   {
	     for(i=0;i<tam;i++)
	     {
	        car=dato.charAt(i);
		    car=car.toUpperCase();
		    if(!((car>='A'&& car<='Z')||(car>='0'&&car<='9')||car=="_"||car=="-"||car=="."))
		    {
			   alert("Error al ingresar el Usuario.");//cuando tienen caracteres no validos
			   return false;
		    }
			else
			{
			   if(i<tam-1)
			   {
			      carsig=dato.charAt(i+1);
				  if((car=="."||car=="-"||car=="_")&&(carsig=="."||carsig=="-"||carsig=="_"))
				  {
				     alert("Error al ingresar el Usuario.");//cuando estan seguidos el . - _
			         return false;
				  }
			   }
			   else
			   {
			      if(car=="."||car=="_"||car=="-")
				  {
				     alert("El Usuario debe terminar en una letra o dígito.");
					 return false;
				  }
			   }
			}
	     }
	   }
	   return true;
   }
   function valida_alfanumerico(dato)//solo numeros y letras
   {
       var tam,car;
	   tam=dato.length;
	   for(i=0;i<tam;i++)
	   {
	       car=dato.charAt(i);
		   if(!((car>="0"&&car<="9")||car==" "||(car>="A"&&car<="Z")||(car>="a"&&car<="z")||car=="ñ"||car=="Ñ"))
		   {
		      //alert("El dato debe ser alfanumérico");
			  return false;
		   }
	   }
	   return true;
   }
   
   
   function carga_anios(anio,an,mn,dn)
   {
      var ai=1940,af=anio-15;
	  var dif=(af-ai)+1;
	  var indsel=0;
	  document.frm_alumno.cbo_anio.length=dif; 
	  document.frm_alumno.cbo_anio.options[0].value=0;
	  document.frm_alumno.cbo_anio.options[0].text="-Sel-";
	  limpia_combo("D");
	  limpia_combo("M");
	  for(i=1;i<dif;i++,ai++)
	  {
	      document.frm_alumno.cbo_anio.options[i].value=ai;
		  document.frm_alumno.cbo_anio.options[i].text=ai;
		  if(an==ai)indsel=i;
	  }
	  if(indsel!=0)
	  {
	     document.frm_alumno.cbo_anio.selectedIndex=indsel;
	     carga_mes(mn,dn);
	  }
   }
   
   function carga_mes(mn,dn)
   {
      var meses=new Array("ENERO","FEBRERO","MARZO","ABRIL","MAYO","JUNIO","JULIO","AGOSTO","SEPTIEMBRE","OCTUBRE","NOVIEMBRE","DICIEMBRE");
	  var indsel=0;
	  document.frm_alumno.cbo_mes.length=13;
	  document.frm_alumno.cbo_mes.options[0].value=0;
	  document.frm_alumno.cbo_mes.options[0].text="-Sel-";
	  for(i=0;i<12;i++)
	  { 
	      document.frm_alumno.cbo_mes.options[i+1].value=i+1;
	      document.frm_alumno.cbo_mes.options[i+1].text=meses[i].substring(0,3);
		  document.frm_alumno.cbo_mes.options[i+1].title=meses[i];
		  if(mn==i+1)indsel=i+1;
	  }
	  if(indsel!=0)
	  {
	     document.frm_alumno.cbo_mes.selectedIndex=indsel;
		 carga_dia(dn);
	  }
	  else
	  {
	     limpia_combo("D");
	  }
   }
   
   function carga_dia(dn)
   {
      var anio=document.frm_alumno.cbo_anio.value;
	  var mes=document.frm_alumno.cbo_mes.value;
	  var indsel=0;
      if(mes!=0)
	  {
	     var dias=0;
	     if(mes==1||mes==3||mes==5||mes==7||mes==8||mes==10||mes==12)
	         dias=31;
	     else
	     if(mes==2)
	         if((anio%4)==0)
			   dias=29;
		     else 
			   dias=28;
	     else
		    dias=30;
		  
	     document.frm_alumno.cbo_dia.length=dias+1;
         document.frm_alumno.cbo_dia.options[0].value=0;
	     document.frm_alumno.cbo_dia.options[0].text="-Sel-";	  
	     for(i=1;i<dias+1;i++)
	     {
	        document.frm_alumno.cbo_dia.options[i].value=i;
    	    document.frm_alumno.cbo_dia.options[i].text=i;	  
			if(dn==i)indsel=i;
	     }
		 document.frm_alumno.cbo_dia.selectedIndex=indsel;	  
	  }
	  else
	  {
	     limpia_combo("D");
	  }
   }
   
   function limpia_combo(tipo)//encera los combos de mes y dia
   {
       if(tipo=='M')
	   {
	       document.frm_alumno.cbo_mes.length=1;
		   document.frm_alumno.cbo_mes.options[0].value=0;
		   document.frm_alumno.cbo_mes.options[0].text="-Sel-";
	   }
	   else
	   {
	       document.frm_alumno.cbo_dia.length=1;
		   document.frm_alumno.cbo_dia.options[0].value=0;
		   document.frm_alumno.cbo_dia.options[0].text="-Sel-";
	   }
   }
   
 
   
   
   function selcombo(tipo)//cuando se selecciona algo de año mes o dia
   {
      if(tipo=='A')
	  {
	     if(document.frm_alumno.cbo_anio.selectedIndex==0)
		 {
		    limpia_combo("M"); 
			limpia_combo("D"); 
		 }
		 else
		 {
		    carga_mes(0,0);
		 }
		 document.frm_alumno.cbo_mes.selectedIndex=0;
	     document.frm_alumno.cbo_dia.selectedIndex=0;
	  }
	  else
	  {
	      limpia_combo("D");
	  }
   }
   
   function sel_datos_combo(tipo,valor)
   {
	   if(tipo=='S')
	   {
	      document.frm_alumno.cbo_sexo.selectedIndex=valor;
		  habdeslmil();
	   }
	   else
	   if(tipo=='E')
	   {
	     document.frm_alumno.cbo_estciv.selectedIndex=valor;
	   }
	   else
	   if(tipo=='TS')
	   {
	      document.frm_alumno.cbo_tsangre.selectedIndex=valor;
	   }
	   else
	   if(tipo=='OP1')
	   {
	      document.frm_alumno.cbo_oper1.selectedIndex=valor;
	   }
	   else
	   {
	      document.frm_alumno.cbo_oper2.selectedIndex=valor;
	   }
   }
   
   function habdeslmil()
   {
      if(document.frm_alumno.cbo_sexo.selectedIndex==0)
	  {
	     document.frm_alumno.txt_libmil.disabled=false;
	  }
	  else	 
	  {
	     document.frm_alumno.txt_libmil.disabled=true;
		 document.frm_alumno.txt_libmil.value="";
	  }
   }
   
   function combo_oper(tipo)
   {
       if(tipo=='OP1')
	   {
	      if(dato_vacio(document.frm_alumno.txt_celular1.value))
	        document.frm_alumno.cbo_oper1.selectedIndex=0;
	   }
	   else
	   {
	      if(dato_vacio(document.frm_alumno.txt_celular2.value))
	        document.frm_alumno.cbo_oper2.selectedIndex=0;
	   }
   }
   
   function valida_pasaporte(valor)
   {
	   var pasaporte=valor;
		 if(!valida_numero(pasaporte))
		 {
			alert("El Nº de Pasaporte debe ser numérico.");
			document.frm_alumno.txt_cedula.value="";
			document.frm_alumno.txt_cedula.focus();
			return false;
		 } 
		 if(pasaporte.length<9)
		 {
		    alert("El Nº de Pasaporte debe tener mínimo 9 digitos.");
			document.frm_alumno.txt_cedula.value="";
			document.frm_alumno.txt_cedula.focus();
			return false;
		 }
		 if(parseFloat(pasaporte)==0)
		 {
		    alert("El Nº de Pasaporte debe ser diferente a 0.");
			document.frm_alumno.txt_cedula.value="";
			document.frm_alumno.txt_cedula.focus();
			return false;
		 }
       return true;
   }
   
   function valida_form_consul()
   {
       if(dato_vacio(document.frm_alumno.txt_cedula.value))
	   {
	     alert("Ingrese el Número de Cédula.");
	     document.frm_alumno.txt_cedula.focus();
		 return false;
	  }
	  
	  if(!valida_cedula(document.frm_alumno.txt_cedula.value))
	  {
		  document.frm_alumno.txt_cedula.value="";
		  document.frm_alumno.txt_cedula.focus();
		  return false;
	  }
	  return true;
   }