/* Strip whitespaces from the head and tail of a string. */
function trim(str){
  var i = str.length, x = 0;
  
  while (str.substring(x,x+1) == ' ' || str.substring(x,x+1) == "\n") x++;
  while (str.substring(i-1,i) == ' ' || str.substring(i-1,i) == "\n") i--;
  
  if(x == str.length && i == 0) {
    return '';
  } 
  else { return str.substring(x,i); }
}

function checkPosting() {
	var doc_title = document.form_nwsgrp.doc_title;
	var doc_text = document.form_nwsgrp.doc_text;
	doc_title.value = trim(doc_title.value);
	doc_text.value = trim(doc_text.value);
	if (doc_title.value == "" || doc_text.value == "") {
		return false;
	}
	return true;
}
