PageSourceSearch

https://www.comcrepe.shop/res/touch011/js/public/customize-form-check.js?1911191101

js comcrepe.shop collected 2026-10-08 03:47:20 UTC 31,178 bytes, 746 lines download raw bytes

1customizeFormCheck = {};
2customizeFormCheck.FormInit = function (selector) {
3    customizeFormCheck.changeInputType();
4    customizeFormCheck.setAutoFitTextareaHeight();
5
6    var $formElem = jQuery(selector);
7    $formElem.find('input[type=text], input[type=email], input[type=tel], textarea').on('input keyup focus blur', function (e) {
8        customizeFormCheck.hideDiaphanousDisplay(e, '');
9        customizeFormCheck.FormTextInput(e);
10    });
11    $formElem.find('select').on('focus blur', function(e){
12        customizeFormCheck.hideDiaphanousDisplay(e, '');
13    });
14    $formElem.find('select').on('change', function(e){
15        customizeFormCheck.FormSelectBox(e);
16    });
17    $formElem.find('input:radio').on('click focus blur', function(e){
18        customizeFormCheck.hideDiaphanousDisplay(e, '');
19    });
20    $formElem.find('input:radio').on('change', function(e){
21        customizeFormCheck.FormRadioButton(e);
22    });
23    $formElem.find('input:checkbox').on('click focus blur', function(e){
24        customizeFormCheck.hideDiaphanousDisplay(e, '');
25    });
26    $formElem.find('input:checkbox').on('click', function(e){
27        customizeFormCheck.FormCheckBox(e);
28    });
29    jQuery('.type_date').on('click', '.cell_box', function(e){
30        var id = jQuery(e.currentTarget).find("input:text").attr('id');
31        customizeFormCheck.hideDiaphanousDisplay('', '#'+id);
32    });
33    $formElem.on('click', '.a_cal_day, .date_change input:button, .date_change button', function(e){
34        customizeFormCheck.CalendarDateClick(e);
35    });
36    customizeFormCheck.addressDisplayInit(selector);
37};
38
39customizeFormCheck.changeInputType = function () {
40    if (typeof globalObj.changeInputType === 'function') {
41        var inputType = {}, dataType, dataId;
42        jQuery(".form_parts input[type='text']").each(function(i, e){
43            dataType = jQuery(e).data('type');
44            dataId = jQuery(e).attr('id');
45            if (dataType === 'email') {
46                inputType[dataId] = 'email';
47            } else if (dataType === 'postjp' || dataType === 'tel') {
48                inputType[dataId] = 'tel';
49            }
50        });
51        if (inputType) {
52            globalObj.changeInputType(inputType);
53        }
54    }
55};
56
57customizeFormCheck.setAutoFitTextareaHeight = function () {
58    if (jQuery.fn.autoFitTextareaHeight) {
59        jQuery('textarea').autoFitTextareaHeight();
60    } else if (typeof globalObj.setAutoFitTextareaHeight === 'function') {
61        globalObj.setAutoFitTextareaHeight();
62    }
63};
64
65customizeFormCheck.disableEnterSubmit = function(elem) {
66    elem.keypress(function (e) {
67        if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
68            return false;
69        }
70    });
71};
72
73// 透過表示OFF
74customizeFormCheck.hideDiaphanousDisplay = function (obj, selector) {
75    if (obj && !selector.length) {
76        var id = jQuery(obj.target).attr('id');
77        selector = '#'+id;
78    }
79    if (!selector.length) {
80        return;
81    }
82    var $formPartsElem = jQuery(selector).closest(".form_parts");
83    if ($formPartsElem.hasClass('form_alpha')) {
84        $formPartsElem.removeClass('form_alpha');
85    } else if ($formPartsElem.find(".form_alpha").length) {
86        $formPartsElem.find(".form_alpha").removeClass('form_alpha');
87    }
88};
89
90customizeFormCheck.FormEmailCheck = function (inputVal) {
91    if (0 < inputVal.length && !inputVal.match(/^[\/0-9A-Za-z_-][+?\/0-9A-Za-z.._-]*@[0-9A-Za-z_-]+[\.]+[0-9A-Za-z_..-]+[A-Za-z]$/)) {
92        return false;
93    }
94    return true;
95};
96
97customizeFormCheck.FormTelCheck = function (inputVal) {
98    if (0 < inputVal.length && !inputVal.match(/^[0-9+(][0-9 \.\-\+()]{1,28}[0-9]$/)) {
99        return false;
100    }
101    return true;
102};
103
104customizeFormCheck.FormJPPostCheck = function (inputVal) {
105    if (0 < inputVal.length && !inputVal.match(/^[0-9]{3}-?[0-9]{4}$/)) {
106        return false;
107    }
108    return true;
109};
110
111customizeFormCheck.convertCharacter = function (inputVal) {
112    var list = {
113        'a':'a','b':'b','c':'c','d':'d','e':'e','f':'f','g':'g','h':'h','i':'i','j':'j','k':'k','l':'l','m':'m','n':'n','o':'o','p':'p','q':'q','r':'r','s':'s','t':'t','u':'u','v':'v','w':'w','x':'x','y':'y','z':'z',
114        'A':'A','B':'B','C':'C','D':'D','E':'E','F':'F','G':'G','H':'H','I':'I','J':'J','K':'K','L':'L','M':'M','N':'N','O':'O','P':'P','Q':'Q','R':'R','S':'S','T':'T','U':'U','V':'V','W':'W','X':'X','Y':'Y','Z':'Z',
115        '0':'0','1':'1','2':'2','3':'3','4':'4','5':'5','6':'6','7':'7','8':'8','9':'9',
116        ' ':' ','!':'!','#':'#','$':'$','%':'%','&':'&','(':'(',')':')','*':'*','+':'+',',':',','-':'-','ー':'-','.':'.','/':'/',':':':',';':';','<':'<','=':'=','>':'>','?':'?','@':'@','[':'[',']':']','^':'^','_':'_','{':'{','|':'|','}':'}'
117    };
118    var re = /[a-zA-Z0-9 !#$%&()*+,-ー./:;<=>?@[]^_{|}]/g;
119    inputVal = inputVal.replace(re, function(m){return list[m];});
120    return inputVal;
121};
122
123customizeFormCheck.addressDisplayInit = function (selector) {
124    jQuery(selector+' select').each(function(i, obj) {
125        var id = jQuery(obj).attr('id');
126        var selector = '#'+id;
127        var dataType = jQuery(selector).data('type');
128        if (dataType == 'country') {
129            customizeFormCheck.changeCountryProcess(selector, false);
130            if (globalObj.language=='Japanese') {
131                customizeFormCheck.addressRequireChangeProcess(selector, selector.replace('country', 'prefecture'));
132            }
133        }
134    });
135};
136
137customizeFormCheck.FormTextInput = function (obj) {
138    var id = jQuery(obj.target).attr('id');
139    var selector = '#'+id;
140    var inputVal = customizeFormCheck.convertCharacter(jQuery(selector).val());
141    var dataRequired = jQuery(selector).data('required');
142    var dataType = jQuery(selector).data('type');
143    var error = null;
144
145    if (dataType == 'email') {
146        if (inputVal.length==0) {
147            if (dataRequired == 1) {
148                error = errorStatusPrefix + messageBr + NG_icon + MSG_INPUT + errorStatusSuffix;
149            } else {
150                customizeFormCheck.hideErrorDisplay(selector, '');
151            }
152        } else {
153            if (!customizeFormCheck.FormEmailCheck(inputVal)) {
154                error = errorStatusPrefix + messageBr + NG_icon + MSG_INPUT2 + errorStatusSuffix;
155            } else {
156                customizeFormCheck.hideErrorDisplay(selector, OK_icon);
157            }
158        }
159        if (error) {
160            customizeFormCheck.addErrorDisplay(selector, error);
161        }
162        var $confirmElem = jQuery(selector).closest(".cell_box").find(".confirm_email");
163        if (0 < $confirmElem.length) {
164            $confirmElem.text(inputVal);
165            if (0 < inputVal.length) {
166                $confirmElem.css("display", "block");
167            } else {
168                $confirmElem.css("display", "none");
169            }
170        }
171    } else if (dataType == 'tel') {
172        if (inputVal.length==0) {
173            if (dataRequired == 1) {
174                error = errorStatusPrefix + messageBr + NG_icon + MSG_INPUT + errorStatusSuffix;
175            } else {
176                customizeFormCheck.hideErrorDisplay(selector, '');
177            }
178        } else {
179            if (!customizeFormCheck.FormTelCheck(inputVal)) {
180                if (globalObj.language === 'English') {
181                    error = errorStatusPrefix + messageBr + NG_icon + MSG_NUMERIC5 + errorStatusSuffix;
182                } else {
183                    error = errorStatusPrefix + messageBr + NG_icon + MSG_NUMERIC6 + errorStatusSuffix;
184                }
185            } else {
186                customizeFormCheck.hideErrorDisplay(selector, OK_icon);
187            }
188        }
189        if (error) {
190            customizeFormCheck.addErrorDisplay(selector, error);
191        }
192    } else if (dataType == 'postjp') {
193        customizeFormCheck.CheckJPPost(selector, dataRequired);
194    } else {
195        if (dataType == 'post') {
196            var countrySelector = selector.replace('post', 'country');
197            if (jQuery(countrySelector).val() == '58') {// Hong Kong
198                dataRequired = 0;
199            }
200            var postJPSelector = selector.replace('post', 'postjp');
201            if (jQuery(postJPSelector).length) {
202                jQuery(postJPSelector).val(inputVal);
203            }
204        }
205        if (inputVal.length==0) {
206            if (dataRequired == 1) {
207                error = errorStatusPrefix + messageBr + NG_icon + MSG_INPUT + errorStatusSuffix;
208                customizeFormCheck.addErrorDisplay(selector, error);
209            } else {
210                customizeFormCheck.hideErrorDisplay(selector, '');
211            }
212        } else {
213            customizeFormCheck.hideErrorDisplay(selector, OK_icon);
214        }
215    }
216};
217
218customizeFormCheck.FormCheckBox = function (obj) {
219    var id = jQuery(obj.target).attr('id');
220    var selector = '#'+id;
221    var dataRequired = jQuery(selector).data('required');
222    var checked = false;
223    var t_name, status;
224    jQuery(selector).closest(".input_box").find('input:checkbox').each(function (i, e) {
225        t_name = jQuery(e).attr('name');
226        status = jQuery("input[name='"+t_name+"']").prop('checked');
227        if (status == true) {
228            checked = true;
229            return false;
230        }
231    });
232    if (checked) {
233        customizeFormCheck.hideErrorDisplay(selector, OK_icon);
234    } else {
235        if (dataRequired == '1') {
236            error = errorStatusPrefix + messageBr + NG_icon + MSG_SELECT + errorStatusSuffix;
237            customizeFormCheck.addErrorDisplay(selector, error);
238        } else {
239            customizeFormCheck.hideErrorDisplay(selector, '');
240        }
241    }
242};
243
244customizeFormCheck.FormRadioButton = function (obj) {
245    var id = jQuery(obj.target).attr('id');
246    var selector = '#'+id;
247    var dataRequired = jQuery(selector).data('required');
248    customizeFormCheck.hideErrorDisplay(selector, OK_icon);
249};
250
251customizeFormCheck.FormSelectBox = function (obj) {
252    var id = jQuery(obj.target).attr('id');
253    var selector = '#'+id;
254    var dataRequired = jQuery(selector).data('required');
255    var dataType = jQuery(selector).data('type');
256    var error = null;
257    if (dataType == 'birthday') {
258        var t_name, d_name, status, year, month, day;
259        jQuery(selector).closest(".input_box").find('select').each(function (i, e) {
260            t_name = jQuery(e).attr('name');
261            status = jQuery("select[name='" + t_name + "']").val();
262            if (t_name.match(/year/)) {
263                year = status;
264            } else if (t_name.match(/month/)) {
265                month = status;
266            } else if (t_name.match(/day/)) {
267                day = status;
268                d_name = t_name;
269            }
270        });
271        if (year || month || day) {
272            day = customizeFormCheck.birthDateCheck(d_name, year, month, day);
273            if (year && month && day) {
274                var birthdate = new Date(year, month - 1, day);
275                if (year != birthdate.getFullYear() || month - 1 != birthdate.getMonth() || day != birthdate.getDate()) {
276                    error = errorStatusPrefix + messageBr + NG_icon + MSG_BIRTHDAY + errorStatusSuffix;
277                } else {
278                    customizeFormCheck.hideErrorDisplay(selector, OK_icon);
279                }
280            } else {
281                error = errorStatusPrefix + messageBr + NG_icon + MSG_SELECT + errorStatusSuffix;
282            }
283        } else {
284            if (dataRequired == '1') {
285                error = errorStatusPrefix + messageBr + NG_icon + MSG_SELECT + errorStatusSuffix;
286            } else {
287                customizeFormCheck.hideErrorDisplay(selector, '');
288            }
289        }
290        if (error) {
291            customizeFormCheck.addErrorDisplay(selector, error);
292        }
293    } else if (dataType == 'time') {
294        var t_name, status, hour, minute, time;
295        jQuery(selector).closest(".input_box").find('select').each(function (i, e) {
296            t_name = jQuery(e).attr('name');
297            status = jQuery("select[name='" + t_name + "']").val();
298            if (t_name.match(/hour/)) {
299                hour = status;
300            } else if (t_name.match(/minute/)) {
301                minute = status;
302            } else if (t_name.match(/time/)) {
303                time = status;
304            }
305        });
306        if (selector.match(/time_h/)) {
307            minute = customizeFormCheck.timeCheck(selector);
308        }
309        if (hour || minute || time) {
310            if (time || (hour && minute)) {
311                customizeFormCheck.hideErrorDisplay(selector, OK_icon);
312            } else {
313                error = errorStatusPrefix + messageBr + NG_icon + MSG_SELECT + errorStatusSuffix;
314            }
315        } else {
316            if (dataRequired == '1') {
317                error = errorStatusPrefix + messageBr + NG_icon + MSG_SELECT + errorStatusSuffix;
318            } else {
319                customizeFormCheck.hideErrorDisplay(selector, '');
320            }
321        }
322        if (error) {
323            customizeFormCheck.addErrorDisplay(selector, error);
324        }
325    } else if (dataType == 'country') {
326        customizeFormCheck.changeCountryProcess(selector, true);
327        customizeFormCheck.checkPrefCountry(selector, dataRequired);
328    } else if (dataType == 'prefecture') {
329        customizeFormCheck.checkPrefCountry(selector, dataRequired);
330    } else {
331        var selectVal = jQuery(selector).val();
332        if (selectVal == '') {
333            if (dataRequired == '1') {
334                error = errorStatusPrefix + messageBr + NG_icon + MSG_SELECT + errorStatusSuffix;
335                customizeFormCheck.addErrorDisplay(selector, error);
336            } else {
337                customizeFormCheck.hideErrorDisplay(selector, '');
338            }
339        } else {
340            customizeFormCheck.hideErrorDisplay(selector, OK_icon);
341        }
342    }
343};
344
345customizeFormCheck.timeCheck = function (selector) {
346    var $hourElem = jQuery(selector);
347    var startT = $hourElem.data('start').split(':');
348    var endT = $hourElem.data('end').split(':');
349    var h_val = $hourElem.val();
350    var mSelector = selector.replace('time_h', 'time_m');
351    var $minuteElem = jQuery(mSelector);
352    var m_val = $minuteElem.val();
353    var interval = $minuteElem.data('interval');
354    var m_select_ok = false;
355    var start = 0, end = 60, cnt = 0 ;
356    if (parseInt(h_val) == parseInt(startT[0])) {
357        start = parseInt(startT[1]);
358    }
359    if (parseInt(h_val) == parseInt(endT[0])) {
360        end = parseInt(endT[1]);
361    }
362    $minuteElem.children().remove();
363    $minuteElem.append(jQuery('<option>').attr({ value: '' }).text('--'));
364    for (var i=start; i<=end; i+=interval) {
365        if (i == 60) {
366            break;
367        }
368        ++cnt;
369        $minuteElem.append(jQuery('<option>').attr({ value: i }).text(('0'+i).slice(-2)));
370        if (m_val != '' && m_val == i) {
371            m_select_ok = true;
372        }
373    }
374    if (m_select_ok || $minuteElem.children().length == 2) {
375        if (!m_select_ok) {
376            m_val = jQuery(mSelector+" option:last-child").val();
377        }
378        $minuteElem.val(m_val);
379        return m_val;
380    }
381    return '';
382};
383
384customizeFormCheck.birthDateCheck = function (d_name, year, month, day) {
385    if (year || month) {
386        var lastDateObj = new Date(year, month, 0);
387        var lastDay = lastDateObj.getDate();
388        var optionCnt = isNaN(lastDay) ? 31 : lastDay;
389        var $formElem = jQuery("select[name='" +d_name+"']");
390        var hasOptGroup = (0 < $formElem.find('optgroup').length);
391        $formElem.children().remove();
392        $formElem.append(jQuery('<option>').attr({ value: '' }).text('--'));
393        var label;
394        for (var i=1;i<=optionCnt;i++) {
395            label = i;
396            if (globalObj.language=='English') {
397                if (i == 1 || i == 31) {
398                    label = label + 'st';
399                } else if (i == 2) {
400                    label = label + 'nd';
401                } else if (i == 3) {
402                    label = label + 'rd';
403                } else {
404                    label = label + 'th';
405                }
406            }
407            $formElem.append(jQuery('<option>').attr({ value: i }).text(label));
408        }
409        if (hasOptGroup) {
410            $formElem.append(jQuery('<optgroup>'));
411        }
412        if (day && day <= optionCnt) {
413            $formElem.val(day);
414        } else {
415            day = '';
416        }
417    }
418    return day;
419};
420
421customizeFormCheck.addErrorDisplay = function (selector, out) {
422    var $boxElem;
423    if (jQuery(selector).closest(".input_box_parts").length > 0) {
424        jQuery(selector).closest(".input_box_parts").find(".form_status").html(out);
425        jQuery(selector).closest(".input_box_parts").removeClass("ok_row").addClass('error_row');
426    } else if (jQuery(selector).closest(".form_area_wrapper").length > 0){
427        $boxElem = jQuery(selector).closest('.form_data');
428        $boxElem.find(".form_status").html(out);
429        $boxElem.removeClass("ok_row").addClass('error_row');
430    } else {
431        jQuery(selector).closest(".cell_box").find(".form_status").html(out);
432        jQuery(selector).closest("tr").removeClass('ok_row').addClass('error_row');
433    }
434};
435
436customizeFormCheck.hideErrorDisplay = function (selector, out) {
437    if (jQuery(selector).closest(".input_box_parts").length > 0) {
438        customizeFormCheck.hideErrorDisplay2(selector, out);
439    } else if (jQuery(selector).closest(".form_area_wrapper").length > 0){
440        customizeFormCheck.hideErrorDisplay3(selector, out);
441    } else {
442        if (jQuery(selector).closest(".cell_form_error").length > 0) {
443            jQuery(selector).closest(".cell_form_error").removeClass("cell_form_error");
444            if (jQuery(selector).closest(".form_error").length > 0) {
445                jQuery(selector).closest(".form_parts").find(".form_error").removeClass("form_error");
446            }
447        }
448        if (jQuery(selector).closest(".cell_box").length > 0) {
449            jQuery(selector).closest(".cell_box").find(".form_status").html(out);
450        }
451        if (out) {
452            jQuery(selector).closest("tr").removeClass('error_row').addClass('ok_row');
453        } else {
454            jQuery(selector).closest("tr").removeClass('error_row').removeClass('ok_row');
455        }
456    }
457};
458
459customizeFormCheck.hideErrorDisplay2 = function (selector, out) {
460    if (jQuery(selector).closest(".input_box_parts").length <= 0){
461        return false;
462    }
463    jQuery(selector).closest(".input_box_parts").find(".form_status").html(out);
464    if (out) {
465        jQuery(selector).closest(".input_box_parts").removeClass("error_row").addClass('ok_row');
466    } else {
467        jQuery(selector).closest(".input_box_parts").removeClass("error_row").removeClass('ok_row');
468    }
469
470    if (jQuery(selector).closest(".cell_form_error").length > 0){
471        if (jQuery(selector).closest(".cell_box").find('.error_status').length <= 0) {
472            jQuery(selector).closest(".cell_form_error").removeClass("cell_form_error");
473            if (jQuery(selector).closest(".form_error").length > 0) {
474                jQuery(selector).closest(".form_parts").find(".form_error").removeClass("form_error");
475            }
476        }
477    }
478};
479
480customizeFormCheck.hideErrorDisplay3 = function (selector, out) {
481    var $blockElem = jQuery(selector).closest('.form_data');
482    if (out) {
483        $blockElem.removeClass("error_row").addClass('ok_row');
484    } else {
485        $blockElem.removeClass("error_row").removeClass('ok_row');
486    }
487    if ($blockElem.hasClass('form_error')) {
488        $blockElem.removeClass('form_error');
489    }
490    $blockElem.find('.form_status').html(out);
491};
492
493customizeFormCheck.CalendarDateClick = function (obj) {
494    var id = jQuery(obj.target).closest(".cell_box").find("input:text").attr('id');
495    var selector = '#'+id;
496    if (jQuery(obj.target).hasClass('a_cal_day')) {
497        var inputText = jQuery(obj.target).data('date');
498        var datelabel = jQuery(obj.target).data('datelabel');
499        jQuery(selector).val(inputText);
500        jQuery(selector).closest(".cell_box").find(".ajax_calendar_form").hide();
501        jQuery(selector).closest(".cell_box").find(".confirm_date").text(datelabel);
502        jQuery(selector).closest(".cell_box").find(".date_change").show();
503        customizeFormCheck.hideErrorDisplay(selector, OK_icon);
504    } else {
505        jQuery(selector).val('');
506        jQuery(selector).closest(".cell_box").find(".ajax_calendar_form").show();
507        jQuery(selector).closest(".cell_box").find(".confirm_date").text('');
508        jQuery(selector).closest(".cell_box").find(".date_change").hide();
509        var dataRequired = jQuery(selector).data('required');
510        if (dataRequired == '1') {
511            error = errorStatusPrefix + messageBr + NG_icon + MSG_SELECT + errorStatusSuffix;
512            customizeFormCheck.addErrorDisplay(selector, error);
513        } else {
514            customizeFormCheck.hideErrorDisplay(selector, '');
515        }
516    }
517};
518
519var latestPostal = {};
520var postErr = false;
521customizeFormCheck.CheckJPPost = function (postId, required) {
522    var error;
523    var prefId = postId.replace('postjp', 'prefecture');
524    var prefecture = jQuery(prefId).val();
525    var line1Id = postId.replace('postjp', 'address1');
526    var line2Id = postId.replace('postjp', 'address2');
527    var newPost = customizeFormCheck.convertCharacter(jQuery(postId).val());
528    var postSelector = postId.replace('postjp', 'post');
529    if (jQuery(postSelector).length) {
530        jQuery(postSelector).val(newPost);
531    }
532
533    function addressSet(result) {
534        if (result.error) {
535            postErr = true;
536            error = errorStatusPrefix + messageBr + NG_icon + MSG_NOPOST + errorStatusSuffix;
537            customizeFormCheck.addErrorDisplay(postId, error);
538            customizeFormCheck.addErrorDisplay(prefId, '');
539            customizeFormCheck.addErrorDisplay(line1Id, '');
540            customizeFormCheck.addErrorDisplay(line2Id, '');
541        } else {
542            postErr = false;
543            customizeFormCheck.hideErrorDisplay(postId, OK_icon);
544            if (result['pref_no']) {
545                jQuery(prefId).val(result['pref_no']);
546                customizeFormCheck.hideErrorDisplay(prefId, OK_icon);
547            }
548            if (result['address1']) {
549                jQuery(line1Id).val(result['address1']);
550                customizeFormCheck.hideErrorDisplay(line1Id, OK_icon);
551                if (result['address2']) {
552                    jQuery(line2Id).val(result['address2']);
553                    error = errorStatusPrefix + messageBr + NG_icon + MSG_BANCHI + errorStatusSuffix;
554                    customizeFormCheck.addErrorDisplay(line2Id, error);
555                }
556            }
557        }
558    }
559    if (newPost.length==0) {
560        if (required) {
561            error = errorStatusPrefix + messageBr + NG_icon + MSG_INPUT + errorStatusSuffix;
562            customizeFormCheck.addErrorDisplay(postId, error);
563        } else {
564            customizeFormCheck.hideErrorDisplay(postId, OK_icon);
565        }
566    } else if (prefecture == '48') {
567        customizeFormCheck.hideErrorDisplay(postId, OK_icon);
568    } else if (!customizeFormCheck.FormJPPostCheck(newPost)) {
569        error = errorStatusPrefix + messageBr + NG_icon + MSG_NUMERIC6 + errorStatusSuffix;
570        customizeFormCheck.addErrorDisplay(postId, error);
571    } else {
572        newPost = newPost.replace('-', '');
573        if (latestPostal[postId] && newPost == latestPostal[postId]) {
574            if (!postErr) {
575                customizeFormCheck.hideErrorDisplay(postId, OK_icon);
576            }
577        } else if (newPost == '0000000') {
578            jQuery(prefId).val('48');
579            if ('48' != jQuery(prefId).val()) {
580                addressSet({"error": "1"});
581            } else {
582                var countryId = postId.replace('postjp', 'country');
583                if (jQuery(countryId).length) {
584                    postErr = false;
585                    latestPostal[postId] = newPost;
586                    customizeFormCheck.hideErrorDisplay(postId, OK_icon);
587                    jQuery(prefId).val('48');
588                    customizeFormCheck.hideErrorDisplay(prefId, OK_icon);
589                    customizeFormCheck.checkPrefCountry(countryId, required);
590                }
591            }
592        } else {
593            latestPostal[postId] = newPost;
594            customizeFormCheck.addErrorDisplay(postId, loadingDisplay);
595            customizeFormCheck.addErrorDisplay(prefId, loadingDisplay);
596            customizeFormCheck.addErrorDisplay(line1Id,loadingDisplay);
597            customizeFormCheck.addErrorDisplay(line2Id, loadingDisplay);
598            var pars = "go=address-search&post_number=" + newPost;
599            jQuery.ajax({
600                type: 'GET',
601                url: xmlUrl,
602                data: pars,
603                dataType : 'json',
604                headers: {'X-Requested-With': 'XMLHttpRequest'}
605            }).done(function (data, status) {
606                addressSet(data);
607            });
608        }
609    }
610};
611
612customizeFormCheck.addressRequireChangeProcess = function (cSelector, pSelector) {
613    var dataRequired = jQuery(cSelector).data('required');
614    if (dataRequired != '1') {
615        return;
616    }
617    var cVal = jQuery(cSelector).val();
618    var pVal = jQuery(pSelector).val();
619    var cRequireSelector = cSelector.replace('form', 'require');
620    if (pVal != '48' && (!cVal.length || cVal == '61')) {
621        jQuery(cRequireSelector).hide();
622    } else {
623        jQuery(cRequireSelector).show();
624    }
625};
626
627customizeFormCheck.checkPrefCountry = function (selector, required) {
628    var target, cSelector, pSelector, cVal, pVal, cErr = false, pErr = false;
629    if (selector.match(/country/)) {
630        target = 'country';
631        cSelector = selector;
632        pSelector = selector.replace('country', 'prefecture');
633    } else {
634        target = 'prefecture';
635        cSelector = selector.replace('prefecture', 'country');
636        pSelector = selector;
637    }
638    if (jQuery(pSelector).length) {
639        pVal =  jQuery(pSelector).val();
640        cVal = '';
641        if (jQuery(cSelector).length) {
642            customizeFormCheck.addressRequireChangeProcess(cSelector, pSelector);
643
644            cVal = jQuery(cSelector).val();
645            if (!cVal.length) {
646                if (!pVal.length && required == '1' && target == 'prefecture') {
647                    pErr = errorStatusPrefix + messageBr + NG_icon + MSG_SELECT + errorStatusSuffix;
648                } else if (pVal == '48' && required == '1') {
649                    cErr = errorStatusPrefix + messageBr + NG_icon + MSG_SELECT + errorStatusSuffix;
650                }
651            } else if (cVal == '61') {
652                if (!pVal.length && required == '1' && target == 'prefecture') {
653                    pErr = errorStatusPrefix + messageBr + NG_icon + MSG_SELECT + errorStatusSuffix;
654                } else if (pVal == '48') {
655                    cErr = errorStatusPrefix + messageBr + NG_icon + MSG_PREF + errorStatusSuffix;
656                }
657            }
658        } else {
659            if (!pVal.length && required == '1') {
660                pErr = errorStatusPrefix + messageBr + NG_icon + MSG_SELECT + errorStatusSuffix;
661            }
662        }
663    } else {
664        cVal = jQuery(cSelector).val();
665        if (!cVal.length && required == '1') {
666            cErr = errorStatusPrefix + messageBr + NG_icon + MSG_SELECT + errorStatusSuffix;
667        }
668    }
669    if (cErr) {
670        customizeFormCheck.addErrorDisplay(cSelector, cErr);
671    } else if (cVal.length) {
672        customizeFormCheck.hideErrorDisplay(cSelector, OK_icon);
673    } else {
674        customizeFormCheck.hideErrorDisplay(cSelector, '');
675    }
676    if (pErr) {
677        customizeFormCheck.addErrorDisplay(pSelector, pErr);
678    } else if (pVal.length) {
679        customizeFormCheck.hideErrorDisplay(pSelector, OK_icon);
680    } else {
681        customizeFormCheck.hideErrorDisplay(pSelector, '');
682    }
683};
684
685customizeFormCheck.changeCountryProcess = function (selector, localChange) {
686    var val = jQuery(selector).val();
687    var citySelector = selector.replace('country', 'local');
688    var line3LabelSelector = selector.replace('form', 'parts').replace('country', 'address3');
689
690    if (val && (val == 202 || val == 222 || val == 238)) {
691        var pars = "go=address-local-search&countryid=" + val;
692        jQuery.ajax({
693            type: 'GET',
694            url: xmlUrl,
695            data: pars,
696            dataType: 'json',
697            headers: {'X-Requested-With': 'XMLHttpRequest'}
698        }).done(function (data, status) {
699            if (data) {
700                if (localChange) {
701                    jQuery(citySelector).children().remove();
702                    jQuery(citySelector).append(jQuery('<option>').attr({ value: '' }).text('----'));
703                    var d_name, d_id;
704                    for (var i=0;i<data.local.length;i++) {
705                        d_name = data.local[i].name;
706                        d_id = data.local[i].id;
707                        jQuery(citySelector).append(jQuery('<option>').attr({ value: d_id }).text(d_name));
708                    }
709                    jQuery(citySelector).closest(".input_box_parts").find(".form_status").text('');
710                }
711                jQuery(citySelector).closest('.input_box_parts').show();
712                if (globalObj.language=='English') {
713                    jQuery(line3LabelSelector).find('.cell_note').text("Address 3(City):");
714                }
715            }
716        });
717    } else {
718        jQuery(citySelector).closest('.input_box_parts').hide();
719        if (globalObj.language=='English') {
720            jQuery(line3LabelSelector).find('.cell_note').text("Address 3(City, State/Province):");
721        }
722    }
723    if (globalObj.language=='Japanese') {
724        var partsPostJP = selector.replace('form', 'parts').replace('country', 'postjp');
725        var partsPrefecture = selector.replace('form', 'parts').replace('country', 'prefecture');
726        var partsPost = selector.replace('form', 'parts').replace('country', 'post');
727        if (val && val != 61) {
728            jQuery(partsPostJP).hide();
729            jQuery(partsPrefecture).hide();
730            jQuery(partsPost).show();
731            jQuery(partsPrefecture).closest('.cell_box').find('.address1_title, .address2_title, .address3_title').hide();
732            //jQuery(".type_name_ph").hide();
733            //jQuery(".type_name_ph").find(':input').attr('disabled', true);
734        } else {
735            jQuery(partsPostJP).show();
736            jQuery(partsPrefecture).show();
737            jQuery(partsPost).hide();
738            jQuery(partsPrefecture).closest('.cell_box').find('.address1_title, .address2_title, .address3_title').show();
739            //jQuery(".type_name_ph").show();
740           // jQuery(".type_name_ph").find(':input').attr('disabled', false);
741        }
742    }
743    return true;
744};
745
746

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.