$(document).ready(function(){
    // Highlight Messages
    $(".messagelist").fadeOut().fadeIn().fadeOut().fadeIn();
    $(".nojs").removeClass("nojs");
    $("input[type=checkbox]").addClass("checkbox");
    
    $('textarea[maxlength]').each(function() {
        // Store the jQuery object to be more efficient...
        var $textarea = $(this);

        // Store the maxlength and value of the field.
        var maxlength = $textarea.attr('maxlength');
        var val = $textarea.val();

        // Trim the field if it has content over the maxlength.
        $textarea.val(val.slice(0, maxlength));

        // Bind the trimming behavior to the "keyup" event.
        $textarea.bind('keyup, blur', function() {
            $textarea.val($textarea.val().slice(0, maxlength));
        });

    });
});

