


function IsEmpty(aTextField) {
   if ((aTextField.value.length==0) ||
   (aTextField.value==null)) {
      return true;
   }
   else { return false; }
}




function ValidateFormSp(form)
{
   if(IsEmpty(form.nombre)) 
   { 
      alert('Por favor ingrese su nombre.\nPlease enter your name.') 
      form.nombre.focus(); 
      return false; 
   } 
   
   
      if(IsEmpty(form.apellido)) 
   { 
      alert('Por favor ingrese su apellido.\nPlease enter your surname.') 
      form.apellido.focus(); 
      return false; 
   } 
   
   
      if(IsEmpty(form.telefono)) 
   { 
      alert('Por favor ingrese su telefono.\nPlease enter your phone number.') 
      form.telefono.focus(); 
      return false; 
   } 
    
  
  if (form.emilio.value == "")
  {
    alert("Por favor ingrese su email.\nPlease specify an email address to proceed.");
    form.emilio.focus();
    return (false);
  }

  if (!isEmailAddr(form.emilio.value))
  {
    alert("Ingrese email con formato: nombre@dominio.com.\nPlease fill in email with format: name@domain.com.");
    form.emilio.focus();
    return (false);
  }
   
  if (form.emilio.value.length < 3)
  {
    alert("Ingrese email con formato: nombre@dominio.com.\nPlease fill in email with format: name@domain.com.");
    form.emilio.focus();
    return (false);
      
   } 
   
return true; 
}








function isEmailAddr(email)
{
  var result = false;
  var theStr = new String(email);
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function FormValidator(theForm)
{
	
	
	if(IsEmpty(theForm.name)) 
   { 
      alert('Por favor ingrese su nombre completo.\nPlease enter your full name.') 
      theForm.name.focus(); 
      return false; 
   } 

  if (theForm.email.value == "")
  {
    alert("Por favor ingrese su email.\nPlease specify an email address to proceed.");
    theForm.email.focus();
    return (false);
  }

  if (!isEmailAddr(theForm.email.value))
  {
    alert("Ingrese email con formato: nombre@dominio.com.\nPlease fill in email with format: name@domain.com.");
    theForm.email.focus();
    return (false);
  }
   
  if (theForm.email.value.length < 3)
  {
    alert("Ingrese email con formato: nombre@dominio.com.\nPlease fill in email with format: name@domain.com.");
    theForm.email.focus();
    return (false);
  }
  
  if(IsEmpty(theForm.respuesta)) 
   { 
      alert('Por favor ingrese su respuesta.\nPlease enter your answer.') 
      theForm.respuesta.focus(); 
      return false; 
   }

  return (true);
}
