function checkForumFields(variant){ // variant=1 => check message body, autor, headline // variant=2 => check message body, headline if (variant==1){autor = document.forumFrm.nimi.value;} headline = document.forumFrm.pealkiri.value; message = document.forumFrm.text.value; if (variant==1){ if (autor.length < 2){ alert(''); return false; } } if (headline.length < 2){ alert(''); return false; } else if (message.length < 2){ alert(''); return false; } else { return true; }; }