﻿function limitChars(textid, limit, infodiv) {
    var text = $j('#' + textid).val();
    var textlength = text.length;
    if (textlength > limit) {
        $j('#' + infodiv).html('You cannot write more then ' + limit + ' characters!');
        $j('#' + textid).val(text.substr(0, limit));
        return false;
    }
    else {
        $j('#' + infodiv).html('You have ' + (limit - textlength) + ' characters left.');
        return true;
    }
}