﻿GoodNitesUserControls.CreateComment = function(serverVars) {
    this.ServerVars = serverVars;
    this.Initialize();
};

GoodNitesUserControls.CreateComment.prototype = {
    Initialize: function() {
        $('#' + serverVars.commentId).charCounter(500, { container: '#commentTextCounter' });
    }
};

function ValidateComment(source, arguments) {
    var length = arguments.Value.length;

    if (length < 2 || length > 500) {
        $('#' + source.id).html('Please enter your comment.');
        arguments.IsValid = false;
    } else {
        arguments.IsValid = true;
    }
}

GoodNites.Extend(GoodNitesUserControls.CreateComment, GoodNites.Core);