PageSourceSearch

https://rkp-static.kaipoke.biz/rkp/kaipokebiz/js/common.js?202609260534&v=20260914030511

js kaipoke.biz collected 2026-09-25 20:34:29 UTC 30,945 bytes, 1,043 lines download raw bytes

1function show(inputData) {
2    var objID = document.getElementById("layer-" + inputData);
3    var buttonID = document.getElementById("category-" + inputData);
4    var iconID = document.getElementById("button-" + inputData);
5    if (objID.className == 'open') {
6        objID.style.display = 'none';
7        objID.className = 'close';
8        iconID.src = './img/ico-off.gif';
9    } else {
10        objID.style.display = 'block';
11        objID.className = 'open';
12        iconID.src = './img/ico-on.gif';
13    }
14}
15
16function imgRollover() {
17    if (document.getElementsByTagName) {
18        var images = document.getElementsByTagName("img");
19
20        for (var i=0; i < images.length; i++) {
21            if (images[i].getAttribute("src").match("-off.")) {
22                images[i].onmouseover = function() {
23                    this.setAttribute("src", this.getAttribute("src").replace("-off.", "-on."));
24                };
25                images[i].onmouseout = function() {
26                    this.setAttribute("src", this.getAttribute("src").replace("-on.", "-off."));
27                };
28            }
29        }
30    }
31}
32
33if (window.addEventListener) {
34    window.addEventListener("load", imgRollover, false);
35} else if (window.attachEvent) {
36    window.attachEvent("onload", imgRollover);
37}
38
39function searchbox(clicked){
40    if (clicked=='btn-search'){
41        document.getElementById('btn-search').style.display='none';
42        document.getElementById('box-search').style.display='block';
43    } else{
44        document.getElementById('btn-search').style.display='block';
45        document.getElementById('box-search').style.display='none';
46    }
47}
48
49function searchboxTurn(clicked){
50    if(clicked=='box-close'){
51        document.getElementById('btn-search').style.display='block';
52        document.getElementById('box-search').style.display='none';
53    }
54    else{
55        document.getElementById('btn-search').style.display='none';
56        document.getElementById('box-search').style.display='block';
57    }
58}
59
60function mycheck(element, slen, maxlen, maxrow)
61{
62/*
63    var size = 0;
64    var tmp = element.value;
65    var agent = navigator.userAgent;
66
67    if (agent.indexOf("Firefox") > 0){
68        while (tmp.indexOf("\n") != -1 ){
69            var n = tmp.indexOf("\n");
70            if (n == maxlen){
71                size = size + maxlen;
72            } else {
73                var row = Math.floor(n / maxlen) + 1;
74                size = size + maxlen * row;
75            }
76            tmp = tmp.substring(n + 1, tmp.length);
77        }
78    } else {
79        while (tmp.indexOf("\r\n") != -1 ){
80            var n = tmp.indexOf("\r\n");
81            if (n == maxlen) {
82                size = size + maxlen;
83            } else {
84                var row = Math.floor(n / maxlen) + 1;
85                size = size + maxlen * row;
86            }
87            tmp = tmp.substring(n + 2, tmp.length);
88        }
89
90    }
91
92    size = size + tmp.length;
93    max = maxlen * maxrow;
94
95    mesAllsize = '入力した文字数 : ' + size;
96    mesInput = '残り : ' + (max - size);
97    var slenObj = document.getElementById(slen);
98    slenObj.style.color=(size>max)?'red':'peru';
99    slenObj.innerHTML=(size>max)?'規定文字数をオーバーしました':mesInput + '文字';
100*/
101}
102/**
103 * addOption
104 *
105 * @param selectbox
106 * @param text
107 * @param value
108 * @return
109 */
110function addOption(selectbox,text,value )
111{
112    var optn = document.createElement("OPTION");
113    optn.text = text;
114    optn.value = value;
115    selectbox.options.add(optn);
116}
117/**
118 * removeItems
119 *
120 * @param selectbox
121 * @return
122 */
123function removeItems(selectbox)
124{
125    var i;
126    for (i=selectbox.options.length-1;i>=0;i--)
127    {
128        selectbox.remove(i);
129    }
130}
131var ERA_VALUE_MEIJI = 1;
132var ERA_VALUE_TAISHO = 2;
133var ERA_VALUE_SHOWA = 3;
134var ERA_VALUE_HEISEI = 4;
135var MAX_MEIJI = 45;
136var MAX_TAISHO = 15;
137var MAX_SHOWA = 64;
138
139/**
140 * getYearEra
141 *
142 * @param eraSelect
143 * @param idYear
144 * @return
145 */
146function getYearEra(eraSelect, idYear) {
147    var eraValue = eraSelect.value;
148    var objectSelectYear  = document.getElementById(idYear);
149    var maxYearNow  = document.getElementById("form:maxYearNow").value;
150    removeItems(objectSelectYear);
151    if (eraValue == ERA_VALUE_MEIJI){
152        maxYearNow = MAX_MEIJI;
153    } else if (eraValue == ERA_VALUE_TAISHO){
154        maxYearNow = MAX_TAISHO;
155    } else if (eraValue == ERA_VALUE_SHOWA){
156        maxYearNow = MAX_SHOWA;
157    }
158    for (var i = 1; i <= maxYearNow; i++ ) {
159        addOption(objectSelectYear, i, i);
160    }
161}
162
163/**
164 * escapeClientId
165 */
166$(function() {
167    if($ != undefined){
168        $.escapeClientId = function (id) {
169        id = id.replace(/\\\\:/g,":");
170        id = id.replace(/\\:/g,":");
171        id = id.replace(/:/g,"\\:");
172        if (id.indexOf("#") != 0) id = "#" + id;
173        return id;
174      };
175    };
176});
177
178/**
179 * Remove a element in array
180 *
181 * @author HungTV
182 * @param arr
183 *            Array to remove element
184 * @param id
185 *            Value to remove
186 * @return Array
187 */
188function removeElementInArray(arr, id) {
189    if (arr == null) {
190        return null;
191    }
192    for (var i = 0; i < arr.length; i++) {
193        if (id == arr[i]) {
194            arr.splice(i, 1);
195        }
196    }
197    return arr;
198}
199
200/**
201 * Get state inactive or active of fields by state input of Object
202 *
203 * @author HungTV
204 * @param obj The input field
205 * @param activeIds The array ids of fields to active/inactive
206 * @param ignoreIds The array ids of fields to inactive
207 */
208function getActiveFields(obj, activeIds, ignoreIds) {
209    var flgDisabled = true;
210    if (typeof obj == "undefined" || activeIds.constructor != Array || ignoreIds.constructor != Array) {
211        return;
212    }
213    var oType = obj.type;
214    // Check type of object and condition for disable fields
215    if ((oType == "text" && obj.value.length > 0)
216            || (oType == "textarea" && obj.value.length > 0)
217            || (obj.type == "radio" && obj.checked)
218            || (obj.type == "checkbox" && obj.checked)
219            || (obj.type == "select-one" && obj.selected)) {
220        flgDisabled = false;
221    }
222    // Change status active or inactive of fields that determine by activeIds array
223    for (var i = 0; i < activeIds.length; i++) {
224        document.getElementById(activeIds[i]).disabled = flgDisabled;
225    }
226    // Inactive of fields that determine by ignoreIds array
227    for (var i = 0; i < ignoreIds.length; i++) {
228        document.getElementById(ignoreIds[i]).disabled = true;
229    }
230}
231
232/**
233 * Submit a action link of JSF
234 *
235 * @param linkId The id of link tag
236 */
237function clickLink(linkId) {
238    /*var fireOnThis = document.getElementById(linkId);
239    if (document.createEvent) {
240        var evObj = document.createEvent('MouseEvents');
241        evObj.initEvent('click', true, false);
242        fireOnThis.dispatchEvent(evObj);
243    } else if (document.createEventObject) {
244        var status = fireOnThis.fireEvent('onclick');
245        if (status) {
246            fireOnThis.click();
247        }
248    }*/
249    clickAct(linkId);
250}
251
252/**
253 * Excute a action invisible
254 *
255 * @author HungTV
256 * @param objId action id
257 */
258function clickAct(objId) {
259    var actId = objId.replace(/:/gi, "\\:");
260    $("#"+ actId).click();
261}
262
263/**
264 * Get element of date and put to hidden field
265 *
266 * @author HungTV
267 * @param obj The obj to get data
268 * @idHidden The hidden field to store date
269 */
270 function getJapaneseDate(obj, idHidden) {
271     id = obj.id;
272     if (typeof id == "undefined") {
273         id = obj;
274     }
275     idPart = id.substring(0, id.lastIndexOf('Era'));
276     if (idPart == '') {
277         idPart = id.substring(0, id.lastIndexOf('Year'));
278         if (idPart == '') {
279             idPart = id.substring(0, id.lastIndexOf('Month'));
280             if (idPart == '') {
281                 idPart = id.substring(0, id.lastIndexOf('Day'));
282             }
283         }
284     }
285     if (idPart == '') {
286         return;
287     }
288     era = document.getElementById(idPart + 'Era');
289     strDate = '';
290     if (era != null) {
291         strDate = era.value + '/';
292     }
293     year = document.getElementById(idPart + 'Year').value;
294     month = document.getElementById(idPart + 'Month').value;
295     day = document.getElementById(idPart + 'Day').value;
296     strDate += year + '/' + month + '/' + day;
297     document.getElementById(idHidden).value = strDate;
298 }
299
300 /**
301     * Function doConfirm Show dialog confirm
302     *
303     * @author phamxuanduong
304     * @param message:
305     *            the message will be displayed on the dialog
306     * @return True if user click button OK otherwise return false
307     */
308 function doConfirm(message) {
309     if (confirm(message)) {
310         return true;
311     } else {
312         return false;
313     }
314 }
315
316 /**
317     * change style of submit button
318     *
319     * @param hide1
320     * @param hide2
321     * @param id
322     * @return
323     */
324 function stylechange(hide1,hide2, id)
325 {
326     document.getElementById(hide1).style.display='inline';
327     document.getElementById(hide2).style.display='none';
328 }
329
330 /**
331 * @author nguyentienthanh
332 * @param hide1 id element 1
333 * @param hide2 id element 2
334 */
335function styleChangeElement(hide1,hide2) {
336     document.getElementById(hide1).style.display='inline';
337     document.getElementById(hide2).style.display='none';
338 }
339
340/**
341 * @author nguyenngocdong
342 * @param nameClass1 name class element 1
343 * @param nameClass2 name class element 2
344 */
345function styleChangeByClass(nameClass1, nameClass2) {
346    $(nameClass1).hide();
347    $(nameClass2).show();
348 }
349
350 /**
351  * Change style of input tag when has click event on input tags of tables,
352  * tables determine by array ids is tableIds
353  *
354  * @author HungTV
355  * @param spanBtn id of span tag of button that had changed to image
356  * @param spanImg id of span tag of image alternative of button
357  * @tableIds ids of tables that click event then change style of button
358  * @inputIds ids of input tag
359  */
360function changeStyleByEventOnInputTag(spanBtn, spanImg, tableIds, inputIds) {
361    if (typeof spanBtn == "undefined" || typeof spanImg == "undefined"
362        || typeof tableIds == "undefined" || tableIds.constructor != Array
363        || typeof inputIds == "undefined" || inputIds.constructor != Array) {
364        return;
365    }
366    for (var i = 0; i < inputIds.length; i++) {
367        $("#" + inputIds[i]).click(function(event) {
368            if ($("#" + spanBtn).css("display") == "inline") {
369                return;
370            }
371            stylechange(spanBtn, spanImg);
372        });
373    }
374    for (var i = 0; i < tableIds.length; i++) {
375        $("#" + tableIds[i] + " tr").click(function(event) {
376           if (typeof event.target.type == "undefined" || event.target.type == ""
377              || $("#" + spanBtn).css("display") == "inline") {
378              return;
379           }
380           stylechange(spanBtn, spanImg);
381        });
382    }
383}
384
385/**
386 * 指定した URL の小窓を開く。
387 *
388 * @param url 表示する小窓のコンテンツ URL
389 * @param width 表示する小窓の横幅
390 * @param height 表示する小窓の高さ
391 * @returns {Window|*|void}
392 * @deprecated 非推奨である showModalDialog() を利用しているため、
393 *     替わりに open_popup() を使用してください。
394 */
395function popup_open(url, width, height) {
396     if (window.showModalDialog) {
397         var features = "dialogWidth:"+width+"px;dialogHeight:"+height+"px;dialogLeft:100px;resizable:yes;scroll:yes;";
398         return window.showModalDialog(url, "", features);
399     } else {
400         var features = "width="+width+",height="+height+",resizable=yes,scrollbars=yes";
401         return window.open(url,"biz_windows", features);
402     }
403}
404
405/**
406 * 指定した URL の小窓を開く。
407 *
408 * @param url 表示する小窓のコンテンツ URL
409 * @param width 表示する小窓の横幅
410 * @param height 表示する小窓の高さ
411 * @returns {Window}
412 */
413function open_popup(url, width, height) {
414  var features = "width=" + width + ",height=" + height + ",resizable=yes,scrollbars=yes";
415  return window.open(url, "biz_windows", features);
416}
417
418var child_window = null;
419var parent_window = window;
420function popUponClick(url, name,width, height) {
421    child_window = window.open(url, name, "status=1,width=" + width + ",height=" + height + ",resizable=yes,scrollbars=yes,menubar=no,modal=yes");
422    parent_window.onclick = blurify;
423    parent_window.onfocus = blurify;
424}
425function blurify() {
426    if (child_window != "undefined" && !child_window.closed) {
427        if (parent_window) {
428            // anhdv fix bug parent lost focus when child closed ID 1332
429            //parent_window.blur();
430            child_window.focus();
431        }
432    }
433}
434function manual_popup(url,width,height){
435    window.open(url, "manual_faq", "status=1,width=" + width + ",height=" + height + ",resizable=yes,scrollbars=yes,menubar=no,modal=yes");
436}
437
438/**
439 * auto focus on first element.If the param is empty then set focus on the first element else focus on input element.
440 *
441 * @author phamxuanduong
442 * @param elementId
443 *            the id of the element needs to focus
444 * @return none
445 */
446 function autoFocus(elementId) {
447     // AnhDV - 2011/10/04 - 7034 - ignore focus with ADM991002 - start
448     if (typeof ignoreFocus != "undefined" && ignoreFocus) {
449         return;
450     }
451     // AnhDV - 2011/10/04 - 7034 - end
452     // if elementId is not empty then set focus on the input element
453     if (elementId && typeof elementId != "undefined" && typeof elementId != "function" ) {
454         try {
455             $("#"+ elementId).focus();
456         }catch(e){}
457     } else { // set focus on the first element
458       // get all elements
459       if($ != undefined){
460         var objInput = $("*");
461         // if there isn't any element then return;
462         if (!objInput) return;
463         // get the first input element
464         var length = objInput.length;
465         for (var i = 0; i < length; i++) {
466             var sType = objInput[i].type;
467             // if the element used to input data then focus on first element
468             if ((sType == "text" || sType == "checkbox"
469                 || sType == "radio" || sType == "select-one"
470                 || sType == "textarea" || sType == "select-multiple")
471                 && objInput[i].disabled != true
472                 && $(objInput[i]).css("display") != "none") {
473                 // set focus on first element then return
474                 try {
475                     (objInput[i]).focus();
476                 } catch (e) {}
477                 break;
478             }
479         }
480       }
481     }
482     return;
483}
484
485 // add listener for autoFocus
486 $(document).ready(autoFocus);
487
488
489 /**
490     * Active fields by checked value of radio button or checkbox
491     *
492     * @author phamxuanduong
493     * @param aryActive
494     *            the array of fields. Example of aryActive ( array(" id of checkBox1", "id of field 1", "id of field 2", "id of field 3" ... "id of
495     *            field n"); array("id of radio", "id of field 1", "id of field 2" ... "id of field n"); )
496     *
497     * @return none
498     */
499 function activeFieldsByCheckedValue(aryActiveFileds) {
500     // check input param
501     if (aryActiveFileds && typeof aryActiveFileds != "undefined" && aryActiveFileds.length > 0) {
502         // get all of arrays from input array
503         for (var i = 0; i < aryActiveFileds.length; i++) {
504             if (typeof aryActiveFileds[i] != "undefined" && aryActiveFileds[0].length > 0){
505                 // get status of the first field
506                 var status = document.getElementById(aryActiveFileds[i][0]);
507                 status = (status && status.checked)? false : "disabled";
508                 // set status of the fields by the first status
509                 for (var j = 1; j < aryActiveFileds[i].length; j++) {
510                     var activeElement = document.getElementById(aryActiveFileds[i][j]);
511                     if (activeElement && typeof activeElement != "undefined") {
512                         activeElement.disabled = status;
513                     }
514                 }
515             }
516         }
517     }
518 }
519
520/**
521 * Trim left data before using.
522 *
523 * @author CuongTV
524 * @param str
525 *            the string need to trim
526 * @return the string after trim left
527 */
528function lTrim(str){
529     var whitespace = new String(" \t\n\r ");
530     var s = new String(str);
531
532     if (whitespace.indexOf(s.charAt(0)) != -1) {
533         var j = 0;
534         var i = s.length;
535         while (j < i && whitespace.indexOf(s.charAt(j)) != -1) {
536             j++;
537         }
538         s = s.substring(j, i);
539     }
540
541     return s;
542}
543
544/**
545 * Trim right data before using.
546 *
547 * @author CuongTV
548 * @param str
549 *            the string need to trim
550 * @return the string after trim right
551 */
552function rTrim(str){
553     var whitespace = new String(" \t\n\r ");
554     var s = new String(str);
555
556     if (whitespace.indexOf(s.charAt(s.length - 1)) != -1) {
557         var i = s.length - 1;
558         while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) {
559             i--;
560         }
561         s = s.substring(0, (i + 1));
562     }
563
564     return s;
565}
566/**
567 * Trim data before using.
568 *
569 * @author CuongTV
570 * @param str
571 *            the string need to trim
572 * @return the string after trim
573 */
574function trim(str) {
575    return rTrim(lTrim(str));
576}
577
578/**
579 * Trim data of Element in form
580 * @param form  id form
581 * @param idElement the id of the element
582 * @return the string after trim
583 */
584function trimElement(form, idElement) {
585    var txtElement = document.getElementById(form + idElement);
586    if (txtElement != null) {
587        str = txtElement.value;
588        txtElement.value = str.replace(/^[\s ]+/, '').replace(/[\s ]+$/, '');
589    }
590}
591
592/**
593 * Right Trim data of Element in form
594 * @param form  id form
595 * @param idElement the id of the element
596 * @return the string after right trim
597 */
598function rtrimElement(form, idElement) {
599    var txtElement = document.getElementById(form + idElement);
600    if (txtElement != null) {
601        str = txtElement.value;
602        txtElement.value = str.replace(/[\s ]+$/, '');
603    }
604}
605
606/**
607 * convert <br> tag to \n
608 * @author tudk
609 */
610String.prototype.br2nl = function () {
611    var str = "";
612    str = this.replace(/<br\/>/gi, '\n');
613    str = this.replace(/<br>/gi, '\n');
614    return str;
615};
616
617/**
618 * Update checked state when each other click checkbox elements
619 *
620 * @author HungTV
621 * @param obj Checkbox element object
622 * @param idCheckAll id checkAll
623 * @param idTotalChecked id total checked
624 * @param idTotalCheckboxAvailable id total check available
625 */
626function updateCheckedState(obj, idCheckAll, idTotalChecked, idTotalCheckboxAvailable) {
627    var objCheckAll = document.getElementById(idCheckAll);
628    var objTotalChecked = document.getElementById(idTotalChecked);
629    var totalCheckboxAvailable = document.getElementById(idTotalCheckboxAvailable);
630
631    // update total checked
632    if (obj.checked) {
633        objTotalChecked.value++;
634    } else {
635        objTotalChecked.value--;
636    }
637
638    // check state of checkall
639    if (objTotalChecked.value == totalCheckboxAvailable.value) {
640        objCheckAll.checked = true;
641    } else {
642        objCheckAll.checked = false;
643    }
644}
645
646/**
647 * Check checked status of checkall base on totalChecked and totalCheckboxAvailable when page loaded
648 *
649 * @author HungTV
650 * @param idTotalChecked id total checked
651 * @param idCheckAll id checkAll
652 * @param idTotalCheckboxAvailable id total check available
653 */
654function checkCheckallStatus(idCheckAll, idTotalChecked, idTotalCheckboxAvailable) {
655    var objTotalChecked = document.getElementById(idTotalChecked);
656    var objCheckAll = document.getElementById(idCheckAll);
657    var totalCheckboxAvailable = document.getElementById(idTotalCheckboxAvailable);
658
659    // check state of checkall
660    if (!objCheckAll.checked && objTotalChecked.value > 0 && (objTotalChecked.value == totalCheckboxAvailable.value)) {
661        objCheckAll.checked = true;
662    } else if (objCheckAll.checked && objTotalChecked.value > 0 && (objTotalChecked.value != totalCheckboxAvailable.value)) {
663        objCheckAll.checked = false;
664    }
665}
666
667function resetDateServiceOffer(serviceOfferYm, idServiceOfferDay, currentDay) {
668    var year = parseInt(serviceOfferYm.substring(0, 4));
669    var month = serviceOfferYm.substring(4);
670    var e = document.getElementById(idServiceOfferDay);
671    if (e == null) {
672        return 0;
673    }
674    var dayInMonth = e.value;
675    if (dayInMonth == 0) {
676        return null;
677    }
678    var d = new Date(year, month, 0);
679    var day = parseInt(currentDay);
680
681    if (dayInMonth <= d.getDate()) {
682        return day;
683    } else {
684         return d.getDate();
685    }
686}
687
688/**
689 * function selectRow used to check checkboxes when click any where on row
690 *
691 * @author nguyenhonggiang
692 * @param tableID: table id
693 * @param idCheckAll
694 *            id of checkall check box
695 * @param idTotalChecked
696 *            total checked data
697 * @param idTotalCheckboxAvailable
698 *            total checkbox available.
699 * @return none
700 */
701function selectRowWithCheckall(tableId, idCheckAll, idTotalChecked, idTotalCheckboxAvailable) {
702    $("#"+ tableId +" tr").click(function(event) {
703        if (event.target.type == "checkbox" || event.target.type == "") {
704            return;
705        }
706        var tr = $(this);
707        var rSpan = event.target.rowSpan;
708        var input;
709        for ( var i = 0; i < rSpan; i++) {
710            input = $(tr).children()[0].getElementsByTagName("input");
711            if (input[0] && input[0].type == "checkbox") {
712                input[0].checked = !input[0].checked;
713                updateCheckedState(input[0], idCheckAll, idTotalChecked, idTotalCheckboxAvailable);
714            }
715            tr =$(tr).next();
716        }
717    });
718}
719
720/**
721 * function selectRow used to check checkboxes when click any where on row
722 *
723 * @author nguyenhonggiang
724 * @param tableID: table id
725 * @param idCheckAll
726 *            id of checkall check box
727 * @param idTotalChecked
728 *            total checked data
729 * @param idTotalCheckboxAvailable
730 *            total checkbox available.
731 * @return none
732 */
733function selectRowWithOneCheck(tableId, idCheckAll, idTotalChecked, idTotalCheckboxAvailable) {
734    $("#"+ tableId +" tr").click(function(event) {
735        if (event.target.type == "checkbox" || event.target.type == "") {
736            return;
737        }
738        var tr = $(this);
739        var rSpan = tr[0].rowIndex;
740        var input;
741        for ( var i = 0; i <= rSpan; i++) {
742            input = $(tr).children()[0].getElementsByTagName("input");
743            // start fix #18842 - 2015/06/01 BacDV
744            if (input[0] && input[0].disabled) {
745                return;
746            }
747            // end fix #18842 - 2015/06/01 BacDV
748            if (input[0] && input[0].type == "checkbox") {
749                input[0].checked = !input[0].checked;
750                updateCheckedState(input[0], idCheckAll, idTotalChecked, idTotalCheckboxAvailable);
751                return;
752            }
753            tr =$(tr).prev();
754        }
755    });
756}
757
758
759/**
760 * clear checked data
761 *
762 * @author nguyenhonggiang
763 * @param tableID:
764 *            table id
765 * @param idCheckAll
766 *            id of checkall check box
767 * @param idTotalChecked
768 *            total checked data
769 * @return void
770 */
771function clearCheckedData(tableId, idTotalChecked, idCheckAll) {
772    // clear check all data
773    var objCheckAll = document.getElementById(idCheckAll);
774    var objTotalChecked = document.getElementById(idTotalChecked);
775    objCheckAll.checked = false;
776    objTotalChecked.value = 0;
777    var input;
778    $('#'+ tableId +' tr').each(function() {
779        input = $(this).children()[0].getElementsByTagName("input");
780        if (input[0] && input[0].type == "checkbox") {
781            input[0].checked = false;
782        }
783    });
784}
785
786function allCheck(element, check)
787{
788    if (element) {
789        if (element.length >= 1) {
790            for(i=0;i<element.length;i++){
791                element[i].checked = check;
792            }
793        } else {
794            element.checked = check;
795        }
796    }
797}
798
799 function displayStyleChange(element1, element2, element1DisplayFlg)
800 {
801     if(element1DisplayFlg == true){
802         document.getElementById(element1).style.display = 'inline';
803         document.getElementById(element2).style.display = 'none';
804     } else {
805         document.getElementById(element1).style.display = 'none';
806         document.getElementById(element2).style.display = 'inline';
807     }
808 }
809
810 function displayChange(element1, element1DisplayFlg)
811 {
812     if(element1DisplayFlg == true){
813         document.getElementById(element1).style.display = 'inline';
814     } else {
815         document.getElementById(element1).style.display = 'none';
816     }
817 }
818
819 function setValue(element1, setvalue)
820 {
821     document.getElementById(element1).value = setvalue;
822 }
823
824/**
825 * trim all element, trim if is text, right trim if is textarea
826 * @author nguyenngocanh
827 * @return void
828 */
829function trimAll() {
830    var input = document.getElementsByTagName("input");
831    for (i = 0; i < input.length; i++) {
832        input[i].value = input[i].value.replace(/^[  ]+|[  ]+$/g, '');
833    }
834    var textarea = document.getElementsByTagName("textarea");
835    for (i = 0; i < textarea.length; i++) {
836        textarea[i].value = textarea[i].value.replace(/[  ]+$/g, '');
837    }
838}
839
840/**
841 * trim all element, trim if is text, right trim if is input text
842 * @author huynhduychuong
843 */
844function trimAllForInputText() {
845    var input = document.getElementsByTagName("input");
846    for (i = 0; i < input.length; i++) {
847        input[i].value = input[i].value.replace(/^[  ]+|[  ]+$/g, '');
848    }
849}
850/**
851 * Change status a radio button of a row by onclick event over row
852 * @param objRow objRow
853 */
854function changeRadioStatusByOnclickRow(objRow) {
855    var aryInput = objRow.getElementsByTagName('input');
856    if (aryInput && typeof (aryInput) == "object") {
857        for ( var i = 0; i < aryInput.length; i++) {
858            if ((aryInput[i].type == "radio")) {
859                aryInput[i].checked = true;
860            }
861        }
862    }
863}
864
865/**
866 * Enable/Disable all INPUT and SELECT elements
867 */
868var disabledElements;
869function disableElements() {
870    disabledElements = $(':disabled');
871    $('select, input').attr('disabled', true);
872}
873
874function enableElements() {
875    $('select, input').removeAttr('disabled');
876    disabledElements.each(function(){
877        $("#" + this.id.replace(/:/g,'\\:')).attr('disabled', true);
878    });
879}
880
881/**
882 * get conversation context id on URL
883 * @param formId id of form
884 */
885function getConversationId(formId) {
886    var fullURL = $(formId).attr("action");
887    return  fullURL.substring(fullURL.lastIndexOf('?') + 1);
888}
889
890/**
891 * disable plant for popup screen if  insuranceDivision is other insurance
892 *
893 * @author dovietanh
894 * @param insuranceDivision
895 * @return
896 */
897function disablePlant(insuranceDivision) {
898    if (insuranceDivision == '02') {
899        $('#form\\:servicePlant').attr('disabled', true);
900    } else if (insuranceDivision == '01') {
901        $('#form\\:servicePlant').removeAttr('disabled');
902    }
903}
904
905/**
906 * Reconvert interger value from pattern #,###
907 *
908 * @author hpt
909 * @return
910 */
911function removeCommas() {
912    $("input[type=text]").each(function() {
913        var value = $(this).val();
914        $(this).val(value.split(",").join(""));
915    });
916}
917
918/**
919 * Convert interger value to pattern #,###
920 *
921 * @author hpt
922 * @return
923 */
924function addCommas(n) {
925    n = String(n);
926    var Rx = /^(.*\s)?(\d+)(\d{3}\b)/;
927    return n == (n = n.replace(Rx, "$1$2,$3")) ? n : addCommas(n);
928}
929/**
930 * Calculate all month from date1 to date2
931 * 
932 * @author dovietanh
933 * @param date1
934 * @param date2
935 * @returns minus month if date1 > date2
936 * 			month if date1 < date2 
937 */
938function calculateMonthBetweenDate(date1, date2) {
939	if (date1 instanceof Date && date2 instanceof Date) {
940		return date1.getMonth() - date2.getMonth() + (12 * (date1.getFullYear() - date2.getFullYear()));
941	}
942}
943/**
944 * convert string to integer, if NaN then return zero
945 * 
946 * @author dovietanh
947 * @param strNumber
948 * @returns if NaN then return zero else return number
949 */
950function convertInt(strNumber) {
951	var unit = parseInt(strNumber, 10);
952    if (unit && unit != 0 && unit != 'NaN') return unit;
953	else return 0;
954}
955
956function countNumberDigits(element, slen, maxlen, maxrow) {
957    var size = 0;
958    var tmp = element.value;
959    var browserType = getBizBrowserType();
960    if (browserType == 'ie') {
961        var detectIEregexp;
962        if (navigator.userAgent.indexOf('MSIE') != -1) {
963            detectIEregexp = /MSIE (\d+\.\d+);/;
964        } else {
965            detectIEregexp = /Trident.*rv[ :]*(\d+\.\d+)/;
966        }
967        var ieversion = new Number(RegExp.$1);
968        if ((detectIEregexp.test(navigator.userAgent) && ieversion == 10) || (document.documentMode == 9)) {
969            while (tmp.indexOf("\n") != -1 ) {
970                var n = tmp.indexOf("\n");
971                var row = Math.floor(n / maxlen) + 2;
972                size = size + maxlen * row;
973                tmp = tmp.substring(n + 1, tmp.length);
974            }
975        } else {
976            while (tmp.indexOf("\r\n") != -1 ) {
977                var n = tmp.indexOf("\r\n");
978                var row = Math.floor(n / maxlen) + 2;
979                size = size + maxlen * row;
980                tmp = tmp.substring(n + 2, tmp.length);
981            }
982        }
983    } else {
984        while (tmp.indexOf("\n") != -1 ) {
985            var n = tmp.indexOf("\n");
986            var row = Math.floor(n / maxlen) + 2;
987            size = size + maxlen * row;
988            tmp = tmp.substring(n + 1, tmp.length);
989        }
990    }
991    size = size + tmp.length;
992    var slenObj = document.getElementById(slen);
993    slenObj.style.color = 'peru';
994    slenObj.innerHTML = size + '文字';
995}
996
997function getCountNumberDigitsByEventInput(element, slen, maxlen, maxrow) {
998    $(element).bind('input propertychange', function() {
999        setTimeout(function() {
1000            countNumberDigits(element, slen, maxlen, maxrow);
1001        }, 0);
1002    });
1003}
1004
1005/**
1006 * get data json demand status form api 
1007 * return json object if responseText is json, else null 
1008 * 
1009 * @author tranvinhthinh
1010 * @param patchAPI url api
1011 * @param sendData data send to api
1012 * @returns json object
1013 */
1014function getDataDemandStatus(patchAPI, sendData) {
1015    try {
1016        var responseText = getResponseText(patchAPI, sendData);
1017        return JSON.parse(responseText);
1018    } catch (e) {
1019        console.warn("SMBCのAPIを呼び出す際エラーが発生しました。");
1020        return null;
1021    }
1022}
1023
1024/**
1025 * get response text form api with methord POST ajax
1026 * 
1027 * @author tranvinhthinh
1028 * @param patchAPI url api
1029 * @param sendData data send to api
1030 * @returns responseText from api
1031 */
1032function getResponseText(patchAPI, sendData) {
1033	return $.ajax({
1034        type: "POST",
1035        url: patchAPI,
1036        data : JSON.stringify(sendData),
1037        datatype : "json",
1038        contentType : "application/json",
1039        traditional:true,
1040        timeout: 30000,
1041        async: false
1042    }).responseText;
1043}

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.