/* Validate.js, version 1.0.2
*  (c) 2006 achraf bouyakhsass <mutation[at]mutationevent.com>
*
*  This software is licensed under the CC-GNU GPL
*  http://creativecommons.org/licenses/GPL/2.0/
*
*  For more details
*  http://www.mutationevent.com/project/validate.js
*
*  Package to validate various data :
*  hasValidChars
*  isSimpleIP
*  isAlphaLatin
*  isNotEmpty
*  isIntegerInRange
*  isNum
*  isEMailAddr
*  isZipCode
*  isDate
*  isMD5
*  isURL
*  isGuid
*  isISBN
*  isDecimal
*  isplatform
*  isSelected
*  isRadioChecked
*  isTelephoneNumber
*  isTextLengthInRange
*  isHalfwidthLengthInRange
*  isFullwidthLengthInRange
*  isNonnegativeInteger
*  isAlphanumeric
*  isTextLengthWithinMaxLength
*  isHalfwidthLengthWithinMaxLength
*  isFullwidthLengthWithinMaxLength
*  addValidate
*  Apply

'Required' :
'Number' :
'AlphaLatin' :
'Alphanumeric' :
'ValidChars' :
'IntegerRange' :
'Email' :
'ZipCode' :
'Date' :
'Url' :
'Decimal' :
'SelectRequired' :
'RadioRequired' :
'TextareaRequired' :
'PictureRequired' :
'TelephoneNumber' :
'TextLengthRange' :
'HalfwidthLengthRange' :
'FullwidthLengthRange' :
'NonnegativeInteger' :
'Alphanumeric' :
'TextLength' :
'HalfwidthLength' :
'FullwidthLength' :
'Price' :

/*--------------------------------------------------------------------------*/

var Class = {
    create : function() {
        return function() {
            this.initialize.apply(this, arguments);
        }
    }
}

function getValue(s) {
  return document.getElementById(s).value
}

function getValues(elementName) {
  return document.getElementsByName(elementName)
}

// 全角の長さを2、半角の長さを1とカウント
function halfwidthLength(strSrc) {
    len = 0;
    strSrc = escape(strSrc);
    for(i = 0; i < strSrc.length; i++, len++){
        if(strSrc.charAt(i) == "%"){
            if(strSrc.charAt(++i) == "u"){
                i += 3;
                len++;
            }
            i++;
        }
    }
    return len;
}

var Validate = Class.create();
Validate.prototype = {

    initialize : function() {
        this.rules_array = new Array();
        this.error_array = new Array();
        this.error_id    = new Array();
        this.e           = true;
    },

    Apply : function(el) {
        this.check();
        if (this.e) {
            return true;
        } else {
            var endMsg = this.error_array;
            if (!el) {
                alert(this.error_array.toString().replace(/\,/gi,"\n"));
            } else {
//                document.getElementById(el).innerHTML = this.error_array.toString().replace(/\,/gi,"<br/>");
                $("#" + el).empty();
                var ulObj = $("<ul>");
                $.each(this.error_array, function(i, msg) {
                    ulObj.append("<li>" + msg + "</li>");
                });
                $("#" + el).append(ulObj).show();
                location.hash = "error";

                $("#estimate_form input").removeClass("error");
                $("#estimate_form textarea").removeClass("error");
                $("#estimate_form select").removeClass("error");

                $.each(this.error_id, function(i, eid) {
                    $("#" + eid).addClass("error");
                });
            }
            return false;
        }
    },

    addValidate : function(rules) {
        this.rules_array.push(rules);
    },

    hasValidChars : function(s, characters, caseSensitive) {
        function escapeSpecials(s) {
            return s.replace(new RegExp("([\\\\-])", "g"), "\\$1");
        }
        return new RegExp("^[" + escapeSpecials(characters) + "]+$",(!caseSensitive ? "i" : "")).test(s);
    },

    isSimpleIP : function(ip) {
        ipRegExp = /^(([0-2]*[0-9]+[0-9]+)\.([0-2]*[0-9]+[0-9]+)\.([0-2]*[0-9]+[0-9]+)\.([0-2]*[0-9]+[0-9]+))$/
        return ipRegExp.test(ip);
    },

    isAlphaLatin : function(string) {
        alphaRegExp = /^[0-9a-z]+$/i
        return alphaRegExp.test(string);
    },

    isNotEmpty : function(string) {
        return /\S/.test(string);
    },

    isEmpty : function(s) {
        return !/\S/.test(s);
    },

    isIntegerInRange : function(n, Nmin, Nmax) {
        var num = Number(n);
        if (isNaN(num)) {
            return false;
        }
        if (num != Math.round(num)) {
            return false;
        }
        return (num >= Nmin && num <= Nmax);
    },

    isNum : function(number) {
        numRegExp = /^[0-9]+$/
        return numRegExp.test(number);
    },

    isEMailAddr : function(string) {
        emailRegExp = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})$/
        return emailRegExp.test(string);
    },

    isZipCode : function(zipcode) {
        if(!zipcode) return false;
        zpcRegExp = /^\d{7}$|^\d{3}-\d{4}$/;
        return zpcRegExp.test(zipcode);
    },

    isDate : function(date) {
        RegExpformat = /^\d{4}\/\d{2}\/\d{2}$/;
        return RegExpformat.test(date);
    },

    isValidDate : function(year, month, day) {
        var daysOfMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
        if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
            daysOfMonth[1]++;
        }
        
        return (month >= 1 && month <= 12 && day >= 1 && day <= daysOfMonth[month - 1]);
    },

    isMD5 : function(string) {
        if(!string) return false;
        md5RegExp = /^[a-f0-9]{32}$/;
        return md5RegExp.test(string);
    },

    isURL : function(string) {
        if(!string) return false;
        string = string.toLowerCase();
        urlRegExp = /^(((ht|f)tp(s?))\:\/\/)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(\/\S*)?$/
        return urlRegExp.test(string);
    },

    isGuid : function(guid) { //guid format : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx or xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
        if(!guid) return false;
        GuidRegExp = /^[{|\(]?[0-9a-fA-F]{8}[-]?([0-9a-fA-F]{4}[-]?){3}[0-9a-fA-F]{12}[\)|}]?$/
        return GuidRegExp.test(guid);
    },

    isISBN : function(number) {
        if(!number) return false;
        ISBNRegExp = /ISBN\x20(?=.{13}$)\d{1,5}([- ])\d{1,7}\1\d{1,6}\1(\d|X)$/
        return ISBNRegExp.test(number);
    },

    isDecimal : function(number) { // positive or negative decimal
        if(!number) return false;
        decimalRegExp = /^-?(0|[1-9]{1}\d{0,})(\.(\d{1}\d{0,}))?$/
        return decimalRegExp.test(number);
    },

    isPrice : function(number) { // price check
        if(!number) return false;
        priceRegExp = /^(?:[0-9]{1,12}|[0-9]{1,10}\.[0-9]{1}|[0-9]{1,9}\.[0-9]{2})$/
        return priceRegExp.test(number);
    },

    isplatform : function(platform) {
        //win, mac, nix
        if(!platform) return false;
        var os;
        winRegExp = /\win/i
        if(winRegExp.test(window.navigator.platform)) os = 'win';
        
        macRegExp = /\mac/i
        if(macRegExp.test(window.navigator.platform)) os = 'mac';
        
        nixRegExp = /\unix|\linux|\sun/i
        if(nixRegExp.test(window.navigator.platform)) os = 'nix';
        
        if(platform == os) return true;
        else return false;
    },

    isSelected : function(val) {
        if (val == "" || val == 0) return false;
        else return true;
    },

    isChecked : function(obj) {
        var flg = false;
        for (var j = 0; j < obj.length; j++) {
            if (obj[j].checked) {
                flg = true;
                break;
            }
        }
        return flg;
    },

    isChecksInRange : function(obj, min, max) {
        var checks = 0;
        for (var j = 0; j < obj.length; j++) {
            if (obj[j].checked) {
                checks++;
            }
        }
        
        return (checks >= min && checks <= max);
    },

    isRadioChecked : function(radioObj) {
        return this.isChecked(radioObj);
    },

    isTelephoneNumber : function(telephoneNumber){
        if(!telephoneNumber){
            return false;
        }
        telephoneRegex = /^\d{1,}-\d{1,}-\d{1,}$/;
        
        return telephoneRegex.test(telephoneNumber);
    },

    isTextLengthInRange : function(strSrc, min, max){
        return (strSrc.length >= min && strSrc.length <= max);
    },

    isHalfwidthLengthInRange : function(strSrc, min, max){
        halfLen = halfwidthLength(strSrc);
        
        return (halfLen >= min && halfLen <= max);
    },

    isFullwidthLengthInRange : function(strSrc, min, max){
        fullLen = Math.ceil(halfwidthLength(strSrc) / 2);
        
        return (fullLen >= min && fullLen <= max);
    },

    isPositiveInteger : function(number) {
        return /^(?:[1-9]{1}[0-9]{0,}|[1-9]{1}[0-9]{0,2}(?:,[0-9]{3})*)$/.test(number);
    },

    isNonnegativeInteger : function(number){
        return /^(?:0|[1-9]{1}[0-9]{0,}|[1-9]{1}[0-9]{0,2}(?:,[0-9]{3})*)$/.test(number);
    },

    isNegativeInteger : function(number) {
        return /^(?:-[1-9]{1}[0-9]{0,}|-[1-9]{1}[0-9]{0,2}(?:,[0-9]{3})*)$/.test(number);
    },

    isNonpositiveInteger : function(number) {
        return /^(?:0|-[1-9]{1}[0-9]{0,}|-[1-9]{1}[0-9]{0,2}(?:,[0-9]{3})*)$/.test(number);
    },

    isPositiveDecimal : function(number) {
        return /^(?:0(?:\.[0-9]{0,}[1-9]{1,}[0-9]{0,})|[1-9]{1}[0-9]{0,}(?:\.[0-9]{1,})?|[1-9]{1}[0-9]{0,2}(?:,[0-9]{3})*(?:\.[0-9]{1,})?)$/.test(number);
    },

    isNonnegativeDecimal : function(number){
        return /^(?:0(?:\.[0-9]{1,})?|[1-9]{1}[0-9]{0,}(?:\.[0-9]{1,})?|[1-9]{1}[0-9]{0,2}(?:,[0-9]{3})*(?:\.[0-9]{1,})?)$/.test(number);
    },

    isNegativeDecimal : function(number) {
        return /^(?:-0(?:\.[0-9]{0,}[1-9]{1,}[0-9]{0,})|-[1-9]{1}[0-9]{0,}(?:\.[0-9]{1,})?|-[1-9]{1}[0-9]{0,2}(?:,[0-9]{3})*(?:\.[0-9]{1,})?)$/.test(number);
    },

    isNonpositiveDecimal : function(number) {
        return /^(?:-0(?:\.[0-9]{1,})?|-[1-9]{1}[0-9]{0,}(?:\.[0-9]{1,})?|-[1-9]{1}[0-9]{0,2}(?:,[0-9]{3})*(?:\.[0-9]{1,})?)$/.test(number);
    },

    isAlphanumeric : function(text){
        AlphanumericRegex = /^[0-9A-Za-z]*$/;
        
        return AlphanumericRegex.test(text);
    },

    isTextLengthWithinMaxLength : function(strSrc, maxLength){
        return (strSrc.length <= maxLength);
    },

    isHalfwidthLengthWithinMaxLength : function(strSrc, maxLength){
        halfLen = halfwidthLength(strSrc);
        
        return (halfLen <= maxLength);
    },

    isFullwidthLengthWithinMaxLength : function(strSrc, maxLength){
        fullLen = Math.ceil(halfwidthLength(strSrc) / 2);
        
        return (fullLen <= maxLength);
    },

    isHalfwidth : function(strSrc) {
        var flag = true;
        
        for (var i = 0; i < strSrc.length; i++) {
            if (halfwidthLength(strSrc.charAt(i)) == 2) {
                flag = false;
                
                break;
            }
        }
        
        return flag;
    },

    isFullwidth : function(strSrc) {
        var flag = true;
        
        for (var i = 0; i < strSrc.length; i++) {
            if (halfwidthLength(strSrc.charAt(i)) == 1) {
                flag = false;
                
                break;
            }
        }
        
        return flag;
    },

    isBlank : function(str){
        return /[\s　]/.test(str);
    },

    isNotBlank : function(str){
        return /[^\s　]/.test(str);
    },

    check : function() {
        for (var i = 0; i < this.rules_array.length; i++) {
            switch (this.rules_array[i].option) {

                case "Required" :
                    if (this.isEmpty(getValue(this.rules_array[i].id))) {
                        this.error_array.push(this.rules_array[i].error);
                        this.error_id.push(this.rules_array[i].id);
                        this.e = false;
                    }
                    break;

                case 'Number' :
                    if (!this.isEmpty(getValue(this.rules_array[i].id))) {
                        if (!this.isNum(getValue(this.rules_array[i].id))) {
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case 'AlphaLatin' :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if (this.isAlphaLatin(getValue(this.rules_array[i].id))) {
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case 'ValidChars' :
                    if (!this.hasValidChars(getValue(this.rules_array[i].id), this.rules_array[i].chars, false)) {
                        this.error_array.push(this.rules_array[i].error);
                        this.error_id.push(this.rules_array[i].id);
                        this.e = false;
                    }
                    break;

                case 'IntegerRange' :
                    if (!this.isIntegerInRange(getValue(this.rules_array[i].id), this.rules_array[i].Min, this.rules_array[i].Max)) {
                        this.error_array.push(this.rules_array[i].error);
                        this.error_id.push(this.rules_array[i].id);
                        this.e = false;
                    }
                    break;

                case 'Email' :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if (!this.isEMailAddr(getValue(this.rules_array[i].id))) {
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case 'ZipCode' :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if (!this.isZipCode(getValue(this.rules_array[i].id),this.rules_array[i].country)) {
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case 'Date' :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if (!this.isDate(getValue(this.rules_array[i].id),this.rules_array[i].format)) {
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case 'ValidDate' :
                    var today = new Date();
                    var year = 0;
                    if (this.rules_array[i].year) {
                        if (this.isNotEmpty(this.rules_array[i].year)) {
                            year = getValue(this.rules_array[i].year);
                            
                        } else {
                            year = today.getFullYear();
                        }
                        
                    } else {
                        year = today.getFullYear();
                    }
                    var month = getValue(this.rules_array[i].month);
                    var day   = getValue(this.rules_array[i].day);
                    
                    if (this.isNotEmpty(month) && this.isNotEmpty(day)) {
                        if (!this.isNonnegativeInteger(month) || !this.isNonnegativeInteger(day)) {
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                            
                        } else if (!this.isValidDate(year, month, day)) {
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case 'Url' :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if (!this.isURL(getValue(this.rules_array[i].id))) {
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case 'Decimal' :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if (!this.isDecimal(getValue(this.rules_array[i].id))) {
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "SelectRequired" :
                    if (!this.isSelected(getValue(this.rules_array[i].id))) {
                        this.error_array.push(this.rules_array[i].error);
                        this.error_id.push(this.rules_array[i].id);
                        this.e = false;
                    }
                    break;

                case "CheckRequired" :
                    if (!this.isChecked(getValues(this.rules_array[i].name))) {
                        this.error_array.push(this.rules_array[i].error);
                        this.error_id.push(this.rules_array[i].id);
                        this.e = false;
                    }
                    break;

                case "ChecksRange" :
                    if (!this.isChecksInRange(getValues(this.rules_array[i].name), this.rules_array[i].min, this.rules_array[i].max)) {
                        this.error_array.push(this.rules_array[i].error);
                        this.error_id.push(this.rules_array[i].id);
                        this.e = false;
                    }
                    break;

                case "RadioRequired" :
                    if (!this.isChecked(getValues(this.rules_array[i].name))) {
                        this.error_array.push(this.rules_array[i].error);
                        this.error_id.push(this.rules_array[i].id);
                        this.e = false;
                    }
                    break;

                case "TextareaRequired" :
                    if (this.isEmpty(getValue(this.rules_array[i].id))) {
                        this.error_array.push(this.rules_array[i].error);
                        this.error_id.push(this.rules_array[i].id);
                        this.e = false;
                    }
                    break;

                case "PictureRequired" :
                    var newFile = "new_" + this.rules_array[i].id;
                    var curFile = "cur_" + this.rules_array[i].id;

                    var newVal = document.getElementById(newFile).value;
                    var curVal = document.getElementById(curFile).value;


                    if (this.isEmpty(newVal) && this.isEmpty(curVal)) {
                        this.error_array.push(this.rules_array[i].error);
                        this.error_id.push(this.rules_array[i].id);
                        this.e = false;
                    }
                    break;

                case "TelephoneNumber" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if (!this.isTelephoneNumber(getValue(this.rules_array[i].id))) {
                            this.error_array.push(this.rules_array[i].error);
                        this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "TextLengthRange" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if(!this.isTextLengthInRange(getValue(this.rules_array[i].id), this.rules_array[i].min, this.rules_array[i].max)){
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "HalfwidthLengthRange" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if (!this.isHalfwidthLengthInRange(getValue(this.rules_array[i].id), this.rules_array[i].min, this.rules_array[i].max)){
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "FullwidthLengthRange" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if (!this.isFullwidthLengthInRange(getValue(this.rules_array[i].id), this.rules_array[i].min, this.rules_array[i].max)){
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "PositiveInteger" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if(!this.isPositiveInteger(getValue(this.rules_array[i].id))){
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "NonnegativeInteger" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if(!this.isNonnegativeInteger(getValue(this.rules_array[i].id))){
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "NegativeInteger" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if(!this.isNegativeInteger(getValue(this.rules_array[i].id))){
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "NonpositiveInteger" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if(!this.isNonpositiveInteger(getValue(this.rules_array[i].id))){
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "PositiveDecimal" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if(!this.isPositiveDecimal(getValue(this.rules_array[i].id))){
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "NonnegativeDecimal" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if(!this.isNonnegativeDecimal(getValue(this.rules_array[i].id))){
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "NegativeDecimal" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if(!this.isNegativeDecimal(getValue(this.rules_array[i].id))){
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "NonpositiveDecimal" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if(!this.isNonpositiveDecimal(getValue(this.rules_array[i].id))){
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "Alphanumeric" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if (!this.isAlphanumeric(getValue(this.rules_array[i].id))) {
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "TextLength" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if(!this.isTextLengthWithinMaxLength(getValue(this.rules_array[i].id), this.rules_array[i].length)){
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case 'Price' :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if (!this.isPrice(getValue(this.rules_array[i].id))) {
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "HalfwidthLength" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if (!this.isHalfwidthLengthWithinMaxLength(getValue(this.rules_array[i].id), this.rules_array[i].length)){
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "FullwidthLength" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if (!this.isFullwidthLengthWithinMaxLength(getValue(this.rules_array[i].id), this.rules_array[i].length)){
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "Halfwidth" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if (!this.isHalfwidth(getValue(this.rules_array[i].id))) {
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "Fullwidth" :
                    if (this.isNotEmpty(getValue(this.rules_array[i].id))) {
                        if (!this.isFullwidth(getValue(this.rules_array[i].id))) {
                            this.error_array.push(this.rules_array[i].error);
                            this.error_id.push(this.rules_array[i].id);
                            this.e = false;
                        }
                    }
                    break;

                case "NotBlank" :
                    if (!this.isNotBlank(getValue(this.rules_array[i].id))){
                        this.error_array.push(this.rules_array[i].error);
                        this.error_id.push(this.rules_array[i].id);
                        this.e = false;
                    }
                    break;

                case "Rise" :
                    this.error_array.push(this.rules_array[i].error);
                    this.error_id.push(this.rules_array[i].id);
                    this.e = false;
                    
                    break;

            }
        }
    }

}

