function submit_post_to_CMS()
{
	if( !(document.board.body.value) )
		{ alert("You'll need to type a message before you press that button."); }
	else
	{ if((!document.board.guestname.value))
		{ alert("You forgot to type your name!");  }
	else
		{ document.board.submit(); }
	}
}

function toggleSpellcheck(newstate)
{
	var i, span;
	for(i=0; (span = document.getElementsByTagName("span")[i]); i++)
	{
		if(newstate == 'off')
		{
			if(span.className.indexOf("spellerror") != -1)
			{
				span.className = "disabledspellerror";
			}
		}
		else
		{
			if(span.className.indexOf("disabledspellerror") != -1)
			{
				span.className = "spellerror";
			}
		}
	}
}

function ebtextbold()
{
	document.getElementById("ebbody").value += ' [b]your text here[/b]';
}

function ebtextitalic()
{
	document.getElementById("ebbody").value += ' [i]your text here[/i]';
}

function ebtextunderline()
{
	document.getElementById("ebbody").value += ' [u]your text here[/u]';
}

function ebtextquote()
{
	document.getElementById("ebbody").value += "\n[blockquote=\"Author of Quote\"]\nyour text here\n[/blockquote]\n";
}

function ebinslink()
{
	var text = document.getElementById("ebbody");
	var linkURL = prompt("Enter the URL (address) for the link:", "http://");
	var linktext = prompt("Enter the text that should be linkified:", "your text here");
	var num = 1;
	while(text.value.indexOf('][' + num + ']') != -1)
		num++;
	if(linktext && linkURL)
		text.value += ' [' + linktext + '][' + num + '] ' + "\n\n" + '[' + num + ']: ' + linkURL + "\n";
}

function ebinsimage()
{
	var text = document.getElementById("ebbody");
	var tag = '[image1here]';
	var num = 1;
	var showed_warning = 0;
	while(text.value.indexOf(tag) != -1)
	{
		tag = '[image' + (++num) + 'here]';
		showed_warning = 1;
	}
	text.value += "\n" + tag + "\n";
	if(!showed_warning)
		alert("Inserting the image tag now; you will be prompted to upload your image at the end of the posting process.");
}


