﻿//-----------------------------------------------------------------------
// SelectionDetailView.js
//-----------------------------------------------------------------------
$(function() {
    nl.SelectionDetailView = function() {
        ///	<summary>コンストラクタ</summary>
        this.init();
    };
    nl.SelectionDetailView.prototype = {
        init: function() {
            //*** コメント入力チェック ***
            var comment = $(".form_comment");
            comment.focus(function(event) {
                var self = this;
                var before = comment.val();
                this.interval = window.setInterval(
                function(event) {
                    var after = comment.val();
                    if (before !== after) {
                        var validValue = after.valid(1000);
                        if (validValue) { comment.val(validValue) };
                        before = after;
                    }
                }, 1000);
            });
            comment.blur(function(event) {
                clearInterval(this.interval);
                var validValue = comment.val().valid(1000);
                if (validValue) { comment.val(validValue) };
            });
        }
    };

    nl.selectionDetailView = new nl.SelectionDetailView();
});