function checkpost() {
var tit = jtrim(document.newpost.msgtit.value);
var txt = jtrim(document.newpost.msgtxt.value);
 if ((tit == '') || (txt == ''))
 {
  alert('Please specify both a title and a message for the post');
  return(false);
 }
 document.newpost.action = "newpost.php";
 return(true);
}

function checkreply() {
var tit = jtrim(document.newreply.msgtit.value);
var txt = jtrim(document.newreply.msgtxt.value);
 if ((tit == '') || (txt == ''))
 {
  alert('Please specify both a title and a message for the post');
  return(false);
 }
 document.newreply.action = "newreply.php";
 return(true);
}

function jtrim(inputStr)
{
var returnStr = inputStr;
var chrctr = returnStr.substring(0, 1);

  while (chrctr == " ")
  {
    returnStr = returnStr.substring(1, returnStr.length);
    chrctr = returnStr.substring(0, 1);
  }
  chrctr = returnStr.substring(returnStr.length-1, returnStr.length);
  while (chrctr == " ")
  {
    returnStr = returnStr.substring(0, returnStr.length-1);
    chrctr = returnStr.substring(returnStr.length-1, returnStr.length);
  }
  return (returnStr);
}

