<!--
//based on code found at:  http://www.snitz2000.com

function wsboard_validate_post(){
	if (document.PostTopic.Subject) {
		if (trim(document.PostTopic.Subject.value)=="") {
			alert("You must enter a Subject")
			return false
		}
	}
	if (document.PostTopic.Message) {
		if (trim(document.PostTopic.Message.value)=="") {
			alert("You must enter a Message")
			return false
		}
	}
	document.PostTopic.Submit.disabled = true
	return true
}


function wsboard_store_caret(ftext) {
	if (ftext.createTextRange) {
		ftext.caretPos = document.selection.createRange().duplicate();
	}
}


function wsboard_add_text(text) {
	var tarea = document.PostTopic.Message;
	if (typeof tarea.selectionStart != 'undefined'){ // if it supports DOM2
		start = tarea.selectionStart;
		end = tarea.selectionEnd;
		tarea.value = tarea.value.substr(0,tarea.selectionStart)
			+ text + tarea.value.substr(tarea.selectionEnd);
		tarea.focus();
		tarea.selectionStart = ((start - end) == 0) ? start + text.length : start;
		tarea.selectionEnd = start + text.length;
	} else {
		if (tarea.createTextRange && tarea.caretPos) {
			var caretPos = tarea.caretPos;
			caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?   text + ' ' : text;
		}
		else {
			tarea.value += text;
		}
		tarea.focus(caretPos);
	}
}



function wsboard_open_popup(page) {   
   var name = "wsboard";
   var features = "width=600,height=400";
   window.open(page,name,features);
}


function wsboard_open_preview()
{
	var features = "width=600,height=400,scrollbars=yes";
	var name = "wspreview";
	if (document.PostTopic.Message) {
		if (trim(document.PostTopic.Message.value)=="") {
			alert("Nothing to Preview!")
			return false
		}
		popupWin = window.open('pop_preview.asp', name, features)
		return true
	}
}

function wsboard_open_sig_preview()
{
	var features = "width=600,height=400,scrollbars=yes";
	var name = "wspreview";
	if (document.Form1.Sig) {
		if (trim(document.Form1.Sig.value)=="") {
			alert("Nothing to Preview!")
			return false
		}
		popupWin = window.open('pop_preview_sig.asp', name, features)
		return true
	}
}




//code below found here:  http://www.marzie.com/devtools/javascript/functions.asp
function ltrim(s) {
	return s.replace( /^\s*/, "" );
}
function rtrim(s) {
	return s.replace( /\s*$/, "" );
}
function trim ( s ) {
	return rtrim(ltrim(s));
}



//-->