function insertcode(form, field, start)
{
	var textarea = document.forms[form].elements[field];
	if (typeof(textarea.selectionStart) != "undefined")
	{
		var text = new Array();
		text[0] = textarea.value.substr(0, textarea.selectionStart);
		text[1] = textarea.value.substr(textarea.selectionEnd);
		caretPos = textarea.selectionEnd+start.length;
		textarea.value = text[0]+start+text[1];
		if (textarea.setSelectionRange)
		{
			textarea.focus();
			textarea.setSelectionRange(caretPos, caretPos);
		}
	}
	else
	{
		textarea.focus();
		theSelection = document.selection.createRange().text;
		document.selection.createRange().text = start + theSelection;
		textarea.focus();
	}
}
function setFocus(aField)
{
	document.usercomment[aField].focus();
}
function isEmpty(aTextField)
{
	if((document.usercomment[aTextField].value.length==0) || (document.usercomment[aTextField].value==null))
	{
		return true;
	}
	else
	{
		return false;
	}
}
function validate()
{
	if(isEmpty("msg"))
	{
		alert("Please enter a comment.");
		setFocus("msg");
		return false;
	}
	return true;
}

function resizeArea (myField, action)
{
	var elHeight = myField.rows;
	if (action == '+')
	{
		if (elHeight > 3)
		{
			myField.rows = elHeight - 3;
		}
		else
		{
			alert('You have reached the minimum size!');
			myField.rows = 3;
		}
	}
	if (action == '-')
	{
		if (elHeight < 8)
		{
			myField.rows = elHeight + 3;
		}
		else
		{
			alert('You have reached the maximum size!');
			myField.rows = 8;
		}
	}
}