//FORM registro
// 00 NOMBRE_INTITUCION
// 01 RUT
// 02 DIGITO_VERIFICADOR
// 03 DOMICILIO
// 04 LOCALIDAD
// 05 TELEFONO
// 06 FAX
// 07 CORREO_ELECTRONICO
// 08 SITIO_WEB
// 09 PRESIDENTE
// 10 NOMINA_DIRECTORIO
// 11 GERENTE_GENERAL
// 12 FECHA_ANIVERSARIO
// 13 ARCHIVO1
// 14 ARCHIVO2
//'********************************************************
// CRISTIAN QUINTANA  VARIABLES GLOBALES
var swOK=0;
var nEle=0;
var sError='';
// CRISTIAN QUINTANA
function darioquintana() {
var nTot=0;
var nPas=0;
var nTorna=0;
sError=" COMO ASOCIARSE: \n CAMARA NACIONAL DE COMERCIO SERVICIOS Y TURISMO DE CHILE \n----> Detectó error en el ingreso de datos <----\n* ---------------------------------------------------------- *"+"\n";
//sError2="Gracias por Contactarce, "+"\n";
//sError2="Gracias por Contactarce, +quintana.nombre_del_contacto.value+,su e-mail es : +quintana.email.value+  "+"\n";
//sError3="hola,"+document.forms[0].elements[nEle].name.substr(0)+",contiene caracteres NO VALIDOS"+"\r"
//sError="Lista de errores: "+"\n";
  for (var j=0; j<16; j++) {
    nEle=j;
    // CRISTIAN QUINTANA LOS TIPOS
    var sNom=document.forms[0].elements[j].name;
    var sOne=sNom.substring(0,1);
    var sTwo=sNom.substring(1,2);
    var stre=sNom.substring(2,3);
//'01 RUT
if (sOne=='R' && sTwo=='U' && stre=='T') {
CaracterNoValid(document.forms[0].elements[j].value,'01');
nTot+=swOK;
}
//'02 DIGITO_VERIFICADOR
if (sOne=='D' && sTwo=='I' && stre=='G') {
CaracterNoValid(document.forms[0].elements[j].value,'02');
nTot+=swOK;
}
// 07 CORREO_ELECTRONICO
if (sOne=='C' && sTwo=='O') {
CaracterNoValid(document.forms[0].elements[j].value,'07');
nTot+=swOK;
}
//CRISTIAN QUINTANA DE ERRORES
    if (nPas==0 && nTot>0) {
      document.forms[0].elements[nEle].focus()
      nPas=1
    }
  }
  if (nTot>0)
    alert(sError)
else
    //alert(sError2)
   // alert(sError3)
document.regis.submit();
}
// CRISTIAN QUINTANA CAMPO A CAMPO
//------12345678901234567890123456789012345678901234567890123456789012345678901234567890101234
//------°!"#$%&/()=?¡|¿,;.:-{}[]<>@*¬^+\_'~ABCDEFGHIJLMNÑOPQRSTUVWXYZabcdefghijlmnñopqrstuvwxyz no " no \
function CaracterNoValid(pCaracter,pType) {
//'01 RUT
  if (pType=='01') {
   swOK=0;
    if (pCaracter=='') {
       sError+="* Ingrese su, "+document.forms[0].elements[nEle].name.substr(0)+" ,solo numeros ej: 100542xx"+"\n\r"
       swOK=1;
       return
     }
    for (var i=0;i<pCaracter.length;i++) {
      var sByte=pCaracter.substring(i,i+1);
      if (
sByte=="°" || sByte=="!" || sByte=="#" || sByte=="$" || sByte=="%" || sByte=="&" || sByte=="/" || 
sByte=="(" || sByte==")" || sByte=="=" || sByte=="?" || sByte=="¡" || sByte=="|" || sByte=="¿" || 
sByte=="," || sByte==";" || sByte==":" || sByte=="{" || sByte=="}" || 
sByte=="[" || sByte=="]" || sByte=="<" || sByte==">" || sByte=="@" || sByte=="*" || sByte=="¬" ||
sByte=="^" || sByte=="+" || sByte=="_" || sByte=="'" || sByte=="~" || 
sByte=="A" || sByte=="B" || sByte=="C" || sByte=="D" || sByte=="E" || sByte=="F" || sByte=="G" ||
sByte=="H" || sByte=="I" || sByte=="J" || sByte=="L" || sByte=="M" || sByte=="N" ||
sByte=="Ñ" || sByte=="O" || sByte=="P" || sByte=="Q" || sByte=="R" || sByte=="S" || sByte=="T" ||
sByte=="U" || sByte=="V" || sByte=="W" || sByte=="X" || sByte=="Y" || sByte=="Z" ||
sByte=="Á" || sByte=="É" || sByte=="Í" || sByte=="Ó" || sByte=="Ú" || 
sByte=="a" || sByte=="b" || sByte=="c" || sByte=="d" || sByte=="e" || sByte=="f" || sByte=="g" ||
sByte=="h" || sByte=="i" || sByte=="j" || sByte=="l" || sByte=="m" || sByte=="n" ||
sByte=="ñ" || sByte=="o" || sByte=="p" || sByte=="q" || sByte=="r" || sByte=="s" || sByte=="t" ||
sByte=="u" || sByte=="v" || sByte=="w" || sByte=="x" || sByte=="y" || sByte=="z" ||
sByte=="á" || sByte=="é" || sByte=="í" || sByte=="ó" || sByte=="ú" )
 {
        sError+="error! en "+document.forms[0].elements[nEle].name.substr(0)+" ,Usted  ingreso caracteres no válidos, es numérico ej: 100542xx"+"\n\r"
        swOK=1;
        return;
      }
    }
  }
//'02 DIGITO_VERIFICADOR
  if (pType=='02') {
   swOK=0;
    if (pCaracter=='') {
       sError+="* Ingrese su, "+document.forms[0].elements[nEle].name.substr(0)+" ,solo el digito verificador ej: K"+"\n\r"
       swOK=1;
       return
     }
    for (var i=0;i<pCaracter.length;i++) {
      var sByte=pCaracter.substring(i,i+1);
      if (
sByte=="°" || sByte=="!" || sByte=="#" || sByte=="$" || sByte=="%" || sByte=="&" || sByte=="/" || 
sByte=="(" || sByte==")" || sByte=="=" || sByte=="?" || sByte=="¡" || sByte=="|" || sByte=="¿" || 
sByte=="," || sByte==";" || sByte==":" || sByte=="{" || sByte=="}" || 
sByte=="[" || sByte=="]" || sByte=="<" || sByte==">" || sByte=="@" || sByte=="*" || sByte=="¬" ||
sByte=="^" || sByte=="+" || sByte=="_" || sByte=="'" || sByte=="~" || 
sByte=="A" || sByte=="B" || sByte=="C" || sByte=="D" || sByte=="E" || sByte=="F" || sByte=="G" ||
sByte=="H" || sByte=="I" || sByte=="J" || sByte=="L" || sByte=="M" || sByte=="N" ||
sByte=="Ñ" || sByte=="O" || sByte=="P" || sByte=="Q" || sByte=="R" || sByte=="S" || sByte=="T" ||
sByte=="U" || sByte=="V" || sByte=="W" || sByte=="X" || sByte=="Y" || sByte=="Z" ||
sByte=="Á" || sByte=="É" || sByte=="Í" || sByte=="Ó" || sByte=="Ú" || 
sByte=="a" || sByte=="b" || sByte=="c" || sByte=="d" || sByte=="e" || sByte=="f" || sByte=="g" ||
sByte=="h" || sByte=="i" || sByte=="j" || sByte=="l" || sByte=="m" || sByte=="n" ||
sByte=="ñ" || sByte=="o" || sByte=="p" || sByte=="q" || sByte=="r" || sByte=="s" || sByte=="t" ||
sByte=="u" || sByte=="v" || sByte=="w" || sByte=="x" || sByte=="y" || sByte=="z" ||
sByte=="á" || sByte=="é" || sByte=="í" || sByte=="ó" || sByte=="ú" )
 {
        sError+="error! en "+document.forms[0].elements[nEle].name.substr(0)+" ,Usted  ingreso caracteres no válidos, ej: k"+"\n\r"
        swOK=1;
        return;
      }
    }
  }
// 07 CORREO_ELECTRONICO
  if (pType=='07') {
   swOK=2
   for (var i=0;i<pCaracter.length;i++) {
     var sByte=pCaracter.substring(i,i+1);
     if (sByte=="@" || sByte==".") {
       swOK=swOK-1;
     }
   }
   if (swOK>0)    {
       sError+="* Ingrese su, "+document.forms[0].elements[nEle].name.substr(0)+" ,ej: usuario@dominio" +"\n\r" }
   return;
 }
 
 }









