
// JavaScript Document
function valida (theform) {
    if (theform.nombre.value=="") {
	  alert("Favor de ingresar su NOMBRE COMPLETO");
	  return false;
	 }

     if (theform.email.value=="" || !(isemailvalidation(theform.email.value))) {
	  alert("EMAIL o CORREO ELECTRONICO es un dato requerido y debe ser válido");
	  return false;
	 }
	 if (theform.telefono.value=="") {
	  alert("Favor de ingresar su TELEFONO");
	  return false;
	 }
	 if (theform.asunto.value=="") {
	  alert("Favor de ingresar el ASUNTO");
	  return false;
	 }

	return true; 
  }
function validanewsletter2 (theform) {
    if (theform.nombre.value=="") {
	  alert("Favor de ingresar su NOMBRE COMPLETO");
	  return false;
	 }

     if (theform.email.value=="" || !(isemailvalidation(theform.email.value))) {
	  alert("EMAIL o CORREO ELECTRONICO es un dato requerido y debe ser válido");
	  return false;
	 }	 

	return true; 
  }  
  
  
function validaaff (theform) {
    if (theform.affiliate_firstname.value=="") {
	  alert("NOMBRE es un valor requerido");
	  return false;
	 }
	 if (theform.affiliate_lastname.value=="") {
	  alert("APELLIDOS es un valor requerido");
	  return false;
	 }
		 
     if (theform.affiliate_email.value=="" || !(isemailvalidation(theform.affiliate_email.value)) ) {
	  alert("EMAIL es un valor requerido y debe ser valido");
	  return false;
	 }
	 if (theform.affiliate_password.value=="") {
	  alert("PASSWORD es un valor requerido");
	  return false;
	 }
	 
	return true; 
  }
  
function isemailvalidation ( stremail ){
var nLongitud, strNum;
nLongitud = stremail.length;
var arroba = false;
var punto = false;
var espacio = false;
for ( var cont = 0; cont < nLongitud; cont++ )	{
strNum = stremail.substring ( cont, cont + 1 );
if ( ( strNum == "@" ) && ( arroba == false ) ){
arroba = true;}
else if ( ( strNum == "@" ) && ( arroba == true ) ){
arroba = false;}
else if ( strNum == "." ){
punto = true;}
else if ( strNum == " " ){
espacio = true;}
}//endfor
if ( arroba && punto && ( nLongitud >= 6 ) && ( ! ( espacio ) ) ){
return true;}
else{
return false;}
}//  
