function tF(id) {
	var doIt = false
	if(document.all) { var dToggle = document.all('tr_' + id); doIt = true }
	else if (document.getElementById) { var dToggle = document.getElementById('tbl_' + id); doIt = true	}
	if(doIt) {
		switch (dToggle.className) {
			case 'Hidden' : dToggle.className = 'Visible'; document.images['img_' + id].src = 'images/minus.gif'; break;
			case 'Visible' : dToggle.className = 'Hidden'; document.images['img_' + id].src = 'images/plus.gif'; break;
		}
	}
	else {
		alert('Your browser is too old to use this function.')
	}
}
function storeCaret (textEl) {
  if (textEl.createTextRange) 
    textEl.caretPos = document.selection.createRange().duplicate();
}
function AddText(text) {
	var tarea = document.frmPost.strMessage;
	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;
			storeCaret(document.frmPost.strMessage)
		}
		else {
			tarea.value += text;
		}
		tarea.focus(caretPos);
	}
}
function bold() {
	var text = getText();
	AddTxt="[b]" + text + "[/b]";
	AddText(AddTxt);
}
function italicize() {
	var text = getText();
	AddTxt="[i]" + text + "[/i]";
	AddText(AddTxt);
}
function underline() {
	var text = getText();
	AddTxt="[u]" + text + "[/u]";
	AddText(AddTxt);
}
function strike() {
	var text = getText();
	AddTxt="[s]" + text + "[/s]";
	AddText(AddTxt);
}
function left() {
	var text = getText();
	AddTxt="[left]" + text + "[/left]";
	AddText(AddTxt);
}
function center() {
	var text = getText();
	AddTxt="[center]" + text + "[/center]";
	AddText(AddTxt);
}
function right() {
	var text = getText();
	AddTxt="[right]" + text + "[/right]";
	AddText(AddTxt);
}
function hr() {
	var text = getText();
	AddTxt="[hr]" + text;
	AddText(AddTxt);
}
function hyperlink() {
	var text = getText();
	AddTxt="[url]" + text + "[/url]";
	AddText(AddTxt);	
}
function showcode() {
	var text = getText();
	AddTxt="[code]" + text + "[/code]";
	AddText(AddTxt);	
}
function quote() {
	var text = getText();
	AddTxt=" [quote]" + text + "[/quote]";
	AddText(AddTxt);	
}
function list() {
	AddTxt=" [list][*]  [/*][*]  [/*][*]  [/*][/list]";
	AddText(AddTxt);
}
function showcolor(color) {
	var text = getText();
	if (color) {		
		AddTxt="["+color+"]" + text + "[/"+color+"]";
		AddText(AddTxt);		
		document.frmPost.Color.selectedIndex = 0;
	}
}
function storeCaret(ftext) {
	if (ftext.createTextRange) {
		ftext.caretPos = document.selection.createRange().duplicate();
	}
}

function getText() {
	var tarea = document.frmPost.strMessage;
	if (tarea.createTextRange && tarea.caretPos) {
		return tarea.caretPos.text;
	} else if (typeof tarea.selectionStart != 'undefined'){
		return tarea.value.substr(tarea.selectionStart,tarea.selectionEnd-tarea.selectionStart)
	}
	return '';
}
function ltrim(s) {
	return s.replace( /^\s*/, "" );
}
function rtrim(s) {
	return s.replace( /\s*$/, "" );
}
function trim ( s ) {
	return rtrim(ltrim(s));
}
function insertsmilie(smilieface) {
	AddText(smilieface);
}
function vU(userID) { 
	self.location = 'ForumMember.asp?UserID=' + userID
}
function vProfile(userID) { 
	self.location = 'ViewProfile.asp?UserID=' + userID
}
function tN(userID, c) {
	self.location = 'ForumMember.asp?UserID=' + userID + '&N=' + c + '&Mode=NotifictionToggle'
}
