/*Fonction de limitation de caractère sans compteur */
function limitChars(textid, limit)
{
	var text = $('#'+textid).val(); 
	var textlength = text.length;

	if(textlength > limit)
	{
		$('#'+textid).val(text.substr(0,limit));
		return false;
	}else{
		return true;
	}
}

/*Fonction de limitation de caractère avec compteur */
function limitCharsDiv(textid, limit, infodiv)
{
	var text = $('#'+textid).val(); 
	var textlength = text.length;

	if(textlength > limit)
	{
		$('#' + infodiv).html('You cannot write more then '+limit+' characters!');
		$('#'+textid).val(text.substr(0,limit));
		return false;
	}else{
		$('#' + infodiv).html('You have '+ (limit - textlength) +' characters left.');
		return true;
	}
}
