<!--
function ins(tag) {
postcontents = document.forms[0].postcontents;

if ( tag=="img" ) {
href=prompt("Please enter the image URL:");
postcontents.value = postcontents.value + "<img src=\"" + href + "\" alt=\" \">";
postcontents.focus();
} else {

	if ( tag=="a" ) {
	href=prompt("Please enter the link URL:");
	tagA=tag + " href=\"" + href + "\"";
	} else tagA=tag;

o="<" + tagA + ">";
c="</" + tag + ">";

// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase();
var clientVer = parseInt(navigator.appVersion);

var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));

	if ((clientVer >= 4) && is_ie && is_win) {
		theSelection = document.selection.createRange().text;
		if (!theSelection) {
			postcontents.value += o + c;
			postcontents.focus();
			return;
		}
		document.selection.createRange().text = o + theSelection + c;
		postcontents.focus();
		return;
	}
	else if (postcontents.selectionEnd && (postcontents.selectionEnd - postcontents.selectionStart > 0))
	{
		mozWrap(postcontents, o, c);
		return;
	}
	else
	{
		postcontents.value += o + c;
		postcontents.focus();
	}
}

// From http://www.massless.org/mozedit/
function mozWrap(postcontents, open, close)
{
	var selLength = postcontents.textLength;
	var selStart = postcontents.selectionStart;
	var selEnd = postcontents.selectionEnd;
	if (selEnd == 1 || selEnd == 2)
		selEnd = selLength;

	var s1 = (postcontents.value).substring(0,selStart);
	var s2 = (postcontents.value).substring(selStart, selEnd)
	var s3 = (postcontents.value).substring(selEnd, selLength);
	postcontents.value = s1 + open + s2 + close + s3;
	return;
	}
}

//-->
