PageSourceSearch

https://sloanled.com/wp-content/themes/sloanled/js/main.js?1790977607

js sloanled.com collected 2026-10-02 22:00:21 UTC 54,208 bytes, 1,540 lines download raw bytes

1/* 
2#############################################
3#											#
4#				GLOBAL VARS					#
5#											#
6#############################################
7*/
8var siteURL = SLOANLED.site_url;
9var ajaxSiteURL = siteURL + "/wp-admin/admin-ajax.php";
10var themeURL = SLOANLED.theme_url;
11var product;
12var hasProducts = false;
13var htbCollection = "";
14var htbRegion = "";
15/*###########################################*/
16/*============================================
17=            get width and height            =
18============================================*/
19
20$(function(){
21    windowWidth = $(window).width();
22    windowHeight = $(window).height();
23
24    $( window ).resize(function() {
25        var windowWidth = $(window).width();
26        var windowHeight = $(window).height();
27    });
28
29});
30
31$(function(){
32
33  $("select").select2();
34 
35});
36/*=====  End of get width and height  ======*/
37
38
39/*==============================
40=            navbar            =
41==============================*/
42
43$(function() {
44    //change navbar in scroll
45    // $(window).scroll(function() {
46    //     var posToChange = 100;
47    //     var pos = $('.navbar').offset();
48
49    //     if (pos.top > posToChange) {
50    //         $('.navbar').addClass('navbar-bg-white');
51    //         $('#white-logo').addClass('hidden');
52    //         $('#colored-logo').removeClass('hidden');
53
54    //         $('.navbar .iconSB').removeClass('hidden');
55    //         $('.navbar .iconSW').addClass('hidden');
56
57    //     } else {
58    //         $('#white-logo').removeClass('hidden');
59    //         $('#colored-logo').addClass('hidden');
60    //         $('.navbar').removeClass('navbar-bg-white');
61
62    //         $('.navbar .iconSB').addClass('hidden');
63    //         $('.navbar .iconSW').removeClass('hidden');
64
65    //     }
66    // });
67
68});
69
70
71/*=====  End of navbar  ======*/
72
73/*=======================================
74=            Home hero image            =
75=======================================*/
76
77
78$(function(){
79
80    function mqMarginTop(windowWidth){
81
82        var mT320 = 50;
83        var mTSm = 50;
84        var mTMd = 50;
85        var mT1200 = 60;
86        var mTLg = 80;
87
88        if(windowWidth >= 320 && windowWidth < 768){
89            var margTop = mT320;
90
91        }else if(windowWidth >= 768 && windowWidth < 1000){
92            var margTop = mTSm;
93
94        }else if(windowWidth >= 1000 && windowWidth < 1200){
95            var margTop = mTMd;
96
97        }else if(windowWidth >= 1200 && windowWidth < 1600){
98            var margTop = mT1200;
99
100        }else if(windowWidth >= 1600 ){
101            var margTop = mTLg;
102
103        }
104
105        return margTop;
106    }
107
108
109
110    $( window ).resize(function() {
111
112        var windowWidth = $(window).width();
113        var windowHeight = $(window).height();
114
115        $('#headerImage').css({'height': windowHeight, 'width': windowWidth});
116       // $('#headerImage h1').css('margin-top', mqMarginTop(windowWidth));
117
118        var headerContentHeight = $('#headerImage .introcontent').height();
119        var diffHHeight = (windowHeight - headerContentHeight);
120        var HPaddingTop = ((diffHHeight / 2) + (mqMarginTop(windowWidth) / 2));
121        $('#headerImage .introcontent').css('margin-top', HPaddingTop);
122
123    });
124
125    $('#headerImage').css({'height': windowHeight, 'width': windowWidth});
126    //$('#headerImage h1').css('margin-top', mqMarginTop(windowWidth));
127
128    var headerContentHeight = $('#headerImage .introcontent').height();
129    var diffHHeight = (windowHeight - headerContentHeight);
130    console.log(mqMarginTop(windowWidth));
131    var HPaddingTop = ((diffHHeight / 2) + (mqMarginTop(windowWidth) / 2));
132    $('#headerImage .introcontent').css('margin-top', HPaddingTop);
133    console.log(HPaddingTop);
134
135
136});
137
138/*=====  End of Home hero image  ======*/
139
140/*===============================================
141=            Case Study on home page            =
142===============================================*/
143
144$(function(){
145
146    var itemHeight;
147    var carouselaptionHeight;
148    var diffHeight;
149    var paddingTop;
150
151    itemHeight = $('.carousel-stories .item.active').height();
152    carouselaptionHeight = $('.carousel-stories .item.active .carousel-caption').height();
153    diffHeight = (itemHeight - carouselaptionHeight);
154    paddingTop = (diffHeight / 2);
155    $('.carousel-stories .item.active .carousel-caption').css('padding-top', paddingTop);
156
157     $("#myCarousel").on('slide.bs.carousel', function () {
158
159        itemHeight = $('.carousel-stories .item.active').height();
160        carouselaptionHeight = $('.carousel-stories .item.active .carousel-caption').height();
161        diffHeight = (itemHeight - carouselaptionHeight);
162        paddingTop = (diffHeight / 2);
163        $('.carousel-stories .item.active .carousel-caption').css('padding-top', paddingTop);
164    });
165
166     $('#myCarousel').on('slid.bs.carousel', function () {
167        itemHeight = $('.carousel-stories .item.active').height();
168        carouselaptionHeight = $('.carousel-stories .item.active .carousel-caption').height();
169        diffHeight = (itemHeight - carouselaptionHeight);
170        paddingTop = (diffHeight / 2);
171        $('.carousel-stories .item.active .carousel-caption').css('padding-top', paddingTop);
172    })
173    
174});
175
176
177/*=====  End of Case Study on home page  ======*/
178
179
180
181/*======================================
182=            home solutions            =
183======================================*/
184
185
186$(function(){
187
188    if(windowWidth >= 1000){
189        $('#solutions .grid .cStore').removeClass('grid-item--height4').addClass('grid-item--height2');
190        $('#solutions .grid .sportV').removeClass('grid-item--height2').addClass('grid-item--height4');
191
192        var cStore = $('#solutions .grid .cStore').clone();
193        var sportV = $('#solutions .grid .sportV').clone();
194
195        $('#solutions .grid .cStore').remove();
196        $('#solutions .grid .sportV').remove();
197
198        $(sportV).insertAfter($('#solutions .grid .commercial'));
199        $(cStore).insertAfter($('#solutions .grid .sportV'));
200    }
201
202
203    $('.grid').masonry({
204        itemSelector: '.grid-item',
205        columnWidth: '.grid-sizer',
206        percentPosition: true
207    });
208
209});
210
211
212
213
214/*=====  End of home solutions  ======*/
215
216/*========================================
217=            Collections page            =
218========================================*/
219
220$(function() {
221
222    function addInMobileDiv(nbrElD, nbrElM) {
223        return $('.collecDesktop .collection').get(nbrElD - 1).clone().insertAfter($('.collecMobile .collection').get(nbrElM - 1));
224
225// Begin Hidden 2023-07-24
226    // }
227// End Hidden 2023-07-24
228
229        if (windowWidth < 992 && $('#collectionsPage')) {
230            var childDesktop = $('#collectionsPage .collecDesktop .collection');
231            for (var i = 1; i < childDesktop.length + 1; i++) {
232                console.log("i: " + i); 
233                if (i == 1) {
234                    addInMobileDiv(i,i);
235                } else if (i == 2) {
236                    j = i;
237                    addInMobileDiv(i,i);
238                } else if (i == 3) {
239                    j = i;
240                    addInMobileDiv(i,i);
241                }
242            }
243
244            $('#collectionsPage .collecMobile .collection').get(3).remove(); 
245            
246            $('#collectionsPage .collecMobile .collection').get(2).before($('#collectionsPage .collecMobile .collection').get(3));
247
248            $('#collectionsPage .collecDesktop').addClass('hidden');
249        } else {
250            $('#collectionsPage .collecDesktop').removeClass('hidden');
251        }
252
253// Begin Added 2023-07-24
254    }
255// End Added 2023-07-24
256
257});
258
259$(function() {
260
261    if (windowWidth < 992 && $('#sollutionsPage')) {
262
263        var childDesktop = $('#sollutionsPage .collecDesktop .collection');
264        for (var i = 1; i < childDesktop.length + 1; i++) {
265             console.log("i: " + i); 
266            if (i == 1) {
267                addInMobileDiv(i,i);
268            } else if (i == 2) {
269                j = i + 1;
270                addInMobileDiv(i,i);
271            } else if (i == 3) {
272                j = i + 2;
273                addInMobileDiv(i,i);
274            } else if (i == 4) {
275                j = i + 3;
276                addInMobileDiv(i,i);
277            } else if (i == 5) {
278                j = i + 4;
279                addInMobileDiv(i,i);
280            } else if (i == 6) {
281                j = i + 5;
282                addInMobileDiv(i,i);
283            }
284
285        }
286
287        $('#sollutionsPage .collecDesktop').addClass('hidden');
288    } else {
289        $('#sollutionsPage .collecDesktop').removeClass('hidden');
290    }
291});
292
293/*----------  Sub menu  ----------*/
294$('#collecMenu').on('shown.bs.dropdown', function() {
295    $('#collecMenu #ArrowTop').removeClass('rotate');
296});
297
298$('#collecMenu').on('hidden.bs.dropdown', function() {
299    $('#collecMenu #ArrowTop').addClass('rotate');
300});
301
302/*=====  End of Collections page  ======*/
303
304/*====================================
305=            Product page            =
306====================================*/
307
308/*----------  Description and Galery  ----------*/
309
310
311$(function() {
312
313
314    if (windowWidth < 1000) {
315        $('.prodGalery').insertBefore($('.prodDescription'));
316    }
317
318});
319
320/*----------  Resources  ----------*/
321
322
323    // $(function() {
324
325    //     nbrResource = $('#resourceDContainer .resource').length;
326    //     x = 4;
327    //     $('#resourceDContainer .resource:lt(' + x + ')').show();
328    //     $('#loadMore').click(function() {
329    //         x = (x + 4 <= nbrResource) ? x + 4 : nbrResource;
330    //         $('#resourceDContainer .resource:lt(' + x + ')').show();
331    //         $('#loadMore').addClass('hidden');
332    //         $('#showLess').removeClass('hidden');
333
334    //         $('.viewAllTop').removeClass('rotate');
335
336           
337
338    //     });
339    //     $('#showLess').click(function() {
340    //         //x = (x - 5 < 0) ? 4 : x - 4;
341            
342    //         // var ressources = $('#resourceDContainer .resource:gt(0)');
343    //         // console.log(ressources);
344    //         $('#resourceDContainer .resource:gt(3)').hide();
345
346    //         $('#loadMore').removeClass('hidden');
347    //         $('#showLess').addClass('hidden');
348
349    //         $('.viewAllTop').addClass('rotate');
350
351    //     });
352
353    // });
354
355
356/*----------  for sm display  ----------*/
357/*
358$(function() {
359
360    var smWid = $(window).width();
361
362    if (smWid < 1000) {
363
364        nbrResourceSm = $('#resourceDContainer .resource').length;
365        xSm = 2;
366        $('#resourceDContainer .resource:lt(' + xSm + ')').show();
367        $('#loadMoreSm').click(function() {
368            xSm = (xSm + 2 <= nbrResourceSm) ? xSm + 2 : nbrResourceSm;
369            $('#resourceDContainer .resource:lt(' + xSm + ')').show();
370
371            if (xSm == 8) {
372
373                $('#loadMoreSm').addClass('hidden');
374                $('#showLessSm').removeClass('hidden');
375
376                $('.viewAllTop').removeClass('rotate');
377
378            } else if (xSm == 4 || xSm == 6) {
379
380                $('#loadMoreSm').removeClass('hidden');
381                $('#showLessSm').removeClass('hidden');
382                $('.viewAllTop').addClass('hidden');
383
384                $('.betSmMore').removeClass('hidden');
385                $('.betSmLess').removeClass('hidden');
386
387            } else if (xSm == 2) {
388
389                $('#showLessSm').addClass('hidden');
390            }
391        });
392        $('#showLessSm').click(function() {
393            xSm = (xSm - 3 < 0) ? 2 : xSm - 2;
394            $('#resourceDContainer .resource').not(':lt(' + xSm + ')').hide();
395
396            if (xSm == 8) {
397
398                $('#loadMoreSm').addClass('hidden');
399                $('#showLessSm').removeClass('hidden');
400
401                $('.viewAllTop').removeClass('rotate');
402
403            } else if (xSm == 4 || xSm == 6) {
404
405                $('#loadMoreSm').removeClass('hidden');
406                $('#showLessSm').removeClass('hidden');
407                $('.viewAllTop').addClass('hidden');
408
409                $('.betSmMore').removeClass('hidden');
410                $('.betSmLess').removeClass('hidden');
411
412            } else if (xSm == 2) {
413
414                $('#showLessSm').addClass('hidden');
415            }
416        });
417
418    }
419
420});
421
422*/
423
424/*----------  More from the collection  ----------*/
425
426$(function(){
427
428
429    if(windowWidth < 1000){
430
431        $('.carousel').flickity({
432            cellSelector: '.carousel-cell', 
433            prevNextButtons: false, 
434            pageDots: false 
435        });
436
437    }else if(windowWidth >= 1000){
438
439        $('.carousel').flickity({
440            cellSelector: '.carousel-cell', 
441            prevNextButtons: false, 
442            pageDots: false,
443            draggable: false
444        });
445
446    }
447
448
449
450    
451
452});
453
454/*----------  search form  ----------*/
455
456// 
457// $(function(){
458// 
459//     $( '.firstSelect' ).change(function() {
460//         var valueSelect = $('.firstSelect').val();
461// 
462//       if( valueSelect != 'Select a Collection'){
463// 
464//           $('.resCollection').prop('disabled', false);
465//           $('.resCollection').removeClass('desabledSelect');
466//       }else{
467//         $('.resCollection').prop('disabled', true);
468//         $('.resCollection').addClass('desabledSelect'); 
469// 
470//         $('.firstSelect').prop('disabled', false);
471//         $('.firstSelect').removeClass('desabledSelect'); 
472//       }
473//     });
474// 
475// });
476
477/*=====  End of Product page  ======*/
478
479/*==================================
480=            About page            =
481==================================*/
482
483$(function(){
484
485if(windowWidth < 768){
486
487    $('#companyPage .bloc2 .bloc2Img').insertBefore($('#companyPage .bloc2 .bloc2Txt'));
488
489}
490
491});
492
493/*=====  End of About page  ======*/
494
495
496
497$(function(){
498
499	/* ===== Resource Library ======== */
500    $( '#resCollection' ).change(function() {
501    console.log("Collection Changed");
502			var collection = $(this).val();
503			//reset values 
504			var html = '<option value="-1">Select a Product Line</option>';
505			$("#resProductLine").empty().append(html);
506			html = '<option value="-1">Select a Product</option>';
507			$("#resProduct").empty().append(html);
508			$('#resProduct').prop('disabled', true);
509			$('#resProduct').addClass('desabledSelect'); 
510			$('#resType').prop('disabled', true);
511			$('#resType').addClass('desabledSelect'); 
512			html = '<option value="-1">What are you looking for?</option>';
513			$("#resType").empty().append(html);
514			if(collection != "-1"){
515				$.ajax({
516					  type: 'POST',
517					  url: ajaxSiteURL,
518					  data: {
519								action: 'getProductLine',
520								collection : collection,		
521					  },
522					  success: function(response){
523					  var respObj = $.parseJSON(response);
524					  var productLine = respObj.productLine;
525					  var products = respObj.products;
526					  var productList = respObj.product_list;
527					  console.log("Product Line : " + productLine);
528					  	if(productLine != -1 && productLine != "undefined" && productLine != null){
529					   		$('#resProductLine').prop('disabled', false);
530					   		$('#resProductLine').removeClass('desabledSelect');
531							
532							for (var i=0; i < productLine.length; i++){
533								var item = productLine[i];
534								$("#resProductLine").append(item);
535							}
536							
537						}
538						else{
539							$('#resProductLine').prop('disabled', true);
540							$('#resProductLine').addClass('desabledSelect'); 
541							var html = '<option value="-1">Select a Product Line</option>';
542							$("#resProductLine").empty().append(html);
543							//Collection Does not have a Product Line get Products
544							//getProductForCollection(collection);
545						}
546						$("#query-results").empty();
547						if (productList != -1 && productList != "undefined" && productList != null){
548							$('#resProduct').prop('disabled', false);
549							$('#resProduct').removeClass('desabledSelect'); 
550							$("#resProduct").empty();
551							var p_html = '<option value="-1">Select a Product</option>';
552							$("#resProduct").html(p_html);
553
554							for (var j = 0; j < productList.length; j++){						
555								p_html = productList[j];
556								$("#resProduct").append(p_html);
557							}
558							
559						}
560						if(products != -1 && products != "undefined" && products != null){
561							// We have products
562							//Loop thru products
563							console.log("Nb products : " + products.length);
564							$('#resProduct').prop('disabled', false);
565							$('#resProduct').removeClass('desabledSelect'); 
566							$("#resProduct").empty();
567							var p_html = '<option value="-1">Select a Product</option>';
568							$("#resProduct").html(p_html);
569							for (var j = 0; j < products.length; j++){						
570								var p_title = products[j].product_title;
571								var p_id = products[j].product_id;
572								if (collection == 58 || collection == 63 || collection == 6310){
573									p_html = "<option value = '" + p_id + "' selected=selected>
573" + p_title + "</option>";
574									$( "#resProduct" ).trigger( "change" )
575								}
576								else{
577									p_html = "<option value = '" + p_id + "'>" + p_title + "</option>";
578								}
579								$("#resProduct").append(p_html);
580								
581								var p_resources = products[j].p_resources;
582								var resources = p_resources.resources;
583								var items = p_resources.items;
584                                console.log(items);
585								var titles = p_resources.titles;
586								$("#query-results").append("<div class='row'>");
587								if (collection == 58 || collection == 63 || collection == 6310){
588								
589								}
590								else{
591								var productTitle = "<h3 class='results-categorie-name'>" + p_title + "</h3>";
592								}
593								$("#query-results").append(productTitle);
594								for(var i = 0; i<titles.length; i++){
595									var html = generateResourceOutput(titles[i], items[i]);
596									$("#query-results").append(html);
597									 $("select").select2({minimumResultsForSearch: Infinity});
598								}
599								$("#query-results").append("</div>");
600								
601							}
602						}
603// 						else if(products == "undefined" || products == null){
604// 							$("#query-results").empty().html("<p style ='text-align: left;color:#07074e; padding-top:20px; font-family:\"Myriad Pro Regular\"; font-size: 18px; line-height:21px;'><span >Sorry, no results found! </span></p>");
605// 						}
606					  },
607					  error: function(MLHttpRequest, textStatus, errorThrown){
608						 alert(errorThrown);
609					  }
610				});
611			}
612			else{
613					//Disable all Select tags & reset content
614					$('#resProductLine').prop('disabled', true);
615					$('#resProductLine').addClass('desabledSelect'); 
616					var html = '<option value="-1">Select a Product Line</option>';
617					$("#resProductLine").empty().append(html);
618					$('#resProduct').prop('disabled', true);
619					$('#resProduct').addClass('desabledSelect'); 
620					html = '<option value="-1">Select a Product</option>';
621					$("#resProduct").empty().append(html);
622					$('#resType').prop('disabled', true);
623					$('#resType').addClass('desabledSelect'); 
624					html = '<option value="-1">What are you looking for?</option>';
625					$("#resType").empty().append(html);
626					$("#query-results").empty();
627			}
628    });
629	
630	function getProductForCollection(collection){
631		console.log("getProductForCollection Called");
632		//reset Product Dropdown List
633		var html = '<option value="-1">Select a Product</option>';
634		$("#resProduct").empty().append(html);
635		$.ajax({
636					  type: 'POST',
637					  url: ajaxSiteURL,
638					  data: {
639								action: 'getProduct',
640								collection : collection,		
641					  },
642					  success: function(response){
643					  //console.log("Response : " + response);
644						var respObj = $.parseJSON(response);
645					 	var productLine = respObj.productLine;
646					  	var products = respObj.products;
647					  	if(response != ""){
648					   		$('#resProduct').prop('disabled', false);
649					   		$('#resProduct').removeClass('desabledSelect');
650							$("#resProduct").append(response);
651						}
652						else{
653							$('#resProduct').prop('disabled', true);
654							 $('#resProduct').addClass('desabledSelect'); 
655							var html = '<option value="-1">Select a Product</option>';
656							$("#resProduct").empty().append(html);
657							//Collection Does not have a Product Line get Products
658						}
659					  },
660					  error: function(MLHttpRequest, textStatus, errorThrown){
661						 alert(errorThrown);
662					  }
663				});
664	
665	}
666	 $( '#resProductLine' ).change(function() {
667			var productLine = $(this).val();
668			var html = '<option value="-1">Select a Product</option>';
669			$("#resProduct").empty().append(html);
670			$('#resProduct').prop('disabled', true);
671			$('#resProduct').addClass('desabledSelect'); 
672			html = '<option value="-1">What are you looking for?</option>';
673			$("#resType").empty().append(html);
674			if(productLine != "-1"){
675				$.ajax({
676					  type: 'POST',
677					  url: ajaxSiteURL,
678					  data: {
679								action: 'getProduct',
680								productLine : productLine,		
681					  },
682					  success: function(response){
683					  var respObj = $.parseJSON(response);
684					  var productList = respObj.product_list;
685					  var products = respObj.products;
686					  if(productList != -1){
687					  		$("#resProduct").empty();
688					   		$('#resProduct').prop('disabled', false);
689					   		$('#resProduct').removeClass('desabledSelect');
690					   		
691					   		$("#resProduct").append('<option value="-1">Select a Product</option>');
692							$("#resProduct").append(productList);
693							$("#query-results").empty();
694// 							if(products != null){
695// 								// We have products
696// 								//Loop thru products
697// 								console.log("Nb products : " + products.length);
698// 		
699// 								for (var j = 0; j < products.length; j++){						
700// 									var p_title = products[j].product_title;
701// 									var p_id = products[j].product_id;
702// 
703// 									var p_resources = products[j].p_resources;
704// 									var resources = p_resources.resources;
705// 									var items = p_resources.items;
706// 									var titles = p_resources.titles;
707// 									$("#query-results").append("<div class='row'>");
708// 									var productTitle = "<h3 class='results-categorie-name'>" + p_title + "</h3>";
709// 									$("#query-results").append(productTitle);
710// 									for(var i = 0; i<titles.length; i++){
711// 										var html = generateResourceOutput(titles[i], items[i]);
712// 										$("#query-results").append(html);
713// 										 $("select").select2({minimumResultsForSearch: Infinity});
714// 									}
715// 									$("#query-results").append("</div>");
716// 								
717// 								}
718// 							}
719						}
720						else{
721							$('#resProduct').prop('disabled', true);
722							 $('#resProduct').addClass('desabledSelect'); 
723							var html = '<option value="-1">Select a Product</option>';
724							$("#resProduct").empty().append(html);
725						}
726					  },
727					  error: function(MLHttpRequest, textStatus, errorThrown){
728						 alert(errorThrown);
729					  }
730				});
731			}
732			else{
733					//Disable all Select tags & reset content
734					$('#resProduct').prop('disabled', true);
735					$('#resProduct').addClass('desabledSelect'); 
736					html = '<option value="-1">Select a Product</option>';
737					$("#resProduct").empty().append(html);
738					$('#resType').prop('disabled', true);
739					$('#resType').addClass('desabledSelect'); 
740					html = '<option value="-1">What are you looking for?</option>';
741					$("#resType").empty().append(html);
742			}
743    });
744    
745    $( '#resProduct' ).change(function() {
746			product = $(this).val();
747			var html = '<option value="-1">What are you looking for?</option>';
748			$("#resType").empty().append(html);
749			$('#resType').prop('disabled', true);
750			$('#resType').addClass('desabledSelect'); 
751			if(product != "-1"){
752				$.ajax({
753					  type: 'POST',
754					  url: ajaxSiteURL,
755					  data: {
756								action: 'getResource',
757								product : product,		
758					  },
759					  success: function(response){
760					 	var respObj = $.parseJSON(response);
761					  	if(respObj.resources != "-1"  ){				  		
762					  		var titles = respObj.titles;
763							var items = respObj.items;
764							var resources =  respObj.resources;
765					   		$('#resType').prop('disabled', false);
766					   		$('#resType').removeClass('desabledSelect');
767							$("#resType").append(resources);
768							$("#query-results").empty();
769							
770							for(var i = 0; titles.length; i++){
771								var html = generateResourceOutput(titles[i], items[i]);
772								$("#query-results").append(html);
773								 $("select").select2({minimumResultsForSearch: Infinity});
774							}
775							
776						}
777						else{
778							$('#resType').prop('disabled', true);
779							 $('#resType').addClass('desabledSelect'); 
780							var html = '<option value="-1">What are you looking for?</option>';
781							$("#resType").empty().append(html);
782							$("#query-results").empty().html("<p style ='text-align: left;color:#07074e; padding-top:20px; font-family:\"Myriad Pro Regular\"; font-size: 18px; line-height:21px;'><span >Sorry, no results found! </span></p>");
783						}
784					  },
785					  error: function(MLHttpRequest, textStatus, errorThrown){
786						 alert(errorThrown);
787					  }
788				});
789			}
790			else{
791					//Disable all Select tags & reset content
792// 					$('#resProduct').prop('disabled', true);
793// 					$('#resProduct').addClass('desabledSelect'); 
794// 					html = '<option value="-1">Select a Product</option>';
795// 					$("#resProduct").empty().append(html);
796					$('#resType').prop('disabled', true);
797					$('#resType').addClass('desabledSelect'); 
798					html = '<option value="-1">What are you looking for?</option>';
799					$("#resType").empty().append(html);
800					$("#query-results").empty();
801			}
802    });
803    
804     $( '#resType' ).change(function() {
805			var resource = $(this).val();
806			if(resource != "-1"){
807				$.ajax({
808					  type: 'POST',
809					  url: ajaxSiteURL,
810					  data: {
811								action: 'getResourceAssets',
812								resource : resource,
813								product: product		
814					  },
815					  success: function(response){
816					 
817					  	if(response != ""){
818							console.log(response);
819							var respObj = $.parseJSON(response);
820							var title = respObj.title;
821							var items = respObj.items;
822							var html = generateResourceOutput(title, items);
823							$("#query-results").empty().html(html);
824							 $("select").select2({minimumResultsForSearch: Infinity});
825						}
826						else{
827
828						}
829					  },
830					  error: function(MLHttpRequest, textStatus, errorThrown){
831						 alert(errorThrown);
832					  }
833				});
834			}
835			else{
836				//display all results.
837				$( "#resProduct" ).trigger( "change" )
838			}
839			
840			
841	});
842	
843	function generateResourceOutput(title, items){
844	
845		var html = "";
846		html +=  '<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 resultOut">';
847		html += '		<div class="result">';
848		html += '			<div class="resultImg">';
849		html += '				<img src="' + themeURL + '/img/fileBlue.png" alt="Sloanled result" class="hidden-md hidden-lg">';
850		html += '				<img src="' + themeURL + '/img/fileGray.png" alt="Sloanled result" class="hidden-xs hidden-sm">';
851		html += '			</div><!-- /.resultImgTESTPHP -->';
852		html += '			<span class="resultTitle">' + title + '</span>';
853		html += '			<form class="resource-library-form" action="" method="post">';								
854		html += '				<div class="selectDiv">';
855		html += '					<select class="form-control resAssets" name="resAssets" >';
856		
857		for (i = 0; i< items.length ; i++){
858				var item = items[i];
859				html += '				<option value= "' + ((item['upload_pdf']) ? item['upload_pdf'] : ((item['url']) ? item['url'] : item['estimator'])) + '" >' + item['description']  + '</option>';
860		}
861		html += '					</select>';
862		html += '				</div>';						
863		html += '				<div class="buttonDiv">';
864        if (item['estimator']) {
865            html += '                   <button type="submit">ESTIMATOR</button>';
866        } else {
867            html += '                   <button type="submit">DOWNLOAD</button>';
868        }
869		html += '				</div>';
870		html += '			</form>';
871		html += '		</div><!-- /.Result item -->';
872		html += '</div><!-- /.Result item -->';
873		
874		return html;
875	}
876
877   //query-results
878    $('#query-results').on("submit", '.resource-library-form', function(event) {
879		event.preventDefault();
880		var redir = $(this).find("select.resAssets").val();
881		console.log("Redirection : " + redir);
882		window.open(redir ,"_blank", "noopener");
883});
884	$("#search-products").keyup(function() {
885		var searchStr = $(this).val();
886  		
887		if(searchStr.length > 2){
888		$.ajax({
889			  type: 'POST',
890			  url: ajaxSiteURL,
891			  data: {
892						action: 'getAssetsFromSearch',
893						search : searchStr,	
894			  },
895			  success: function(response){
896			  console.log("Response : " + response);
897
898			  },
899			  error: function(MLHttpRequest, textStatus, errorThrown){
900				 alert(errorThrown);
901			  }
902		});
903	}
904	});
905	
906	/* ============= End Resource Library ===== */
907	/* CONTACT PAGE */
908
909    $('#sf-form').on('submit', this, function() {
910        if(!$('#sf-form').validationEngine('validate', {promptPosition : "bottomLeft", scroll: true, scrollOffset:200})){
911            return false;
912        } else {
913            return true;
914        }
915    });
916// 	$("#cnt-submit").click(function(){
917// 	document.getElementById("sf-form").submit();
918// 	console.log("Submit clicked");
919// 		if(!$('#sf-form').validationEngine('validate', {promptPosition : "bottomLeft", scroll: true, scrollOffset:200})){
920// 			return false;
921// 		}
922// 		else{
923// 			var url = $('#sf-form').attr('action');
924// 			console.log("valid form")
925// 			$('#sf-form').submit();
926
927
928
929
930// 			$.ajax({
931// 				  type: 'POST',
932// 				  url: url,
933// 				  beforeSend: function (xhr){              	 
934// 							xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
935// 							xhr.setRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
936// 							xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
937// 
938// 						},
939// 				  data: {
940// 							retURL : $("#retURL").val(),
941// 							lead_source : $("#lead_source").val(),
942// 							oid: $("#oid").val(),
943// 							first_name : $("#first_name").val(),
944// 							last_name : $("#last_name").val(),		
945// 							company : $("#company").val(),
946// 							email : $("#email").val(),
947// 							phone : (($("#phone").val().length > 0 ) ? $("#phone").val() : ""),
948// 							'00N4100000Rr8da' :  $("#00N4100000Rr8da").val(),
949// 							'00N4100000NdZcn' : $("#00N4100000NdZcn").val(),
950// 							street : (($("#street").val().length > 0 ) ? $("#street").val() : ""),
951// 							zip : (($("#zip").val().length > 0 ) ? $("#zip").val() : ""),
952// 							'00N4100000NdZcs' : $("#00N4100000NdZcs").val(),
953// 							'00N4100000REIBQ' : $("#00N4100000REIBQ").is(":checked") ? $("#00N4100000REIBQ").val() : "",
954// 							'00N4100000REIBV' : $("#00N4100000REIBV").is(":checked") ? $("#00N4100000REIBV").val() : "",
955// 							'00N4100000REIBk' : $("#00N4100000REIBk").is(":checked") ? $("#00N4100000REIBk").val() : "",
956// 							'00N4100000REIBf' : $("#00N4100000REIBf").is(":checked") ? $("#00N4100000REIBf").val() : "",
957// 							'00N4100000REIBp' : $("#00N4100000REIBp").is(":checked") ? $("#00N4100000REIBp").val() : "",
958// 							'00N4100000REIBz' : $("#00N4100000REIBz").is(":checked") ? $("#00N4100000REIBz").val() : "",
959// 							description : $("#description").val()
960// 				  },
961// 				  success: function(response){
962// 				  console.log("Response : " + response);
963// 
964// 				  },
965// 				  error: function(MLHttpRequest, textStatus, errorThrown){
966// 					 alert(errorThrown);
967// 				  }
968// 			});
969
970
971		//}
972		//return false;
973// 	});
974	$("#country_code").change(function(){
975		var country = $(this).val();
976		if (country == "US"){
977			$("#state_code").attr("disabled", false);
978			var html = generateUSStates;
979			$("#state_code").empty().append(html);
980		}
981		else if(country == "CA"){
982			$("#state_code").attr("disabled", false);
983			var html = generateCAProvinces();
984			$("#state_code").empty().append(html);
985		}
986        else if(country == "MX"){
987            $("#state_code").attr("disabled", false);
988            var html = generateMXStates();
989            $("#state_code").empty().append(html);
990        }
991		else{
992			$("#state_code").attr("disabled", false);
993		
994			// var html = '<option value="none" selected = selected>--None--</option>';
995            var html = '<option value="" selected = selected>--None--</option>';
996			$("#state_code").empty().append(html);
997		}
998
999
1000	});
1001
1002	function generateUSStates(){
1003	var list = '<option value="AK">Alaska</option>';
1004        list += '<option value="AL">Alabama</option>';
1005        list += '<option value="AR">Arkansas</option>';
1006        list += '<option value="AZ">Arizona</option>';
1007        list += '<option value="CA">California</option>';
1008        list += '<option value="CO">Colorado</option>';
1009        list += '<option value="CT">Connecticut</option>';
1010        list += '<option value="DC">District of Columbia</option>';
1011        list += '<option value="DE">Delaware</option>';
1012        list += '<option value="FL">Florida</option>';
1013        list += '<option value="GA">Georgia</option>';
1014        list += '<option value="HI">Hawaii</option>';
1015        list += '<option value="IA">Iowa</option>';
1016        list += '<option value="ID">Idaho</option>';
1017        list += '<option value="IL">Illinois</option>';
1018        list += '<option value="IN">Indiana</option>';
1019        list += '<option value="KS">Kansas</option>';
1020        list += '<option value="KY">Kentucky</option>';
1021        list += '<option value="LA">Louisiana</option>';
1022        list += '<option value="MA">Massachusetts</option>';
1023        list += '<option value="MD">Maryland</option>';
1024        list += '<option value="ME">Maine</option>';
1025        list += '<option value="MI">Michigan</option>';
1026        list += '<option value="MN">Minnesota</option>';
1027        list += '<option value="MO">Missouri</option>';
1028        list += '<option value="MS">Mississippi</option>';
1029        list += '<option value="MT">Montana</option>';
1030        list += '<option value="NC">North Carolina</option>';
1031        list += '<option value="ND">North Dakota</option>';
1032        list += '<option value="NE">Nebraska</option>';
1033        list += '<option value="NH">New Hampshire</option>';
1034        list += '<option value="NJ">New Jersey</option>';
1035        list += '<option value="NM">New Mexico</option>';
1036        list += '<option value="NV">Nevada</option>';
1037        list += '<option value="NY">New York</option>';
1038        list += '<option value="OH">Ohio</option>';
1039        list += '<option value="OK">Oklahoma</option>';
1040        list += '<option value="OR">Oregon</option>';
1041        list += '<option value="PA">Pennsylvania</option>';
1042        list += '<option value="PR">Puerto Rico</option>';
1043        list += '<option value="RI">Rhode Island</option>';
1044        list += '<option value="SC">South Carolina</option>';
1045        list += '<option value="SD">South Dakota</option>';
1046        list += '<option value="TN">Tennessee</option>';
1047        list += '<option value="TX">Texas</option>';
1048        list += '<option value="UT">Utah</option>';
1049        list += '<option value="VA">Virginia</option>';
1050        list += '<option value="VT">Vermont</option>';
1051        list += '<option value="WA">Washington</option>';
1052        list += '<option value="WI">Wisconsin</option>';
1053        list += '<option value="WV">West Virginia</option>';
1054        list += '<option value="WY">Wyoming</option>';
1055		return list;
1056	}
1057
1058	function generateCAProvinces(){
1059		var list = '<option value="AB">Alberta</option>';
1060            list += '<option value="BC">British Columbia</option>';
1061            list += '<option value="MB">Manitoba</option>';
1062            list += '<option value="NB">New Brunswick</option>';
1063            list += '<option value="NL">Newfoundland and Labrador</option>';
1064            list += '<option value="NS">Nova Scotia</option>';
1065            list += '<option value="NT">Northwest Territories</option>';
1066            list += '<option value="NU">Nunavut</option>';
1067            list += '<option value="ON">Ontario</option>';
1068            list += '<option value="PE">Prince Edward Island</option>';
1069            list += '<option value="QC">Quebec</option>';
1070            list += '<option value="SK">Saskatchewan</option>';
1071            list += '<option value="YT">Yukon Territories</option>';
1072		return list;
1073	}
1074
1075    function generateMXStates(){
1076        var list = '<option value="AG">Aguascalientes</option>';
1077            list += '<option value="BC">Baja California</option>';
1078            list += '<option value="BS">Baja California Sur</option>';
1079            list += '<option value="CH">Chihuahua</option>';
1080            list += '<option value="CL">Colima</option>';
1081            list += '<option value="CM">Campeche</option>';
1082            list += '<option value="CO">Coahuila</option>';
1083            list += '<option value="CS">Chiapas</option>';
1084            list += '<option value="DF">Federal District</option>';
1085            list += '<option value="DG">Durango</option>';
1086            list += '<option value="GR">Guerrero</option>';
1087            list += '<option value="GT">Guanajuato</option>';
1088            list += '<option value="HG">Hidalgo</option>';
1089            list += '<option value="JA">Jalisco</option>';
1090            list += '<option value="ME">Mexico State</option>';
1091            list += '<option value="MI">Michoacán</option>';
1092            list += '<option value="MO">Morelos</option>';
1093            list += '<option value="NA">Nayarit</option>';
1094            list += '<option value="NL">Nuevo León</option>';
1095            list += '<option value="OA">Oaxaca</option>';
1096            list += '<option value="PB">Puebla</option>';
1097            list += '<option value="QE">Querétaro</option>';
1098            list += '<option value="QR">Quintana Roo</option>';
1099            list += '<option value="SI">Sinaloa</option>';
1100            list += '<option value="SL">San Luis Potosí</option>';
1101            list += '<option value="SO">Sonora</option>';
1102            list += '<option value="TB">Tabasco</option>';
1103            list += '<option value="TL">Tlaxcala</option>';
1104            list += '<option value="TM">Tamaulipas</option>';
1105            list += '<option value="VE">Veracruz</option>';
1106            list += '<option value="YU">Yucatán</option>';
1107            list += '<option value="ZA">Zacatecas</option>';
1108        return list;
1109    }
1110	
1111	function checkSelect(field, rules, i, options){
1112		if (field.val() == "country" || field.val() == "state") {
1113    	 // this allows the use of i18 for the error msgs
1114    		 return "You must select an option!";
1115  		}
1116	}
1117	
1118
1119	/* ============== END Contact ============= */
1120});
1121
1122
1123
1124/* ===== How To Buy ======== */
1125
1126$(function(){
1127//htbCollection
1128   $( '#htbCollection' ).change(function() {
1129    		console.log("Collection Changed");
1130			var collection = $(this).val();
1131			htbCollection = collection;
1132			console.log("Collection : " + collection);
1133			$("#htbCountry").val("-1");
1134			$('#htbState').prop('disabled', true);
1135			$('#htbState').addClass('desabledSelect'); 
1136			$("#htbState").val("-1");
1137			$('#htbState').prop('disabled', true);
1138			$('#htbState').addClass('desabledSelect'); 
1139			$("#htbState").empty().html('<option value="-1">Select a State/Province</option>');
1140			$("#search-results").empty();
1141			if(collection != "-1"){
1142				$.ajax({
1143					  type: 'POST',
1144					  url: ajaxSiteURL,
1145					  data: {
1146								action: 'getResults',
1147								collection : collection,		
1148					  },
1149					  success: function(response){
1150						
1151						var respObj = $.parseJSON(response);
1152						var products = respObj.posts;
1153						var regions = respObj.region_country;
1154						var states = respObj.states;
1155						if(products != -1){
1156// 							for(var i=0; i< products.length; i++){
1157// 								var item = products[i];
1158// 								console.log("item : " + item);
1159// 								var html = "";
1160// 								if (item.type == 'distributor'){
1161// 										html = displayDistributors(item);
1162// 										html += separatorLine();
1163// 								}
1164// 								else{
1165// 										html = displaySalesReps(item);
1166// 										html += separatorLine();
1167// 								}
1168// 								$("#search-results").append(html);
1169// 							}
1170							html = '<option value="-1">Select a Country</option>';
1171							for(var i = 0; i < regions.length; i++){
1172								var item = regions[i];
1173								html += '<option value="' + item + '">' +item + '</option>';
1174							}
1175							$('#htbCountry').prop('disabled', false);
1176							$('#htbCountry').removeClass('desabledSelect'); 
1177							$("#htbCountry").empty().append(html);
1178						}
1179						else{
1180							$("#htbCountry").empty().html('<option value="-1">Select a Country</option>')
1181							$('#htbCountry').prop('disabled', true);
1182							$('#htbCountry').addClass('desabledSelect'); 
1183							$('#htbState').prop('disabled', true);
1184							$('#htbState').addClass('desabledSelect'); 
1185							$("#htbState").empty().html('<option value="-1">Select a State/Province</option>');
1186							//$("#search-results").empty().append("<p style ='text-align: left;color:#07074e; padding-top:20px; font-family:\"Myriad Pro Regular\"; font-size: 18px; line-height:21px;'><span >Sorry, no results found! </span></p>");
1187							var html = displaySalesReps(item);
1188								html += separatorLine();
1189							$("#htbState").empty().html(html);
1190							console.log("NO RECORDS FOUND.");
1191						}
1192					  },
1193					  error: function(MLHttpRequest, textStatus, errorThrown){
1194						 alert(errorThrown);
1195					  }
1196				});	
1197			
1198			}
1199			else{
1200				$("#htbCountry").empty().html('<option value="-1">Select a Country</option>');
1201				$('#htbState').prop('disabled', true);
1202				$('#htbState').addClass('desabledSelect'); 
1203				$("#htbState").empty().html('<option value="-1">Select a State/Province</option>');
1204				//$("#search-results").empty().append("<p style ='text-align: left;color:#07074e; padding-top:20px; font-family:\"Myriad Pro Regular\"; font-size: 18px; line-height:21px;'><span >Sorry, no results found! </span></p>");
1205				console.log("NO RECORDS FOUND.");
1206			}
1207			
1208	});
1209
1210$('#htbCountry').change(function(){
1211	var region = $(this).val();
1212	console.log("Country has changed : " + region);
1213			$('#htbState').prop('disabled', true);
1214		$('#htbState').addClass('desabledSelect'); 
1215		$("#htbState").empty().html('<option value="-1">Select a State/Province</option>');
1216	if(region != -1){
1217		htbRegion = region;
1218		$.ajax({
1219					  type: 'POST',
1220					  url: ajaxSiteURL,
1221					  data: {
1222								action: 'getResults',
1223								collection : htbCollection,	
1224								region : region	
1225					  },
1226					  success: function(response){
1227						
1228						var respObj = $.parseJSON(response);
1229						var products = respObj.posts;
1230						var regions = respObj.region_country;
1231						var states = respObj.states;
1232						
1233						if(products != -1){
1234						var displayed = false;
1235						$("#search-results").empty();
1236							for(var i=0; i< products.length; i++){
1237								var item = products[i];
1238								console.log("item : " + item);
1239								var html = "";
1240								if (item.type == 'distributor'){
1241										if(item["country"] == region){
1242											html = displayDistributors(item);
1243											html += separatorLine();
1244										}
1245								}
1246								else{
1247										if(item["country"] == region && displayed == false){
1248											html = displaySalesReps(item);
1249											html += separatorLine();
1250											displayed = true;
1251										}
1252// 										else 
1253// 
1254// 										if(item["country"] == region){
1255// 											console.log("Country : " + region + " | item-country : " + item["country"]);
1256// 											html = displaySalesReps(item);
1257// 											html += separatorLine();
1258// 										}
1259								}
1260								$("#search-results").append(html);
1261							}
1262							html = '<option value="-1">Select a State/Province</option>';
1263							var showStates = false;
1264							for(var i = 0; i < states.length; i++){
1265								var item = states[i];
1266								if (item != "N/A") {
1267									html += '<option value="' + item + '">' +item + '</option>';
1268									showStates = true;
1269								}
1270							}
1271							if (showStates == true){
1272								$('#htbState').prop('disabled', false);
1273								$('#htbState').removeClass('desabledSelect'); 
1274								$("#htbState").empty().append(html);
1275							}
1276						}
1277						else{
1278						
1279							$('#htbState').prop('disabled', true);
1280							$('#htbState').addClass('desabledSelect'); 
1281							$("#htbState").empty().html('<option value="-1">Select a State/Province</option>');
1282// 							var html = displaySalesReps(item);
1283//  								html += separatorLine();
1284							//$("#search-results").empty().append("<p style ='text-align: left;color:#07074e; padding-top:20px; font-family:\"Myriad Pro Regular\"; font-size: 18px; line-height:21px;'><span >Sorry, no results found! </span></p>");
1285						// 	$("#search-results").empty().append(html);
1286							console.log("NO RECORDS FOUND.");
1287						}
1288					  },
1289					  error: function(MLHttpRequest, textStatus, errorThrown){
1290						 alert(errorThrown);
1291					  }
1292				});	
1293	
1294	
1295	}
1296	else{
1297		$('#htbState').prop('disabled', true);
1298		$('#htbState').addClass('desabledSelect'); 
1299		$("#htbState").empty().html('<option value="-1">Select a State/Province</option>');
1300	}
1301
1302});
1303
1304$('#htbState').change(function(){
1305	var state = $(this).val();
1306	console.log("State has changed : " + state);
1307	if(state != -1){
1308		
1309		$.ajax({
1310					  type: 'POST',
1311					  url: ajaxSiteURL,
1312					  data: {
1313								action: 'getResults',
1314								collection : htbCollection,	
1315								region : htbRegion,
1316								state : state	
1317					  },
1318					  success: function(response){				
1319						var respObj = $.parseJSON(response);
1320						var products = respObj.posts;
1321						var regions = respObj.region_country;
1322						var states = respObj.states;
1323						var displayed = false;
1324						if(products != -1){
1325						$("#search-results").empty();
1326							for(var i=0; i< products.length; i++){
1327								var item = products[i];
1328								
1329								var html = "";
1330								if (item.type == 'distributor'){
1331									if(item["country"] == htbRegion && item["state_province"] == state){
1332										html = displayDistributors(item);
1333										html += separatorLine();
1334									}
1335								}
1336								else{
1337								console.log("Country : " + htbRegion + " | item-country : " + item["country"] + " | State : " + state + " | item state : " + item["state_province"] + " | Displayed : " + displayed);
1338										if($.trim(item["country"]) == $.trim(htbRegion) && $.trim(item["state_province"]) == $.trim(state) && displayed == false){										
1339											html = displaySalesReps(item);
1340											html += separatorLine();
1341											displayed = true;
1342										}
1343								}
1344								$("#search-results").append(html);
1345							}
1346	
1347						}
1348						else{
1349							$("#search-results").empty().append("<p style ='text-align: left;color:#07074e; padding-top:20px; font-family:\"Myriad Pro Regular\"; font-size: 18px; line-height:21px;'><span >Sorry, no results found! </span></p>");
1350							console.log("NO RECORDS FOUND.");
1351						}
1352					  },
1353					  error: function(MLHttpRequest, textStatus, errorThrown){
1354						 alert(errorThrown);
1355					  }
1356				});	
1357	
1358	
1359	}
1360	else{
1361	
1362		$('#htbState').prop('disabled', true);
1363		$('#htbState').addClass('desabledSelect'); 
1364		$("#htbState").empty().html('<option value="-1">Select a State/Province</option>');
1365	}
1366
1367});
1368function displayDistributors(params){
1369	var html =  '<div class="row">';
1370		html += '	<div class="col-xs-12">';
1371		html += '		<h3>' + params['title'] + '</h3>';
1372		html += '	</div>';
1373		html += '</div>';
1374		html +=  '<div class="row">';
1375		html += '	<div class="col-xs-10 col-md-8">';
1376		html += '		<h5>';
1377        if ( params['country'] == "United States" || params['country'] == "Canada" ) {
1378        html += '           <strong><em>' + ((params['channel_partner_type'] != "N/A" ) ? params['channel_partner_type'] : "" ) + '</em></strong>';
1379// BEGIN NEED TO MOVE NEXT TO LOCATION
1380            if ( params['territory_map_url'] != "Unavailable" && params['territory_map_url'] != "" && params['territory_map_url'] != null && params['territory_map_url'] != "undefined") {
1381                html += ' <a href="' + params['territory_map_url'] + '" target="_blank">[Territory Map]</a>';
1382            }
1383// END NEED TO MOVE NEXT TO LOCATION            
1384        html += '           </br>';
1385        }
1386        html +=             ((params['location'] != "N/A" ) ? params['location'] : "" ) + '</br>';
1387
1388        if ( params['additional_info'] != "" && params['additional_info'] != null && params['additional_info'].length != 0) {
1389            if ( params['additional_info_label'] != "" && params['additional_info_label'] != null && params['additional_info_label'].length != 0) {
1390                html += '<span><strong>' + params['additional_info_label'] + ' </strong>' + params['additional_info'] + '</span></br>';
1391            } else {
1392                html += '<span>' + params['additional_info'] + '</span></br>';
1393            }
1394        }
1395
1396		if ( params['website'] != "Unavailable" || params['website'] == "" || params['website'] == null || params['website'] == "undefined") {
1397			html += '			<a href="' + params['website'] + '" target="_blank" rel="external noopener">' + params['website'] + '</a></h5>';
1398		}
1399		html += '	</div>';				
1400		html += '	<div class="col-xs-2  col-md-2 col-md-push-2">';
1401		
1402		if ( params['website'] != "Unavailable" || params['website'] == "" || params['website'] == null || params['website'] == "undefined" || params['website'].length == 0) {
1403			html += '			<a href="' + params['website'] + '" target="_blank" rel="external noopener" class="link-icon-a"><img class="link-icon" src="' + themeURL + '/img/Link_icon.png"></a>';
1404		}
1405		html += '	</div>';
1406		html += '	<div class="col-xs-12  col-md-2 col-md-pull-2">';		
1407		html += '		<h5 class="B-right-text">' + params['phone'] + '</h5>';
1408		html += '	</div>';
1409		html += '</div>';
1410		return html;
1411
1412}
1413function separatorLine(){
1414	var html = '<div class="row">';
1415		html += '	<div class="col-xs-12">';
1416		html += '		<div class="gray-line"></div>';
1417		html += '	</div>';
1418		html += '</div>';
1419	return html;
1420
1421}
1422function displaySalesReps(params){
1423    if ( params['display_type'] == "contact_principal_sloan" ) {
1424    var html = '<div class="row">';
1425        html += '   <a href="https://principalsloan.com/contact/contact-headquarters/" target="_blank" rel="external"><div class="col-xs-12">';
1426        html += '       <h3>Contact Principal Sloan</h3>';
1427        html += '   </div></a>';
1428        html += '</div>';
1429        html += '<div class="row">';
1430        html += '   <div class="col-xs-10">';
1431        html += '       <h5>For buying options, please contact Principal Sloan via PrincipalSloan.com.<br> &nbsp;</h5>';
1432        html += '   </div>';
1433        html += '   <div class="col-xs-2 text-right">';
1434        html += '       <a href="https://principalsloan.com/contact/contact-headquarters/" target="_blank" rel="external" class="link-icon-a"><img src="' + themeURL + '/img/Link_icon.png"></a>';
1435        html += '   </div>';
1436        html += '</div>';
1437        return html;
1438    } else if ( params['display_type'] == "visit_principal_sloan" ) {
1439    var html = '<div class="row">';
1440        html += '   <a href="https://principalsloan.com/where-to-buy/" target="_blank" rel="external"><div class="col-xs-12">';
1441        html += '       <h3>Visit Principal Sloan</h3>';
1442        html += '   </div></a>';
1443        html += '</div>';
1444        html += '<div class="row">';
1445        html += '   <div class="col-xs-10">';
1446        html += '       <h5>Locate an authorized distributor near you by visiting PrincipalSloan.com.<br> &nbsp;</h5>';
1447        html += '   </div>';
1448        html += '   <div class="col-xs-2 text-right">';
1449        html += '       <a href="https://principalsloan.com/where-to-buy/" target="_blank" rel="external" class="link-icon-a"><img src="' + themeURL + '/img/Link_icon.png"></a>';
1450        html += '   </div>';
1451        html += '</div>';
1452        return html;
1453    } else {
1454	var html = '<div class="row">';
1455		html += '	<a href="' + siteURL + '/contact" target="_blank"><div class="col-xs-12">';
1456		html += '		<h3>Contact SloanLED</h3>';
1457		html += '	</div></a>';
1458		html += '</div>';
1459		html += '<div class="row">';
1460		html += '	<div class="col-xs-10">';
1461		html += '		<h5>For buying options, please contact SloanLED.<br> &nbsp;</h5>';
1462		html += '	</div>';
1463		html += '	<div class="col-xs-2 text-right">';
1464		html += '		<a href="https://sloanled.com/contact/" target="_blank" class="link-icon-a"><img src="' + themeURL + '/img/Link_icon.png"></a>';
1465		html += '	</div>';
1466		html += '</div>'; 
1467        return html;
1468    }
1469}
1470/* ===== End How To Buy ======== */
1471/* ############ Search Page ########### */
1472
1473// $('.search__input').keypress(function (e) {
1474//   if (e.which == 13) {
1475//    // $('form#login').submit();
1476//    var query = $('.search__input').val();
1477//    console.log("Searching for : " + query);
1478// 	$.ajax({
1479// 				  type: 'POST',
1480// 				  url: ajaxSiteURL,
1481// 				  data: {
1482// 							action: 'getSearchResults',
1483// 							query : query,	
1484	
1485// 				  },
1486// 				  success: function(response){				
1487// 					var respObj = $.parseJSON(response);
1488// 					var search_results = respObj.search;
1489// 					var criteria = "Showing search results for: " + query ;
1490// 					$("#search-criteria").val(criteria.toUpperCase());
1491// 					if(search_results != -1){
1492// 						$("#search-results").empty();
1493// 						for(var i=0; i< search_results.length; i++){
1494// 							var item = search_results[i];
1495// 							console.log("item : " + item["content"]);
1496// 							var html = outputSearchResult(item);
1497// 							$("#search-results").append(html);
1498// 							//if(i <= search_results.length -2 ){
1499// 								$("#search-results").append(outputDivider());
1500// 							//}
1501// 						}
1502
1503// 					}
1504// 					else{
1505// 						$("#search-results").empty().append("<p style ='text-align: left;color:#07074e; padding-top:20px; font-family:\"Myriad Pro Regular\"; font-size: 18px; line-height:21px;'><span >Sorry, no results found! </span></p>");
1506// 						console.log("NO RECORDS FOUND.");
1507// 					}
1508// 				  },
1509// 				  error: function(MLHttpRequest, textStatus, errorThrown){
1510// 					 alert(errorThrown);
1511// 				  }
1512// 			});	
1513	
1514//     return false;    //<---- Add this line
1515//   }
1516// });
1517
1518// function outputSearchResult(item){
1519// 	var html = "";
1520// 		html +='<div class="search-results__result">';
1521// 		html +='	<h3 class="search-results__result-title">';
1522// 		html +='		<a href="' + item["url"] + '" class="search-results__result-a" target="_blank" rel="external noopener">' + item["title"] + '</a>';
1523// 		html +='	</h3>';
1524// 		html +='	<p class="search-results__result-except">';
1525// 		html += 	item["content"];
1526// 		html +='	</p>';
1527// 		html +='</div>';
1528
1529						
1530// 	return html;
1531// }
1532
1533// function outputDivider(){
1534// 		return '<div class="search-results__line"></div>';
1535// }
1536/* ############# End Search Page ######### */
1537});
1538
1539
1540

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.