function setTextareaRows(toExpand)
{
	var textarea = document.getElementById("MessageTextarea");
	toExpand ? textarea.rows = textarea.rows + 3 : textarea.rows = textarea.rows - 3;
}

function setAnonymous(aElement)
{
	document.getElementById("HandleInput").value = aElement.checked ? "GUEST" : "";
}

function checkForm()
{
	var elt;
	var elt1 = document.forms["postform"].elements["message"];
	var elt2 = document.forms["postform"].elements["captha"];
	if ( elt1.value && elt2.value ) return true;
	if ( !elt1.value ) {
		alert("Please input your message.");
		elt = elt1;
	} else if ( !elt2.value ) {
		alert("Please answer the Anti-Spam question.");
		elt = elt2;
	} else {
		return true;
	}
	elt.style.backgroundColor = "#FFFF66";
	elt.addEventListener("input", function(){ elt.style.backgroundColor = ""; }, false);
	elt.focus();
	return false;
}

function _checkForm()
{
	var elt;
	elt = document.forms["postform"].elements["message"];
	if ( !elt.value )
	{
		elt.style.backgroundColor = "#FFFF66";
		elt.focus();
		elt.addEventListener("input", function(){ elt.style.backgroundColor = ""; }, false);
		alert("Please input your message.");
		return false;
	}
	elt = document.forms["postform"].elements["captha"];
	if ( !elt.value )
	{
		elt.style.backgroundColor = "#FFFF66";
		elt.focus();
		elt.addEventListener("input", function(){ elt.style.backgroundColor = ""; }, false);
		alert("Please answer the Anti-Spam question.");
		return false;
	}
}

function confirm_delete()
{
	if ( confirm("Would you like to delete this topic?") ) document.F1.submit();
}

function toggleOpenState(aShowHide)
{
	var expire = new Date();
	expire.setTime(expire.getTime() + 6 * 24 * 60 * 60 * 1000);
	document.cookie = "toggle=" + aShowHide + ";expires=" + expire.toGMTString();
	window.location.reload();
}

function showBBCode(aEvent, aShowHide)
{
	document.getElementById("bbcode").style.display = aShowHide ? "block" : "none";
}


