function previewText() {
document.getElementById('c_prev').innerHTML = '<p>'+document.getElementById('c_comment').value.replace(/(\n|\r)/g,'<br />').replace(/(<br \/>){2,}/gi,'<'+'/p><p>')+'<'+'/p>';
}

var text_enter_url      = "Enter the complete URL for the hyperlink";
var text_enter_url_name = "Enter the title of the webpage";
var error_no_url        = "You must enter a URL";
var error_no_title      = "You must enter a title";

function contentWrite(NewCode) {
    document.iform.user_post.value+=NewCode;
    document.iform.user_post.focus();
    return;
}

function modBold() {
	add = "<strong></strong>";
	contentWrite(add);
}

function modItalic() {
	add = "<em></em>";
	contentWrite(add);
}

function modQuote() {
	add = "<blockquote></blockquote>";
	contentWrite(add);
}

function modURL()
{
	var FoundErrors = '';
	var enterURL   = prompt(text_enter_url, "http://");
	var enterTITLE = prompt(text_enter_url_name, "Webpage");
	
	if (!enterURL) { FoundErrors += " " + error_no_url; }
	if (!enterTITLE) { FoundErrors += " " + error_no_title; }
	if (FoundErrors) { alert("Error! " + FoundErrors); return; }

	ToAdd = "<a href=\"" + enterURL + "\">" + enterTITLE + "</a>";
	contentWrite(ToAdd);
}

function modCode() {
	add = "<code></code>";
	contentWrite(add);
}