function ComprobarMail(form) {

if (form.mail.value == ""  ||

form.mail.value.indexOf ('@', 0) == -1 ||
      form.mail.value.indexOf ('.', 0) == -1){

      alert("'' " + form.mail.value + " '', no es un valor válido para e-mail.");
form.mail.focus();

      return false;
 }
}

function hasOnlyWhiteSpace(s) {
	var i;
	if (s == null) {
		return false;
	}
	// Search through string's characters one by one
	// until we find a non-whitespace character. then return true
	for (i = 0; i < s.length; i++) {   
		// Check that current character isn't whitespace.
		var c = s.charAt(i);
		if (c != " ") return false;
	}
	// All characters are whitespace.
	return true;
}

function ComprobarDadesConcurs(form)
{

if (form.mail.value == ""  ||

form.mail.value.indexOf ('@', 0) == -1 ||
      form.mail.value.indexOf ('.', 0) == -1){

      alert("'' " + form.mail.value + " '', no es un valor válido para e-mail.");
form.mail.focus();

      return false;
 }
if (form.nom.value == "")
     {
     alert("Por favor escribe un valor para el Nombre.");
     form.nom.focus();
     return (false);
     }
if (form.titol.value == "")
     {
     alert("Es necesario escribir un título para el truco.");
     form.titol.focus();
     return (false);
     }

if (form.descripcio.value == "")
     {
     alert("Necesitamos la descripción del truco.");
     form.descripcio.focus();
     return (false);
     }
if (form.codi.value == "")
     {
     alert("Es necesario el código del truco.");
     form.codi.focus();
     return (false);
     }

if ((form.categoria.value == "") || (hasOnlyWhiteSpace(form.categoria.value))) 
     {
     alert("Por favor incluye la categoría del truco.");
     form.categoria.focus();
     return (false);
     }

}


