<!-- //

// Chequea si es un nuúmero real
function eCheckFloat(sn){
    s= sn.value;
    for (var i = 0; i < s.length; i++) {
        ch = s.substring(i, i + 1)
        if (!((ch >= "0" && ch <= "9") || ch=="." )) //|| ch==","
             return false;
        }
   return true;
}
// Chequea si es formato hora
function eCheckTime(sn) {
      s= sn.value;
      i=0;
      tm= new Array();
      tm[0]= '';tm[1]= '';tm[2]='';tm[3]= '';tm[4]='';
      md = 0 ;

      while (i< s.length) {
          ch= s.substring(i, i + 1);
          if( ch<='9' && ch>='0')
              tm[md] += ch;
          else if(ch==':') md++;
          else if (ch==' ') {
             if(md<2) return false;
             md++;
          }
          else if(md>=2 && md<=3){
            tmp= s.substring(i, i + 2);
            tmp = tmp.toUppercase();
            if ( tmp=='AM' || tmp=='PM')
            {
               tm[3]= tmp;
               ++i;
               md++;
            }
            else return false;
          }
          else return false;
          i++;
      }

      if(tm[4]!='') return false;
      if( tm[0].valueOf()<1 || tm[0].valueOf()>23) return false;
      if(tm[0].valueOf()<13 && tm[3]=='') //Specify am/pm
          return false;

      if(tm[0].valueOf()>12 && tm[3]!='') //don't Specify am/pm
          return false;

      if( tm[1].valueOf()<1 || tm[1].valueOf()>59) return false;

      if(tm[2]!='')
          if( tm[2].valueOf()<1 || tm[2].valueOf()>59) return false;

      return (tm[4]=='');
}
// Chequea si es fecha sin la hora
function eCheckDate(sn) {
      s= sn.value;
      var i=0;
      tm= new Array();
      tm[0]= '';tm[1]= '';tm[2]='';tm[3]='';
      sep='';
      md = 0 ;

      while (i< s.length) {
          ch= s.substring(i, i + 1);
          if( ch<='9' && ch>='0')
              tm[md] += ch;
          else if (sep=='') {
              if(ch=='.' || ch=='/' || ch=='-') {
                   md++;
                   sep=ch;
              }
          }
          else if (ch==sep) {
             md++;
             if(md>2) return false;
          }
          else return false;

          i++;
      }

      if(tm[3]!='') return false;
      if(tm[0].valueOf()<1 || tm[0].valueOf()>12) return false; //Month
      if(tm[1].valueOf()<1 || tm[1].valueOf()>31) return false;
      if(tm[2].valueOf()<100) return false;

      if ((tm[0]==4 || tm[0]==6 || tm[0]==9 || tm[0]==11) && tm[1]==31)
          return false;
      if (tm[0]==2) {
           isleap = (tm[2] % 4 == 0 && (tm[2] % 100 != 0 || tm[2] % 400 == 0));
           if (tm[1]>29 || (tm[1]==29 && !isleap))
                return false;
      }

      return (tm[3]=='');
}
// Chequea si es alfanumércio
function eCheckAlphaNum(sn){
    s= sn.value;
    for (var i = 0; i < s.length; i++) {
        ch = s.substring(i, i + 1)
        if (!((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z") || (ch >= "0" && ch <= "9") || ch == " " || ch == "-" || ch == "&" || ch == "#" || ch == "(" || ch == ")" || ch == "," || ch == "." || ch == "/" || ch == "á" || ch == "é" || ch == "í" || ch == "ó" || ch == "ú" || ch == "Á" || ch == "É" || ch == "Í" || ch == "Ó" || ch == "Ú" || ch == "ñ" || ch == "Ñ" || ch == ":"))
             return false;
        }
   return true;
}
// Chequea si es alfabético
function eCheckAlpha(sn){
    s= sn.value;
    for (var i = 0; i < s.length; i++) {
        ch = s.substring(i, i + 1)
        if (!((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z")))
             return false;
        }
   return true;
}
// Chequea si es alfabético
function eCheckAlpha_with_space(sn){
    s= sn.value;
    for (var i = 0; i < s.length; i++) {
        ch = s.substring(i, i + 1)
        if (!((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z") || ch == " "))
             return false;
        }
   return true;
}
// Chequea si es dígito
function eCheckNum(sn){
    s= sn.value;
    for (var i = 0; i < s.length; i++) {
        ch = s.substring(i, i + 1)
        if (!(ch >= "0" && ch <= "9"))
             return false;
        }
   return true;
}
// Chequea si es dígito con espacio
function eCheckNum_with_space(sn){
    s= sn.value;
    for (var i = 0; i < s.length; i++) {
        ch = s.substring(i, i + 1)
        if (!((ch >= "0" && ch <= "9") || ch == " "))
             return false;
        }
   return true;
}
// Chequea si es un e-mail
function eCheckEMail(sn){
    s= sn.value;
    if (s.indexOf("@") == -1) return false;
    if (s.indexOf(".") == -1) return false;
    at=false;
    dot=false;
    for (var i = 0; i < s.length; i++) {
        ch = s.substring(i, i + 1)
        if ((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z")
                || (ch == "@") || (ch == ".") || (ch == "_")
                || (ch == "-") || (ch >= "0" && ch <= "9")) {
                if (ch == "@"){
                  if (at) return false;
                  else at=true;
                }
                if ((ch==".") && at)
                   dot=true;
        }
        else return false;
    }
   return dot;
}
//-->
