function bbcode_bold()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the text you want to be bold", "");
	if (newText == null) return;
	var boldText = "[b]" + newText + "[/b] ";
	insertAtCursor( document.form.Message, boldText );
}
function bbcode_italic()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the text you want to be italic", "");
	if (newText == null) return;
	var boldText = "[i]" + newText + "[/i] ";
	insertAtCursor( document.form.Message, boldText );
}
function bbcode_underline()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the text you want to be underlined", "");
	if (newText == null) return;
	var boldText = "[u]" + newText + "[/u] ";
	insertAtCursor( document.form.Message, boldText );
}
function bbcode_q()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the word(s) you want to quote", "");
	if (newText == null) return;
	var qText = "[q]" + newText + "[/q] ";
	insertAtCursor( document.form.Message, qText );
}
function bbcode_strikethrough()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the text you want to be strike-through", "");
	if (newText == null) return;
	var boldText = "[strike]" + newText + "[/strike] ";
	insertAtCursor( document.form.Message, boldText );
}
function bbcode_member()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the Usersname of the Member you want to be linked to.", "");
	if (newText == null) return;
	var memberText = "@" + newText;
	var memberText = "[member=" + newText + "]" + newText + "[/member] ";
	insertAtCursor( document.form.Message, memberText );
}
function bbcode_spacer()
{
	var currentText = document.form.Message.value;
	var spacerText = "[spacer] ";
	if (spacerText == null) return;
	insertAtCursor( document.form.Message, spacerText );
}
function bbcode_center()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the text you want to be centered", "");
	if (newText == null) return;
	var centerText = "[center]" + newText + "[/center] ";
	insertAtCursor( document.form.Message, centerText );
}
function bbcode_title()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter your section title", "");
	if (newText == null) return;
	var titleText = "[title]" + newText + "[/title] ";
	insertAtCursor( document.form.Message, titleText );
}
function bbcode_subscript()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the text you want to be subscript", "");
	if (newText == null) return;
	var subscriptText = "[sub]" + newText + "[/sub] ";
	insertAtCursor( document.form.Message, subscriptText );
}
function bbcode_supscript()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the text you want to be superscript", "");
	if (newText == null) return;
	var supscriptText = "[sup]" + newText + "[/sup] ";
	insertAtCursor( document.form.Message, supscriptText );
}
function bbcode_tiny()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the text you want to be tiny", "");
	if (newText == null) return;
	var tinyText = "[tiny]" + newText + "[/tiny] ";
	insertAtCursor( document.form.Message, tinyText );
}
function bbcode_license()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter your Blog License", "");
	if (newText == null) return;
	var licenseText = "[license]" + newText + "[/license] ";
	insertAtCursor( document.form.Message, licenseText );
}
function bbcode_bloglink()
{
    var currentText = document.form.Message.value;
    var newText_Title = prompt("Enter the title of the Blog:", "");
    var newText_URL = prompt("Enter the Blog Link (Do NOT include: http://www.christianblog.com/blog/", "");
    if (newText_Title == null) return;
    if (newText_URL == null) return;
    var blogText = "[blog=" + newText_URL + "]" + newText_Title + "[/blog] ";
	insertAtCursor( document.form.Message, blogText );
}
function bbcode_internallink()
{
    var currentText = document.form.Message.value;
    var newText_Title = prompt("Enter the title of the ChristianBlog.Com page:", "");
    var newText_URL = prompt("Enter the actual URL of the link here at ChristianBlog.Com. (please be sure to include the http://", "");
    if (newText_Title == null) return;
    if (newText_URL == null) return;
    var boldText = "[link=" + newText_URL + "]" + newText_Title + "[/link] ";
	insertAtCursor( document.form.Message, boldText );
}
function bbcode_link()
{
    var currentText = document.form.Message.value;
    var newText_Title = prompt("Enter the title of the link:", "");
    var newText_URL = prompt("Enter the actual URL of the link. (please be sure to include: http://  and a closing / mark at the end of the url.", "");
    if (newText_Title == null) return;
    if (newText_URL == null) return;
    var boldText = "[url=" + newText_URL + "]" + newText_Title + "[/url] ";
	insertAtCursor( document.form.Message, boldText );
}
function bbcode_verse()
{
    var currentText = document.form.Message.value;
    var newText_Title = prompt("Enter the Passage title (example: John 3:16)", "");
    var newText_URL = prompt("Enter the actual text of the passage of Scripture.", "");
    if (newText_Title == null) return;
    if (newText_URL == null) return;
    var boldText = "[verse=" + newText_Title + "]" + newText_URL + "[/verse] ";
	insertAtCursor( document.form.Message, boldText );
}
function bbcode_photo()
{
    var currentText = document.form.Message.value;
    var newText_Title = prompt("Enter the FULL URL of the image. (be sure to include: http://www. )", "");
    if (newText_Title == null) return;
    var boldText = "[img]" + newText_Title + "[/img] ";
	insertAtCursor( document.form.Message, boldText );
}
function bbcode_quote()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the text you want to quote", "");
	if (newText == null) return;
	var quoteText = "[quote]" + newText + "[/quote] ";
	insertAtCursor( document.form.Message, quoteText );
}
function bbcode_blockquote()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the text you want to blockquote", "");
	if (newText == null) return;
	var excerptText = "[blockquote]" + newText + "[/blockquote] ";
	insertAtCursor( document.form.Message, excerptText );
}
function bbcode_strongs()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the Strong's Concordance Reference number", "");
	if (newText == null) return;
	var strongsText = "[strongs]" + newText + "[/strongs] ";
	insertAtCursor( document.form.Message, strongsText );
}
function bbcode_youtube()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the YouTube Video Code", "");
	if (newText == null) return;
	var boldText = "[youtube]" + newText + "[/youtube] ";
	insertAtCursor( document.form.Message, boldText );
}
function bbcode_bible()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the Verse you want to be linked to. (example: John 3:16)", "");
	if (newText == null) return;
	var BibleText = "[bible]" + newText + "[/bible] ";
	insertAtCursor( document.form.Message, BibleText );
}
function bbcode_orderedlist()
{
    var currentText = document.form.Message.value;
    var newText_1 = prompt("Text For First Row", "");
    var newText_2 = prompt("Text For Second Row", "");
	var newText_3 = prompt("Text For Third Row", "");
    if (newText_1 == null) return;
    var passText = " [list=1]\n[*] " + newText_1 + "\n[*] " + newText_2 + "\n[*] " + newText_3 + "\n[/list] ";
	insertAtCursor( document.form.Message, passText );
}
function bbcode_unorderedlist()
{
    var currentText = document.form.Message.value;
    var newText_1 = prompt("Text For First Row", "");
    var newText_2 = prompt("Text For Second Row", "");
	var newText_3 = prompt("Text For Third Row", "");
    if (newText_1 == null) return;
    var passText = " [list=a]\n[*] " + newText_1 + "\n[*] " + newText_2 + "\n[*] " + newText_3 + "\n[/list] ";
	insertAtCursor( document.form.Message, passText );
}
/*
useage: insertAtCursor( document.formname.fieldname, 'some text here' );
<TEXTAREA NAME="Message" COLS="110" ROWS="35" CLASS="input_R"></TEXTAREA>
*/
function insertAtCursor(myField, myValue) {
	if (document.selection) {
		myField.focus();
		sel = document.selection.createRange();
		sel.text = myValue;
	}
	else if (myField.selectionStart || myField.selectionStart == '0') {
		var startPos = myField.selectionStart;
		var endPos = myField.selectionEnd;
		myField.value = myField.value.substring(0, startPos)
		+ myValue
		+ myField.value.substring(endPos, myField.value.length);
	} else {
		myField.value += myValue;
	}
}
function bbcode_wiki()
{
	var currentText = document.form.Message.value;
	var newText = prompt("Enter the text you want to be linked to wikipedia", "");
	if (newText == null) return;
	var wikiText = "[wiki]" + newText + "[/wiki] ";
	insertAtCursor( document.form.Message, wikiText );
}
