PageSourceSearch

https://www.goo-net.com/goonet/php/image/iphone/js/cart_common.js?20160704

js goo-net.com collected 2026-10-01 10:30:34 UTC 53,647 bytes, 1,569 lines download raw bytes

1/**
2 * ¥«¡¼¥ÈÍÑ
3 * @
4 *
5 */
6
7
8/**
9 * ±üÅÄÄɲÃʬ
10 */
11
12// reCAPTCHAv2 widgetID
13var widgetId = '';
14
15function backCart(mode){
16
17    document.getElementById("act").innerHTML = '<input type="hidden" name="act" value="back">';
18    if(mode == "one"){
19        document.getElementById("go_one").innerHTML = '<input type="hidden" name="go_one" value="on">';
20    }else{
21        document.getElementById("go_one").innerHTML = '<input type="hidden" name="go_one" value="off">';
22    }
23    var f = document.frm;
24        f.action = "cart.php";
25        f.target = "_self";
26        f.submit();
27}
28
29function backCartTradein(mode){
30
31    var f = document.frm;
32
33    document.getElementById("mode").innerHTML = '<input type="hidden" name="mode" value="' + mode + '">';
34    if(mode == "all"){
35        f.action = "cart.php";
36    }else{
37        f.action = "cart.php";
38    }
39        f.target = "_self";
40        f.submit();
41
42}
43
44/**
45 * ÀÄÌÚÄɲÃʬ
46 */
47
48// ¸ÄÊÌÍÑ ¼Öξ¾õÂÖ³Îǧ/¤½¤Î¾¤Ë¥Á¥§¥Ã¥¯¤¬¤¢¤Ã¤¿»þ ɽ¼¨On/Off
49// p_flg ... 1:°ì³ç 2:¸ÄÊÌ
50function dispCartMsgKobetsu (cart_num) {
51    // MAX·ï¿ô cart_num ʬ¥ë¡¼¥×
52    for (var i=1; i <= cart_num; i++) {
53        dispCartMsg ('', i);
54    }
55}
56
57// ¥«¡¼¥È ¼Öξ¾õÂÖ³Îǧ/¤½¤Î¾¤Ë¥Á¥§¥Ã¥¯¤¬¤¢¤Ã¤¿»þ¤Ëưºî
58function dispCartMsg(obj, index) {
59
60    var demand = document.frm["demand_"+index];
61
62    var obj_3 = document.frm["Request_Type"+index+"_3"];
63    var obj_5 = document.frm["Request_Type"+index+"_5"];
64
65    if(obj.checked){
66        document.getElementById("disp_alert_" + index).style.display = "";    // ɽ¼¨
67        demand.style.backgroundColor = "#ffe2e2"; 
68
69    }else if(obj.checked == false){
70
71        // false¤Î¾ì¹ç¡¢3¤«5¤Î¤É¤Á¤é¤«¤Ë¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤¿¾ì¹ç¤Ïɽ¼¨¤Î¤Þ¤Þ
72        if(obj_3.checked || obj_5.checked){
73        }else{
74            document.getElementById("disp_alert_" + index).style.display = "none";    // Èóɽ¼¨
75            demand.style.backgroundColor = "#ffffff"; 
76        }
77
78    }else{
79
80        // 3¤«5¤Î¤É¤Á¤é¤«¤Ë¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤¿¾ì¹ç¤Ïɽ¼¨
81        if(obj_3.checked || obj_5.checked){
82            document.getElementById("disp_alert_" + index).style.display = "";    // ɽ¼¨
83            demand.style.backgroundColor = "#ffe2e2"; 
84        }else{
85           document.getElementById("disp_alert_" + index).style.display = "none";    // Èóɽ¼¨
86            demand.style.backgroundColor = "#ffffff"; 
87        }
88    }
89}
90
91function createXMLHttpRequest(){
92
93    /* XMLHttpRequest ¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤¹¤ë   */
94    if(window.addEventListener){
95
96        /* Firefox ÍÑ */
97        return new XMLHttpRequest();
98    }else{
99
100        /* IE ÍÑ */
101        return new ActiveXObject("Microsoft.XMLHTTP");
102    }
103
104}
105
106function XMLHttpRequestByPost(zip){
107
108    /* ajax_postcode.php ¤Ë¥ê¥¯¥¨¥¹¥È¤òÁ÷¤ë */
109    var request = createXMLHttpRequest();
110
111    /* ¥¹¥Æ¡¼¥¿¥¹( ÆÉ¤ß¹þ¤ßÃæ¤Ê¤Î¤«´°Î»¤·¤¿¤Î¤«) ¤¬Êѹ¹¤µ¤ì¤¿¤éreadyStateChangeHandler ¤ò¼Â¹Ô */
112    request.open("POST", "./ajax_postcode.php" , true);
113
114    request.onreadystatechange = readyStateChangeHandler;
115    request.setRequestHeader( "Content-Type" ,  "application/x-www-form-urlencoded");
116    request.send("zip=" + zip);
117
118    function readyStateChangeHandler(){
119        switch(request.readyState){
120            case 4:
121                /* ´°Î»¤Î¾ì¹ç¡¢¥µ¡¼¥Ð¤«¤éÁ÷¤é¤ì¤¿¥Ç¡¼¥¿¤òɽ¼¨ */
122                if(request.status == 200){
123                    document.getElementById( 'address').innerHTML  = request.responseText;
124
125                    DispResult(request);
126                }
127                break;
128        }
129    }
130}
131
132function XMLHttpRequestByPostAddress(params){
133
134    /* ajax_addlist.php ¤Ë¥ê¥¯¥¨¥¹¥È¤òÁ÷¤ë */
135    var request = createXMLHttpRequest();
136
137    /* ¥¹¥Æ¡¼¥¿¥¹( ÆÉ¤ß¹þ¤ßÃæ¤Ê¤Î¤«´°Î»¤·¤¿¤Î¤«) ¤¬Êѹ¹¤µ¤ì¤¿¤éreadyStateChangeHandler ¤ò¼Â¹Ô */
138    request.open("POST", "./ajax_addlist.php" , true);
139
140    request.onreadystatechange = readyStateChangeHandler;
141    request.setRequestHeader( "Content-Type" ,  "application/x-www-form-urlencoded");
142    request.send(params);
143
144    function readyStateChangeHandler(){
145        switch(request.readyState){
146            case 4:
147                /* ´°Î»¤Î¾ì¹ç¡¢¥µ¡¼¥Ð¤«¤éÁ÷¤é¤ì¤¿¥Ç¡¼¥¿¤òɽ¼¨ */
148
149                if(request.status == 200){
150                    DispCity(request);
151                }
152                break;
153        }
154    }
155}
156
157function RequestByPost(){
158
159    var f = document.frm;
160    var zip1 = f.zip01.value;
161    var zip2 = f.zip02.value;
162
163    var params = zip1 + zip2;
164    if(7 == params.length){
165        XMLHttpRequestByPost(params);
166    }
167}
168
169
170// Enter¤ò²¡¤·¤Æ¤âsubmit¤µ¤ì¤Ê¤¤¤è¤¦¤Ë¤¹¤ë
171function submitStop(e){
172    if (!e) var e = window.event;
173
174    if(e.keyCode == 13)
175        return false;
176} 
177
178function goBack(back){
179
180    var f = document.frm;
181
182        if(back == "tradein"){
183            f.action = "cart_tradein.php";
184        }else if(back == "appointment"){
185            f.action = "appointment.php";
186        }else{
187            f.action = "cart.php";
188        }
189        f.target = "_self";
190        f.submit();
191}
192
193function checkEntryCart(){
194
195    var f = document.frm;
196    document.getElementById("act").innerHTML = '<input type="hidden" name="act" value="chk">';
197    f.action = "cart.php";
198    f.target = "_self";
199    f.submit();
200}
201
202function initTradein(){
203    document.getElementById("Car_List").innerHTML   = "<select name=car_cd><option value=''>ÁªÂò¤·¤Æ²¼¤µ¤¤</option></select>";
204    document.getElementById("Grade_List").innerHTML = "<select name=grade_cd><option value=''>ÁªÂò¤·¤Æ²¼¤µ¤¤</option></select>";
205
206    // 2008.03.07 SESSION¤Ë¥Ç¡¼¥¿¤¬¤¢¤ë¾ì¹ç¤ÏÀ¸À® Mori
207    var brand_cd = document.frm.brand_cd.value;
208    var cnt = 0;
209    if (brand_cd != '') {
210        // ¼Ö¼ï¤Î¥×¥ë¥À¥¦¥óÀ¸À®
211        Change_CarList(brand_cd, 'car_cd', 'select', 'width:',1,0,'grade_cd');
212        // car_cd ¤ÎÁªÂò
213        if (car_cd != '') {
214            // ÁªÂò½èÍý
215            var car_cd_id = setInterval ( function () {
216                var car_cd_obj = document.frm.car_cd;
217                if (car_cd_obj.options.length > 1) {
218                    cnt = car_cd_obj.options.length;
219                    for (var i=0; i< cnt; i++) {
220                        if (car_cd == car_cd_obj.options[i].value ) {
221                            car_cd_obj.selectedIndex = i;
222                            clearInterval(car_cd_id);
223                            break;
224                        }
225                    }
226                }
227            }, 1000);
228
229            // ¥°¥ì¡¼¥É¤Î¥×¥ë¥À¥¦¥óÀ¸À®
230            Change_GradeList(car_cd, 'grade_cd', 'select', 'width:',0,0);
231            // grade_cd ¤ÎÁªÂò
232            if (grade_cd != '') {
233                // ÁªÂò½èÍý
234                var grade_cd_id = setInterval ( function () {
235                    var grade_cd_obj = document.frm.grade_cd;
236                    car_cd_obj = document.frm.car_cd;
237                    // car_cd_obj¤ÎÁªÂò¤µ¤ì¤ë¤Þ¤ÇWait
238                    if (grade_cd_obj.options.length > 1 && car_cd == car_cd_obj.value) {
239                        cnt = grade_cd_obj.options.length;
240                        for (i=0; i< cnt; i++) {
241                            if (grade_cd == grade_cd_obj.options[i].value ) {
242                                grade_cd_obj.selectedIndex = i;
243                                clearInterval(grade_cd_id);
244                                break;
245                            }
246                        }
247                        clearInterval(grade_cd_id);
248                    }
249                }, 1000);
250            }
251        }
252    }
253}
254// ¼Ö¸¡¤Ê¤·¤Î¥Á¥§¥Ã¥¯½èÍý add 2008.03.11 Mori
255function chk_inspect(obj){
256   if (obj.checked == true) {
257       // ½é´ü²½
258       document.frm.inspect_year.selectedIndex  = 0;
259       document.frm.inspect_month.selectedIndex = 0;
260       document.frm.inspect_year.disabled  = true;
261       document.frm.inspect_month.disabled = true;
262   // ²ò½ü
263   } else {
264       document.frm.inspect_year.disabled  = false;
265       document.frm.inspect_month.disabled = false;
266   }
267}
268
269function initCart(){
270	document.getElementById("state_zip").innerHTML = '<input type="hidden" name="state_zip" value="">';
271    document.getElementById("act").innerHTML = '<input type="hidden" name="act" value="">';
272
273   // ¥Æ¥ó¥×¥ì¡¼¥È½¤Àµ¤Ë¤è¤êÉÔÍ× 20080529 aoki
274   // var uName = navigator.userAgent.toUpperCase();
275   // if(uName.indexOf("FIREFOX") >= 0){
276   //     w = window.outerWidth;
277   //     h = window.outerHeight-1;
278   //     if(window.outerWidth >= screen.width){
279   //         moveTo(0,0)
280   //     }
281   //     resizeTo(w, h);
282   // }
283}
284
285// ¸ÄÊÌÍÑ ¼Ö¸Ë¾ÚÌÀ+Ǽ¼Ö´õ˾ ɽ¼¨On/Off
286// p_flg ... 1:°ì³ç 2:¸ÄÊÌ
287function chkCartOptionKobetsu (p_flg) {
288    // MAX·ï¿ô 10 ¤Ç¸ÇÄê
289    for (var i=1; i <= 10; i++) {
290        var p_obj = document.frm["Request_Type"+i+"_1"];    // ¸«ÀѤâ¤ê°ÍÍê¤Îcheckbox¥ª¥Ö¥¸¥§¥¯¥È
291        if (p_obj) {
292            dispCartOption (p_obj, i, p_flg);
293        }
294    }
295}
296
297// ¼Ö¸Ë¾ÚÌÀ+Ǽ¼Ö´õ˾ ¤Î ɽ¼¨On/Off
298function dispCartOption (obj, index, flg) {
299    // °ì³ç
300    if (flg == 1) {
301        if (obj == '') {
302            var obj = document.frm.Request_Type1_1;
303        }
304    // ¸ÄÊÌ
305    } else {
306    }
307    var radio_1 = document.frm["shako_"+index];
308    var radio_2 = document.frm["nousha_"+index];
309
310    // ¥Á¥§¥Ã¥¯¤¢¤ê ¢Í ɽ¼¨
311    if (obj.checked == true) {
312        radio_1[0].disabled  = false;
313        radio_1[1].disabled  = false;
314        radio_2[0].disabled  = false;
315        radio_2[1].disabled  = false;
316
317    // ¥Á¥§¥Ã¥¯¤Ê¤· ¢Í Èóɽ¼¨
318    } else {
319        radio_1[0].checked   = true;    // ¡Ö¤Ê¤·¡×¤Ë¥Á¥§¥Ã¥¯¤òÁ«°Ü
320        radio_1[0].disabled  = true;
321        radio_1[1].disabled  = true;
322        radio_2[0].checked   = true;    // ¡Ö¤Ê¤·¡×¤Ë¥Á¥§¥Ã¥¯¤òÁ«°Ü
323        radio_2[0].disabled  = true;
324        radio_2[1].disabled  = true;
325    }
326}
327
328function initCheck(state, address1, address2){
329    document.getElementById("state_zip").innerHTML = '<input type="hidden" name="state_zip" value="'+ state + '">';
330    document.getElementById("address1_zip").innerHTML = '<input type="hidden" name="address1_zip" value="' + address1 + '">';
331    document.getElementById("address2_zip").innerHTML = '<input type="hidden" name="address2_zip" value="' + address2 + '">';
332    document.getElementById("address").innerHTML = state + address1 + address2;
333}
334
335function change_auction(flg){
336    if(flg){
337        document.getElementById("Tradein_Auction").innerHTML = 
338      "<TABLE class=auc_tel cellSpacing=0 cellPadding=0 border=0>"+
339      "<TBODY><TR><TH class=auc_tit scope=row colSpan=2>¢§Çã¼è¥ª¡¼¥¯¥·¥ç¥ó¤òÍøÍѤ¹¤ë¤Ë¤ÏÅÅÏÃÈÖ¹æ¤ÎÆþÎϤ¬É¬¿Ü¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£</TH>"+
340      "<TR><TH scope=row>ÅÅÏÃÈÖ¹æ<SPAN>¡Êɬ¿Ü¡Ë</SPAN></TH>"+
341      "<TD><INPUT name=auction_tel1 maxlength=4 style=ime-mode:disabled;>¡Ý"+
342      "<INPUT name=auction_tel2 maxlength=4 style=ime-mode:disabled;>¡Ý"+
343      "<INPUT name=auction_tel3 maxlength=4 style=ime-mode:disabled;><P>"+
344      "<SPAN>(Ⱦ³Ñ¿ô»ú)</SPAN> ¢¨¼«Âð/·ÈÂÓ¤¤¤º¤ì¤«¤òÆþÎϤ·¤Æ²¼¤µ¤¤</P></TD></TR></TBODY></TABLE>";
345    }else{
346        document.getElementById("Tradein_Auction").innerHTML = "";
347    }
348}
349
350
351/**
352 * ¼Ö¼ïÊѹ¹(from can-get)
353 */
354function Change_CarList(brand_cd,sel_name,sel_class,sel_style,null_val,doclevel,change){
355	var params = "brand_cd=" + brand_cd + "&sel_name=" + sel_name + "&sel_class=" + sel_class + "&sel_style=" + sel_style + "&null_val=" + null_val + "&change=" + change;
356
357	var options = {
358					method : 'post',
359					parameters : params,
360					onComplete: function(request){Set_Car_List(request);},
361					onFailure: Set_Car_List
362				  };
363
364	var addpath = "";
365	if(doclevel){
366		for(var i=0; i<doclevel; i++){
367			addpath += '../';
368		}
369	}
370
371	new Ajax.Request(addpath + 'ajax_carlist.php?aid=carlist', options);
372}
373
374function Set_Car_List(request){
375	var content = request.responseText;
376
377	if(content == ''){
378		alert('¥·¥¹¥Æ¥à¥¨¥é¡¼');
379	} else {
380		document.getElementById("Car_List").innerHTML = content;
381	}
382}
383
384function Change_GradeList(car_cd,sel_name,sel_class,sel_style,null_val,doclevel){
385	var params = "car_cd=" + car_cd + "&sel_name=" + sel_name + "&sel_class=" + sel_class + "&sel_style=" + sel_style + "&null_val=" + null_val;
386	var options = {
387					method : 'post',
388					parameters : params,
389					onComplete: function(request){Set_Grade_List(request);},
390					onFailure: Set_Grade_List
391				  };
392
393	var addpath = "";
394	if(doclevel){
395		for(var i=0; i<doclevel; i++){
396			addpath += '../';
397		}
398	}
399
400	new Ajax.Request(addpath + 'ajax_carlist.php?aid=gradelist', options);
401}
402
403function Set_Grade_List(request){
404	var content = request.responseText;
405
406	if(content == ''){
407		alert('¥·¥¹¥Æ¥à¥¨¥é¡¼');
408	} else {
409		document.getElementById("Grade_List").innerHTML = content;
410	}
411}
412
413function Change_Dealer_CarList(maker_id,sel_name,sel_class,sel_style,null_val,doclevel,change){
414	var params = "maker=" + maker_id + "&sel_name=" + sel_name + "&sel_class=" + sel_class + "&sel_style=" + sel_style + "&null_val=" + null_val + "&change=" + change;
415	var options = {
416					method : 'post',
417					parameters : params,
418					onComplete: function(request){Set_Dealer_Car_List(request);},
419					onFailure: Set_Dealer_Car_List
420				  };
421
422	var addpath = "";
423	if(doclevel){
424		for(var i=0; i<doclevel; i++){
425			addpath += '../';
426		}
427	}
428
429	new Ajax.Request(addpath + 'ajax/com_carlist.php?aid=dealer_carlist', options);
430}
431
432function Set_Dealer_Car_List(request){
433	var content = request.responseText;
434
435	if(content == ''){
436		alert('¥·¥¹¥Æ¥à¥¨¥é¡¼');
437	} else {
438		document.getElementById("Car_List").innerHTML = content;
439	}
440}
441
442/**
443 * ²¼¼è¼Ö¥¨¥ó¥È¥ê¥Á¥§¥Ã¥¯
444 */
445function checkTrCarEntry(){
446    var f = document.frm;
447
448    f.tradein_memo.value = replaceJisX0213String(f.tradein_memo.value);
449
450    f.action = "cart_tradein.php";
451    f.target = "_self";
452    f.submit();
453    
454}
455
456/**
457 * Í¹ÊØÈֹ渡º÷(from can-get)
458 */
459function SearchAddr(doclevel){
460    var f = document.frm;
461    var zip1 = f.zip01.value;
462    var zip2 = f.zip02.value;
463
464    var params = zip1 + zip2;
465    if(7 == params.length){
466        XMLHttpRequestByPost(params);
467    }
468
469/* function.js¤ò»ÈÍѤ·¤Ê¤¤¤è¤¦¤ËÊѹ¹ 20090213 aoki
470	var params = "zip=" + zip1 + zip2;
471	var params2 = zip1 + zip2;
472
473    if(7 == params2.length){
474	    var options = {
475	        method : 'post',
476			parameters : params,
477			onComplete: function(request){DispResult(request);},
478			onFailure: DispResult
479		};
480
481		var addpath = "";
482		if(doclevel){
483			for(var i=0; i<doclevel; i++){
484				addpath += '../';
485			}
486		}
487
488		new Ajax.Request(addpath + 'ajax_postcode.php', options);
489	}
490*/
491}
492
493/**
494 * Í¹ÊØÈֹ渡º÷(from can-get)
495 **/
496function SearchAddrNew(doclevel){
497    var f = document.frm;
498    var zip01 = f.zip01.value;
499
500    if(7 == zip01.length){
501        XMLHttpRequestByPost(zip01);
502    }
503}
504
505function DispResult(request){
506	var content = request.responseText;
507	var dat = content.split('\n');
508
509	if(content == ''){
510		document.getElementById("address").innerHTML = '';
511		document.getElementById("state_zip").innerHTML = '<input type="hidden" name="state_zip" value="">';
512		document.getElementById("address1_zip").innerHTML = '<input type="hidden" name="address1_zip" value="">';
513		document.getElementById("address2_zip").innerHTML = '<input type="hidden" name="address2_zip" value="">';
514	} else {
515		document.getElementById("address").innerHTML = dat[0]+dat[1]+dat[2];
516		document.getElementById("state_zip").innerHTML = '<input type="hidden" name="state_zip" value="'+dat[0]+'">';
517		document.getElementById("address1_zip").innerHTML = '<input type="hidden" name="address1_zip" value="'+dat[1]+'">';
518		document.getElementById("address2_zip").innerHTML = '<input type="hidden" name="address2_zip" value="'+dat[2]+'">';
519	}
520}
521
522
523/**
524 * ²¼¼è¼Ö¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹
525 */
526function reg_Tradein(){
527    var f = document.frm;
528    if(f.Trade_In[0].checked == true){
529        f.action = 'cart_tradein.php';
530        f.submit();
531//		window.open('cart_tradein.php','TradeIn','scrollbars=yes,resizable=yes,width=720,height=720,left=150,top=100')
532    } else {
533        alert("²¼¼è¼Ö¤òÅÐÏ¿¤¹¤ë¾ì¹ç¤Ï²¼¼è¼Ö¤¢¤ê¤òÁªÂò¤·¤Æ²¼¤µ¤¤¡£");
534    }
535    location.hash = "POS_TRADEIN";
536}
537
538function getCookie(name) {
539    var match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
540    return match ? decodeURIComponent(match[1]) : null;
541}
542
543
544/**
545 * ¥«¥¹¥¿¥Þ¥¤¥º¥Ç¡¼¥¿¤«¤é¥Æ¥­¥¹¥È·Á¼°¤ÎÀâÌÀ¤òÀ¸À®
546 * @param {Object} customizeData
547 * @returns {string}
548 */
549function generateCustomizeText(customizeData) {
550    try {
551        if (!customizeData || !customizeData.visibleMainCategories) {
552            return '';
553        }
554
555        var text = '';
556        customizeData.visibleMainCategories.forEach(function (mainCat) {
557            if (mainCat.visibleSubCategories && mainCat.visibleSubCategories.length > 0) {
558                mainCat.visibleSubCategories.forEach(function (subCat) {
559                    if (subCat.visibleProducts && subCat.visibleProducts.length > 0) {
560                        subCat.visibleProducts.forEach(function (product) {
561                            if (product.isChecked) {
562                                if (text) text += '\n';
563                                text += '¡Ú' + mainCat.mainCategoryName + ' - ' + subCat.subCategoryName + '¡Û';
564                                text += product.productName;
565                                if (product.price && product.price !== '0') {
566                                    text += ' (' + product.price + '±ß)';
567                                }
568                            }
569                        });
570                    }
571                });
572            }
573        });
574
575        return text;
576    } catch (error) {
577        console.error('Error in generateCustomizeText:', error);
578        return '';
579    }
580}
581
582/**
583 * ¥«¥¹¥¿¥Þ¥¤¥º¥Ç¡¼¥¿¤òlocalStorage¤«¤é¼èÆÀ¤·¤Æ¥Õ¥©¡¼¥à¤ËÄɲÃ
584 * @param {HTMLFormElement} form
585 * @param {number} cart_num
586 */
587function addCustomizeDataToForm(form, cart_num) {
588    try {
589        if (!form) {
590            return;
591        }
592
593        var gnCustomizeJson = localStorage.getItem('gn_customize_json');
594        if (!gnCustomizeJson) {
595            return;
596        }
597
598        var allCustomizeData = JSON.parse(gnCustomizeJson);
599        if (!allCustomizeData || typeof allCustomizeData !== 'object') {
600            return;
601        }
602
603        // stockId¤ò¼èÆÀ¡Êrecommend_stock_ids¤Èpack_Í×ÁǤÎξÊý¤«¤é¡Ë
604        var stockIdsArray = [];
605        var stockIdsSet = {};
606
607        // 1. recommend_stock_ids¤«¤é¼èÆÀ
608        var recommendStockIds = form.elements['recommend_stock_ids'];
609        if (recommendStockIds && recommendStockIds.value) {
610            var idsFromRecommend = recommendStockIds.value.split(',').map(function (id) { return id.trim(); });
611            idsFromRecommend.forEach(function(id) {
612                if (id && !stockIdsSet[id]) {
613                    stockIdsSet[id] = true;
614                    stockIdsArray.push(id);
615                }
616            });
617        }
618
619        // 2. pack_Í×ÁǤ«¤é¤â¼èÆÀ¡Ê¥«¥¹¥¿¥Þ¥¤¥º¥Ç¡¼¥¿¤¬¤¢¤ë¤â¤Î¤Î¤ß¡Ë
620        for (var i = 0; i < form.elements.length; i++) {
621            var elem = form.elements[i];
622            if (elem.name && elem.name.indexOf('pack_') === 0) {
623                var stockId = elem.name.replace('pack_', '');
624                if (allCustomizeData[stockId] && !stockIdsSet[stockId]) {
625                    stockIdsSet[stockId] = true;
626                    stockIdsArray.push(stockId);
627                }
628            }
629        }
630
631        if (stockIdsArray.length === 0) {
632            return;
633        }
634
635        // ³ÆstockId¤ËÂФ·¤Æ¥«¥¹¥¿¥Þ¥¤¥º¥Ç¡¼¥¿¤ò³Îǧ¡¦ÄɲÃ
636        stockIdsArray.forEach(function (stockId) {
637            if (!stockId) return;
638
639            var packInput = form['pack_' + stockId];
640
641            // pack_¤¬-1¡Ê¼«Ê¬¤Ç¥ª¥×¥·¥ç¥ó¤òÁªÂò¡Ë¤Î¾ì¹ç¤Î¤ß
642            if (packInput && packInput.value === '-1' && allCustomizeData[stockId]) {
643                var customizeData = allCustomizeData[stockId];
644
645                // customize[stockId][customize_json]¤Î·Á¼°¤ÇPOST
646                var customizeJsonInput = document.createElement('input');
647                customizeJsonInput.type = 'hidden';
648                customizeJsonInput.name = 'customize[' + stockId + '][customize_json]';
649                customizeJsonInput.value = JSON.stringify(customizeData);
650                form.appendChild(customizeJsonInput);
651
652                // customize[stockId][customize_menu_id]¤âÄɲÃ
653                if (customizeData.customizeMenuId) {
654                    var menuIdInput = document.createElement('input');
655                    menuIdInput.type = 'hidden';
656                    menuIdInput.name = 'customize[' + stockId + '][customize_menu_id]';
657                    menuIdInput.value = customizeData.customizeMenuId;
658                    form.appendChild(menuIdInput);
659                }
660
661                // customize[stockId][customize_text]¤âÄɲáʥƥ­¥¹¥È·Á¼°¤ÎÀâÌÀ¡Ë
662                var customizeText = generateCustomizeText(customizeData);
663                if (customizeText) {
664                    var textInput = document.createElement('input');
665                    textInput.type = 'hidden';
666                    textInput.name = 'customize[' + stockId + '][customize_text]';
667                    textInput.value = customizeText;
668                    form.appendChild(textInput);
669                }
670            }
671        });
672    } catch (error) {
673        console.error('Error in addCustomizeDataToForm:', error);
674    }
675}
676
677var estimateSubmitLocked = false;
678
679function lockEstimateSubmitButton() {
680    if (estimateSubmitLocked) {
681        return false;
682    }
683
684    estimateSubmitLocked = true;
685
686    var submitLinks = document.querySelectorAll('.send_conf_static, .send_conf');
687    for (var i = 0; i < submitLinks.length; i++) {
688        submitLinks[i].style.pointerEvents = 'none';
689        submitLinks[i].style.cursor = 'default';
690        submitLinks[i].style.opacity = '0.6';
691    }
692
693    return true;
694}
695
696function unlockEstimateSubmitButton() {
697    estimateSubmitLocked = false;
698
699    var submitLinks = document.querySelectorAll('.send_conf_static, .send_conf');
700    for (var i = 0; i < submitLinks.length; i++) {
701        submitLinks[i].style.pointerEvents = '';
702        submitLinks[i].style.cursor = '';
703        submitLinks[i].style.opacity = '';
704    }
705}
706
707/**
708 * ¥¨¥ó¥È¥êÆþÎÏ¥Á¥§¥Ã¥¯¤ò¹Ô¤¤¤Þ¤¹
709 */
710function checkEntry(mode,cart_num){
711    var EC = new EstimateCart();
712    let skipRestimate = false;
713    if (EC && EC.COOKIE_NAME && (EC.COOKIE_NAME == "estimate_cart_G" || EC.COOKIE_NAME == "estimate_cart_E_G")) {
714        var urlParams = new URLSearchParams(window.location.search);
715        var est_epack = urlParams.get("est_epack") ? urlParams.get("est_epack") : '';
716        var baitai = urlParams.get("baitai") ? urlParams.get("baitai") : '';
717        var cart_num = 0;
718        var cookie_num = 0;
719        var cookie_data = '';
720        var car_casetEstimate_all = document.querySelectorAll('.car_casetEstimate');
721        var stock_ids = [];
722        var stock_id_prefix = 'car_caset_';
723        car_casetEstimate_all.forEach(element => {
724            if (element.id) {
725                stock_ids.push(element.id.substring(stock_id_prefix.length));
726            }
727        });
728        if (est_epack && baitai) {
729            cookie_data = getCookie('estimate_cart_E_G');
730        } else {
731            cookie_data = getCookie('estimate_cart_G');
732        }
733        cookie_data = JSON.parse(cookie_data);
734
735        var recommend_data = Array.from(document.querySelectorAll('.checkbox_recommend_estimate'));
736        if (recommend_data && recommend_data.length > 0) {
737            for (let recommend_data_key = 0; recommend_data_key < recommend_data.length; recommend_data_key++) {
738                if (recommend_data[recommend_data_key].checked) {
739                    const recommend_data_value = JSON.parse(recommend_data[recommend_data_key].value);
740                    if (recommend_data_value && recommend_data_value.stock_id) {
741                        stock_ids.push(recommend_data_value.stock_id);
742                    }
743                }
744            }
745        }
746        
747        cart_num = stock_ids ? stock_ids.length : cart_num;
748        cookie_num = cookie_data ? Object.keys(cookie_data).length : cookie_data;
749        var confirm_flg = false;
750        Object.keys(cookie_data).forEach(cookie_data_key => {
751            if (!stock_ids.includes(cookie_data[cookie_data_key][0])) {
752                confirm_flg = true;
753            }
754        });
755        if (cart_num != cookie_num || confirm_flg) {
756            var checkBtn = window.confirm('¥«¡¼¥È¤¬¹¹¿·¤µ¤ì¤¿¤¿¤á¡¢¥Ú¡¼¥¸¤òºÆÆÉ¤ß¹þ¤ß¤·¤Æ¤¯¤À¤µ¤¤¡£');
757            if (checkBtn) {
758                if (document.getElementById('est_epack') != null && document.getElementById('est_epack').value != '') {
759                    let est_epack_value = document.getElementById("est_epack").value;
760                    document.frm.action = "cart.php?baitai=" + est_epack_value + "&est_epack=" + est_epack_value;
761                } else  {
762                    document.frm.action = "cart.php";
763                }
764                skipRestimate = true;
765                document.getElementById("act").innerHTML = '<input type="hidden" name="act" value="keep">';
766                document.frm.submit();return;
767
768            } else {
769                return;
770            }
771        }
772    }
773    var f = document.frm;
774    
775    if(!f) {
776        return;
777    }
778    
779    var msg = VOID_STRING;
780
781    // reCAPTCHA¼Â»Ü¥Õ¥é¥°
782    var recaptcha_flg = true;
783    if (f.recaptcha === void 0 || !f.recaptcha.value) {
784        recaptcha_flg = false;
785    }
786
787    // ¥¯¥ë¥Þ ̵ͭ¥Á¥§¥Ã¥¯
788    if(cart_num==0){
789        alert("Ãæ¸Å¼Ö¥Ç¡¼¥¿¤¬ÅÐÏ¿¤µ¤ì¤Æ¤Þ¤»¤ó¡£");
790        return;
791    }
792
793
794    f.name.value = replaceJisX0213String(f.name.value);
795
796    if(f.demand_1) f.demand_1.value = replaceJisX0213String(f.demand_1.value);
797
798    if(mode == "one"){
799        if(cart_num >= 2 && f.demand_2){
800            f.demand_2.value = replaceJisX0213String(f.demand_2.value);
801        }
802        if(cart_num >= 3 && f.demand_3){
803            f.demand_3.value = replaceJisX0213String(f.demand_3.value);
804        }        
805        if(cart_num >= 4 && f.demand_4){
806            f.demand_4.value = replaceJisX0213String(f.demand_4.value);
807        }
808        if(cart_num >= 5 && f.demand_5){
809            f.demand_5.value = replaceJisX0213String(f.demand_5.value);
810        }
811        if(cart_num >= 6 && f.demand_6){
812            f.demand_6.value = replaceJisX0213String(f.demand_6.value);
813        }
814        if(cart_num >= 7 && f.demand_7){
815            f.demand_7.value = replaceJisX0213String(f.demand_7.value);
816        }
817        if(cart_num >= 8 && f.demand_8){
818            f.demand_8.value = replaceJisX0213String(f.demand_8.value);
819        }
820        if(cart_num >= 9 && f.demand_9){
821            f.demand_9.value = replaceJisX0213String(f.demand_9.value);
822        }
823        if(cart_num == 10 && f.demand_10){
824            f.demand_10.value = replaceJisX0213String(f.demand_10.value);
825        }
826    }
827
828    var go_one_elem = document.getElementById("go_one");
829    if(go_one_elem) {
830        if(mode == "one"){
831            go_one_elem.innerHTML = '<input type="hidden" name="go_one" value="on">';
832        }else{
833            go_one_elem.innerHTML = '<input type="hidden" name="go_one" value="off">';
834        }
835    }
836
837    // ¥í¡¼¥ó²¾¿³ºº¡¦¼Öξɾ²Á½ñ¤Ç¤ÏRequest_Type¤¬Â¸ºß¤·¤Ê¤¤¤¿¤á¡¢Â¸ºß¥Á¥§¥Ã¥¯¤òÄɲÃ
838    var hasRequestType = $("input[name='Request_Type1_1']").length > 0;
839        if (!lockEstimateSubmitButton()) {
840                return;
841        }
842
843    if($("#r_estimate_flg").length > 0 && (hasRequestType || !skipRestimate)){
844      if($("input[name='Request_Type1_1']").is(':checked')){
845        var mailaddress01 = $("#mailaddress01").val();
846        $.ajax({
847          url:"/goonet/php/estimate/restimate.php",
848          type:"post",
849          data:"mailaddress01="+mailaddress01,
850          dataType:"json",
851          success:function(data){
852            if(data != "" && data != null){
853              showRestimatePopup(function(){
854                var act_elem = document.getElementById("act");
855                if(act_elem) act_elem.innerHTML = '<input type="hidden" name="act" value="chk">';
856                var r_estimate_elem = document.getElementById("r_estimate_flg");
857                if(r_estimate_elem) r_estimate_elem.innerHTML = '<input type="hidden" name="r_estimate_flg" value="1">';
858                addCustomizeDataToForm(f, cart_num);
859                if (document.getElementById('est_epack') != null && document.getElementById('est_epack').value != '') {
860                    let est_epack_value = document.getElementById("est_epack").value;
861                    f.action = "cart.php?baitai=" + est_epack_value + "&est_epack=" + est_epack_value;
862                } else {
863                    f.action = "cart.php";
864                }
865                f.target = "_self";
866                var source_client_list = document.getElementById("source_client_list");
867                source_client_list.value = getCookie('source_client_list');
868                if (recaptcha_flg) {
869                    checkRecaptchav3(f);
870                } else {
871                    f.submit();
872                }
873              }, function(){
874                $.each(data,function(num,value){
875                  $("#"+value+"_chk").show(); 
876                                });
877                                unlockEstimateSubmitButton();
878                            });
879            }else{
880              var act_elem = document.getElementById("act");
881              if(act_elem) act_elem.innerHTML = '<input type="hidden" name="act" value="chk">';
882              addCustomizeDataToForm(f, cart_num);
883              if (document.getElementById('est_epack') != null && document.getElementById('est_epack').value != '') {
884                  let est_epack_value = document.getElementById("est_epack").value;
885                  f.action = "cart.php?baitai=" + est_epack_value + "&est_epack=" + est_epack_value;
886              } else {
887                  f.action = "cart.php";
888              }
889              f.target = "_self";
890              var source_client_list = document.getElementById("source_client_list");
891              source_client_list.value = getCookie('source_client_list');
892              if (recaptcha_flg) {
893                  checkRecaptchav3(f);
894              } else {
895                  f.submit();
896              }
897            }
898          },
899                    error:function(){
900                        unlockEstimateSubmitButton();
901                    }
902        })
903      }else{
904        var act_elem = document.getElementById("act");
905        if(act_elem) act_elem.innerHTML = '<input type="hidden" name="act" value="chk">';
906        addCustomizeDataToForm(f, cart_num);
907        if (document.getElementById('est_epack') != null && document.getElementById('est_epack').value != '') {
908            let est_epack_value = document.getElementById("est_epack").value;
909            f.action = "cart.php?baitai=" + est_epack_value + "&est_epack=" + est_epack_value;
910        } else {
911            f.action = "cart.php";
912        }
913        f.target = "_self";
914        var source_client_list = document.getElementById("source_client_list");
915        source_client_list.value = getCookie('source_client_list');
916        if (recaptcha_flg) {
917            checkRecaptchav3(f);
918        } else {
919            f.submit();
920        }
921      }
922    }else{
923    var act_elem = document.getElementById("act");
924    if(act_elem) act_elem.innerHTML = '<input type="hidden" name="act" value="chk">';
925    
926    // ¥í¡¼¥ó²¾¿³ºº¤Þ¤¿¤Ï¼Öξɾ²Á½ñ¤Î¾ì¹ç¡¢Request_Type1_1¤ò¼«Æ°ÀßÄê
927    var loan_name_elem = document.getElementById("loan_name");
928    var est_specific_elem = document.getElementById("est_specific");
929    if((loan_name_elem && loan_name_elem.value) || (est_specific_elem && est_specific_elem.value)) {
930        // Request_Type1_1¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤ÏºîÀ®
931        if(!f.Request_Type1_1) {
932            var request_type_input = document.createElement("input");
933            request_type_input.type = "hidden";
934            request_type_input.name = "Request_Type1_1";
935            request_type_input.value = "on";
936            f.appendChild(request_type_input);
937        }
938    }
939    
940    addCustomizeDataToForm(f, cart_num);
941    if (document.getElementById('est_epack') != null && document.getElementById('est_epack').value != '') {
942        let est_epack_value = document.getElementById("est_epack").value;
943        f.action = "cart.php?baitai=" + est_epack_value + "&est_epack=" + est_epack_value;
944    } else {
945        f.action = "cart.php";
946    }
947    f.target = "_self";
948    var source_client_list = document.getElementById("source_client_list");
949    source_client_list.value = getCookie('source_client_list');
950    if (recaptcha_flg) {
951        checkRecaptchav3(f);
952    } else {
953        f.submit();
954    }
955}
956}
957
958/* ¥«¡¼¥ÈºÇ½é¤ËÆÉ¤ß¹þ¤ß(²¼¼è¼Ö¤¢¤ê)  */
959/*function initConfirm(tradein){ */
960/*    if(tradein == 1){ */
961/*        document.getElementById("go_finish").innerHTML = '<A href="javascript:goTradeinOK();"><img src="../image/iphone/img/next_btn.jpg" width="266" height="45" alt="¼¡¤Ø" class="next_btn" /></A>'; */
962/*    }else if(tradein == 2){ */
963/*        document.getElementById("go_finish").innerHTML = '<A href="javascript:goSameCar();"><img src="../image/iphone/img/next_btn.jpg" width="266" height="45" alt="¼¡¤Ø" class="next_btn" /></A>'; */
964/*    }else{ */
965/*        document.getElementById("go_finish").innerHTML = '<A href="javascript:goFinish();"><img src="../image/iphone/img/next_btn.jpg" width="266" height="45" alt="¼¡¤Ø" class="next_btn" /></A>'; */
966/*    } */
967/*} */
968
969/* Ʊ°ì¼ÔƱ°ì¼Ö¥é¡¼²èÌ̤عԤ¯  */
970function goSameCar(){
971
972    document.getElementById("go_finish").innerHTML = '<IMG height=47 alt=¤³¤ÎÆâÍÆ¤Ç°ÍÍê src="../image/iphone/img/next_btn.jpg" width=260 border=0>';
973
974    var f = document.frm;
975    f.action = "samecar.php";
976    f.target = "_self";
977    f.submit();
978}
979
980/* ¥«¡¼¥È´°Î»²èÌ̤عԤ¯  */
981function goFinish(){
982
983    document.getElementById("go_finish").innerHTML = '<IMG height=47 alt=¤³¤ÎÆâÍÆ¤Ç°ÍÍê src="../image/iphone/img/next_btn.jpg" width=260 border=0>';
984
985    var f = document.frm;
986    f.action = "finish.php";
987//    f.action = "finish_iphone.php";
988    f.target = "_self";
989    f.submit();
990}
991/* ²¼¼è¤êÅÐÏ¿¤Ø¹Ô¤¯  */
992function goTradeinOK(){
993
994    document.getElementById("go_finish").innerHTML = '<IMG height=47 alt=¤³¤ÎÆâÍÆ¤Ç°ÍÍê src="../image/iphone/img/next_btn.jpg" width=260 border=0>';
995
996    var f = document.frm;
997    f.action = "/goonet/php/tradein/tradein_ok.php";
998    f.target = "_self";
999    f.submit();
1000}
1001
1002/* ¥«¡¼¥È¸ÄÊ̲èÌ̤عԤ¯  */
1003function goOneCart(){
1004    document.getElementById("act").innerHTML = '<input type="hidden" name="act" value="change">';
1005    document.getElementById("go_one").innerHTML = '<input type="hidden" name="go_one" value="on">';
1006    var f = document.frm;
1007    f.action = "cart.php";
1008    f.target = "_self";
1009    f.submit();
1010}
1011
1012/* ¥«¡¼¥È°ì³ç²èÌ̤عԤ¯  */
1013function goAllCart(){
1014    document.getElementById("act").innerHTML = '<input type="hidden" name="act" value="change">';
1015    document.getElementById("go_one").innerHTML = '<input type="hidden" name="go_one" value="off">';
1016    var f = document.frm;
1017    f.action = "cart.php";
1018    f.target = "_self";
1019    f.submit();
1020}
1021
1022/* ¥«¡¼¥Èºï½ü  */
1023// param mode ¸ÄÊ̤«°ì³ç¤«
1024// param cart ¥«¡¼¥ÈÈÖ¹æ(1,2,3,4¡¦¡¦¡¦,10)
1025// param cart_num ¥«¡¼¥È¤ËÆþ¤Ã¤Æ¤ëÁí¿ô
1026function delCart(mode,cart,cart_num){
1027    var f = document.frm;
1028
1029    if (!f) {
1030        return;
1031    }
1032
1033    // "01"·Á¼°
1034    if( cart < 10 ){
1035        cart = "0" + cart;
1036    }
1037    deleteEstimateCartOne(cart);
1038
1039    var hasGnRenewal = false;
1040    var gnOptValue = '';
1041    var currentQuery = window.location.search;
1042    if (currentQuery) {
1043        var queryParams = currentQuery.substring(1).split('&');
1044        for (var q = 0; q < queryParams.length; q++) {
1045            var pair = queryParams[q].split('=');
1046            if (pair[0] === 'gn_renewal' && decodeURIComponent(pair[1] || '') === '1') {
1047                hasGnRenewal = true;
1048            }
1049            // GOO_OPE_PRJ-17692 keep the Dejam AB group across the delete reload
1050            if (pair[0] === 'gn_opt') {
1051                gnOptValue = decodeURIComponent(pair[1] || '');
1052            }
1053        }
1054    }
1055
1056    var actElement = document.getElementById("act");
1057    if (!actElement) {
1058        return;
1059    }
1060    actElement.innerHTML = '<input type="hidden" name="act" value="delete">';
1061
1062    var goOneElement = document.getElementById("go_one");
1063    if(mode == "one"){
1064        if (goOneElement) {
1065            goOneElement.innerHTML = '<input type="hidden" name="go_one" value="on">';
1066        }
1067    }else{
1068        if (goOneElement) {
1069            goOneElement.innerHTML = '<input type="hidden" name="go_one" value="off">';
1070        }
1071    }
1072
1073    if( mode == 'one' ){
1074        // 01¤È¤«Æþ¤Ã¤Æ¤¤¤ë¤Î¤Ç¡¢0¤òºï½ü
1075        if( cart < 10 ){
1076            cart = cart.charAt(1);
1077        }
1078        // ºï½üÂоݤÎʪ·ï¤Î¸å¤í¤Î¥Ç¡¼¥¿¤ò1¤Ä¤º¤Ä¤º¤é¤¹
1079        cart = parseInt(cart) ;
1080        for(var i=cart; i <= cart_num; i++ ){
1081            j = parseInt(i+1);
1082            if( j > cart_num ){ break; }
1083            // Request_TypeÍ×ÁǤ¬Â¸ºß¤¹¤ë¾ì¹ç¤Î¤ß½èÍý¡Ê¥í¡¼¥ó²¾¿³ºº/¼Öξɾ²Á½ñ¤Ç¤Ï¸ºß¤·¤Ê¤¤²ÄǽÀ­¤¬¤¢¤ë¡Ë
1084            try {
1085                if(eval("f.Request_Type"+i+"_1")) eval("f.Request_Type"+i+"_1").checked = eval("f.Request_Type"+j+"_1.checked");
1086                if(eval("f.Request_Type"+i+"_2")) eval("f.Request_Type"+i+"_2").checked = eval("f.Request_Type"+j+"_2.checked");
1087                if(eval("f.Request_Type"+i+"_3")) eval("f.Request_Type"+i+"_3").checked = eval("f.Request_Type"+j+"_3.checked");
1088                if(eval("f.Request_Type"+i+"_4")) eval("f.Request_Type"+i+"_4").checked = eval("f.Request_Type"+j+"_4.checked");
1089                if(eval("f.Request_Type"+i+"_5")) eval("f.Request_Type"+i+"_5").checked = eval("f.Request_Type"+j+"_5.checked");
1090                if(eval("f.demand_"+i)) eval("f.demand_"+i).value = eval("f.demand_"+j+".value");
1091            } catch(e) {
1092                // ¥í¡¼¥ó²¾¿³ºº/¼Öξɾ²Á½ñ¤Ê¤É¤ÇRequest_TypeÍ×ÁǤ¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï¥¹¥­¥Ã¥×
1093            }
1094        }
1095    }
1096
1097    if (document.getElementById('est_epack') != null && document.getElementById('est_epack').value != '') {
1098        let est_epack_value = document.getElementById("est_epack").value;
1099        f.action = "cart.php?baitai=" + est_epack_value + "&est_epack=" + est_epack_value;
1100    } else {
1101        f.action = "cart.php";
1102    }
1103
1104    if (hasGnRenewal) {
1105        f.action += (f.action.indexOf('?') === -1 ? '?' : '&') + 'gn_renewal=1';
1106    }
1107    // GOO_OPE_PRJ-17692 keep the Dejam AB group across the delete reload
1108    if (gnOptValue !== '') {
1109        f.action += (f.action.indexOf('?') === -1 ? '?' : '&') + 'gn_opt=' + encodeURIComponent(gnOptValue);
1110    }
1111
1112    f.target = "_self";
1113    f.submit();
1114}
1115
1116function showRestimatePopup(onOk, onCancel){
1117    var pop = document.querySelector('.popupRestimate');
1118    if(!pop){
1119        if(window.confirm('¤´ÁªÂò¤µ¤ì¤¿¼Ö¤Ï3¥õ·î°ÊÆâ¤¹¤Ç¤Ë¸«ÀѺѤߤǤ¹¡£ºÆÅÙ¸«ÀѤò¼Â»Ü¤·¤Þ¤¹¤«¡©')){ onOk(); } else { onCancel(); }
1120        return;
1121    }
1122    var okBtn = pop.querySelector('.btnList .confirm');
1123    var cancelBtn = pop.querySelector('.btnList .cancel');
1124    okBtn.onclick = function(){ pop.classList.remove('show'); onOk(); };
1125    cancelBtn.onclick = function(){ pop.classList.remove('show'); onCancel(); };
1126    pop.classList.add('show');
1127}
1128
1129/**
1130 * ¥¨¥ó¥È¥êÆþÎÏ¥Á¥§¥Ã¥¯¤ò¹Ô¤¤¤Þ¤¹(appointment.php)
1131 */
1132function checkEntryApp(shop_num){
1133    var f = document.frm;
1134    var msg = VOID_STRING;
1135
1136    for(loop=1; loop<=shop_num; loop++){
1137
1138        if(loop==1){
1139               f.shop_book_memo_1.value = replaceJisX0213String(f.shop_book_memo_1.value);
1140        }else if(loop==2){
1141               f.shop_book_memo_2.value = replaceJisX0213String(f.shop_book_memo_2.value);
1142        }else if(loop==3){
1143               f.shop_book_memo_3.value = replaceJisX0213String(f.shop_book_memo_3.value);
1144        }else if(loop==4){
1145               f.shop_book_memo_4.value = replaceJisX0213String(f.shop_book_memo_4.value);
1146        }else if(loop==5){
1147               f.shop_book_memo_5.value = replaceJisX0213String(f.shop_book_memo_5.value);
1148        }else if(loop==6){
1149               f.shop_book_memo_6.value = replaceJisX0213String(f.shop_book_memo_6.value);
1150        
1151}else if(loop==7){
1152               f.shop_book_memo_7.value = replaceJisX0213String(f.shop_book_memo_7.value);
1153        }else if(loop==8){
1154               f.shop_book_memo_8.value = replaceJisX0213String(f.shop_book_memo_8.value);
1155        }else if(loop==9){
1156               f.shop_book_memo_9.value = replaceJisX0213String(f.shop_book_memo_9.value);
1157        }else if(loop==10){
1158               f.shop_book_memo_10.value = replaceJisX0213String(f.shop_book_memo_10.value);
1159        }
1160    }
1161
1162    document.getElementById("act").innerHTML = '<input type="hidden" name="act" value="chk">';
1163
1164    // ÆþÎÏÃÍ¥Á¥§¥Ã¥¯¤Î°Ù¼«Ê¬¼«¿È¤Ø
1165    f.action = "appointment.php";
1166    f.target = "_self";
1167    f.submit();
1168}
1169
1170
1171// Í¹ÊØÈÖ¹æ¤È½»½êÀÚÂØ
1172// mode=pref¤Î¾ì¹ç¤ÏÍ¹ÊØÈÖ¹æ¤òɽ¼¨
1173// mode=zip¤Î¾ì¹ç¤Ï½»½ê¤òɽ¼¨
1174function changeZipPref( mode ){
1175    if( mode == 'zip' ) {
1176       try {
1177           document.getElementById("view_zip").style.display = "block";
1178       } catch(e) {
1179           document.getElementById("view_zip").style.display = "block";
1180       }
1181
1182       document.getElementById("view_pref").style.display = "none";
1183       document.getElementById("zip_or_pref").value = "1";
1184    } else if ( mode == 'pref' ) {
1185       
1186
1187       document.getElementById("view_zip").style.display = "none";
1188       try {
1189           document.getElementById("view_pref").style.display = "block";
1190       } catch(e) {
1191           document.getElementById("view_pref").style.display = "block";
1192       }
1193       document.getElementById("zip_or_pref").value = "2";
1194    }
1195}
1196
1197
1198// »Ô¶èĮ¼¤òajax¤Ç¼èÆÀ
1199var g_address1_value = ''; // Ajax´°Î»¸å¤ËÀßÄꤹ¤ë»Ô¶èĮ¼¤ÎÃÍ
1200var g_is_restoring_pref_address = false; // Éü¸µÃæ¥Õ¥é¥°¡Ê·Ù¹ðʸ¸À¤Î°ì»þÍÞ»ßÍÑ¡Ë
1201
1202// jQuery 1.6·Ï¤Ç¤â³°ÉôJS¤Î¥Í¥¤¥Æ¥£¥Ö¥ê¥¹¥Ê¡¼¤Ë³Î¼Â¤ËÄÌÃΤ¹¤ë¤¿¤á¡¢
1203// ¥Í¥¤¥Æ¥£¥Ö change ¤òÍ¥À褷¤ÆÈ¯²Ð¤·¡¢¥Í¥¤¥Æ¥£¥Öȯ²Ð¤Ç¤­¤Ê¤¤¾ì¹ç¤Î¤ß jQuery trigger ¤Ë¥Õ¥©¡¼¥ë¥Ð¥Ã¥¯¤¹¤ë
1204function triggerChangeBoth($el) {
1205    if (!$el || !$el.length) {
1206        return;
1207    }
1208    var el = $el[0];
1209    var nativeFired = false;
1210
1211    // ¥Í¥¤¥Æ¥£¥Ö change ¤òÍ¥À褷¤ÆÈ¯²Ð¡Êbubbles=true ¤Ç document ¥ê¥¹¥Ê¡¼¤Ë¤âÆÏ¤¯¡Ë
1212    try {
1213        if (el) {
1214            if (typeof el.dispatchEvent === 'function') {
1215                if (typeof Event === 'function') {
1216                    el.dispatchEvent(new Event('change', { bubbles: true }));
1217                    nativeFired = true;
1218                } else if (document.createEvent) {
1219                    var evt = document.createEvent('HTMLEvents');
1220                    evt.initEvent('change', true, false);
1221                    el.dispatchEvent(evt);
1222                    nativeFired = true;
1223                }
1224            }
1225
1226            // IEÍÑ¡ÊdispatchEvent ¤¬¤Ê¤¤´Ä¶­¡Ë
1227            if (!nativeFired && typeof el.fireEvent === 'function') {
1228                el.fireEvent('onchange');
1229                nativeFired = true;
1230            }
1231        }
1232    } catch (e) {
1233        nativeFired = false;
1234    }
1235
1236    // ¥Õ¥©¡¼¥ë¥Ð¥Ã¥¯¡§¥Í¥¤¥Æ¥£¥Öȯ²Ð¤¬¤Ç¤­¤Ê¤¤¾ì¹ç¤Î¤ß jQuery trigger
1237    if (!nativeFired) {
1238        try {
1239            $el.trigger('change');
1240        } catch (e) {
1241            // noop
1242        }
1243    }
1244}
1245
1246function syncPrefErrorDisplay() {
1247    try {
1248        if (!$('#view_pref').length || $('#view_pref').css('display') === 'none') {
1249            return;
1250        }
1251        var stateVal = $("select[name='state']").val();
1252        var address1Val = $("select[name='address1']").val();
1253        var $err = $('.warn_pref_error');
1254        if (!$err.length) {
1255            return;
1256        }
1257        // Éü¸µ½èÍýÃæ¤Ï°ì»þŪ¤Ë·Ù¹ð¤òÍ޻ߡÊAJAX¤Ç»Ô¶èĮ¼¤¬Ëä¤Þ¤ë¤Þ¤Ç¡Ë
1258        if (g_is_restoring_pref_address) {
1259            $err.addClass('no_show');
1260            return;
1261        }
1262        if (stateVal && address1Val) {
1263            $err.addClass('no_show');
1264        } else {
1265            $err.removeClass('no_show');
1266        }
1267    } catch (e) {
1268        // noop
1269    }
1270}
1271
1272function changeCity(doclevel,pref,address1) {
1273    g_address1_value = address1; // ¥°¥í¡¼¥Ð¥ëÊÑ¿ô¤ËÊݸ
1274    if( pref != "" ){
1275        var params = "pref_str="+pref+"&address1="+address1;
1276
1277        XMLHttpRequestByPostAddress(params);
1278    }else{
1279        document.getElementById("address1_view").innerHTML = "<select name='address1'><option value=''>»Ô¶èĮ¼</option></select>";
1280
1281
1282/* prototype.js¤ò»ÈÍѤ·¤Ê¤¤¤è¤¦¤ËÊѹ¹ aoki 20090218
1283        var params = "pref_str="+pref+"&address1="+address1;
1284        var options = {
1285            method : 'post',
1286            parameters : params,
1287            onComplete: function(request){DispCity(request);},
1288            onFailure: DispResult
1289        };
1290
1291        var addpath = "";
1292        if(doclevel){
1293            for(var i=0; i<doclevel; i++){
1294                addpath += '../';
1295            }
1296        }
1297
1298         new Ajax.Request(addpath + 'ajax_addlist.php', options);
1299*/
1300    }
1301}
1302
1303function replaceJisX0213String(string){
1304
1305    var REPLACE_STRING = " ";
1306
1307    // windows¤Î¤ß¼Â¹Ô¤¹¤ë
1308    user_agent = navigator.userAgent.toUpperCase();
1309    if(user_agent.indexOf("WIN") < 0) return string;
1310
1311    var rtnValue = "";
1312    for(var i = 0; i < string.length; i++){
1313
1314        var c = string.charAt(i);
1315
1316        //¥µ¥í¥²¡¼¥È¥Ú¥¢Ê¸»ú¤«¤É¤¦¤«¥Á¥§¥Ã¥¯
1317        if(!checkSurrogates(c)){
1318            //¥µ¥í¥²¡¼¥Èʸ»ú
1319            rtnValue = rtnValue + REPLACE_STRING;
1320            i++;
1321        //
1322        }else if(!checkSjis(c)){
1323            //SJISÊÑ´¹ÉÔ²Ä
1324            rtnValue = rtnValue + REPLACE_STRING;
1325            //¤½¤ì°Ê³°¤ÏÏ¢·ë
1326        }else{
1327            rtnValue = rtnValue + c;
1328        }
1329    }
1330    return rtnValue;
1331}
1332
1333function checkSjis(string) {
1334
1335    var result = EscapeSJIS(string);
1336    result = UnescapeSJIS(result);
1337    if (result == "¡¦") {
1338        return false;
1339    }
1340
1341    return true;
1342}
1343
1344function checkSurrogates(string){
1345    //¥µ¥í¥²¡¼¥È¥Ú¥¢¤Ç¤Ï¤Ê¤¤¡§true ¥µ¥í¥²¡¼¥È¥Ú¥¢¤Ç¤¢¤ë¡§false
1346    return string.match(new RegExp("^[^\uD800-\uDBFF\uDC00-\uDFFF]+$"));
1347}
1348
1349
1350// changeCity¤òᤤ¤¿»þ¤Îajax¤ÎÌá¤ê¥á¥½¥Ã¥É
1351function DispCity(request) {
1352    var content = request.responseText;
1353    if( content != null ){
1354        document.getElementById("address1_view").innerHTML = content;
1355        
1356        // DOM¤Î¹¹¿·¤òÂÔµ¡
1357        setTimeout(function(){
1358            var address1Select = $("select[name='address1']");
1359            
1360            // ¥°¥í¡¼¥Ð¥ëÊÑ¿ô¤ËÊݸ¤µ¤ì¤¿»Ô¶èĮ¼¤ÎÃͤòÀßÄê
1361            if (g_address1_value) {
1362                address1Select.val(g_address1_value);
1363                g_address1_value = ""; // Ãͤò»ÈÍѤ·¤¿¤é¥¯¥ê¥¢
1364            }
1365            
1366            // Ãͤ¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¥Ð¥ê¥Ç¡¼¥·¥ç¥ó¤ò¼Â¹Ô
1367            if (address1Select.val() && address1Select.val() !== '') {
1368                address1Select.addClass('active');
1369                // change¥¤¥Ù¥ó¥È¤òȯ²Ð¤·¤Æ³Æ¼ïȽÄê¤ò¥È¥ê¥¬¡¼
1370                triggerChangeBoth(address1Select);
1371                // Éü¸µ´°Î»
1372                g_is_restoring_pref_address = false;
1373                syncPrefErrorDisplay();
1374                
1375                // ¥Ð¥ê¥Ç¡¼¥·¥ç¥ó¾õÂÖ¤ò¹¹¿·
1376                if(typeof(fc) != "undefined" && fc.checkAllState){
1377                    fc.isCheckedInputs.address1 = true;
1378                    fc.checkAllState("DispCity after change");
1379                }
1380            }
1381        }, 10);
1382        
1383        //ANG_PRJ-2171
1384        if(($("#selectaddress").val() != "")){
1385            $("select[name='address1']").css('background-color','white');
1386        }
1387        $("#selectaddress").focus(function(){
1388
1389          $(this).css('background-color','white');
1390        }).blur(function(){
1391          if( $(this).val() == ""){
1392             $(this).css('background-color','#ffe2e2');
1393          }
1394       });
1395    }
1396    
1397}
1398
1399// POSTÌá¤ê¤ÇÃÍ¥»¥Ã¥È
1400function setZipORPref( zip_or_pref, state, address1 ) {
1401    var f = document.frm;
1402    if( zip_or_pref == "2" ) {
1403        // Éü¸µ³«»Ï¡§»Ô¶èĮ¼¤ÎAJAX¤¬ÊÖ¤ë¤Þ¤Ç·Ù¹ð¤òÍÞ»ß
1404        g_is_restoring_pref_address = true;
1405        try {
1406            $('.warn_pref_error').addClass('no_show');
1407        } catch (e) {
1408            // noop
1409        }
1410
1411        // ¥Õ¥©¡¼¥ë¥Ð¥Ã¥¯¡§AJAX¤¬¼ºÇÔ/Ãٱ䤷¤Æ¤â·Ù¹ð¤¬±Êµ×¤ËÍ޻ߤµ¤ì¤Ê¤¤¤è¤¦¤Ë¤¹¤ë
1412        setTimeout(function(){
1413            g_is_restoring_pref_address = false;
1414            syncPrefErrorDisplay();
1415        }, 1500);
1416
1417        changeZipPref( 'pref' );
1418        if( state != "" ){
1419            var stateSelect = $("select[name='state']");
1420            stateSelect.val(state);
1421            
1422            // Ãͤ¬ÀßÄꤵ¤ì¤¿¤éactive¥¯¥é¥¹¤òÄɲä·¤ÆÄ̾￧¤Ë
1423            if (stateSelect.val() && stateSelect.val() !== '') {
1424                stateSelect.addClass('active');
1425            }
1426            
1427            changeCity(0,state, address1);
1428            
1429            // changeCity()¤Î´°Î»¤òÂԤäƤ«¤é¥Ð¥ê¥Ç¡¼¥·¥ç¥ó¾õÂÖ¤ò¹¹¿·
1430            setTimeout(function(){
1431                if(typeof(fc) != "undefined" && fc.checkAllState){
1432                    fc.isCheckedInputs.address1 = true;
1433                    fc.checkAllState("setZipORPref after changeCity");
1434                }
1435                syncPrefErrorDisplay();
1436            }, 100);
1437        }
1438    } else {
1439        changeZipPref( 'zip' );
1440    }
1441}
1442
1443/**
1444 * ÅÅÏÃÈÖ¹æ ¤ÎinputÍ×ÁÇɽ¼¨¤òÀÚ¤êÂØ¤¨¤ë
1445 *
1446 * modified ɬ¿Ü¡¦Ç¤°Õ¤Îɽ¼¨¡¦Èóɽ¼¨ÀÚ¤êÂØ¤¨
1447 */
1448function toggleInputCusTel(element)
1449{
1450    var cus_tel  = document.frm.cus_tel;
1451    // getElementById¤Ç¼è¤Ã¤¿Êý¤¬¤¤¤¤¤«¤â¤À¤±¤É¤Ê¤ó¤«¾å¤¬¤³¤¦¤Ê¤Ã¤Æ¤ë¤«¤é¹ç¤ï¤»¤¿
1452    var loan_flg = document.frm.loan_name;
1453    // 
1454    if (element.checked) {
1455        cus_tel.className = "txt optionInput required";
1456        document.getElementById("Request4_comment").style.display = "";
1457    } else {
1458        cus_tel.className = "txt optionInput";
1459        document.getElementById("Request4_comment").style.display = "none";
1460    }
1461
1462    //Í×ÁǤΥÁ¥§¥Ã¥¯¡¢
1463    if (element.checked == true) {
1464        toggleLoadCusTel(true);
1465    } else {
1466        toggleLoadCusTel(false);
1467    }
1468}
1469
1470/**
1471 * inputÍ×ÁǤÎɽ¼¨¡¦Èóɽ¼¨
1472 * 
1473 */
1474function toggleLoadCusTel(state)
1475{
1476       //dd¥¿¥°¤ÎID¼èÆÀ
1477    var cus_div = document.getElementById("cus_div_req");
1478    var cus_telid = document.getElementById("cus_teldd");
1479    var cus_teldt = document.getElementById("cus_teldt");
1480
1481    var cus_tel_input = document.getElementById("cus_tel_input");
1482    var cus_tel_input_2 = document.getElementById("cus_tel_input_2");
1483    //Í×ÁǤΥÁ¥§¥Ã¥¯¡¢
1484    if (state == true) {
1485         cus_div.style.display = "block";
1486         cus_telid.style.display = "none";
1487         cus_teldt.style.display = "none";
1488    } else {
1489         cus_div.style.display = "none";
1490         cus_telid.style.display = "block";
1491         cus_teldt.style.display = "block";
1492    }
1493
1494}
1495
1496/* ANG_PRJ-1951 150602 Matayoshi */
1497$(function(){
1498	$('.typeArea .error').each(function(){
1499		$(this).parents('.typeArea').find('.txtCenter textarea').css('background-color','#ffe2e2');
1500	});
1501});
1502
1503function checkRecaptchav3(f) {
1504    grecaptcha.ready(function () {
1505        grecaptcha.execute('6LfaUbodAAAAAEgDNeoLbLHQtQ4fLQ7kva6-1PTe', { action: 'estimate' }).then(function (token) { // reCAPTCHAv3 ¥µ¥¤¥È¥­¡¼
1506            // post¥Ñ¥é¥á¡¼¥¿"g-recaptcha-response"ÄɲÃ
1507            appendGrr = document.createElement('input');
1508            appendGrr.setAttribute('type', 'hidden');
1509            appendGrr.setAttribute('name', 'g-recaptcha-response');
1510            appendGrr.setAttribute('value', token);
1511            // post¥Ñ¥é¥á¡¼¥¿"action"ÄɲÃ
1512            appendAct = document.createElement('input');
1513            appendAct.setAttribute('type', 'hidden');
1514            appendAct.setAttribute('name', 'action');
1515            appendAct.setAttribute('value', 'estimate');
1516    
1517            f.appendChild(appendGrr);
1518            f.appendChild(appendAct);
1519            // reCAPTCHAv3¸¡¾Ú
1520            $.ajax({
1521                url: '/goonet/php/estimate/recaptchav3.php',
1522                type: 'post',
1523                data: { token: token },
1524            }).done(function (data) {
1525                // data¤¬´û¤Ë¥ª¥Ö¥¸¥§¥¯¥È¤Î¾ì¹ç¤Ï¤½¤Î¤Þ¤Þ»ÈÍÑ¡¢Ê¸»úÎó¤Î¾ì¹ç¤Ï¥Ñ¡¼¥¹
1526                if (typeof data === 'string') {
1527                    data = JSON.parse(data);
1528                }
1529                // reCAPTCHAv3¸¡¾ÚÀ®¸ù¤ÇÁ÷¿®
1530                if (data.success) {
1531                    var source_client_list = document.getElementById("source_client_list");
1532                    source_client_list.value = getCookie('source_client_list');
1533                    f.submit();
1534                } else {
1535                    checkRecaptchav2(f);
1536                }
1537            }).fail(function(jqXHR, textStatus, errorThrown) {
1538                // AjaxÄÌ¿®¥¨¥é¡¼½èÍý
1539            });
1540        });
1541    });
1542}
1543// reCAPTCHAv3¸¡¾Ú¼ºÇÔ¤ÇreCAPTCHAv2¸¡¾Ú¤Ø°Ü¹Ô
1544function checkRecaptchav2(f) {
1545    grecaptcha.ready(function () {
1546        // reCAPTCHAv2¥ì¥ó¥À¥ê¥ó¥°ÍѤËJSÆÉ¹þ¥¿¥°¤òÄɲÃ
1547        var appendScript = document.createElement("script");
1548        appendScript.src = 'https://www.google.com/recaptcha/api.js?render=explicit';
1549        appendScript.async = true;
1550        appendScript.defer = true;
1551        document.head.appendChild(appendScript);
1552        // post¥Ñ¥é¥á¡¼¥¿"recaptcha"ÃÍÊѹ¹
1553        f.recaptcha.value = "v2";
1554
1555        if (widgetId === '') {
1556            widgetId = grecaptcha.render(document.getElementById('recaptchav2'), {
1557                'sitekey': '6LcwU7odAAAAAPwTBoQZLv2DngD_qtY7mlLGCK8c', // reCAPTCHAv2 ¥µ¥¤¥È¥­¡¼
1558                'size': 'invisible',
1559                'callback': function (token) {
1560                    document.querySelector('input[name="g-recaptcha-response"]').value = token;
1561                    var source_client_list = document.getElementById("source_client_list");
1562                    source_client_list.value = getCookie('source_client_list');
1563                    f.submit();
1564                }
1565            });
1566        }
1567        grecaptcha.execute(widgetId);
1568    });
1569}

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.