// http://www.dreamincode.net/code/snippet979.htm
function word_count(text, doc) {
	text = text.replace(/^\s*|\s*$/g,''); //removes whitespace from front and end
	var count_array = text.split(" ");
	doc.value = count_array.length;
}

function clearbox(element, deftext) {
	if (element.value == deftext) {
		element.value = '';
	}
}