function smiley(img) {
	var content = document.getElementById('message');
	content.value += img + ' ';;
	content.focus();
}

function ubb(code) {
	field = document.getElementById('message');
	if (code == 'bold') {
		tag = 'b'
	} else if (code == 'cursief') {
		tag = 'i'
	} else if (code == 'url') {
		tag = 'url'
	} else if (code == 'img') {
		tag = 'img'
	}
	if (document.selection)
	{
		selText = document.selection.createRange().text;
		if (document.selection.createRange().parentElement().tagName != 'TEXTAREA')
			return;
		var selection = document.selection.createRange();
		selection.text = "[" + tag + "]"  + selText + "[/" + tag + "]";
	} else {
		var startText = (field.value).substring(0, field.selectionStart);
		var selText = (field.value).substring(field.selectionStart, field.selectionEnd);
		var endText = (field.value).substring(field.selectionEnd, field.value.length);
		
		field.value = startText + "[" + tag + "]"  + selText + "[/" + tag + "]" + endText;
	}
}

function checkMessageForm () {
	name = document.getElementById('author_name').value;
	//email = document.getElementById('email').value;
	message = document.getElementById('message').value;
	//if (email != '' && validateEmail(email)) {
		if (name != '' && message != '') {
			document.getElementById('spam_check_passed').value = 'true';
			document.getElementById('sendButton').disabled = false;
			return;
		}
	//}
	document.getElementById('sendButton').disabled = true;
	document.getElementById('spam_check_passed').value = 'false';
}
