var maxChars = 300;

function verify(form) {
	var emailRE = /^([0-9A-Za-z\-\+\.&_])+@([0-9A-Za-z\-\+\.&_])+\.([A-Za-z])+$/;
	var title = form.commentTitle.value;
	var comment = form.comment.value;
	var name = form.name.value;
	var email = form.email.value;
	var captcha = form.captcha.value;
	
	if (isEmpty(title)) {
	  alert("Por favor, inserte un título para su comentario");
	  return(false);
	} else if (isEmpty(comment)) {
	  alert("Por favor, introduzca un comentario");
	  return(false);
	} else if (isEmpty(name)) {
	  alert("Por favor, introduzca su nombre");
	  return(false);
	} else if (isEmpty(email) || (!email.match(emailRE))) {
	  alert("Por favor, introduzca una dirección de correo electrónico válida");
	  return(false);
  } else if (isEmpty(captcha)) {
    alert("Por favor, introduzca el código de verificación");
    return(false);
  }

  return(true);
}

function checkCommentSize(comment) {
  if(comment.length > maxChars) {
    return(false); 
  }
  
  return(true);
}

function trapCaptchaError() {
  if(!document.commentForm.email.value == '') {
    document.write('<span style="color:red"><b>El código de verificación no es correcto, por favor introdúzcalo de nuevo</b></span>');
  }
}