function mailsubject(subject) {
  document.getElementById('othersub').style.display = "none";
  if (subject == 0) {
    document.getElementById('othersub').style.display = "block";
  }
  return;
}

function mailsubmit(mailform) {
  var valid = true;
  if (mailform.contactname.value.length == 0) valid = false;
  if (mailform.email.value.length == 0) valid = false;
  if (mailform.messagetext.value.length == 0) valid = false;
  if (mailform.subject.value == 0 && mailform.othersubject.value.length == 0) valid = false;
  if (valid == true) {
    return;
  }else{
    alert("You must fill out all fields");
    return false;
  }
}

if (document.forms[0].subject.value == 0) {
  document.getElementById('othersub').style.display = "block";
}