function checkTextLimit(textArea, charLimit) {
	var counter = document.getElementById(textArea.id + '_counter');
	//var textAreaClean = textArea.value; //.replace(/\r\n/g,'');
	var textAreaClean = textArea.value.replace(/\r\n/g, '');
	//textAreaClean = textAreaClean.replace("\n",'');
	//textAreaClean = textAreaClean.replace("\r",'');
	//textAreaClean = textAreaClean.replace("\f",'');
	//textAreaClean = textAreaClean.replace("\b",'');

	var count = textAreaClean.length;

	if (count > charLimit) {
		textArea.value = textArea.value.substring(0, charLimit);
		if (count > charLimit + 1) {
			alert('Uw tekst is te lang. Maak uw tekst korter en probeer nogmaals.');
			//textArea.value = '';
		}
//	} else {
//		if (count == charLimit) { counter.style.color = '#FF0000'; }
//		else { counter.style.color = '#FFFFFF'; }
//		counter.innerHTML = charLimit - count;
}
if (count >= charLimit) { counter.style.color = '#FF0000'; }
else { counter.style.color = '#FFFFFF'; }
counter.innerHTML = charLimit - count;
}
