//************************************************************
//  FUNCIONES DE VALIDACIÓN
//************************************************************
var testresults;
function esCorreElectronico(campo)
{

	var str=campo;
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str))
		testresults=true;
	else
		{
			testresults=false;
		}
		return (testresults);

}


function esCampoValido(campo,txtre)
{
	
	var str=campo;
	var filter=txtre;
	//alert(filter.test(str));
	if (filter.test(str))
		testresults=true;
	else
		testresults=false;		
	return (testresults);
	
	
}


/*function esRuc(ruc){
  return ( valruc(ruc) );
}*/
/*function esnulo(campo){ return (campo == null||campo=="");}
function esnumero(campo){ return (!(isNaN( campo )));}
function eslongrucok(ruc){return ( ruc.length == 11 );}
*/
function valRucpre(campo)
{
	 
	 var str = campo;
	// var filter=\^[0-9]{8}\i;
	var str=campo;
	//var filter=/^[0-9]{11}/i
	var filter= /^\d{11,11}$/
	if (filter.test(str))
		{
		testresults=true;
		//alert("Meta 8 0 11");
		}
	else
		{
			testresults=false;
		}
		return (testresults);
}
/*function valruc(valor){
  valor = trim(valor);
  if ( esnumero( valor ) ) {
    if ( valor.length == 8 ){
      suma = 0;
      for (i=0; i<valor.length-1;i++){
        digito = valor.charAt(i) - '0';
        if ( i==0 ) suma += (digito*2)
        else suma += (digito*(valor.length-i));
      }
      resto = suma % 11;
      if ( resto == 1) resto = 11;
      if ( resto + ( valor.charAt( valor.length-1 ) - '0' ) == 11 ){
        return true;
      }
    } else if ( valor.length == 11 ){
      suma = 0;
      x = 6;
      for (i=0; i<valor.length-1;i++){
        if ( i == 4 ) x = 8;
        digito = valor.charAt(i) - '0';
        x--;
        if ( i==0 ) suma += (digito*x);
        else suma += (digito*x);
      }
      resto = suma % 11;
      resto = 11 - resto;
      
      if ( resto >= 10) resto = resto - 10;
      if ( resto == valor.charAt( valor.length-1 ) - '0' ){
        return true;
      }      
    }
  }
  return false
}*/
