function chequea()
    {
    if (isBlanco(document.fm.nombre.value))
       {
       alert("Debe indicar su nombre");
       window.document.fm.nombre.select();
       return false;
       }
    if (isBlanco(document.fm.apellido.value))
       {
       alert("Debe indicar su apellido");
       window.document.fm.apellido.select();
       return false;
       }
    if (!isValidEmail(document.fm.email.value))
       {
       alert("\"" + document.fm.email.value + "\" no es un e-mail válido!");
       window.document.fm.email.focus();
       window.document.fm.email.select();
       return false;
       }
    return true
    }
function isBlanco(texto)
   {
   largo = texto.length
   for (i=0; i < largo ; i++ )
       if ( texto.charAt(i) !=" ")
          return false;
return true
   }
function isValidEmail(texto)
{
  var addressIsValid = false;
  var invalidPatterns = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;
  var validPatterns = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
  if (window.RegExp)
  {
    if (!invalidPatterns.test(texto) && validPatterns.test(texto))
    {
      addressIsValid = true;
    }
    else
        {
         addressIsValid = false;
        }
  }
  else {
       if(texto.indexOf("@") >= 0)
       addressIsValid = true;
       }
return addressIsValid;
}


var submitcount=0;
function reset() {
document.emailform.reset();
}
var reqFields = new parseArray("email");
var reqFieldsDesc = new parseArray("Tu E-mail");
function parseArray() {
        this.length = parseArray.arguments.length
        for (var i = 0; i < this.length; i++) {
           this[i+1] = parseArray.arguments[i]
           } 
 }
function validEmail(email) {
   invalidChars = " £$%*?!#/:,;"
   if (email == "") {      
    return false
   }
   for (i=0; i<invalidChars.length; i++) { 
    badChar = invalidChars.charAt(i)
    if (email.indexOf(badChar,0) > -1) {
     return false
    }
   }
   atPos = email.indexOf("@",1)   
   if (atPos == -1) {
    return false
   }
   if (email.indexOf("@",atPos+1) != -1) {
    return false
   }
   periodPos = email.indexOf(".",atPos)
   if (periodPos == -1) {     
    return false
   }
   if (periodPos+3 > email.length) {  
    return false
   }
   return true
  }
function validname(name) {
   invalidChars = "£$%*?!#/:,;1234567890"
   if (recip_name == "") {      
    return false
   }
  for (i=0; i<invalidChars.length; i++) { 
    badChar = invalidChars.charAt(i)
    if (name.indexOf(badChar,0) > -1) {
     return false
    }
   }
   return true
  } 
function validForm(obj) {
    var errMsg = '';    
    var x = 0;
   for (x = 1; reqFields.length >= x ; x++) {
  if ((obj.elements[reqFields[x]].value == '') || (obj.elements[reqFields[x]].value == ' ')) {
  errMsg = errMsg + '' + reqFieldsDesc[x] + ' es requerido.\n';
            }
    }  
  if (errMsg != '') {
    errMsg = 'Tu registro a nuestro Newsletter a provocado el siguiente error :\n\n' + errMsg + '\nPor favor revise su cuenta de E-mail';
    alert(errMsg); 
    return false;
  } 


//Email Validation Check
 if (!validEmail(obj.email.value)) {
    alert("Tiene que indicar un E-mail correcto para registrarse en nuestro Newsletter")
    obj.email.focus()
    obj.email.select()
    return false
   }  
   if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else 
      {
      alert("Este formulario ya ha sido enviado.");
      return false;
      }  
return true
}

var submitcount=0;

function reset() {
document.emailform.NAME.value="";
document.emailform.EMAIL.value="";
document.emailform.ADDRESS.value="";

}

function checkFields() {                    
if (                                    
     (document.emailform.NAME.value=="") ||
 (document.emailform.EMAIL.value=="")  ||
 (document.emailform.ADDRESS.value==""))  
   {
   alert("Por favor indique su Nombre, Email y Dirección de Contacto.");
   return false;
   }

else 
   {
   if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else 
      {
      alert("El formulario ya ha sido enviado.");
      return false;
      }
   }
}