<!--Scripts om smileys aan het gastenboek toe te voegen.-->
function putStr( type ) {
	var target = document.getElementById( 'gastenboekbericht' );

	if ( target != null ) {
		if ( typeof target.cursorPos != 'undefined' ) {
			var cursorPos = target.cursorPos;
			cursorPos.text = det_replace(type, cursorPos.text);
		} else if ( typeof target.selectionStart != 'undefined' ) {
			var sStart = target.selectionStart;
			var sEnd = target.selectionEnd;
			var text = det_replace(type, target.value.substr(sStart, sEnd));
			target.value = target.value.substr(0, sStart) + text + target.value.substr(sEnd, target.value.length);
			var nStart = sStart == sEnd ? sStart + text.length : sStart;
			var nEnd = sStart + text.length;
			target.setSelectionRange(nStart, nEnd);
		} else {
			target.value += det_replace(type,'');
		}
		target.focus();
	}
}

function det_replace(type, text) {
if (text != '') {
	switch (type) {
		case 'AND': text = text.replace(/(\w+)\s+/g, '$1 AND '); break;
		case 'OR': text = text.replace(/(\w+)\s+/g, '$1 OR '); break;
		case 'brackets': text = '('+text+')'; break;
		case 'title': text = 'title:('+text+')'; break;
		case 'start': text = 'start:('+text+')'; break;
		default: text = type;
	}
} else {
	switch (type) {
		case 'AND':	text = ' AND '; break;
		case 'OR': text = ' OR '; break;
		case 'brackets': text = '()'; break;
		case 'title': text = 'title:'; break;
		case 'start': text = 'start:'; break;
		default: text = type;
	}
}
return text;
}

<!-- Script om het aantal tekens te tellen tijdens het schrijven van het bericht voor het gastenboek.
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
	field.value = field.value.substring(0, maxlimit);
else
	countfield.value = maxlimit - field.value.length;
}

