//
// clears text fields on mouse click
//
function clearText(thefield) {
  if (thefield.defaultValue==thefield.value)
  thefield.value = ""
}

//
// checks length of text area fields
//
var text1;
function checklength(i) {
  var txt;
  txt=document.postedit.topic_body.value;
  n=txt.length;
  if (n>i) {
    alert('Max length for signatures is 200 characters.');
    document.postedit.topic_body.value=text1;
    return;
  }
  text1=document.postedit.topic_body.value;
}


//
// various functions for inserting bb code into textarea on button click
//
function bbbold() {
  var val = document.postedit.topic_body.value;
	val += "[b][/b]";
	document.postedit.topic_body.value = val;
}
function bbitalic() {
  var val = document.postedit.topic_body.value;
	val += "[i][/i]";
	document.postedit.topic_body.value = val;
}
function bbunderline() {
  var val = document.postedit.topic_body.value;
	val += "[u][/u]";
	document.postedit.topic_body.value = val;
}
function bbcolor() {
  var val = document.postedit.topic_body.value;
	val += "[color=][/color]";
	document.postedit.topic_body.value = val;
}
function bbimage() {
  var val = document.postedit.topic_body.value;
	val += "[img]\"\"[/img]";
	document.postedit.topic_body.value = val;
}
function bburl() {
  var val = document.postedit.topic_body.value;
	val += "[url=http:\/\/][/url]";
	document.postedit.topic_body.value = val;
}
function bbquote() {
  var val = document.postedit.topic_body.value;
	val += "[quote][/quote]";
	document.postedit.topic_body.value = val;
}

//
// various functions for inserting smiley code into textarea
//
function biggrin() {
  var val = document.postedit.topic_body.value;
	val += ":D";
	document.postedit.topic_body.value = val;
}
function confused() {
  var val = document.postedit.topic_body.value;
	val += ":?";
	document.postedit.topic_body.value = val;
}
function cool() {
  var val = document.postedit.topic_body.value;
	val += "8)";
	document.postedit.topic_body.value = val;
}
function cry() {
  var val = document.postedit.topic_body.value;
	val += ":cry:";
	document.postedit.topic_body.value = val;
}
function eek() {
  var val = document.postedit.topic_body.value;
	val += "8O";
	document.postedit.topic_body.value = val;
}
function evil() {
  var val = document.postedit.topic_body.value;
	val += ":evil:";
	document.postedit.topic_body.value = val;
}
function lol() {
  var val = document.postedit.topic_body.value;
	val += ":lol:";
	document.postedit.topic_body.value = val;
}
function mad() {
  var val = document.postedit.topic_body.value;
	val += ":x";
	document.postedit.topic_body.value = val;
}
function mrgreen() {
  var val = document.postedit.topic_body.value;
	val += ":mrgreen:";
	document.postedit.topic_body.value = val;
}
function neutral() {
  var val = document.postedit.topic_body.value;
	val += ":|";
	document.postedit.topic_body.value = val;
}
function razz() {
  var val = document.postedit.topic_body.value;
	val += ":P";
	document.postedit.topic_body.value = val;
}
function redface() {
  var val = document.postedit.topic_body.value;
	val += ":oops:";
	document.postedit.topic_body.value = val;
}
function rolleyes() {
  var val = document.postedit.topic_body.value;
	val += ":roll:";
	document.postedit.topic_body.value = val;
}
function sad() {
  var val = document.postedit.topic_body.value;
	val += ":(";
	document.postedit.topic_body.value = val;
}
function smile() {
  var val = document.postedit.topic_body.value;
	val += ":)";
	document.postedit.topic_body.value = val;
}
function surprised() {
  var val = document.postedit.topic_body.value;
	val += ":o";
	document.postedit.topic_body.value = val;
}
function twisted() {
  var val = document.postedit.topic_body.value;
	val += ":twisted:";
	document.postedit.topic_body.value = val;
}
function wink() {
  var val = document.postedit.topic_body.value;
	val += ":wink:";
	document.postedit.topic_body.value = val;
}
