PageSourceSearch

https://js.carpetexpress.com/js/bottom.js?ver=17092026

js carpetexpress.com collected 2026-10-05 02:07:58 UTC 32,791 bytes, 1,067 lines download raw bytes

1$(function () {
2	$('#SubscribeForm').validate({
3		rules: {
4			news_email: {
5				required: true,
6				email: true,
7			},
8		},
9		messages: {
10			news_email: {
11				required: "Please enter an email address",
12				email: "Please enter a vaild email address"
13			},			
14		},
15		errorElement: 'div',
16		errorPlacement: function (error, element) {		
17			element.closest('.error-selector').append(error);
18		},		
19		submitHandler: function(form) {
20			$.ajax({
21				url: form.action,
22				type: form.method,
23				data: $(form).serialize(),
24				headers: {
25				'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
26				},
27				success: function(data) {
28					if($('#subscribe-success-modal'))
29						$('#subscribe-success-modal').remove();
30					$('body').append(data);
31					//$('#subscribe-success-modal').modal('show');
32					const modalEl = document.getElementById('subscribe-success-modal');
33					const modal = new bootstrap.Modal(modalEl);
34					modal.show();
35				}            
36			});
37		}
38	});
39});
40
41function scrollToDiv(divId)
42{		 
43		var divOffset = $('#'+divId).offset().top;
44		var headerhieght = $('header').height();
45		if(headerhieght < 169)
46			headerhieght = 169;
47		$(window).scrollTop(divOffset - headerhieght);
48}
49
50
51
52$(function () {
53	$('#FlyoutPopupForm').validate({
54		rules: {
55			news_email: {
56				required: true,
57				email: true,
58			},
59		},
60		messages: {
61			news_email: {
62				required: "Please enter an email address",
63				email: "Please enter a vaild email address"
64			},			
65		},
66		errorElement: 'div',
67		errorPlacement: function (error, element) {		
68			element.closest('.error-selector').append(error);
69		},		
70		submitHandler: function(form) {
71			$('#popupemailerrordiv').text('');
72			$.ajax({
73				url: form.action,
74				type: form.method,
75				data: $(form).serialize(),
76				headers: {
77				'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
78				},
79				success: function(data) {
80					if(data == 'Success')
81					{
82						$('#popupemailerrordiv').addClass('green-color');
83						$('#popupemailerrordiv').removeClass('red-color');
84						$('#popupemailerrordiv').text('Your email address has been subscribed successfully.');
85					}
86					else if(data == 'alreadySubscribe')
87					{
88						$('#popupemailerrordiv').addClass('red-color');
89						$('#popupemailerrordiv').removeClass('green-color');
90						$('#popupemailerrordiv').text('Your email address already subscribed.');						
91					}
92					else
93					{
94						$('#popupemailerrordiv').addClass('red-color');
95						$('#popupemailerrordiv').removeClass('green-color');
96						$('#popupemailerrordiv').text('Something went wrong. Please try again.');
97					}
98				}            
99			});
100		}
101	});
102});
103
104
105$('.coloHover').mouseover(function(){
106	
107	var eleImg = $(this).find('img');
108	var prdId = eleImg.data('prdid');
109	$('#prdImg'+prdId).attr('src',eleImg.data('mediumimg'));
110});
111
112$('.coloHover').mouseout(function(){
113
114	var eleImg = $(this).find('img');	
115	var prdId = eleImg.data('prdid');
116	$('#prdImg'+prdId).attr('src',$('#prdImg'+prdId).data('src'));
117});
118
119function acc_call_coverage(acc_prod_id)
120{	
121	var Is_ItemSale_On_PerBoxRoll 	= $('#acc_Is_ItemSale_On_PerBoxRoll_'+acc_prod_id).val();
122	var per_box_cartons_roll 		= $('#acc_per_box_cartons_roll_'+acc_prod_id).val();
123	var minimum_order_qty 			= $('#acc_minimum_order_qty_'+acc_prod_id).val();
124
125	var item_sale_price_sf 			= $('#acc_item_sale_price_sf_'+acc_prod_id).val();
126	var item_sale_price_pp 			= $('#acc_item_sale_price_pp_'+acc_prod_id).val();
127	var item_sale_price_f 			= $('#acc_item_sale_price_f_'+acc_prod_id).val();
128		
129	
130	var qty_value	= $('#acc_calc_quantity_'+acc_prod_id).val();
131	
132	
133	
134	if(Is_ItemSale_On_PerBoxRoll =='Yes' && qty_value > 0 && per_box_cartons_roll > 0)
135	{
136		var toal_box = (qty_value/per_box_cartons_roll);
137		
138		if(IsNumeric(''+toal_box+''))
139		{
140			var toal_box_value = parseInt(toal_box);
141		}
142		else 
143		{
144			var toal_box_value = parseInt(toal_box)+1;
145		}
146		
147		$('#acc_item_quantity_'+acc_prod_id).val(toal_box_value);
148		
149		var toal_sf_value = parseFloat(toal_box_value * per_box_cartons_roll).toFixed(2);
150		
151		if(item_sale_price_sf > 0)
152		{
153			var str_sb_total = "$"+((parseFloat(toal_sf_value) * parseFloat(item_sale_price_sf)).toFixed(2));
154			$('#acc_item_subtotal_'+acc_prod_id).html(str_sb_total);
155		}
156		else if(item_sale_price_f > 0)
157		{
158			var str_sb_total = "$"+((parseFloat(toal_sf_value) * parseFloat(item_sale_price_f)).toFixed(2));			
159			$('#acc_item_subtotal_'+acc_prod_id).html(str_sb_total);
160		}
161		else if(item_sale_price_pp > 0)
162		{
163			var str_sb_total = "$"+((parseFloat(toal_sf_value) * parseFloat(item_sale_price_pp)).toFixed(2));			
164			$('#acc_item_subtotal_'+acc_prod_id).html(str_sb_total);
165		}
166	}
167	else if(qty_value > 0)
168	{		
169		$('#acc_item_quantity_' + acc_prod_id).val(parseInt(qty_value));		
170		if(item_sale_price_sf > 0)
171		{
172			var str_sb_total = "$"+((parseFloat(item_sale_price_sf) * parseFloat(qty_value)).toFixed(2));			
173			$('#acc_item_subtotal_' + acc_prod_id).html(str_sb_total);
174		}
175		else if(item_sale_price_f > 0)
176		{
177			var str_sb_total = "$"+((parseFloat(item_sale_price_f) * parseFloat(qty_value)).toFixed(2));			
178			$('#acc_item_subtotal_' + acc_prod_id).html(str_sb_total);
179		}
180		else if(item_sale_price_pp > 0)
181		{
182			var str_sb_total = "$"+((parseFloat(item_sale_price_pp) * parseFloat(qty_value)).toFixed(2));			
183			$('#acc_item_subtotal_' + acc_prod_id).html(str_sb_total);
184		}
185	}
186}
187function IsNumeric(strString)
188{
189   var strValidChars = "0123456789";
190   var strChar;
191   var blnResult = true;
192  
193   if(strString.length == 0) 
194   {	
195	   return false;
196   }
197   
198   //  test strString consists of valid characters listed above
199   for(i = 0; i < strString.length && blnResult == true; i++)
200   {
201	 strChar = strString.charAt(i);
202	 if(strValidChars.indexOf(strChar) == -1)
203	 {
204		blnResult = false;
205	 }
206   }
207   return blnResult;
208}
209
210function AddToCart_Ajax(prod_type,products_id,from="pdetail")
211{
212	if(prod_type == 'main')
213	{
214		var prod_qty = $('#calc_quantity').val();
215		if(prod_qty =='' )
216		{
217			$("#qty-error").text("Please enter quantity value.");
218			if(from == "pdetail")
219				$('#calc_quantity').focus();			
220			return false;
221		}
222		if(isNaN(prod_qty) )
223		{
224			$("#qty-error").text("Please enter only numeric quantity value.");
225			if(from == "pdetail")
226				$('#calc_quantity').focus();			
227			return false;
228		}
229		var minimum_order_qty 	= parseInt($('#frmItemCalc input[name="minimum_order_qty"]').val());
230		if(prod_qty != 1 && prod_qty < minimum_order_qty )
231		{
232			$("#qty-error").text("Please enter minimum quantity value.");
233			if(from == "pdetail")
234				$('#calc_quantity').focus();			
235			return false;
236		}
237		$("#qty-error").text("");
238		var add_prod_id = parseInt($('#frmItemCalc input[name="products_id"]').val());
239		var add_qty 	= parseInt($('#frmItemCalc input[name="item_quantity"]').val());
240		if(parseInt($('#frmItemCalc input[name="minimum_order_qty"]').val()) != 1 && prod_qty == 1)
241			$('#frmShopCart input[name="is_entered_qty_1"]').val(1);
242		
243		$('#frmShopCart input[name="products_id"]').val(add_prod_id);
244		$('#frmShopCart input[name="quantity"]').val(add_qty);
245		$('#frmShopCart input[name="is_sample_order"]').val(0);
246		$('#frmShopCart input[name="is_price_quote"]').val(0);
247	}	
248	if(prod_type == 'accessory')
249	{
250		var prod_qty = $('#acc_calc_quantity_'+products_id).val();
251		if(prod_qty =='' )
252		{
253			$("#qty-error_"+products_id).text("Please enter quantity value.");
254			$('#acc_calc_quantity_'+products_id).focus();
255			return false;
256		}
257		if(isNaN(prod_qty))
258		{
259			$("#qty-error_"+products_id).text("Please enter only numeric quantity value.");
260			$('#acc_calc_quantity_'+products_id).focus();
261			return false;
262		}
263		var minimum_order_qty 	= parseInt($('#frmItemAccessory input[name="acc_minimum_order_qty_'+products_id+'"]').val());
264		if(prod_qty < minimum_order_qty )
265		{
266			$("#qty-error_"+products_id).text("Please enter minimum quantity value.");
267			$('#acc_calc_quantity_'+products_id).focus();
268			return false;
269		}
270		$("#qty-error_"+products_id).text("");
271		var add_prod_id = parseInt($('#frmItemAccessory input[name="acc_products_id_'+products_id+'"]').val());
272		var add_qty 	= parseInt($('#frmItemAccessory input[name="acc_item_quantity_'+products_id+'"]').val());
273		if(from != 'product-detail' && from != 'pdetail')
274		{
275			if($('#frmShopCart'))
276					$('#frmShopCart').remove();
277			$('body').append('<form name="frmShopCart" id="frmShopCart" action="'+site_url+'/shoppingcart-ajax'+'" method="post"><input type="hidden" name="actiononcart"  value="add" />	<input type="hidden" name="products_id"  value="0" />	<input type="hidden" name="quantity"  value="1" />	<input type="hidden" name="is_sample_order"  value="0" />	<input type="hidden" name="is_price_quote"  value="0" /><input type="hidden" name="is_entered_qty_1"  value="0" /></form>');
278		}
279		$('#frmShopCart input[name="products_id"]').val(add_prod_id);
280		$('#frmShopCart input[name="quantity"]').val(add_qty);
281		$('#frmShopCart input[name="is_sample_order"]').val(0);
282		$('#frmShopCart input[name="is_price_quote"]').val(0);
283		$('#frmShopCart input[name="is_entered_qty_1"]').val(0);
284	}
285	/* For Products Sample Code Start */
286	if(prod_type == 'sample')
287	{
288		if(from != 'product-detail' && from != 'pdetail')
289		{
290			if($('#frmShopCart'))
291					$('#frmShopCart').remove();
292			$('body').append('<form name="frmShopCart" id="frmShopCart" action="'+site_url+'/shoppingcart-ajax'+'" method="post"><input type="hidden" name="actiononcart"  value="add" />	<input type="hidden" name="products_id"  value="0" />	<input type="hidden" name="quantity"  value="1" />	<input type="hidden" name="is_sample_order"  value="0" />	<input type="hidden" name="is_price_quote"  value="0" />
292<input type="hidden" name="is_price_quote"  value="0" /> <input type="hidden" name="is_entered_qty_1"  value="0" /></form>');
293		}
294		var add_prod_id = products_id;
295		var add_qty 	= 1;
296				
297		$('#frmShopCart input[name="products_id"]').val(add_prod_id);
298		$('#frmShopCart input[name="quantity"]').val(add_qty);
299		$('#frmShopCart input[name="is_sample_order"]').val(1);
300		$('#frmShopCart input[name="is_price_quote"]').val(0);
301		$('#frmShopCart input[name="is_entered_qty_1"]').val(0);
302		
303	}
304	/* For Products Sample Code End */
305	
306	/* For Products Quote Request Code Start */
307	if(prod_type == 'price_quote')
308	{
309		var add_prod_id = products_id;
310		var add_qty 	= 1;
311				
312		$('#frmShopCart input[name="products_id"]').val(add_prod_id);
313		$('#frmShopCart input[name="quantity"]').val(add_qty);
314		$('#frmShopCart input[name="is_sample_order"]').val(0);
315		$('#frmShopCart input[name="is_price_quote"]').val(1);
316		$('#frmShopCart input[name="is_entered_qty_1"]').val(0);
317		
318	}
319	/* For Products Quote Request Code End */;
320	
321	//$('#checkout').modal('show');
322	if(prod_type == 'sample' || prod_type == 'price_quote' )
323	{
324		//$('#checkout').modal('show');
325	}
326	$("#page-spinner").show();	
327	$.ajax({
328			url: document.frmShopCart.action,
329			type: document.frmShopCart.method,
330			data: $('form#frmShopCart').serialize(),			 			 
331			cache: false,
332			headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
333			beforeSend: function() 
334			{},
335			success: (function(data, status) 
336			{			 
337				if(from == 'shoppingcart'){
338					$('#active_add_to_cart_'+products_id).replaceWith('<span class="red-color txt-12">Item has been added to your cart</span>');
339				}
340				else{
341					if($('#add-cart-modal'))
342						$('#add-cart-modal').remove();
343					$('body').append(data);
344					//$('#add-cart-modal').modal('show');
345					const modalEl = document.getElementById('add-cart-modal');
346					const modal = new bootstrap.Modal(modalEl);
347					modal.show();
348					if($('#quick-view-modal').length == 1)				
349						$('#quick-view-modal').find('.btn-close').trigger('click');
350					
351				}					
352			}),
353			complete: (function(){
354				$("#page-spinner").hide();
355				$.ajax({
356					url: site_url+'/refresh-minicart',
357					type: 'get',			 			 
358					cache: false,
359					headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
360					beforeSend: function() 
361					{},
362					success: (function(data, status) 
363					{			  
364						$('.header_cart').replaceWith(data);
365					})
366					  
367				});
368			})
369			  
370		});
371	
372
373	return false;
374}
375
376function refreshCaptcha()
377{
378	$.ajax({
379		type: 'get',
380		url: site_url+'/refresh-captcha',
381		success:function(data) {
382			$('.captcha-image').html(data.captcha);
383		}
384	});
385}
386
387var interval = setInterval(function () { if($('.captcha-image').length > 0){refreshCaptcha();} }, 3600000); //1 hrs
388
389
390
391function AddToDisysCart_Ajax(prod_type,products_id,from="disys-pdetail")
392{
393	/* For Products Sample Code Start */
394	if(prod_type == 'sample')
395	{
396		if(from != 'disys-product-detail' && from != 'disys-pdetail')
397		{
398			 /*let checked = $(`input[id^="singlebundle-${products_id}-"]:checked`).length;
399			 $(".chk-error-"+products_id).text("");
400			 if(checked == 0){
401				$(".chk-error-"+products_id).text("Please select atleast one roll.");
402				return false;	
403			 }*/
404			if($('#frmShopCart'))
405					$('#frmShopCart').remove();
406			$('body').append('<form name="frmShopCart" id="frmShopCart" action="'+site_url+'/disys-shoppingcart-ajax'+'" method="post"><input type="hidden" name="actiononcart"  value="add" />	<input type="hidden" name="products_id"  value="0" />	<input type="hidden" name="quantity"  value="1" />	<input type="hidden" name="is_sample_order"  value="1" />	<input type="hidden" name="is_price_quote"  value="0" /> <input type="hidden" name="is_entered_qty_1"  value="0" /></form>');
407		}
408		var add_prod_id = products_id;
409		var add_qty 	= 1;
410				
411		$('#frmShopCart input[name="actiononcart"]').val('add');
412		$('#frmShopCart input[name="products_id"]').val(add_prod_id);
413		$('#frmShopCart input[name="quantity"]').val(add_qty);
414		$('#frmShopCart input[name="is_sample_order"]').val(1);
415		$('#frmShopCart input[name="is_price_quote"]').val(0);
416		$('#frmShopCart input[name="is_entered_qty_1"]').val(0);
417		
418		if(from != 'disys-product-detail' && from != 'disys-pdetail')
419		{
420		
421			$('.singlebundle-' + products_id + ':checked').each(function () {
422				var val = $(this).val();
423
424				$('#frmShopCart').append(
425					'<input type="hidden" name="singlebundle[]" value="' + val + '">'
426				);
427			});
428		}
429		
430	}
431	/* For Products Sample Code End */
432	
433	$("#page-spinner").show();	
434	$.ajax({
435			url: document.frmShopCart.action,
436			type: document.frmShopCart.method,
437			data: $('form#frmShopCart').serialize(),			 			 
438			cache: false,
439			headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
440			beforeSend: function() 
441			{},
442			success: (function(data, status) 
443			{			 
444				if($('#add-cart-modal'))
445					$('#add-cart-modal').remove();
446				$('body').append(data);
447				//$('#add-cart-modal').modal('show');
448				const modalEl = document.getElementById('add-cart-modal');
449				const modal = new bootstrap.Modal(modalEl);
450				modal.show();
451				
452			}),
453			complete: (function(){
454				$("#page-spinner").hide();
455				$("#disys-cart-count").text($("#TotalItemInCart").val());
456			})
457			  
458		});
459	
460
461	return false;
462}
463
464
465function AddToDisysQuote_Ajax(products_id,from="disys-pdetail")
466{
467	if(from != 'disys-product-detail' && from != 'disys-pdetail')
468	{
469		 let checked = $(`input[id^="singlebundle-${products_id}-"]:checked`).length;
470		 $(".chk-error-quote-"+products_id).text("");
471		 if(checked == 0){
472			$(".chk-error-quote-"+products_id).text("Please select atleast one roll.");
473			return false;	
474		 }
475		if($('#frmShopCart'))
476				$('#frmShopCart').remove();
477		$('body').append('<form name="frmShopCart" id="frmShopCart" action="'+site_url+'/disys-shoppingcart-ajax'+'" method="post"><input type="hidden" name="actiononcart"  value="addtoquote" />	<input type="hidden" name="products_id"  value="'+products_id+'" />	<input type="hidden" name="quantity"  value="1" />	<input type="hidden" name="is_sample_order"  value="0" />	<input type="hidden" name="is_price_quote"  value="0" /> <input type="hidden" name="is_entered_qty_1"  value="0" /></form>');
478	
479	
480		$('.singlebundle-' + products_id + ':checked').each(function () {
481			var val = $(this).val();
482
483			$('#frmShopCart').append(
484				'<input type="hidden" name="singlebundle[]" value="' + val + '">'
485			);
486		});
487	}
488	
489		$('#frmShopCart input[name="actiononcart"]').val('addtoquote');
490		$('#frmShopCart input[name="products_id"]').val(products_id);
491		$('#frmShopCart input[name="quantity"]').val(1);
492		$('#frmShopCart input[name="is_sample_order"]').val(0);
493		$('#frmShopCart input[name="is_price_quote"]').val(0);
494		$('#frmShopCart input[name="is_entered_qty_1"]').val(0);
495		
496
497	$("#page-spinner").show();	
498	$.ajax({
499			url: document.frmShopCart.action,
500			type: document.frmShopCart.method,
501			data: $('form#frmShopCart').serialize(),			 			 
502			cache: false,
503			headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
504			beforeSend: function() 
505			{},
506			success: (function(data, status) 
507			{			 
508				if($('#add-quote-modal'))
509					$('#add-quote-modal').remove();
510				$('body').append(data);
511				//$('#add-quote-modal').modal('show');
512				const modalEl = document.getElementById('add-quote-modal');
513				const modal = new bootstrap.Modal(modalEl);
514				modal.show();
515				
516			}),
517			complete: (function(){
518				$("#page-spinner").hide();
519				$("#disys-quote-count").text($("#TotalItemInQuoteCart").val());
520			})
521			  
522		});
523	
524
525	return false;
526}
527
528function requestAQuoteDisysPopup()
529{
530	data_str = 'is_popup=yes';
531	
532	$("#page-spinner").show();
533	$.ajax({
534		url: site_url+'/disys-request-quote.html',
535		type: 'GET',
536		data: data_str,
537		cache: false,
538		timeout: 90000,		
539		success: function(data) {	
540			//console.log(response);
541			//var data = JSON.parse(response);
542			if(data.success == true)
543			{			
544				if($('#request-disys-quote-modal').length == 1)
545					$('#request-disys-quote-modal').remove();
546				
547				if($('#message-modal').length == 1)
548					$('#message-modal').remove();
549				
550				$('body').append(data.html);
551				
552				if($('.product-row').length > 0){
553					//$('#request-disys-quote-modal').modal('show');
554					const modalEl = document.getElementById('request-disys-quote-modal');
555					const modal = new bootstrap.Modal(modalEl);
556					modal.show();
557				}
558				else{
559					$('#message-modal').find('div#error_msg').removeClass('displaynone');							
560					$('#message-modal').find('div#error_msg > h1').html('Failed!');
561					$('#message-modal').find('div#error_msg > span').html("No Quaotation List Found.");
562				
563					$('#message-modal').modal('show');
564					const modalEl = document.getElementById('message-modal');
565					const modal = new bootstrap.Modal(modalEl);
566					modal.show();
567
568				}
569				$('#disys-quote-count').text($("#items_count").val());			
570				
571				
572			}
573		},
574		error: function (jqXHR, exception, errorThrown) {
575			$("#page-spinner").hide();
576			var msg = '';
577			msg += msg + 'request a quote popup open = ' + data_str + '\n';
578			if (jqXHR.status === 0) {
579				msg += 'Not connect.\n Verify Network.';
580			} else if (jqXHR.status == 404) {
581				msg += 'Requested page not found. [404]';
582			} else if (jqXHR.status == 500) {
583				msg += 'Internal Server Error [500].';
584			} else if (exception === 'parsererror') {
585				msg += 'Requested JSON parse failed.';
586			} else if (exception === 'timeout') {
587				msg += 'Time out error.';
588			} else if (exception === 'abort') {
589				msg += 'Ajax request aborted.';
590			} else {
591				msg += 'Uncaught Error.\n' + encodeURI(jqXHR.responseText);
592			}
593			msg += '\njqXHR='+JSON.stringify(jqXHR);
594			msg += '\nexception='+JSON.stringify(exception);
595			msg += '\nerrorThrown='+JSON.stringify(errorThrown);
596			$.ajax({
597				url: site_url+'/error-log-request-quote',
598				type: 'POST',
599				data: 'msg='+msg,
600				headers: {
601					'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
602				},
603				success: function(data) {	
604				},
605				complete: function(){
606				},
607				error: function (jqXHR, exception) {
608				}
609			});
610			setTimeout( function ( ) { alert('Sorry, please try again.'); }, 500 );
611		},
612		complete: function(){
613			$("#page-spinner").hide();
614			$(function () {
615				$('#RequestQuotePopUpForm').validate({
616					ignore: [], 
617					rules: {
618						yourName: {
619							required: true,				
620						},
621						phone: {
622							required: true,											
623						},
624						yourEmail: {
625							required: true,
626							email: true,
627						},
628						confirmEmail: {
629							required: true,
630							email: true,
631							equalTo: 	$('#RequestQuotePopUpForm input[name=yourEmail]')
632						},			
633						zip: {
634							required: true,				
635						},
636						items_check: {
637							minProducts: true
638						}
639					},
640					messages: {
641						yourName: {
642							required: "Please enter your name"				
643						},
644						phone: {
645							required: "Please enter your phone number",				
646						
647						},
648						yourEmail: {
649							required: "Please enter an email address",
650							email: "Please enter a vaild email address",
651						},
652						confirmEmail: {
653							required: "Please enter confirmation email address",
654							email: "Please enter a vaild confirmation email address",
655							equalTo: "Email and Confirm Email address does not match.",
656						},			
657						zip: {
658							required: "Please enter zip",				
659						},
660						 items_check: {
661							minProducts: "At least one product is required"
662						}
663					},
664					errorElement: 'label',
665					errorPlacement: function (error, element) {		
666						element.closest('.error-selector').append(error);	
667						if (element.attr("name") === "items_check") {
668
669							$('#items-error').html(error);
670
671							$('#product-section').addClass('border border-danger p-2 rounded');
672
673							$('html, body').animate({
674								scrollTop: $('#items-error').offset().top - 100
675							}, 400);
676
677							$('#items-error').focus();
678
679						} else {
680							let container = element.closest('.error-selector');
681							if (container.length) {
682								container.append(error);
683							} else {
684								error.insertAfter(element);
685							}
686						}	
687					},		
688					success: function(label, element) {
689
690						if ($(element).attr('name') === 'items_check') {
691							$('#product-section').removeClass('border border-danger p-2 rounded');
692							$('#items-error').html('');
693						}
694					},
695					submitHandler: function(form) {						
696						
697						$("#page-spinner").show();
698						 
699						$.ajax({
700							url: form.action,
701							type: form.method,
702							data: $(form).serialize(),
703							cache: false,
704							timeout: 90000,							
705							success: function(response) {
706								$("#page-spinner").hide();
707								var data = JSON.parse(response);
708																													
709								$('#RequestQuotePopUpForm > div#error_msg').removeClass('displaynone');	
710								
711								if(data.error_msg){
712									$('#RequestQuotePopUpForm > div#error_msg > .alert').addClass('alert-danger');
713									$('#RequestQuotePopUpForm > div#error_msg > .alert span').html(data.error_msg);
714								}
715								if(data.success_msg){
716									
717
718									$('#request-disys-quote-modal').find('.btn-close').trigger('click');
719									
720									$('#message-modal').find('div#error_msg').removeClass('displaynone');							
721									$('#message-modal').find('div#error_msg > h1').html('Success!');
722									$('#message-modal').find('div#error_msg > span').html(data.success_msg);
723								
724									//$('#message-modal').modal('show');
725									const modalEl = document.getElementById('message-modal');
726									const modal = new bootstrap.Modal(modalEl);
727									modal.show();
728									$('#disys-quote-count').text($("#items_count").val());
729									
730					  
731								}
732																						
733								$('.modal-body').scrollTop(0);
734								refreshCaptcha();
735								
736							},
737							error: function (jqXHR, exception, errorThrown) {
738								$("#page-spinner").hide();
739								var msg = '';
740								msg += 'request a quote popup submission = ' + data_str + '\n';
741								if (jqXHR.status === 0) {
742									msg += 'Not connect.\n Verify Network.';
743								} else if (jqXHR.status == 404) {
744									msg += 'Requested page not found. [404]';
745								} else if (jqXHR.status == 500) {
746									msg += 'Internal Server Error [500].';
747								} else if (exception === 'parsererror') {
748									msg += 'Requested JSON parse failed.';
749								} else if (exception === 'timeout') {
750									msg += 'Time out error.';
751								} else if (exception === 'abort') {
752									msg += 'Ajax request aborted.';
753								} else {
754									msg += 'Uncaught Error.\n' + encodeURI(jqXHR.responseText);
755								}
756								msg += '\njqXHR='+JSON.stringify(jqXHR);
757								msg += '\nexception='+JSON.stringify(exception);
758								msg += '\nerrorThrown='+JSON.stringify(errorThrown);
759								msg += '\nForm Data='+$(form).serialize();
760								$.ajax({
761									url: site_url+'/error-log-request-quote',
762									type: 'POST',
763									data: 'msg='+msg,
764									headers: {
765										'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
766									},
767									success: function(data) {	
768									},
769									complete: function(){
770									},
771									error: function (jqXHR, exception) {
772									}
773								});	
774								
775								setTimeout( function ( ) { alert('Sorry, please try again.'); }, 500 );
776								
777							},
778							complete: function(){
779								$("#page-spinner").hide();							
780							}            
781						});
782					}
783				});
784				
785				
786				$.validator.addMethod("minProducts", function (value, element) {
787					return $('.product-row').length > 0;
788				}, "At least one product is required");
789			});
790
791			$(document).on('change', '#RequestQuotePopUpForm input[name=country]', function() { 
792				
793				if($(this).val()=="US")
794				{
795					$('#RequestQuotePopUpForm input[name=state]').show();
796					$('#RequestQuotePopUpForm input[name=otherState]').hide();
797				}
798				else 
799				{
800					$('#RequestQuotePopUpForm input[name=state]').hide();
801					$('#RequestQuotePopUpForm input[name=otherState]').show();
802					$('#RequestQuotePopUpForm input[name=otherState]').focus();
803				}
804
805			});
806			
807			$(document).on('change', '#RequestQuotePopUpForm input[name=sales_rep]', function() {  
808			  if($("#old_sales_rep_id").val() != '' && $("#old_sales_rep_id").val() != $("#sales_rep").val()){
809				$("#manual_sales_rep").val("Yes");  
810			  } else {
811				$("#manual_sales_rep").val("No");  
812			  }
813
814			});
815
816			
817			$('#RequestQuotePopUpForm').on('submit',function(event){
818				if (!document.RequestQuotePopUpForm.checkValidity()) {
819						event.preventDefault()
820						event.stopPropagation()
821				}				
822				$(this).addClass('was-validated');
823			});
824			/* ---- Input telephone js ---- */
825			var input = document.RequestQuotePopUpForm.phone;
826			var iti2 = window.intlTelInput(input, {
827				// allowDropdown: false,
828				// autoHideDialCode: false,
829				autoPlaceholder: "on",
830				// dropdownContainer: document.body,
831				// excludeCountries: ["us"],
832				formatOnDisplay: false,
833				// geoIpLookup: function(callback) {
834				//   $.get("http://ipinfo.io", function() {}, "jsonp").always(function(resp) {
835				//     var countryCode = (resp && resp.country) ? resp.country : "";
836				//     callback(countryCode);
837				//   });
838				// },
839				// hiddenInput: "full_number",
840				// initialCountry: "us",
841				// localizedCountries: { 'de': 'Deutschland' },
842				// nationalMode: false,
843				onlyCountries: ['US'],
844				//onlyCountries: document.getElementById('countrydata')?(document.getElementById('countrydata').value).split(","):[],
845				// placeholderNumberType: "MOBILE",
846				preferredCountries: [],
847				// separateDialCode: true,
848				utilsScript: site_url + "/js/utils.js",
849			});
850			iti2.setCountry('US');
851			/* ---- Input telephone js ---- */
852		}
853	});
854}	
855
856$(document).on('click', '.remove-item, .add-product-btn', function () {
857    $('#items_check').valid();
858});
859$(document).on('click', '.disys-remove-quote-item', function () {
860
861    let index = $(this).data('index');
862
863	$.ajax({
864		url: site_url+'/disys-shoppingcart-ajax',
865		type: 'POST',
866		data: 'actiononcart=removequote&index='+index,
867		headers: {
868			'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
869		},
870		success: function(response) {
871			if (response.status === 'success') {
872				$('#request-disys-quote-modal').find('.btn-close').trigger('click');
873                requestAQuoteDisysPopup();
874            }			
875		},
876		complete: function(){
877		},
878		error: function (jqXHR, exception) {
879		}
880	});	
881	
882});
883
884
885
886$(function () {
887	let jqValidationOptions = {
888		ignore: [],
889		rules: {
890			your_name: {
891				required: true,				
892			},
893			frnd_name: {
894				required: true,				
895			},
896			friend_email1: {
897				required: true,
898				email: true,
899			},
900			/*captcha: {
901				required: true,				
902			},*/	
903		},
904		messages: {
905			your_name: {
906				required: 'Please enter your name',				
907			},
908			frnd_name: {
909				required: 'Please enter friend\'s name',				
910			},
911			friend_email1: {
912				required: GetMessage('Validate', 'Email'),
913				email: GetMessage('Validate', 'ValidEmail'),
914			},
915			/*captcha: {
916				required: "Please enter the characters shown in the picture.",				
917			},*/	
918		},
919		errorPlacement: function (error, element) {
920			
921				error.addClass('w-100');
922				element.closest('.col-md-6').append(error);;
923			
924		},
925		submitHandler: function (form) {
926			
927		},
928	};
929	$('#frmsharecart').validate(jqValidationOptions);
930});
931
932function submitShareCart(shareType = 'email') {
933	
934	$('#shareType').val(shareType);
935	if (shareType == 'link') { 
936		data = $("#frmsharecart").serialize();
937	}
938	else{
939		if($("#frmsharecart").valid())
940			data = $("#frmsharecart").serialize();
941		else	
942			return false;
943	}	
944	$.ajax({
945		type: "POST",
946		url: postShareCartURL,
947		data: data,
948		cache: false,
949		headers: {
950			'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
951		},
952		success: function (response) {
953			
954			if(shareType == "email" ){				
955				if(response.status === 'success'){				
956					$('#your_name').val('');
957					$('#frnd_name').val('');
958					$('#friend_email1').val('');
959					
960					$('#frmsharecart > div#error_msg').removeClass('displaynone');	
961					$('#frmsharecart > div#error_msg > .alert').addClass('alert-success');
962					$('#frmsharecart > div#error_msg > .alert span').html('Your Shopping/Quote Bag has been shared with your friend!');
963									
964					
965				}
966				else {
967					$('#frmsharecart > div#error_msg').removeClass('displaynone');
968					$('#frmsharecart > div#error_msg > .alert').addClass('alert-danger');
969					$('#frmsharecart > div#error_msg > .alert span').html('Something went wrong!');
970					
971				}
972			}
973			else if(shareType == "link"){
974				$('#sharecart-modal').modal('hide');
975				//$('#sharecart-link-modal').modal('show');
976				const modalEl = document.getElementById('sharecart-link-modal');
977				const modal = new bootstrap.Modal(modalEl);
978				modal.show();
979				$('#shareLinkInput').val(response.message);
980			}
981			
982			document.frmsharecart.reset();								
983			$('.modal-body').scrollTop(0);
984			refreshCaptcha();
985		},
986		error: function (jqXHR, exception, errorThrown) {
987			$("#page-spinner").hide();
988			var msg = '';					
989			if (jqXHR.status === 0) {
990				msg += 'Not connect.\n Verify Network.';
991			} else if (jqXHR.status == 404) {
992				msg += 'Requested page not found. [404]';
993			} else if (jqXHR.status == 500) {
994				msg += 'Internal Server Error [500].';
995			} else if (exception === 'parsererror') {
996				msg += 'Requested JSON parse failed.';
997			} else if (exception === 'timeout') {
998				msg += 'Time out error.';
999			} else if (exception === 'abort') {
1000				msg += 'Ajax request aborted.';
1001			} else {
1002				msg += 'Uncaught Error.\n' + encodeURI(jqXHR.responseText);
1003			}
1004						
1005			
1006			$("#errormsgs").addClass('error');
1007			$("#errormsgs").removeClass('text-success');
1008			$("#errormsgs").html(msg);
1009			refreshCaptcha();
1010			
1011		},
1012		complete: function(){
1013			$("#page-spinner").hide();							
1014		}
1015	});	
1016}
1017
1018
1019function showsharecartmodal() {
1020	$('#request-disys-quote-modal').find('.btn-close').trigger('click');
1021	$('#frmsharecart > div#error_msg').addClass('displaynone');
1022    //$('#sharecart-modal').modal('show');
1023	const modalEl = document.getElementById('sharecart-modal');
1024	const modal = new bootstrap.Modal(modalEl);
1025	modal.show();
1026}
1027
1028function copyShareLink() {
1029    const input = document.getElementById('shareLinkInput');
1030    input.select();
1031    document.execCommand('copy');
1032    alert('Link copied!');
1033}
1034
1035document.addEventListener('shown.bs.modal', function (event) {
1036    const modal = event.target;
1037	let input = modal.querySelector('input, textarea, select');
1038
1039    if (input) {
1040        input.focus();
1041    } else {
1042        // fallback to close button
1043        const closeBtn = modal.querySelector('.btn-close');
1044        if (closeBtn) closeBtn.focus();
1045    }
1046	console.log('modal show');
1047});
1048
1049let lastClickedElement;
1050document.addEventListener('hidden.bs.modal', function () {
1051	console.log('modal hide');
1052	console.log(lastClickedElement);
1053    if (lastClickedElement) {
1054        lastClickedElement.focus();
1055    }
1056});
1057document.addEventListener('click', function (e) {
1058   
1059	
1060	const clickedInsideModal = e.target.closest('.modal');
1061
1062    // Ignore clicks inside modal
1063    if (clickedInsideModal) return;
1064	
1065	lastClickedElement = e.target;
1066	console.log(lastClickedElement);
1067});

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.