function limitChars(textid, limit, infodiv)
{
	var text = $('#'+textid).val();	
	var textlength = text.length;
	if(textlength > limit)
	{
		$('#' + infodiv).html('Votre message ne doit pas avoir plus de '+limit+' caractères!');
		$('#'+textid).val(text.substr(0,limit));
		return false;
	}
	else
	{
		$('#' + infodiv).html('Vous avez encore '+ (limit - textlength) +' caractères de disponible pour votre message.');
		return true;
	}
}

$(function(){
 	$('#nachricht').keyup(function(){
 		limitChars('nachricht', 600, 'charlimitinfo');
 	})
});

