PageSourceSearch

https://orca.eu/wp-content/plugins/orca_advanced_search/public/js/orca_advanced_search-public.js

js orca.eu collected 2026-10-02 20:03:42 UTC 37,161 bytes, 1,006 lines download raw bytes

1var currentNumProducts = 0;
2var num_product_for_noc = 0;
3var cur_min_weight = 0;
4var cur_max_weight = 0;
5var cur_min_thickness = 0;
6var cur_max_thickness = 0;
7var cur_min_strength = 0;
8var cur_max_strength = 0;
9var can_call = true;
10
11'use strict';
12jQuery.noConflict();
13
14(function ($) {
15    'use strict';
16    /**
17     * PAGE 1: CHOOSE NATURE OF COATING 
18     * PAGE 2: CHOOSE NATURE OF SUPPORT 
19     * PAGE 3: CHOOSE TECHNICAL CHARACTERISTICS
20     * PAGE 4: CHOOOSE RESISTANCE AND SEND MAIL
21     */
22    //document ready shorthand
23    $(function () {
24        retrieveNumProduct(0, '#id_chk_coatings');
25        retrievePageContent(0, '#id_chk_coatings', true);
26
27    });
28
29    //next to nature of support 
30    $(document).on('click', '#pas_next_nos', function () {
31        retrievePageContent(1, '#id_chk_coatings');
32    });
33
34    //back to nature of coating 
35    $(document).on('click', '#pas_back_noc', function () {
36        retrievePageContent(0, '#id_chk_coatings', false, true);
37    });
38
39    //next to technical characteristics
40    $(document).on('click', '#pas_next_tech_carac', function () {
41        retrieveTechnicalCaracteristicPage(false);
42    });
43
44    //back to nature of support
45    $(document).on('click', '#pas_back_nos', function () {
46        retrievePageContent(1, '#id_chk_support', false, true);
47    });
48
49    //next to result page 
50    $(document).on('click', '#pas_next_rslt', function () {
51        retrieveResultsPage();
52    });
53
54    //back to technical characteristics page
55    $(document).on('click', '#pas_back_tec_carac', function () {
56         jQuery('.btn-navigation').detach();
57        retrieveTechnicalCaracteristicPage(true);
58    });
59
60    //perform new search
61    $(document).on('click', '#pas_new_search', function () {
62        
63        jQuery('.btn-navigation').detach();
64        retrievePageContent(0);
65    });
66
67
68
69
70    //removes validation border
71    $(document).on('click', '#formGroupNameInput', function () {
72        jQuery('#formGroupNameInput').removeClass('error-field');
73    });
74    $(document).on('click', '#formGroupEmailInput', function () {
75        jQuery('#formGroupEmailInput').removeClass('error-field');
76    });
77    $(document).on('click', '#formGroupIndustryInput', function () {
78        jQuery('#formGroupIndustryInput').removeClass('error-field');
79    });
80    $(document).on('click', '#formGroupCountryInput', function () {
81        jQuery('#formGroupCountryInput').removeClass('error-field');
82    });
83    $(document).on('click', '#formGroupProductInput', function () {
84        jQuery('#formGroupProductInput').removeClass('error-field');
85    });
86
87    //sending mail 
88    $(document).on('click', '#product_send_mail', function () {
89        sendMail();
90    });
91
92    /**
93     * CHECKBOX MANIPULATIONS
94     */
95    //any checkbox that has been clicked on page coatings
96    $(document).on('click', '#id_chk_coatings', function () {
97        retrieveNumProduct(0, '#id_chk_coatings');
98    });
99    //any checkbox that has been clicked on page coatings - cured uncured 
100    $(document).on('click', '#id_compound_status', function () {
101        retrieveNumProduct(0, '#id_chk_coatings');
102    });
103
104    //any checkbox that has been clicked on page support
105    $(document).on('click', '#id_chk_support', function () {
106        retrieveNumProduct(1, '#id_chk_support');
107    });
108
109    //any checkbox that has been clicked on page technical characteristics 
110    $(document).on('click', '#caract-checkbox', function () {
111        verifyTechCheckboxes(this);
112    });
113
114    //any checkbox that has been clicked on page result
115    $(document).on('click', '#id_product_result', function () {
116        populateContactFormTextArea();
117        jQuery('#formGroupProductInput').removeClass('error-field');
118    });
119
120    //any button that has been clicked on page result
121    $(document).on('click', '#product_btn_resistance', function () {
122        var parent = $(this).parent();
123        parent.toggleClass("active");
124
125        //retrieveResistance();
126    });
127
128})(jQuery);
129
130function sendMail() {
131    var apiName = 'send_mail';
132    var contactName = jQuery('#formGroupNameInput').val();
133    var contactCompanyName = jQuery('#formGroupCompanyInput').val();
134    var contactEmail = jQuery('#formGroupEmailInput').val();
135    var contactPhone = jQuery('#formGroupPhoneInput').val();
136    var contactIndustry = jQuery('#formGroupIndustryInput').val();
137    var contactCountry = jQuery('#formGroupCountryInput').val();
138    var productList = jQuery('#formGroupProductInput').val();
139
140    productList = productList.replace(/\r|\n|\r\n/g, '<br>')
141
142
143    var is_form_valid = validateForm('#formGroupNameInput', '#formGroupCompanyInput', '#formGroupEmailInput', '#formGroupPhoneInput', '#formGroupIndustryInput', '#formGroupCountryInput', '#formGroupProductInput');
144
145    var resistance_list = jQuery('#id_result_resistance').prop('checked') ? 'none' : retrieveResistance();
146
147    var coating_type = jQuery("input[name='result_coating_type']:checked").val();
148    if(coating_type == null) {
149        coating_type = 'NO SPECIFIC REQUIREMENT';
150    }
151
152    if (is_form_valid) {
153        jQuery.ajax({
154            type: "post",
155            dataType: "html",
156            url: advanced_search.ajaxurl,
157            data: {
158                action: apiName,
159                contact_name: contactName,
160                contact_company_name: contactCompanyName,
161                contact_email: contactEmail,
162                contact_phone: contactPhone,
163                contact_industry: contactIndustry,
164                contact_country: contactCountry,
165                product_list: productList,
166                resistance_list: resistance_list,
167                coating_type: coating_type
168            },
169            success: function (response) {
170                jQuery('.ack-msg').html("Your request has been sent, thanks.");
171            },
172            failure: function (response) {
173
174                jQuery('.ack-msg').html("Your request was not sent; please review the information provided in the fields marked with a red border.");
175            }
176        });
177    } else {
178        //RGPD
179        if(! jQuery('#rgpd-checkbox-cookie-accept').prop('checked')){
180            var errorMsg = jQuery('#rgpd-error-msg').text();
181            jQuery('.ack-msg').html(errorMsg);
182        }else{
183            jQuery('.ack-msg').html("Your request was not sent; please review the information provided in the fields marked with a red border.");
184        }
185    }
186
187
188}
189
190function retrieveResistance() {
191    var arr_resis = Array();
192    jQuery('.picto').each(function () {
193        var parent = jQuery(this);
194        if (parent.hasClass('active')) {
195            var child = parent.children()[0];
196            var resis_val = child.attributes[1].nodeValue;
197            arr_resis.push(resis_val);
198        }
199    });
200
201    return arr_resis;
202}
203
204function populateContactFormTextArea() {
205    jQuery('#formGroupProductInput').val('');
206    var chkGroup = 'input:checkbox[name=product-result]:checked';
207    var product_list = '';
208    jQuery(chkGroup).each(function () {
209        var valStr = jQuery(this).val() + '\r\n';
210        product_list += valStr;
211    });
212
213    jQuery('#formGroupProductInput').val(product_list);
214}
215
216
217function contains(container, value) {
218
219    for (i = 0; i < container.length; i++) {
220        if (container[i] === value)
221            return true;
222    }
223    return false;
224
225}
226
227function getDataFromCheckBoxes(checkboxID) {
228
229    var arr = Array();
230    var chkGroup = '';
231    var cookieName = '';
232
233    switch (checkboxID) {
234        case '#id_chk_coatings':
235            chkGroup = 'input:checkbox[name=chk_coatings]:checked';
236            cookieName = 'cookies_noc';
237            break;
238        case '#id_chk_support':
239            chkGroup = 'input:checkbox[name=chk_support]:checked';
240            cookieName = 'cookies_nos';
241            break;
242        case '#id_compound_status' :
243            chkGroup = 'input:radio[name=chk_compound_status]:checked';
244            cookieName = 'cookies_compound_status';
245            break;
246    }
247
248    jQuery(chkGroup).each(function () {
249        arr.push(jQuery(this).val());
250    });
251
252    var includeAllProducts = false;
253
254   
255    
256    switch (checkboxID) {
257        case '#id_compound_status' :
258            if (contains(arr, "include_all_compound") || arr.length == 0) {
259
260                includeAllProducts = true;
261
262                arr = ['include_all_compound'];
263
264            }
265            break;
266        default:
267            if (contains(arr, "include_all") || arr.length == 0) {
268
269                includeAllProducts = true;
270
271                arr = ['include_all'];
272
273            }
274            break;
275    }
276    
277    //RGPD
278    if(jQuery('#cookie-notice-value').val() == '1'){
279        Cookies.set(cookieName, JSON.stringify(arr), {expires: 1, path: ''});        
280    }
281    // Cookies.set(cookieName, JSON.stringify(arr), {expires: 1, path: ''});
282
283    return [arr, includeAllProducts];
284}
285
286
287//Retrieve number of product for every checkbox selected 
288function retrieveNumProduct(methodIndex, checkboxID) {
289
290    var methodsName = ['retrieve_num_products_coating', 'retrieve_num_products_support'];
291    var data        = []; 
292    var curedData   = []; 
293    
294    if('#id_chk_coatings' == checkboxID ){ 
295         //we are actually on the first page, so we retrieve the CURED TYPE and the Nature of Coating
296        data = getDataFromCheckBoxes(checkboxID);
297        curedData = getDataFromCheckBoxes('#id_compound_status');
298    }
299    else{ 
300        data = getDataFromCheckBoxes(checkboxID);
301        curedData = Cookies.getJSON('cookies_compound_status');
302    }
303
304    var noc_selection = Cookies.getJSON(getCookieName('#id_chk_coatings'));
305
306    if (methodIndex == 1 && data[0] == 0) {
307        if (num_product_for_noc > 1) {
308            htmlString = num_product_for_noc + ' products';
309        } else if (num_product_for_noc == 0) {
310            htmlString = '0 products';
311        } else {
312            htmlString = num_product_for_noc + ' product';
313        }
314        jQuery('#num-products').html(htmlString);
315    } else {
316        
317        jQuery.ajax({
318            type: "post",
319            dataType: "html",
320            url: advanced_search.ajaxurl,
321            data: {
322                action:             methodsName[methodIndex],
323                selectedItems:      data[0],
324                includeAllProducts: data[1],
325                noc_selections:     noc_selection,
326                current_num_product: num_product_for_noc,
327                curedType:                  curedData[0],
328                includeAllCompoundStatus:   curedData[1],
329            },
330            success: function (response) {
331                //console.log(response);
332                var htmlString = '';
333                if (response > 1) {
334                    htmlString = response + ' products';
335                } else if (response == 0) {
336                    htmlString = '0 products';
337                } else {
338                    htmlString = response + ' product';
339                }
340                if (methodIndex == 0) {
341                    num_product_for_noc = response;
342                }
343                currentNumProducts = response;
344                jQuery('#num-products').html(htmlString);
345            },
346            failure: function (response) {
347                //console.log("ERROR: Could not retrieve number of products using selected items", arr, response);
348            }
349        });
350    }
351}
352
353function verifyTechCheckboxes(element) {
354    var slider = element.value;
355    var isChecked = element.checked;
356    switch (slider) {
357        case 'weight' :
358            if (isChecked) {
359                jQuery(".slider-weight").slider("option", "disabled", true);
360            } else {
361                jQuery(".slider-weight").slider("option", "disabled", false);
362            }
363            configureSliders(function () {
364                retrieveNumProdWithTimeOuts();
365            }, true, "weight");
366            break;
367        case 'thickness' :
368            if (isChecked) {
369                jQuery(".slider-thickness").slider("option", "disabled", true);
370            } else {
371                jQuery(".slider-thickness").slider("option", "disabled", false);
372            }
373            configureSliders(function () {
374                retrieveNumProdWithTimeOuts();
375            }, true, "thickness");
376            break;
377        case 'strength' :
378            if (isChecked) {
379                jQuery(".slider-tensile-strength").slider("option", "disabled", true);
380            } else {
381                jQuery(".slider-tensile-strength").slider("option", "disabled", false);
382            }
383            configureSliders(function () {
384                retrieveNumProdWithTimeOuts();
385            }, true, "strength");
386            break;
387    }
388
389}
390
391function retrieveNumProdWithTimeOuts() {
392    var timeout;
393    clearTimeout(timeout);
394    if (can_call) {
395        timeout = setTimeout(function () {
396            can_call = false;
397            retrieveNumProductSliders();
398        }, 0);
399    }
400
401}
402
403function retrieveNumProductSliders() {
404
405    var apiName = 'retrieve_num_products_sliders';
406    var noc_selection = Cookies.getJSON(getCookieName('#id_chk_coatings'));
407    var nos_selection = Cookies.getJSON(getCookieName('#id_chk_support'));
408
409    var arr_checkboxes = verifyCheckboxesOnTechnicalCharacteristic();
410    var allWeight = arr_checkboxes[0];
411    var allThickness = arr_checkboxes[1];
412    var allStrength = arr_checkboxes[2];
413
414    var min_weight = jQuery('.slider-weight').slider("values", 0);
415    var max_weight = jQuery('.slider-weight').slider("values", 1);
416
417    var min_thickness = jQuery('.slider-thickness').slider("values", 0);
418    var max_thickness = jQuery('.slider-thickness').slider("values", 1);
419
420    var min_strength = jQuery('.slider-tensile-strength').slider("values", 0);
421    var max_strength = jQuery('.slider-tensile-strength').slider("values", 1);
422
423
424    var compoundStatus  = Cookies.getJSON('cookies_compound_status');
425
426
427    jQuery.ajax({
428        type: "post",
429        dataType: "html",
430        url: advanced_search.ajaxurl,
431        data: {
432            action: apiName,
433            all_weight: allWeight,
434            all_thickness: allThickness,
435            all_strength: allStrength,
436            noc_selections: noc_selection,
437            nos_selection: nos_selection,
438            min_weight: min_weight,
439            max_weight: max_weight,
440            min_thickness: min_thickness,
441            max_thickness: max_thickness,
442            min_strength: min_strength,
443            max_strength: max_strength,
444            current_num_product: currentNumProducts,
445            compound_status : compoundStatus
446        },
447        success: function (response) {
448            //console.log(response);
449            var htmlString = '';
450            if (response > 1) {
451                htmlString = response + ' products';
452            } else if (response == 0) {
453                htmlString = '0 products';
454            } else {
455                htmlString = response + ' product';
456            }
457            currentNumProducts = response;
458            jQuery('#num-products').html(htmlString);
459            can_call = true;
460        },
461        failure: function (response) {
462            can_call = true;
463            //console.log("ERROR: Could not retrieve number of products using selected items", arr, response);
464        }
465    });
466
467}
468
469//Retrieve PAGE  content via AJAX
470function retrievePageContent(index, checkBoxID, includeAllProduct, backAction) {
471
472    var methodsName = ['retrieve_nature_coating', 'retrieve_nature_support'];
473
474    var data = [];
475
476    if (backAction) {
477        data = Cookies.get(getCookieName(checkBoxID));
478    } else {
479        data = getDataFromCheckBoxes(checkBoxID);
480    }
481
482    jQuery.ajax({
483        type: "post",
484        dataType: "html",
485        url: advanced_search.ajaxurl,
486        data: {
487            action: methodsName[index],
488            selectedItems: data[0],  //not used 
489            includeAllProduct: includeAllProduct, //used 
490            currentNumProduct: currentNumProducts //used 
491        },
492        success: function (response) {
493            if (backAction) {
494                jQuery('.advanced-search-content').html(response).promise().done(function () {
495                    checkSelectedCheckBoxes(checkBoxID, function () {
496                        retrieveNumProduct(index, checkBoxID);
497                        addUniformJS();
498                    });
499                });
500            } else {
501                jQuery('.advanced-search-content').html(response);
502            }
503        },
504        failure: function (response) {
505            //console.log("ERROR: Could not retrieve page advanced search", response);
506        }
507    });
508}
509
510function addUniformJS() {
511    //jQuery('[type="checkbox"]').uniform();
512}
513
514function retrieveTechnicalCaracteristicPage(backAction) {
515
516    var apiName = 'retrieve_technical_characteristics';
517    var data_noc = Cookies.getJSON('cookies_noc');
518    var data_nos = Cookies.getJSON('cookies_nos');
519    var compound_status =  Cookies.getJSON('cookies_compound_status');
520
521    jQuery.ajax({
522        type: "post",
523        dataType: "html",
524        url: advanced_search.ajaxurl,
525        data: {
526            action: apiName,
527            noc_selections: data_noc,
528            nos_selections: data_nos,
529            currentNumProduct: currentNumProducts,
530            compound_status : compound_status
531        },
532        success: function (response) {
533            jQuery('.advanced-search-content').html(response).promise().done(function () {
534                //configure sliders 
535                configureSliders(function () {
536                    if (backAction) {
537                        reloadSlidersFromCookie();
538                    }
539                });
540                addUniformJS();
541            });
542
543        },
544        failure: function (response) {
545            //console.log("ERROR: Could not retrieve page advanced search", response);
546        }
547    });
548
549}
550
551function reloadSlidersFromCookie() {
552    var arr_slider_options = Cookies.getJSON('cookie_sliders');
553    cur_min_weight = arr_slider_options[0];
554    cur_max_weight = arr_slider_options[1];
555    var allWeight = arr_slider_options[2];
556    cur_min_thickness = arr_slider_options[3];
557    cur_max_thickness = arr_slider_options[4];
558    var allThickness = arr_slider_options[5];
559    cur_min_strength = arr_slider_options[6];
560    cur_max_strength = arr_slider_options[7];
561    var allStrength = arr_slider_options[8];
562
563    jQuery('input:checkbox[name=chk-teck]').each(function () {
564
565        var currentValue = jQuery(this).val();
566
567        switch (currentValue) {
568            case 'weight' :
569                if (allWeight) {
570                    jQuery(this).prop('checked', true);
571                    jQuery(".slider-weight").slider("option", "disabled", true);
572                }
573                break;
574            case 'thickness' :
575                if (allThickness) {
576                    jQuery(this).prop('checked', true);
577                    jQuery(".slider-thickness").slider("option", "disabled", true);
578                }
579                break;
580            case 'strength' :
581                if (allStrength) {
582                    jQuery(this).prop('checked', true);
583                    jQuery(".slider-tensile-strength").slider("option", "disabled", true);
584                }
585                break;
586        }
587    });
588
589    repositionAllSliderHandles(true);
590
591}
592
593function retrieveResultsPage() {
594
595    var apiName = 'retrieve_result_page';
596    var noc_selection   = Cookies.getJSON(getCookieName('#id_chk_coatings'));
597    var nos_selection   = Cookies.getJSON(getCookieName('#id_chk_support'));
598    var compound_status = Cookies.getJSON('cookies_compound_status');
599
600    //Look for sections which specified no specific requirements    
601    var arr_checkboxes = verifyCheckboxesOnTechnicalCharacteristic();
602    var allWeight = arr_checkboxes[0];
603    var allThickness = arr_checkboxes[1];
604    var allStrength = arr_checkboxes[2];
605
606    var min_weight = jQuery('.slider-weight').slider("values", 0);
607    var max_weight = jQuery('.slider-weight').slider("values", 1);
608
609    var min_thickness = jQuery('.slider-thickness').slider("values", 0);
610    var max_thickness = jQuery('.slider-thickness').slider("values", 1);
611
612    var min_strength = jQuery('.slider-tensile-strength').slider("values", 0);
613    var max_strength = jQuery('.slider-tensile-strength').slider("values", 1);
614
615    //save content of sliders 
616    var slider_arr = [min_weight, max_weight, allWeight, min_thickness, max_thickness, allThickness, min_strength, max_strength, allStrength];
617    
618    //RGPD
619    if(jQuery('#cookie-notice-value').val() == '1'){
620        Cookies.set('cookie_sliders', JSON.stringify(slider_arr), {expires: 1, path: ''});        
621    }
622    // Cookies.set('cookie_sliders', JSON.stringify(slider_arr), {expires: 1, path: ''});
623
624    jQuery.ajax({
625        type: "post",
626        dataType: "html",
627        url: advanced_search.ajaxurl,
628        data: {
629            action: apiName,
630            noc_selections: noc_selection,
631            nos_selections: nos_selection,
632            currentNumProduct: currentNumProducts,
633            min_weight: min_weight,
634            max_weight: max_weight,
635            min_thickness: min_thickness,
636            max_thickness: max_thickness,
637            min_strength: min_strength,
638            max_strength: max_strength,
639            all_weight: allWeight,
640            all_thickness: allThickness,
641            all_strength: allStrength,
642            compound_status: compound_status
643        },
644        success: function (response) {
645            //console.log(response);
646            jQuery('.advanced-search-content').html(response).promise().done(function () {
647                addUniformJS();
648
649                jQuery('.btn-navigation').detach().appendTo('.btn-holder');
650                jQuery('.btn-navigation').addClass('last-step');
651            });
652        },
653        failure: function (response) {
654//            console.log("ERROR: Could not retrieve page advanced search", response);
655        }
656    });
657
658
659}
660
661function verifyCheckboxesOnTechnicalCharacteristic() {
662    var allWeight = false;
663    var allThickness = false;
664    var allStrength = false;
665    var arr = Array();
666
667    jQuery('input:checkbox[name=chk-teck]:checked').each(function () {
668
669        var currentValue = jQuery(this).val();
670
671        switch (currentValue) {
672            case 'weight' :
673                allWeight = true;
674                break;
675            case 'thickness' :
676                allThickness = true;
677                break;
678            case 'strength' :
679                allStrength = true;
680                break;
681        }
682    });
683
684    return [allWeight, allThickness, allStrength];
685
686}
687
688
689function configureSliders(callback, specificSlider = false, sliderID) {
690    var minWeight = isNaN(parseInt(jQuery('#min-weight').val())) ? 0 : parseInt(jQuery('#min-weight').val());
691    var maxWeight = isNaN(parseInt(jQuery('#max-weight').val())) ? 0 : parseInt(jQuery('#max-weight').val());
692
693    var minThickness = isNaN(parseInt(jQuery('#min-thickness').val())) ? 0 : parseInt(jQuery('#min-thickness').val());
694    var maxThickness = isNaN(parseInt(jQuery('#max-thickness').val())) ? 0 : parseInt(jQuery('#max-thickness').val());
695
696    var minStrength = isNaN(parseInt(jQuery('#min-strength').val())) ? 0 : parseInt(jQuery('#min-strength').val());
697    var maxStrength = isNaN(parseInt(jQuery('#max-strength').val())) ? 0 : parseInt(jQuery('#max-strength').val());
698
699    if (specificSlider) {
700        switch (sliderID) {
701            case 'weight' :
702                //CONFIGURE WEIGHT SLIDER 
703                configureSliderWeight(minWeight, maxWeight);
704                break;
705            case 'thickness' :
706                //CONFIGURE THICKNESS SLIDER
707                configureSliderThickness(minThickness, maxThickness);
708                break;
709            case 'strength' :
710                //CONFIGURE TENSILE STRENGTH SLIDER
711                configuresliderTensileStrength(minStrength, maxStrength);
712                break;
713        }
714    } else {
715        //CONFIGURE WEIGHT SLIDER 
716        configureSliderWeight(minWeight, maxWeight);
717
718        //CONFIGURE THICKNESS SLIDER
719        configureSliderThickness(minThickness, maxThickness);
720
721        //CONFIGURE TENSILE STRENGTH SLIDER
722        configuresliderTensileStrength(minStrength, maxStrength);
723    }
724
725    callback();
726}
727
728function repositionAllSliderHandles() {
729    jQuery('.slider-weight').slider('values', 0, cur_min_weight);
730    jQuery('.slider-weight').slider('values', 1, cur_max_weight);
731    jQuery('.slider-thickness').slider('values', 0, cur_min_thickness);
732    jQuery('.slider-thickness').slider('values', 1, cur_max_thickness);
733    jQuery('.slider-tensile-strength').slider('values', 1, cur_min_strength);
734    jQuery('.slider-tensile-strength').slider('values', 1, cur_max_strength);
735
736    positionHandlesOnSliderWeight();
737    positionHandlesOnSliderThickness();
738    positionHandlesOnSliderStrength();
739}
740
741function configureSliderWeight(minWeight, maxWeight) {
742
743    //CONFIGURE WEIGHT SLIDER 
744    jQuery('.slider-weight').slider({
745        range: true,
746        min: minWeight,
747        max: maxWeight,
748        values: [minWeight, maxWeight],
749        slide: function (event, ui) {
750            //console.log('minWeight is ' + ui.values[0] + 'and maxWeight is ' + ui.values[1]);
751
752            var delay = function () {
753                var handleIndex = jQuery(ui.handle).index();
754                //console.log('selected index for weight slider is ', handleIndex);
755                var label = handleIndex == 1 ? '#min-weight-handle' : '#max-weight-handle';
756                jQuery(label).html(ui.value).position({
757                    my: 'center top',
758                    at: 'center bottom',
759                    of: ui.handle,
760                    offset: "0, 10"
761                });
762            };
763
764            // wait for the ui.handle to set its position
765            setTimeout(delay, 2);
766            //retrieveNumProductSliders();
767            retrieveNumProdWithTimeOuts();
768        }
769    });
770
771    positionHandlesOnSliderWeight();
772
773}
774function positionHandlesOnSliderWeight() {
775
776    jQuery('#min-weight-handle').html(jQuery('.slider-weight').slider('values', 0)).position({
777        my: 'center top',
778        at: 'center bottom',
779        of: jQuery('.slider-weight span:eq(0)'),
780        offset: "0, 10"
781    });
782
783    jQuery('#max-weight-handle').html(jQuery('.slider-weight').slider('values', 1)).position({
784        my: 'center top',
785        at: 'center bottom',
786        of: jQuery('.slider-weight span:eq(1)'),
787        offset: "0, 10"
788    });
789
790}
791
792function configureSliderThickness(minThickness, maxThickness) {
793    jQuery('.slider-thickness').slider({
794        range: true,
795        min: minThickness,
796        max: maxThickness,
797        step: 0.1,
798        values: [minThickness, maxThickness],
799        slide: function (event, ui) {
800            //console.log('minThickness is ' + ui.values[0] + 'and maxThickness is ' + ui.values[1]);
801
802            var delay = function () {
803                var handleIndex = jQuery(ui.handle).index();
804                //console.log('selected index for weight slider is ', handleIndex);
805                var label = handleIndex == 1 ? '#min-thickness-handle' : '#max-thickness-handle';
806                jQuery(label).html(ui.value).position({
807                    my: 'center top',
808                    at: 'center bottom',
809                    of: ui.handle,
810                    offset: "0, 10"
811                });
812            };
813
814            // wait for the ui.handle to set its position
815            setTimeout(delay, 2);
816//            retrieveNumProductSliders();
817            retrieveNumProdWithTimeOuts();
818        }
819    });
820
821    positionHandlesOnSliderThickness();
822}
823
824function positionHandlesOnSliderThickness() {
825
826    jQuery('#min-thickness-handle').html(jQuery('.slider-thickness').slider('values', 0)).position({
827        my: 'center top',
828        at: 'center bottom',
829        of: jQuery('.slider-thickness span:eq(0)'),
830        offset: "0, 10"
831    });
832
833    jQuery('#max-thickness-handle').html(jQuery('.slider-thickness').slider('values', 1)).position({
834        my: 'center top',
835        at: 'center bottom',
836        of: jQuery('.slider-thickness span:eq(1)'),
837        offset: "0, 10"
838    });
839}
840
841function configuresliderTensileStrength(minStrength, maxStrength) {
842    jQuery('.slider-tensile-strength').slider({
843        range: true,
844        min: minStrength,
845        max: maxStrength,
846        values: [minStrength, maxStrength],
847        slide: function (event, ui) {
848            var delay = function () {
849                var handleIndex = jQuery(ui.handle).index();
850                var label = handleIndex == 1 ? '#min-strength-handle' : '#max-strength-handle';
851                jQuery(label).html(ui.value).position({
852                    my: 'center top',
853                    at: 'center bottom',
854                    of: ui.handle,
855                    offset: "0, 10"
856                });
857            };
858
859            // wait for the ui.handle to set its position
860            setTimeout(delay, 2);
861//            retrieveNumProductSliders();
862            retrieveNumProdWithTimeOuts();
863        }
864    });
865    positionHandlesOnSliderStrength();
866}
867
868function positionHandlesOnSliderStrength() {
869
870    jQuery('#min-strength-handle').html(jQuery('.slider-tensile-strength').slider('values', 0)).position({
871        my: 'center top',
872        at: 'center bottom',
873        of: jQuery('.slider-tensile-strength span:eq(0)'),
874        offset: "0, 10"
875    });
876
877    jQuery('#max-strength-handle').html(jQuery('.slider-tensile-strength').slider('values', 1)).position({
878        my: 'center top',
879        at: 'center bottom',
880        of: jQuery('.slider-tensile-strength span:eq(1)'),
881        offset: "0, 10"
882    });
883}
884
885
886
887function checkSelectedCheckBoxes(checkBoxID, callback) {
888
889    var cookieName = '';
890    var chkGroup = ''
891
892    switch (checkBoxID) {
893        case '#id_chk_coatings':
894            chkGroup = 'input:checkbox[name=chk_coatings]';
895            cookieName = 'cookies_noc';
896            break;
897        case '#id_chk_support':
898            chkGroup = 'input:checkbox[name=chk_support]';
899            cookieName = 'cookies_nos';
900            break;
901    }
902
903    var selectedItems = Cookies.getJSON(cookieName);
904
905    jQuery(chkGroup).each(function () {
906        var value = jQuery(this).val();
907        if (contains(selectedItems, value)) {
908            jQuery(this).prop('checked', true)
909        } else {
910            jQuery(this).prop('checked', false);
911        }
912    });
913    
914    
915    if('#id_chk_coatings' == checkBoxID){ 
916        
917         var selectedItemsCured = Cookies.getJSON('cookies_compound_status');
918         var chkGroupCured = 'input:radio[name=chk_compound_status]';
919
920            jQuery(chkGroupCured).each(function () {
921                
922                var value = jQuery(this).val();
923                
924                if (contains(selectedItemsCured, value)) {
925                    
926                    jQuery(this).prop('checked', true);
927                    
928                }
929                else {
930                    
931                    jQuery(this).prop('checked', false);
932                    
933                }
934            });
935    
936    }
937
938    callback();
939}
940
941function getCookieName(checkBoxID) {
942    var cookieName = '';
943    switch (checkBoxID) {
944        case '#id_chk_coatings':
945            cookieName = 'cookies_noc';
946            break;
947        case '#id_chk_support':
948            cookieName = 'cookies_nos';
949            break;
950    }
951    return cookieName;
952}
953
954function validateEmail(email_id) {
955    var email = jQuery(email_id).val();
956    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
957    return re.test(email);
958}
959
960function validateIndustry(industry_id) {
961    var industry = jQuery(industry_id).val();
962    var industry_list = ["Aeronautic", "Civil engineering / Construction", "Deep Sea / Subsea Equipments", "Defense", "Energy", "Environment", "Industry", "Marine Equipment", "Medical", "Mining", "Off Shore", "Oil & Gas", "PPE", "Rescue", "Safety", "Transport"];
963    return contains(industry_list, industry);
964}
965
966function validateCountry(country_id) {
967    var country = jQuery(country_id).val();
968    var country_list = ["Afghanistan", "Albania", "Antarctica", "Algeria", "American Samoa", "Andorra", "Angola", "Antigua-et-Barbuda", "Antigua and Barbuda", "Azerbaijan", "Argentina", "Australia", "Austria", "Bahamas", "Bahrain", "Bangladesh", "Armenia", "Barbados", "Belgium", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "Belize", "British Indian Ocean Territory", "Solomon Islands", "British Virgin Islands", "Brunei Darussalam", "Bulgaria", "Myanmar", "Burundi", "Belarus", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African", "Sri Lanka", "Chad", "Chile", "China", "Taiwan", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Mayotte", "Congo", "Cook Islands", "Costa Rica", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Benin", "Denmark", "Dominica", "Dominican Republic", "Ecuador", "El Salvador", "Equatorial Guinea", "Ethiopia", "Eritrea", "Estonia", "Faroe Islands", "Falkland Islands", "South Georgia and the South Sandwich Islands", "Fiji", "Finland", "Aland Islands", "France", "French Guiana", "French Polynesia", "French Southern Territories", "Djibouti", "Gabon", "Georgia", "Gambia", "Occupied Palestinian Territory", "Germany", "Ghana", "Gibraltar", "Kiribati", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guyana", "Haiti", "Heard Island and McDonald Islands", "Vatican City State", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Côte d'Ivoire", "Jamaica", "Japan", "Kazakhstan", "Jordan", "Kenya", "Republic of Korea", "Kuwait", "
968Kyrgyzstan", "Lao People's Democratic Republic", "Lebanon", "Lesotho", "Latvia", "Liberia", "Libyan Arab Jamahiriya", "Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Martinique", "Mauritania", "Mauritius", "Mexico", "Monaco", "Mongolia", "Republic of Moldova", "Montserrat", "Morocco", "Mozambique", "Oman", "Namibia", "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "Aruba", "New Caledonia", "Vanuatu", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway", "Federated States of Micronesia", "Marshall Islands", "Palau", "Pakistan", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Guinea-Bissau", "Timor-Leste", "Puerto Rico", "Qatar", "Réunion", "Romania", "Russian Federation", "Rwanda", "Saint Helena", "Saint Kitts and Nevis", "Anguilla", "Saint Lucia", "Saint-Pierre and Miquelon", "Saint Vincent and the Grenadines", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Vietnam", "Slovenia", "Somalia", "South Africa", "Zimbabwe", "Spain", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Tajikistan", "Thailand", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "United Arab Emirates", "Tunisia", "Turkey", "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "Macedonia", "Egypt", "United Kingdom", "Isle of Man", "United Republic Of Tanzania", "United States", "U.S. Virgin Islands", "Burkina Faso", "Uruguay", "Uzbekistan", "Venezuela", "Wallis and Futuna", "Samoa", "Yemen", "Serbia and Montenegro", "Zambia"];
969    return contains(country_list, country);
970}
971
972function validateRequiredFields(fieldValue_id) {
973    var fieldValue = jQuery(fieldValue_id).val();
974    if (fieldValue == null || fieldValue == '' || fieldValue.length == 0) {
975        return false;
976    }
977    return true;
978}
979
980function validateForm(name_field_id, company_name_field_id, email_field_id, phone_field_id, industry_field_id, country_field_id, product_field_id) {
981//    var error_css = "border: red 2px solid !important;";
982//    
983    var is_form_valid = true;
984
985    function add_red_border(field_id) {
986        jQuery(field_id).addClass('error-field');
987        jQuery(field_id).val('');
988        is_form_valid = false;
989    }
990
991    //RGPD
992    if(! jQuery('#rgpd-checkbox-cookie-accept').prop('checked')){
993        add_red_border('#rgpd-form-checkbox');
994        return false;
995    }
996
997    var is_name_valid = validateRequiredFields(name_field_id) ? '' : add_red_border(name_field_id);
998    var is_company_name_valid = validateRequiredFields(company_name_field_id) ? '' : add_red_border(company_name_field_id);
999    var is_email_valid = validateEmail(email_field_id) ? '' : add_red_border(email_field_id);
1000    var is_phone_valid = validateRequiredFields(phone_field_id) ? '' : add_red_border(phone_field_id);
1001    var is_industry_valid = validateIndustry(industry_field_id) ? '' : add_red_border(industry_field_id);
1002    var is_country_valid = validateCountry(country_field_id) ? '' : add_red_border(country_field_id);
1003    var is_product_valid = validateRequiredFields(product_field_id) ? '' : add_red_border(product_field_id);
1004
1005    return is_form_valid;
1006}

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.