function userreg_valid(theForm)
{
  if (theForm.ssubject.value == "SA")
  {
    alert("Por favor Seleccione un Valor para el campo \"Asunto\" ");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.Name.value == "")
  {
    alert("Por favor Inserte un Valor para el campo \"Nombre\" ");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.Name.value.length > 50)
  {
    alert("El campo \"Nombre\" no debe contener mas de 50 caracteres.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.Ape.value == "")
  {
    alert("Por favor Inserte un Valor para el campo \"Apellidos\" ");
    theForm.Ape.focus();
    return (false);
  }
   if (theForm.email.value == "")
  {
    alert("Por favor inserta un valor en el campo \"Email\".");
    theForm.email.focus();
    return (false);
  }
  if (theForm.email.value.length > 50)
  {
    alert("Inserta una cadena menor de 50 caracteres en el campo\"Email\".");
    theForm.email.focus();
    return (false);
  }
// Email valitacion
	if(theForm.email.value!="")
		{
			 if ((theForm.email.value.indexOf(" ")!=-1)) {
	   	    	alert("Lo siento, pero el Email no debe contener espacios en blanco");
				theForm.email.select();
				theForm.email.focus();
			    return false;
			    }
		 	if ((theForm.email.value.indexOf("@")==-1)) {
				 alert("Lo siento, pero el Email debe contener el caracter @");
			   	 theForm.email.select();
			   	 theForm.email.focus();
			  	 return false;
			 	}
		 	if (theForm.email.value.indexOf("@")<2) {
			   	 alert("Lo siento, pero esta es una direccion invalida"+ "\n"+ "Por favor verifica el texto antes de '@'");
				 theForm.email.select();
				 theForm.email.focus();
				 return false ;
                 }	
		 	 if ((theForm.email.value.indexOf(".",theForm.email.value.indexOf("@")) - theForm.email.value.indexOf("@")) < 2 ) {
				 	alert("Lo siento, pero esta es una direccion invalida" + "\n"+ "el dominio no esta especificado")
				    theForm.email.select();
				    theForm.email.focus();
				    return false;
					}
 			if ((theForm.email.value.length - theForm.email.value.indexOf(".",theForm.email.value.indexOf("@"))) < 2 ) {
				 	alert("Lo siento, pero esta es una direccion invalida")
			 		theForm.email.select();
					theForm.email.focus();
				 	return false;
				    }
			if (theForm.email.value.charAt(theForm.email.value.length-1) == "." ) {
		 			alert("Lo siento, pero esta es una direccion invalida " + "\n"+ "el punto no puede ser el ultimo caracter")
				    theForm.email.select();
				    theForm.email.focus();
				    return false;
				   }
		 }
  if (theForm.comments.value == "")
  {
    alert("Introduce un valor en el campo \"Comentarios\".");
    theForm.comments.focus();
    return (false);
  }
  return (true);
}

