function limitChars(textarea, limit, infodiv) {
	var text = textarea.value; 
	var textlength = text.length;
	var info = document.getElementById(infodiv);

	if(textlength > limit) {
		info.innerHTML = 'You cannot write more than '+limit+' characters!';
		info.style.color='red';
		textarea.value = text.substr(0,limit);
		return false;
	} else {
		info.innerHTML = 'You have '+ (limit - textlength) +' characters left.';
		if ((limit - textlength) > 10) {
			info.style.color='green';
		} else if ((limit - textlength) > 0) {
			info.style.color='orange';
		} else {
			info.style.color='red';
		}
		return true;
	}
}
