PageSourceSearch

https://www.go-new-york.com/redesign/modules/searches/srp_source.js?v=bb-1790980351001

js go-new-york.com collected 2026-10-02 22:32:18 UTC 56,951 bytes, 1,825 lines download raw bytes

1console.log( "!!!!!!!!!!!!!!" );
2	function buildWheresFromForm( s ){
3		
4		var criteria = $.extend( true, { }, configs[ s ].criteria );			
5		var curVal = "";
6		var curKeys = [ ];
7		
8		// Iterate through all distinct types
9		for( w in configs[ s ].wheres ){
10					
11			// Iterate through all of the associated fields
12			for( var cf = 0; cf < configs[ s ].wheres[ w ].length;  cf++ ){
13				switch( configs[ s ].wheres[ w ][ cf ].TYPE ){
14				
15					case "text":
16						
17						curVal = $( '#' + configs[ s ].wheres[ w ][ cf ].ID ).val( );
18					
19						if( curVal != "" ){
20						
21							// If it's the first criteria for this type, add the type object
22							if( criteria[ w ] == undefined ){
23								
24								criteria[ w ] = [ ];
25								
26							}
27							
28							criteria[ w ].push( { idf: configs[ s ].wheres[ w ][ cf ].IDF, type: "text", val: curVal } );
29							
30						}
31						
32						
33					break;
34					
35					case "select":
36					
37						curVal = configs[ s ].ajax_selects[ configs[ s ].wheres[ w ][ cf ].ID ];
38						
39						curKeys = [ ];
40						
41						for(var keyy in curVal){ if( curVal[ keyy ] ){ curKeys.push(keyy); } }
42						   
43						if( curKeys.length > 0 ){
44							
45							if( criteria[ w ] == undefined ){
46								
47								criteria[ w ] = [ ];
48								
49							}
50							
51							// If this is destinations, overwrite the destinations default item instead of pushing it
52							if( w == 3668 && configs[ s ].wheres[ w ][ cf ].IDF == 20414 ){
53									
54								for( var i = 0; i < criteria[ w ].length; i++ ){
55										
56									if( criteria[ w ][ i ].idf == 20414 ){
57									
58										criteria[ w ][ i ] = { idf: configs[ s ].wheres[ w ][ cf ].IDF, type: "select", val: curKeys };
59									
60									}
61									
62								}
63							
64							} else {
65								
66									// Always, always reset the locales here
67										if( request.signature.level == "Site" && w == 3668 && configs[ s ].wheres[ w ][ cf ].IDF == 20273 ){
68									
69												for( var i = 0; i < criteria[ w ].length; i++ ){
70														
71													if( criteria[ w ][ i ].idf == 20273 ){
72													
73														delete criteria[ w ][ i ];
74													
75													}
76													
77												}
78										
79										} else {
80											
81											criteria[ w ].push( { idf: configs[ s ].wheres[ w ][ cf ].IDF, type: "select", val: curKeys } );
82											
83										} // x: reset the locales
84							
85							}
86							
87						}
88						
89					break;
90				
91				}
92				
93				
94			} // Iterate through fields
95		
96		
97		} // Iterate through types
98				
99		
100			// Manually add fish groups here
101			if( configs[ s ].specialFishingSearch == 'group' ){
102			
103				configs[ s ].curFishTypes = [ ];
104						
105				for( var keyy in configs[ s ].ajax_selects.input_fish_types ){ if( configs[ s ].ajax_selects.input_fish_types[ keyy ] ){ configs[ s ].curFishTypes.push( keyy ); } }
106						
107				//if( configs[ s ].curFishTypes.length == 0 ){
108					
109					//for( var keyy in configs[ s ].alls.input_fish_types ){ if( configs[ s ].alls.input_fish_types[ keyy ] ){ configs[ s ].curFishTypes.push( keyy ); } }
110				
111				//} 
112				
113			}
114		
115		
116			// Manually add special lodging searches here
117			if( configs[ s ].specialLodgingSearch == 'group' || configs[ s ].specialLodgingSearch == 'parent' ){
118			
119				var curBrands = [ ];
120						
121				for( var keyy in configs[ s ].ajax_selects.input_brand ){ if( configs[ s ].ajax_selects.input_brand[ keyy ] ){ curBrands.push( keyy ); } }
122						
123				if( curBrands.length == 0 ){
124					
125					for( var keyy in configs[ s ].alls.input_brand ){ if( configs[ s ].alls.input_brand[ keyy ] ){ curBrands.push( keyy ); } }
126				
127				} 
128				
129				if( criteria[ 3647 ] == undefined ){ criteria[ 3647 ] = [ ]; }
130				
131					criteria[ 3647 ].push( { idf: 20140, type: "select", val: curBrands } );
132				
133			}
134				
135		// Locales rewrite
136		if( configs[ s ].localesPresent ){
137			
138			var localeIDs = [ ];
139			
140			var lContainer = $( '#searchForm' + s + ' .destinationPicker div.feedback' );
141			var collection = lContainer.find('input:checkbox:checked').not('.selectAll');	
142				collection.each(function(index){
143						localeIDs.push( $(this).val( ) );
144				});
145				
146				configs[ s ].localeIDs = localeIDs;				
147								
148				if( localeIDs.length > 0 ){
149						
150						// Overwrite instead of updating pre-existing ones
151						var localeObjectExists = false;
152						
153						for( var co = 0; co < criteria[ 3668 ].length; co++ ){
154								if( criteria[ 3668 ][ co ].idf == 20273 ){
155										localeObjectExists = true;
156										criteria[ 3668 ][ co ] = { idf: 20273, type: "select", val: localeIDs };
157								}
158						}
159						
160						if( ! localeObjectExists )
161							criteria[ 3668 ].push( { idf: 20273, type: "select", val: localeIDs } );
162					
163				}
164			
165		} 
166		
167		return criteria;
168		
169	}
170	
171	
172	function cacheGeodata( s, r ){
173	
174		configs[ s ].geodata = toQuery( r );
175		$( '#plotResultsDisplay' + s ).text( "" + configs[ s ].geodata.rc );
176		if( configs[ s ].plotAllResults ){ plotAllResults( s ); }
177		
178	}
179	
180		
181	// fu: initializeSRPMap
182	function initializeSRPMap( s, idMap ) {
183                
184				
185				
186				var latlng = new google.maps.LatLng(40.771592,-111.888189);
187				var myOptions = {
188					zoom: 8,
189					center: latlng,
190					mapTypeId: google.maps.MapTypeId.ROADMAP,
191					mapTypeControlOptions:{style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}
192				};
193				configs[ s ].srpMap = new google.maps.Map(document.getElementById( idMap ), myOptions);
194				configs[ s ].srpMapBounds = new google.maps.LatLngBounds();
195			
196			
197		/*
198		  if( GBrowserIsCompatible( ) ) { 
199		  
200			configs[ s ].srpMap = new GMap2(document.getElementById( idMap ));
201			configs[ s ].srpMap.addMapType(G_PHYSICAL_MAP);
202			configs[ s ].srpMap.addControl(new GSmallZoomControl3D());
203			
204			var mapControl = new GHierarchicalMapTypeControl();
205				mapControl.clearRelationships();
206				mapControl.addRelationship(G_SATELLITE_MAP, G_HYBRID_MAP, "Labels", false);
207			
208			configs[ s ].srpMap.addControl(mapControl);
209			configs[ s ].srpMapBounds = new GLatLngBounds();
210			
211	//		 the below needs to be called after the map is pop-upped
212	//		 in addition to here.  The setCenter call here initializes the map center regardless
213	//		 of the map width & height, and then is called again after the markers are added
214	
215			configs[ s ].srpMap.setCenter(new GLatLng(40.771592,-111.888189), 8);
216	
217		  }
218		  */
219		  
220	}
221	
222	
223	function killLocales( s ){
224				
225			configs[ s ].localesPresent = false;
226			configs[ s ].localeIDs = [ ];
227			
228			try {
229				
230					for( var cf = 0; cf < configs[ s ].params.config.wheres[ '3668' ].length; cf++ ){
231						if( configs[ s ].params.config.wheres[ '3668' ][ cf ].idf == '20273' ){
232							delete configs[ s ].params.config.wheres[ '3668' ][ cf ];
233						}				
234					}
235			
236			} catch( e ){ 	 }
237			
238	}
239	
240	
241	// fu: localesRewrite
242	function localesRewrite( s ){
243		var dests = configs[ s ].ajax_selects[ configs[ s ].idDestinationControl ];
244		var ht = '';
245		var picks = 0;
246		var instantiateMultiselect = false;
247		var loques = '';
248		var crits = [ ];
249		var multiArgs = { oneOrMoreSelected: '*' };
250		var maxLoquesToShow = 15;
251		killLocales( s );
252		
253		// configs[ s ].localeIDs = [ ]; // Reset locales to kill the invisible locales bugs
254		
255		// Calculate if they picked 1 or not 1 option
256		for( pick in dests ){
257			
258			if( dests[ pick ] == true ){
259				picks++;
260				crits.push( pick );
261			}
262		
263		}		
264			if( picks == 0 ){
265				
266				$( '#searchForm' + s + ' .destinationPicker' ).children( 'div.feedback' ).html( "" );
267				configs[ s ].localesPresent = false;
268				
269				
270				/*
271					$('div.checkDrop-wrap').each(function(){
272			var display = '';
273			var collection = $(this).find('input:checkbox:checked').not('.selectAll');			
274			collection.each(function(index){
275				display += $(this).parent().text();
276				if (index < collection.length - 1)
277					display += ", ";
278			});
279			$(this).children('div.feedback').html(display);
280		});
281				*/
282				
283			} else {
284			
285					if( picks != 1 ){
286						var display = '';
287						var collection = $( '#searchForm' + s + ' .destinationPicker label:first' ).find('input
287:checkbox:checked').not('.selectAll');			
288						collection.each(function(index){
289							display += $(this).parent().text();
290							if (index < collection.length - 1)
291								display += ", ";
292						});
293						$( '#searchForm' + s + ' .destinationPicker' ).children( 'div.feedback' ).html( display );
294						$( '#searchForm' + s + ' .destinationPicker' ).removeClass( 'passover' ) ;
295						configs[ s ].localesPresent = false;
296									
297					} else {
298						
299						
300						$( '#searchForm' + s + ' .destinationPicker' ).children( 'div.feedback' ).html( "Checking for specific areas" );
301						
302						var locales = $.cfc( 'ajax.locales', 'glbi', { id_destinations: crits, idType: configs[ s ].idt } );
303						
304								locales = toQuery( locales );								
305								
306								if( locales.rc == 0 ){
307									
308											configs[ s ].localesPresent = false;
309											$( '#searchForm' + s + ' .destinationPicker' ).removeClass( 'passover' ) ;								
310								
311													var display = '';
312													var collection = $( '#searchForm' + s + ' .destinationPicker' ).find('input:checkbox:checked').not('.selectAll');			
313													collection.each(function(index){
314														display += $(this).parent().text();
315														if (index < collection.length - 1)
316															display += ", ";
317													});
318													
319													$( '#searchForm' + s + ' .destinationPicker' ).children( 'div.feedback' ).html( display );
320													$( '#searchForm' + s + ' .destinationPicker' ).removeClass( 'passover' ) ;
321								
322									
323								} else {
324									
325									configs[ s ].localesPresent = true;
326									var h = "<select id='localePicker" + s + "' class='localePicker'>";
327									
328										h += "<option value=''></option>";
329										for( var cl = 0; cl < locales.rc; cl++ ){
330											 h += "<option value='" + locales.id_destination_locales[ cl ] + "'>" + locales.display[ cl ] + "</option>";	
331										}
332									
333									h += "</select>";
334									
335									$( '#searchForm' + s + ' .destinationPicker' ).children( 'div.feedback' ).html( h );
336									
337												$("#localePicker" + s).multiSelect2( { 
338													oneOrMoreSelected: '*',
339													noneSelected: 'Select Specific Area', 
340													farLeftAlign: true
341												}, 
342													function( e ){ 
343														var xange = $( e ); 
344														configs[ s ].ajax_changed[  'localePicker' + s  ]  = true;	
345														selectAndSearch( s, "localePicker" + s, xange.val( ), xange.attr( 'checked' ) ); 
346													} ,
347													
348												function( multis ){
349														$.each( multis, function( ind, item ){
350															manageMultiselectSearching( cci, $( item ).attr( 'id' ), true ); 
351														} ); // xeach
352													}
353												);
354									
355								}								
356								
357								$( '#searchForm' + s + ' .destinationPicker' ).addClass( 'passover' ) ;
358												
359						
360						/*
361						$( $( $( '#locales' + s ).parent( ) ).parent( ) ).show( );
362					
363						// Get the locales if not already gotten
364						//if( configs[ s ].localeCache[ id_destinations ] == undefined )
365						loques = toQuery( $.cfc( 'ajax.locales', 'glbi', { id_destinations: crits, idType: configs[ s ].idt } ) );
366						
367						
368						//localeCache#v.index#[ id_destinations ] = toQuery( $.cfc( 'app.destination_locales__parent_destination', 'get', { id_destinations: id_destinations, include: 'destination_locales' } ) );
369						
370						if( loques.rc > 0 ){
371						
372						// Get a local copy
373							
374							instantiateMultiselect = true;
375							
376							configs[ s ].alls[ configs[ s ].idLocaleControl ] = { };
377							
378							ht += "<select id='" + configs[ s ].idLocaleControl + "'>";
379							
380								ht += "<option value=''></option>";
381							
382								for( var ci = 0; ci < Math.min( maxLoquesToShow, loques.rc ); ci++ ){
383								
384									configs[ s ].alls[ configs[ s ].idLocaleControl ][ loques.id_destination_locales[ ci ] ] = true;
385									ht += "<option value='" + loques.id_destination_locales[ ci ] + "'>
385" + loques.display[ ci ] + "</option>";
386								
387								}
388								
389								// Show the user a message if there are more items than displayable
390								if( loques.rc > maxLoquesToShow ){
391									
392									multiArgs.message = "Not all locales are shown. Select fewer destinations to narrow this list.";
393									
394								}
395							
396							ht += "</select>";
397							
398						} else {
399						
400							ht += '<br/><span style="padding: 4px; font-size: 11px; font-weight: 700; color: rgb(17, 17, 17);">No locales available</span>';
401						
402						}
403						*/
404					
405				
406				} // xif picks == 1
407					
408			}
409				
410		
411		// Update the page
412		$( '#locales' + s ).html( ht );
413		
414		// Deselect the selection?
415		//$( '#' + configs[ s ].idLocaleControl ).attr( 'disabled', true );
416		
417		if( instantiateMultiselect ){
418			
419		  $( "#" + configs[ s ].idLocaleControl ).multiSelect2( multiArgs, function( e ){ var xange = $( e ); selectAndSearch( s, configs[ s ].idLocaleControl, xange.val( ), xange.attr( 'checked' ) ); } );	
420		
421		}
422		
423	} // fux: localesRewrite
424	
425	
426	
427	// fu: manageKeystrokeSearching
428	function manageKeystrokeSearching( s, id ){
429	
430		
431		configs[ s ].custom = true;
432		
433		clearTimeout( configs[ s ].keystrokes[ id ] ); // Clear any previous timeout
434		
435		configs[ s ].keystrokes[ id ] = setTimeout( function( ){ surch( s, true ); }, 300 ); // Set a new timeout
436	
437	}
438	
439	
440	
441	// fu: manageLocaleControl
442	function manageLocaleControl( s, id_destinations ){
443		
444		
445		var dests = configs[ s ].ajax_selects[ configs[ s ].idDestinationControl ];
446		var ht = '';
447		var picks = 0;
448		var instantiateMultiselect = false;
449		var loques = '';
450		var crits = [ ];
451		var multiArgs = { oneOrMoreSelected: '*' };
452		var maxLoquesToShow = 15;
453		
454		
455		// Calculate if they picked 1 or not 1 option
456		for( pick in dests ){
457			
458			if( dests[ pick ] == true ){
459		
460				picks++;
461				crits.push( pick );
462			
463			}
464		
465		}
466		
467		
468			
469			if( picks == 0 ){
470				
471				ht += '<br/><span style="padding: 4px; font-size: 11px; font-weight: 700; color: rgb(17, 17, 17);">No locales available</span>';
472				
473			} else {
474			
475					if( picks != 1 ){
476						
477						$( $( $( '#locales' + s ).parent( ) ).parent( ) ).hide( );
478						
479						
480					} else {
481						
482						$( $( $( '#locales' + s ).parent( ) ).parent( ) ).show( );
483					
484						// Get the locales if not already gotten
485						//if( configs[ s ].localeCache[ id_destinations ] == undefined )
486						loques = toQuery( $.cfc( 'ajax.locales', 'glbi', { id_destinations: crits, idType: configs[ s ].idt } ) );
487						
488						
489						//localeCache#v.index#[ id_destinations ] = toQuery( $.cfc( 'app.destination_locales__parent_destination', 'get', { id_destinations: id_destinations, include: 'destination_locales' } ) );
490						
491						if( loques.rc > 0 ){
492						
493						// Get a local copy
494							
495							instantiateMultiselect = true;
496							
497							configs[ s ].alls[ configs[ s ].idLocaleControl ] = { };
498							
499							ht += "<select id='" + configs[ s ].idLocaleControl + "'>";
500							
501								ht += "<option value=''></option>";
502							
503								for( var ci = 0; ci < Math.min( maxLoquesToShow, loques.rc ); ci++ ){
504								
505									configs[ s ].alls[ configs[ s ].idLocaleControl ][ loques.id_destination_locales[ ci ] ] = true;
506									ht += "<option value='" + loques.id_destination_locales[ ci ] + "'>" + loques.display[ ci ] + "</option>";
507								
508								}
509								
510								// Show the user a message if there are more items than displayable
511								if( loques.rc > maxLoquesToShow ){
512									
513									multiArgs.message = "Not all locales are shown. Select fewer destinations to narrow this list.";
514									
515								}
516							
517							ht += "</select>";
518							
519						} else {
520						
521							ht += '<br/><span style="padding: 4px; font-size: 11px; font-weight: 700; color: rgb(17, 17, 17);">No locales available</span>';
522						
523						}
524				
525				} // xif picks == 1
526					
527			}
528				
529			
530		
531		// Update the page
532		$( '#locales' + s ).html( ht );
533		
534		// Deselect the selection?
535		//$( '#' + configs[ s ].idLocaleControl ).attr( 'disabled', true );
536		
537		if( instantiateMultiselect ){
538			
539		  $( "#" + configs[ s ].idLocaleControl ).multiSelect2( multiArgs, function( e ){ var xange = $( e ); selectAndSearch( s, configs[ s ].idLocaleControl, xange.val( ), xange.attr( 'checked' ) ); } );	
540		
541		}
542		
543	} // fux: manageLocaleControl
544	
545	
546	function manageMultiselectSearching( s, id, isBlur ){
547		
548		//console.log( "manageMultiselectSearching called with: " + s + " and " + id + " and " + isBlur );
549		
550		// Check for a valid timeout as the mechanism to run the blur triggered events
551		//console.log( configs[ s ].multis[ id ] );
552		//console.log( isNaN( configs[ s ].multis[ id ] ) );
553				
554		if( isBlur != undefined && isBlur ){ //&& ! isNaN( configs[ s ].multiTimeout ) && configs[ s ].multiTimeout != 0  ){
555					/*
556					var change = false;		
557					
558					for( var cmc = 0;
558 cmc < configs[ s ].ajax_changed.length; cmc++ ){
559						if( configs[ s ].ajax_changed[ cmc ]  ){
560							change = true;
561							configs[ s ].ajax_changed[ cmc ] = false;
562						}
563					}
564					*/
565						
566					if( configs[ s ].multiselectChange ){
567						//clearTimeout( configs[ s ].multiTimeout ); // Clear any previous timeout
568						surch( s, true );
569						configs[ s ].multiselectChange = false;
570						configs[ s ].custom = true;
571					}
572			
573		}  else {
574			
575				clearTimeout( configs[ s ].multiTimeout ); // Clear any previous timeout
576				configs[ s ].multiTimeout = setTimeout( function( ){ surch( s, true ); }, 750 ); // Set a new timeout
577		
578		} 
579	
580	}
581	
582		
583	// fu: mergeFeatured
584	function mergeFeatured( s, r ){
585
586		console.log( "mergeFeatured called!" );
587
588		
589		var q = toQuery( r );
590		
591		configs[ s ].featured = q.rc;
592		configs[ s ].upgraded = 0;
593		configs[ s ].featuredOrder = [ ];
594		configs[ s ].upgradedOrder = [ ];
595		configs[ s ].featuredQuery = q;
596		
597		var fieldToUse = "featuring";
598
599		// Updated for Zeq
600		if( configs[ s ].specialSearch == "travel planners" ){
601			$(".searchHeading").attr('style','display: none');
602			console.log( "planners" );
603			console.log( configs[ s ].usePreviousRandomization );
604
605			// Test: Here
606			console.log( q );
607
608				if( false && configs[ s ].usePreviousRandomization ){
609					
610					configs[ s ].featuredOrder = srpCookie[ url ][ s ].fo;
611					configs[ s ].upgradedOrder = srpCookie[ url ][ s ].uo;
612					configs[ s ].usePreviousRandomization = false;
613					
614				} else {
615				
616						// Randomize the new order
617						for( var i = 0; i < q.rc; i++ ){
618
619							configs[ s ].featuredOrder[ i ] = i;
620
621							if( request == undefined || request.randomize == undefined || request.randomize ){
622
623							} else {
624
625								if( q.id_records[ i ] == request.force_to_top ){
626									request.force_to_top_index = i;
627
628									console.log( i + ": " + request.force_to_top_index );
629
630								}
631							}
632
633						}
634
635							// configs[ s ].featuredOrder.sort( randomizeResults );
636							// configs[ s ].upgradedOrder.sort( randomizeResults );
637						
638						try{ 
639
640							if( request == undefined || request.randomize == undefined || request.randomize ){
641
642							} else {
643								//configs[ s ].featuredOrder[ 0 ] = request.force_to_top_index;
644
645									// It's now switched spots, figure out where it is and move it to the top
646									for( var p = 0; p < configs[ s ].featuredOrder.length; p++ ){
647										if( configs[ s ].featuredOrder[ p ] == 0 ){
648											configs[ s ].featuredOrder[ p ] = configs[ s ].featuredOrder[ 0 ];
649											configs[ s ].featuredOrder[ 0 ] = 0;
650										}
651									}
652								//configs[ s ].upgradedOrder[ 0 ] = request.force_to_top_index;
653							}
654
655						} catch( e ){ 
656							console.log( e );
657						}
658								
659				} // x: usePreviousRandomization
660
661
662
663		} else {
664
665				if( configs[ s ].usePreviousRandomization ){
666					
667					configs[ s ].featuredOrder = srpCookie[ url ][ s ].fo;
668					configs[ s ].upgradedOrder = srpCookie[ url ][ s ].uo;
669					configs[ s ].usePreviousRandomization = false;
670					
671				} else {
672				
673						// Randomize the new order
674						for( var i = 0; i < q.rc; i++ ){
675
676							//console.log( q.featuring[ i ] + ":" + q.id_records[ i ] + ":" + i );
677
678							if( q.featuring[ i ] == 1 ){
679
680								configs[ s ].featuredOrder[ i ] = i;
681
682
683								if( request == undefined || request.randomize == undefined || request.randomize ){
684
685								} else {
686
687									if( q.id_records[ i ] == request.force_to_top ){
688										request.force_to_top_index = i;
689									}
690								}
691
692
693							} else {
694								configs[ s ].upgradedOrder[ i - configs[ s ].featuredOrder.length ] = i;
695							}
696						}
697
698								configs[ s ].featuredOrder.sort( randomizeResults );
699								configs[ s ].upgradedOrder.sort( randomizeResults );
700						
701						try{ 
702
703							if( request == undefined || request.randomize == undefined || request.randomize ){
704
705							} else {
706								//configs[ s ].featuredOrder[ 0 ] = request.force_to_top_index;
707
708									// It's now switched spots, figure out where it is and move it to the top
709									for( var p = 0; p < configs[ s ].featuredOrder.length; p++ ){
710										if( configs[ s ].featuredOrder[ p ] == 0 ){
711											configs[ s ].featuredOrder[ p ] = configs[ s ].featuredOrder[ 0 ];
712											configs[ s ].featuredOrder[ 0 ] = 0;
713										}
714									}
715								//configs[ s ].upgradedOrder[ 0 ] = request.force_to_top_index;
716							}
717
718						} catch( e ){ 
719							console.log( e );
720						}
721								
722				} // x: usePreviousRandomization
723				
724
725		}
726
727
728
729		configs[ s ].upgraded = configs[ s ].upgradedOrder.length;
730		configs[ s ].featuredItems = configs[ s ].featured - configs[ s ].upgraded;
731		configs[ s ].curFeaturedIndex++;
732		
733		syncSRPC( s ) ; // Save the randomized featured order for revisits
734				
735	} // fux: mergeFeatured
736	
737	
738	
739	
740	// fu: paginate
741	function paginate( s ){
742
743		console.log( "paginate( )" );
744		
745		var ht = "";
746		var showing = "";
747		
748		if( configs[ s ].includePages ){
749		
750		// Calculate the number of pages
751		ht += '<div class="paginationNumbers">';
752		
753		/* Between 1-9 */
754		if( configs[ s ].page < 9 ){
755					
756					if( configs[ s ].pages == 1 ){
757						
758					} else {
759						
760						ht += '<span class="pageLabel">Page</span>';
761						
762/*						if( configs[ s ].page > 1 ){
763							ht += '<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = ' + ( configs[ s ].page - 1 ) + '; surch( ' + s + ' ); syncSRPC( ' + s + ' ); return false; " >Prev</a>...';
764						}
765						else {
766							ht += '<span>Prev</span>';
767						}*/
768					
769						/* Middle pages */				
770						for( var i = 1; i <= Math.min( 9, configs[ s ].pages ); i++ ){
771						
772							if( i == configs[ s ].page ){
773								
774								ht += '<span>' + i + '</span>';
775								
776							} else {
777								
778								ht += '<a href="#searchbox" onclick=" configs[ ' + s + ' ].page = ' + i + '; surch( ' + s + ' ); syncSRPC( ' + s + '); " >' + i + '</a>';
779							
780							}
781						
782						} 
783					
784					
785						/* Next Page */
786/*						if( configs[ s ].items > ( configs[ s ].page * configs[ s ].itemsPerPage ) ){									
787							ht += '...<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = configs[ ' + s + ' ].page + 1; surch( ' + s + ' ); syncSRPC( ' + s + '); return false; " >Next</a>';
788						}
789						else { 
790							ht += '...<span>Next</span>';
791						}*/
792						
793						if( configs[ s ].pages > 9 ){
794							ht += '...<a href="#searchbox" onclick=" configs[ ' + s + ' ].page = ' + configs[ s ].pages + '; surch( ' + s + ' ); syncSRPC( ' + s + '); " >' + configs[ s ].pages + '</a>';
795						}
796						
797					}
798			
799			} else {
800			/* End */
801			if( configs[ s ].page > ( configs[ s ].pages - 9 ) ){
802						
803						ht += '<span class="pageLabel">Page</span>';
804				
805						ht += '<a href="#searchbox" onclick=" configs[ ' + s + ' ].page = 1; surch( ' + s + ' ); syncSRPC( ' + s + '); " >1</a>...';
806					
807/*						ht += '<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = ' + ( configs[ s ].page - 1 ) + '; surch( ' + s + ' ); syncSRPC( ' + s + '); return false;" >Prev</a>...';*/
808					
809						/* Middle pages */					
810						for( var i = configs[ s ].pages - 9; i <= configs[ s ].pages; i++ ){
811						
812							if( i == configs[ s ].page ){
813								
814								ht += '<span>' + i + '</span>';
815								
816							} else {
817								
818								ht += '<a href="#searchbox" onclick=" configs[ ' + s + ' ].page = ' + i + '; surch( ' + s + ' ); syncSRPC( ' + s + '); " >' + i + '</a>';
819							
820							}
821						
822						} 
823					
824/*						if( configs[ s ].page < configs[ s ].pages )
825						ht += '...<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = ' + ( configs[ s ].page + 1 ) + '; surch( ' + s + ' ); syncSRPC( ' + s + '); return false;" >Next</a>';
826						else 
827						ht += '...<span>Next</span>';*/
828					
829					
830			} else {
831			/* Middle */
832							
833						
834						ht += '<span class="pageLabel">Page</span>';
835						
836						/* First and prev page */
837						ht += '<a href="#searchbox" onclick=" configs[ ' + s + ' ].page = 1; surch( ' + s + ' ); syncSRPC( ' + s + '); " >1</a>...';
838/*						ht += '<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = configs[ ' + s + ' ].page - 1; surch( ' + s + ' ); syncSRPC( ' + s + '); return false; " >Prev</a>...';*/
839					
840					
841						/* Middle pages */				
842						for( var i = configs[ s ].page - 3; i <= Math.min( configs[ s ].pages, configs[ s ].page + 3 ); i++ ){
843						
844							if( i == configs[ s ].page ){
845								
846								ht += '<span>' + i + '</span>';
847								
848							} else {
849								
850								ht += '<a href="#searchbox" onclick=" configs[ ' + s + ' ].page = ' + i + '; surch( ' + s + ' ); syncSRPC( ' + s + '); " >' + i + '</a>';
851							
852							}
853						
854						} 
855					
856					
857						/* Last and next page */
858/*						ht += '...<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = configs[ ' + s + ' ].page + 1; surch( ' + s + ' ); syncSRPC( ' + s + '); return false; " >Next</a>';*/
859						ht += '...<a href="#searchbox" onclick=" configs[ ' + s + ' ].page = ' + configs[ s ].pages + '; surch( ' + s + ' ); syncSRPC( ' + s + '); " >' + configs[ s ].pages + '</a>';
860		
861			}
862		
863		}
864		
865		ht += '</div>';
866	
867		}
868	
869		// Showing
870		
871		showing += '<div class="paginationCounter">Showing ';
872		
873		showing += '<span class="resultsCounter">' + ( ( configs[ s ].page * configs[ s ].itemsPerPage ) - ( configs[ s ].itemsPerPage - 1 ) ) + '-' + ( Math.min( configs[ s ].page * configs[ s ].itemsPerPage, configs[ s ].items ) ) + '</span>of<span class="resultsCounter">' + configs[ s ].items + '</span></div>'; //
874		
875		//$( '#paginationShowingTop' + s ).html( showing );
876		
877		
878		
879		ht += '<div class="paginationCounter">Showing ';
880		
881		ht += '<span class="resultsCounter">' + ( ( configs[ s ].page * configs[ s ].itemsPerPage ) - ( configs[ s ].itemsPerPage - 1 ) ) + '-';
882		
883		
884			if( configs[ s ].includePages ) {
885				
886				ht += ( Math.min( configs[ s ].page * configs[ s ].itemsPerPage, configs[ s ].items ) ) + '</span>of<span class="resultsCounter">' + configs[ s ].items + '</span></div>'; //
887			
888			} else {
889			
890				ht += configs[ s ].items + '</span>of<span class="resultsCounter">' + configs[ s ].items + '</span></div>'; //
891			
892			}
893		
894		// Update both the top and bottom with the new pagination
895		$( '#pagingBottom' + s ).html( ht );
896		
897		
898	} // fux: paginate
899	
900	
901	// fu: paginateTop
902	function paginateTop( s ){
903		
904		var ht = "";
905		/* var showing = ""; */
906		
907		if( configs[ s ].includePages ){
908		
909		// Calculate the number of pages
910		ht += '<div class="paginationNumbers">';
911		
912		/* Between 1-3 */
913		if( configs[ s ].page < 3 ){
914					
915					if( configs[ s ].pages == 1 ){
916						
917					} else {
918						
919						ht += '<span class="pageLabel">Page</span>';
920						
921/*						if( configs[ s ].page > 1 ){
922							ht += '<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = ' + ( configs[ s ].page - 1 ) + '; surch( ' + s + ' );  syncSRPC( ' + s + '); return false;" >Prev</a>...';
923						}
924						else {
925							ht += '<span>Prev</span>';
926						}*/
927					
928						/* Middle pages */					
929						for( var i = 1; i <= Math.min( 3, configs[ s ].pages ); i++ ){
930						
931							if( i == configs[ s ].page ){
932								
933								ht += '<span>' + i + '</span>';
934								
935							} else {
936								
937								ht += '<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = ' + i + '; surch( ' + s + ' ); syncSRPC( ' + s + '); return false; " >' + i + '</a>';
938							
939							}
940						
941						} 
942					
943					
944						/* Next page */
945/*						if( configs[ s ].items > ( configs[ s ].page * configs[ s ].itemsPerPage ) ){									
946							ht += '...<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = configs[ ' + s + ' ].page + 1; surch( ' + s + ' ); syncSRPC( ' + s + '); return false; " >Next</a>';
947						}
948						else { 
949							ht += '...<span>Next</span>';
950						}*/
951						
952						if( configs[ s ].pages > 3 ){
953							ht += '...<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = ' + configs[ s ].pages + '; surch( ' + s + ' );  syncSRPC( ' + s + '); return false;" >' + configs[ s ].pages + '</a>';
954						}
955						
956					}
957			
958			} else {
959			/* End */
960			if( configs[ s ].page > ( configs[ s ].pages - 3 ) ){
961						
962						ht += '<span class="pageLabel">Page</span>';
963				
964						ht += '<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = 1; surch( ' + s + ' );  syncSRPC( ' + s + ' ); return false;" >1</a>...';
965					
966/*						ht += '<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = ' + ( configs[ s ].page - 1 ) + '; surch( ' + s + ' ); syncSRPC( ' + s + '); return false; " >Prev</a>...';*/
967					
968						/* Middle pages */					
969						for( var i = configs[ s ].pages - 3; i <= configs[ s ].pages; i++ ){
970						
971							if( i != 0 ){
972									
973								if( i == configs[ s ].page ){
974									
975									ht += '<span>' + i + '</span>';
976									
977								} else {
978									
979									ht += '<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = ' + i + '; surch( ' + s + ' ); syncSRPC( ' + s + '); return false; " >' + i + '</a>';
980								
981								}
982								
983							}
984						} 
985					
986					
987/*						if( configs[ s ].page < configs[ s ].pages )
988						ht += '...<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = ' + ( configs[ s ].page + 1 ) + '; surch( ' + s + ' ); syncSRPC( ' + s + '); return false; " >Next</a>';
989						else 
990						ht += '...<span>Next</span>';
991					*/
992					
993			} else {
994			/* Middle */
995							
996						
997						
998						ht += '<span class="pageLabel">Page</span>';
999						
1000						
1001						ht += '<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = 1; surch( ' + s + ' );  syncSRPC( ' + s + ' ); return false;" >1</a>...';
1002/*						ht += '<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = configs[ ' + s + ' ].page - 1; surch( ' + s + ' ); syncSRPC( ' + s + '); return false; " >Prev</a>...';*/
1003					
1004									
1005						for( var i = configs[ s ].page - 1; i <= Math.min( configs[ s ].pages, configs[ s ].page + 1 ); i++ ){
1006						
1007							if( i == configs[ s ].page ){
1008								
1009								ht += '<span>' + i + '</span>';
1010								
1011							} else {
1012								
1013								ht += '<a href=" javascript: mute( ); " onclick="configs[ ' + s + ' ].page = ' + i + '; surch( ' + s + ' ); syncSRPC( ' + s + '); return false; " >' + i + '</a>';
1014							
1015							}
1016						
1017						} 
1018					
1019					
1020/*						ht += '...<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = configs[ ' + s + ' ].page + 1; surch( ' + s + ' ); syncSRPC( ' + s + '); return false; " >Next</a>';*/
1021						ht += '...<a href=" javascript: mute( ); " onclick=" configs[ ' + s + ' ].page = ' + configs[ s ].pages + '; surch( ' + s + '); syncSRPC( ' + s + '); return false;" >' + configs[ s ].pages + '</a>';
1022						
1023						
1024						
1025						
1026						
1027		
1028			}
1029		
1030		}
1031	
1032		
1033		
1034		ht += '</div>';
1035		
1036	}
1037		
1038		ht += '<div class="paginationCounter">Showing ';
1039		
1040		ht += '<span class="resultsCounter">' + ( ( configs[ s ].page * configs[ s ].itemsPerPage ) - ( configs[ s ].itemsPerPage - 1 ) ) + '-';
1041		
1042			if( configs[ s ].includePages ){
1043				
1044				ht += ( Math.min( configs[ s ].page * configs[ s ].itemsPerPage, configs[ s ].items ) ) + '</span></div>'; //of<span class="resultsCounter">' + configs[ s ].items + '</span>
1045		
1046			} else {
1047				
1048				ht += configs[ s ].items + '</span></div>'; //of<span class="resultsCounter">' + configs[ s ].items + '</span>
1049				
1050			}
1051		
1052		// Update both the top and bottom with the new pagination
1053		$( '#pagingTop' + s ).html( ht );
1054		$( '#feedbackProgress' + s + ' span.numberOfResults').html(configs[ s ].items + "&nbsp;").parent().fadeIn();
1055		if ( configs[ s ].items == 1 )
1056			$( '#feedbackProgress' + s + ' span.plural').hide();
1057		else
1058			$( '#feedbackProgress' + s + ' span.plural').show();		
1059		triggerFeedbackSlider();
1060	} // fux: paginateTop
1061	
1062		function plotAllResults( s ){
1063		
1064		
1065		resetMap( s );
1066		
1067		r = configs[ s ].geodata;		        
1068		   
1069		configs[ s ].srpMapBounds = new google.maps.LatLngBounds( ); // Reset the GMap bounds object     		
1070
1071		  if ( configs[ s ].markers.length > 0 ) {
1072		    for (i in configs[ s ].markers ) {
1073		      configs[ s ].markers[i].setMap(null);
1074		    }
1075		  }
1076		  
1077		  configs[ s ].markers.length = 0;
1078
1079		
1080		var plotted = 0;
1081		var ex = true;
1082		
1083		for (var i = 0; i < r.rc; i++) {
1084		
1085			if (r.latitude[i] != null && r.longitude[i] != null) {
1086			
1087				// current map link
1088				if (r.direct_link[i] == 1 && r.website != undefined && r.website[i] != '' && r.website[i] != null) {
1089					cml = r.website[i];
1090					ex = true;
1091				} else {
1092					cml = '/' + r.display[i];
1093					ex = false;
1094				}
1095				
1096				if( r.id_records != undefined ){				
1097					plotSingleItem( s, new google.maps.LatLng(r.latitude[i], r.longitude[i]), r.name[i], cml, r.id_records[i], ex  );
1098				} else {
1099					plotSingleItem( s, new google.maps.LatLng(r.latitude[i], r.longitude[i]), r.name[i], cml, 0, ex  );
1100				}
1101					plotted++;
1102				
1103			}
1104			
1105		}
1106		
1107		
1108		  
1109			  
1110		if ( request.signature.level == 'site'){
1111			configs[s].srpMap.setCenter( new google.maps.LatLng( request.site.latitude, request.site.longitude ) );
1112			configs[s].srpMap.setZoom( parseInt( request.site.map_zoom_level_2 ) );
1113		} else {
1114			configs[s].srpMap.fitBounds( configs[s].srpMapBounds );
1115		}
1116		
1117	}
1118
1119	
1120	
1121	
1122	function plotCurrentPage( s ){
1123		
1124		resetMap( s );
1125			
1126			var r = { };
1127			var impInd = 0;
1128			var fltt = [ ]; // 04.06.10 featured listings to track
1129			var pageStart = configs[ s ].itemsPerPage * ( configs[ s ].page - 1 ) + 1;
1130			var ex = true;
1131		
1132			for( var i = 0; i < configs[ s ].results.rc; i++ ){
1133				
1134				if( ( i + pageStart ) > configs[ s ].featured ){
1135					
1136					r = configs[ s ].results;
1137					impInd = i;
1138					
1139				} else {
1140					
1141						// Featured
1142						if( ( i + pageStart ) <= configs[ s ].featuredItems ){
1143							
1144							impInd = configs[ s ].featuredOrder[  ( i + pageStart - 1 ) ];
1145
1146												
1147						} else {
1148							
1149							impInd = configs[ s ].upgradedOrder[  ( ( i + pageStart ) - configs[ s ].featuredItems ) - 1 ];
1150							
1151						}
1152					
1153					r = configs[ s ].featuredQuery;					
1154					
1155				}
1156						
1157					// Loop through the active page's results, only mapping applicable items
1158					if( r.latitude[ impInd ] != null && r.longitude[ impInd ] != null){
1159					
1160						if( r.direct_link[ impInd ] == 1 && r.website[ impInd ] != '' && r.website[ impInd ] != null ){
1161							cml = r.website[ impInd ];
1162							ex = true;
1163						} else {
1164							cml = '/' + r.display[ impInd ];
1165							ex = false;
1166						}
1167						
1168						if( r.id_records != undefined ){							
1169							plotSingleItem( s, new google.maps.LatLng( r.latitude[ impInd ], r.longitude[ impInd ] ), r.name[ impInd ], cml, r.id_records[impInd], ex );
1170						} else {
1171							plotSingleItem( s, new google.maps.LatLng( r.latitude[ impInd ], r.longitude[ impInd ] ), r.name[ impInd ], cml, 0, ex );
1172						}
1173					}
1174		
1175			} // xfor			  
1176						  
1177					if ( request.signature.level == 'site'){
1178						configs[s].srpMap.setCenter( new google.maps.LatLng( request.site.latitude, request.site.longitude ) );
1179						configs[s].srpMap.setZoom( parseInt( request.site.map_zoom_level_2 ) );
1180					} else {
1181						configs[s].srpMap.fitBounds( configs[s].srpMapBounds );
1182					}
1183
1184	
1185	}
1186
1187
1188
1189	function plotSingleItem( s, point, name, url, id, external  ) {
1190		var markerImage = new google.maps.MarkerImage("https://maps.gstatic.com/intl/en_us/mapfiles/ms/micons/blue.png", null, null, new google.maps.Point(8, 16), new google.maps.Size(16, 16)); 
1191		var shadowImage = new google.maps.MarkerImage("https://assets.gotravelsites.com/launch/map/shadow.png", null, null, new google.maps.Point(13, 31), new google.maps.Size(34, 31));
1192		//var point = new google.maps.LatLng( point );
1193		var zoom = 11;
1194		var marker = new google.maps.Marker({
1195		position: point, 
1196		map: configs[ s ].srpMap,
1197		title: name,
1198		icon: markerImage,
1199		shadow: shadowImage
1200		});
1201		//map: configs[ s ].srpMap, 
1202		
1203	
1204		google.maps.event.addListener(marker, 'click', function(){ 
1205			
1206				if( external ){
1207					gca.type = 4;
1208				} else {
1209					gca.type = 5;
1210				}
1211				
1212				gca.id = id;
1213				
1214				$.cfc( "ajax.click", "register", gca, function( ){ window.location = url; } );
1215
1216		 });
1217		
1218		configs[ s ].markers.push( marker );
1219		configs[ s ].srpMapBounds.extend( point );
1220		
1221		
1222		//configs[ s ].srpMap.setCenter( configs[ s ].srpMapBounds.getCenter() );
1223	
1224	/*
1225		var markerItem = createMarker( point, name, icon, url );	
1226		
1227			configs[ s ].srpMap.addOverlay( markerItem );
1228		
1229		var tooltip = new Tooltip( markerItem, name, 4 );
1230			
1231			markerItem.tooltip = tooltip; 
1232			
1233			configs[ s ].srpMap.addOverlay( tooltip );
1234			
1235		configs[ s ].srpMapBounds.extend( point );
1236		// configs[ s ].srpMap.setCenter( configs[ s ].srpMapBounds.getCenter(), configs[ s ].srpMap.getBoundsZoomLevel( configs[ s ].srpMapBounds ) );
1237		*/
1238		
1239	}
1240	
1241	
1242	
1243	// fu: randomizeResults	
1244	function randomizeResults( data_A, data_B ){
1245	
1246		return 0.5 - Math.random();
1247		
1248	} // fux: randomizeResults
1249	
1250	
1251
1252	// fu: repaginate
1253	function repaginate( s, r, skipToPage ){
1254
1255		console.log( "repaginate( )" );
1256		
1257		r = toQuery( r );
1258		
1259		// If it's the first set of results on the page, hide the controls if applicable
1260		if( configs[ s ].firstServe ){
1261			
1262			configs[ s ].firstServe = false;
1263			
1264			if( r.tot[ 0 ] == 0 ){
1265			
1266				// Hide stuff and mod dual display
1267				if( searches > 1 ){
1268					
1269					$( '#tc' + s ).attr( 'disabled', true );
1270					<!--- $( '#topicControlContainer' + s ).addClass( 'topicControlDisabled' ); --->
1271					
1272					if( s == 1 )
1273					$( '#tc2' ).attr( 'checked', true );
1274					
1275					// Current config index
1276					cci = ( s == 1 )?2:1;
1277					
1278					// Manually switch the radio button
1279					$( '#tc' + ( s == 1 )?2:1 ).attr( 'checked', true );
1280					
1281					// Current config
1282					cc = configs[ cci ];
1283					
1284					// Swap out the intro text
1285					$( '#intro_text_1_text' ).html( cc.intro );
1286					
1287					// Swap in/out visibility
1288					for( var i = 1; i <= searches; i++ ){
1289						
1290						if( i != cci ){
1291							$( '#search' + i ).hide( );
1292						}
1293					
1294					}
1295					
1296					$( '#search' + cci ).show( );
1297					//$( '#topicControlLabel' + s ).html( 'Show' );
1298				
1299				}
1300			
1301			} else {
1302			
1303				if( r.tot[ 0 ] <= 10 ){
1304				
1305					//$( '#topicControlLabel' + s ).html( 'Show' );
1306				
1307				}
1308			
1309			}
1310			
1311		}
1312		
1313		
1314		
1315		configs[ s ].items = r.tot[ 0 ];
1316		
1317		if( skipToPage != undefined ){
1318			configs[ s ].page = skipToPage;
1319		} else {
1320			configs[ s ].page = 1;
1321		}
1322		
1323		configs[ s ].pages = Math.floor( r.tot[ 0 ] / configs[ s ].itemsPerPage );
1324		
1325		if( ( r.tot[ 0 ] % configs[ s ].itemsPerPage ) != 0 )
1326		configs[ s ].pages++;
1327		
1328		/* 
1329		if( configs[ s ].pages == 1 ){
1330			$( '#mapPlottingControls' + s ).css( 'display', 'none' );
1331		} else {
1332			$( '#mapPlottingControls' + s ).css( 'display', 'block' );
1333		}
1334		*/
1335		
1336		// RPP control
1337		if( configs[ s ].items <= 10 || configs[ s ].disableRPP ){
1338			$( '#rpp' + s ).attr( 'disabled', true );
1339		}
1340		else {
1341			$( '#rpp' + s ).attr( 'disabled', false );	
1342		}
1343
1344
1345		if( configs[ s ].defaultResults || ! configs[ s ].searchable ){
1346			
1347			// Hide the form if less than a page
1348			if( configs[ s ].pages == 1 ){
1349
1350				$( "#searchForm" + s + ",#h3Results" + s + ",#searchControlsFooter" + s + ",#h3Results" + s ).hide( );
1351				$( "#h3Search" + s ).html( "Results" ); // 05.10.10 Modify search label to say results if no form present
1352				
1353				if( configs[ s ].defaultResults ){ configs[ s ].searchable = false; syncSRPC( s ); }
1354				
1355			} 
1356			
1357			if( configs.length == 1 && configs[ s ].pages == 1 ){
1358				
1359				$( "#h3Search" + s ).addClass('noBorder').text(' '); 
1360				
1361			}
1362			//$( "#h3Search" + s ).html("test").show();
1363			configs[ s ].defaultResults = false;
1364		
1365		}		
1366		
1367		if( r.tot[ 0 ] > 0 ){
1368		
1369			paginateTop( s );
1370			paginate( s );
1371			
1372		} else {
1373			
1374			$( '#pagingBottom' + s + ',#pagingTop' + s ).html( "<div align='center' style='font-size: 20px; font-weight: 700; '>No results matched your criteria</div>" );
1375			$( '#paginationShowingTop' + s ).html( "" );
1376		}
1377				
1378	} // fux: repaginate
1379	
1380	
1381	
1382	function resetMap(s){
1383		
1384		// Reset the GMap bounds object                
1385		configs[ s ].srpMapBounds = new google.maps.LatLngBounds( );
1386
1387		// Clear the previously plotted items, this is the suggested method as of Google Maps v3
1388		if ( configs[ s ].markers.length > 0 ) {
1389			for (i in configs[ s  ].markers ) {
1390			  configs[ s  ].markers[i].setMap(null);
1391			}
1392		}
1393		
1394		configs[ s  ].markers.length = 0;
1395	
1396	}
1397		
1398	// fu: resetMultis
1399	function resetMultis( s ){
1400		
1401		for( inpu in configs[ s ].ajax_selects ){
1402			
1403			configs[ s ].ajax_selects[ inpu ] = { };
1404			
1405		}
1406		
1407	} // fux: resetMultis
1408	
1409	
1410	// fu; resetSRPForm
1411	function resetSRPForm( s ){
1412		
1413		configs[ s ].custom = false;
1414		delete srpCookie[ s ]; // Erase cookie
1415		
1416				$('#searchForm' + s + ' .multiSelectOptions input:checkbox').attr('checked',false).parent('label').removeClass('checked'); 
1417				$('#searchForm' + s + ' .checkDrop-wrap>label>input').val(''); 
1418				$('#searchForm' + s + ' .checkDrop-wrap>label>input.multiSelect').val('Select options'); 
1419				$('#searchForm' + s + ' .searchBox>input').val(''); 
1420				$( '#searchForm' + s + ' .destinationPicker' ).removeClass( 'passover' ) ;
1421				resetMultis( s ); 
1422				configs[ s ].page = 1; 
1423				//manageLocaleControl( s ); 
1424				localesRewrite( s );
1425				surch( s, true ); 
1426				return false;
1427				
1428	} // fux; resetSRPForm
1429	
1430	
1431	
1432	// fu: restate
1433	function restate( s ){
1434	
1435			// Iterate through all distinct types
1436			for( w in configs[ s ].wheres ){
1437			
1438				// Iterate through all of the associated fields
1439				for( var cf = 0; cf < configs[ s ].wheres[ w ].length;  cf++ ){
1440					
1441					switch( configs[ s ].wheres[ w ][ cf ].TYPE ){
1442					
1443						case "text":
1444									
1445									if( srpCookie[ url ][ s ].wheres != undefined && srpCookie[ url ][ s ].wheres[ w ] != undefined ){
1446										
1447										  for( _f in srpCookie[ url ][ s ].wheres[ w ] ){
1448														
1449													if( srpCookie[ url ][ s ].wheres[ w ][ _f ].idf == configs[ s ].wheres[ w ][ cf ].IDF ){
1450														
1451														$( '#' + configs[ s ].wheres[ w ][ cf ].ID ).val(  srpCookie[ url ][ s ].wheres[ w ][ _f ].val );														
1452													
1453													}
1454											
1455											} // xfor
1456									
1457									} // xif
1458								
1459						break;
1460						
1461						
1462						case "select":
1463							
1464									if( srpCookie[ url ][ s ].wheres != undefined && srpCookie[ url ][ s ].wheres[ w ] != undefined ){
1465										
1466										  for( _f in srpCookie[ url ][ s ].wheres[ w ] ){
1467											
1468													if( srpCookie[ url ][ s ].wheres[ w ][ _f ].idf == configs[ s ].wheres[ w ][ cf ].IDF ){
1469													
1470														if( srpCookie[ url ][ s ].wheres[ w ][ _f ].val.length <= 10 ){
1471															
1472															configs[ s ].ajax_selects[ configs[ s ].wheres[ w ][ cf ].ID ] = { };
1473			
1474																// Loop through the array of checked values
1475																for( _v in srpCookie[ url ][ s ].wheres[ w ][ _f ].val  ){
1476																	
1477																		$( '[name=' + configs[ s ].wheres[ w ][ cf ].ID + '][value=' + srpCookie[ url ][ s ].wheres[ w ][ _f ].val[ _v ] + ']' ).attr( 'checked', true );
1478																		 configs[ s ].ajax_selects[ configs[ s ].wheres[ w ][ cf ].ID ][ srpCookie[ url ][ s ].wheres[ w ][ _f ].val[ _v ]  ] = true;
1479																		 
1480																}
1481																
1482														
1483														} // xif
1484													
1485													}
1486													
1487													// $( '#' + configs[ s ].wheres[ w ][ cf ].ID ).val(  srpCookie[ url ][ s ].criteria[ w ][ _f ].val );
1488											
1489											} // xfor
1490									
1491									} // xif
1492							
1493						break;
1494					
1495					}
1496					
1497					
1498				} // Iterate through fields
1499			
1500			
1501			} // Iterate through types
1502			
1503									// Customizables re-instatement
1504									if( configs[ s ].localesPresent ){
1505										$( '#searchForm' + s + ' .destinationPicker' ).addClass( 'passover' ) ; // Add passover class
1506									
1507										var dids = [ ];
1508										var dp = $(  '#searchForm' + s + ' div.destinationPicker' );
1509										var collection = dp.find('input:checkbox:checked').not('.selectAll');			
1510												collection.each(function(index){
1511													dids.push( $( this ).val( ) );
1512												});
1513									
1514									
1515																					$( '#searchForm' + s + ' .destinationPicker' ).children( 'div.feedback' ).html( "Checking for specific areas" );
1516																					
1517																					var locales = $.cfc( 'ajax.locales', 'glbi', { id_destinations: dids, idType: configs[ s ].idt } );
1518																					
1519																							locales = toQuery( locales );
1520																							
1521																							
1522																							if( locales.rc == 0 ){
1523																								$( '#searchForm' + s + ' .destinationPicker' ).children( 'div.feedback' ).html( "" );
1524																								configs[ s ].localesPresent = false;
1525																							
1526																							$( '#searchForm' + s + ' .destinationPicker' ).removeClass( 'passover' ) ;
1527																								
1528																							} else {
1529																								
1530																								configs[ s ].localesPresent = true;
1531																								var h = "<select id='localePicker" + s + "' class='localePicker'>";
1532																								
1533																									h += "<option value=''></option>";
1534																									for( var cl = 0; cl < locales.rc; cl++ ){
1535																										 h += "<option value='" + locales.id_destination_locales[ cl ] + "'";
1536																										 	
1537																										 h += " >" + locales.display[ cl ] + "</option>";	
1538																									}
1539																								
1540																								h += "</select>";
1541																								
1542																								$( '#searchForm' + s + ' .destinationPicker' ).children( 'div.feedback' ).html( h );
1543																								
1544																											$("#localePicker" + s ).multiSelect2( { 
1545																												oneOrMoreSelected: '*',
1546																												noneSelected: 'Select Specific Area', 
1547																												farLeftAlign: true
1548																											}, 
1549																												function( e ){ 
1550																													var xange = $( e ); 
1551																													selectAndSearch( s, "localePicker" + s, xange.val( ), xange.attr( 'checked' ) ); 
1552																												} ,
1553													
1554																											function( multis ){
1555																													$.each( multis, function( ind, item ){ 
1556																														manageMultiselectSearching( cci, $( item ).attr( 'id' ), true ); 
1557																													} ); // xeach
1558																												}
1559																											);
1560																											
1561																											
1562																												for( var curlo = 0; curlo < configs[ s ].localeIDs.length; curlo++ ){
1563																													
1564																														for( var cl = 0; cl < locales.rc; cl++ ){
1565																										
1566																																if( locales.id_destination_locales[ cl ] == configs[ s ].localeIDs[ curlo ] ){
1567																																	$( '#searchForm' + s + ' div.destinationPicker div.feedback input[value=' + configs[ s ].localeIDs[ curlo ]+ ']' ).attr( 'checked', true );
1568																																}
1569																																
1570																														}
1571																														
1572																												}
1573																								
1574																							}		
1575									}
1576												
1577			
1578			// Switch to subsequent tabs if applicable
1579			if( srpCookie[ url ] != undefined && srpCookie[ url ].tab != undefined && srpCookie[ url ].tab != 1 ){
1580				swap( srpCookie[ url ].tab );	
1581			}
1582			
1583		
1584		
1585	} // fux: restate
1586	
1587	
1588
1589	// fu: selectAndSearch
1590	function selectAndSearch( s, id, xange, checked ){
1591			
1592			var localeTest = id.substr( 0, 12 );
1593			
1594			// Locales rewrite 
1595			if( localeTest == 'localePicker' ){
1596				
1597						// Do nothing for locales, they're opt in only
1598				
1599			} else {
1600					
1601						// If they picked select all, reset the struct
1602						if( xange != 'on' ){
1603						
1604							if( configs[ s ].ajax_selects[ id ][ xange ] == undefined || configs[ s ].ajax_selects[ id ][ xange ] == false ){ 
1605							
1606								configs[ s ].ajax_selects[ id ][ xange ] = checked; 
1607							
1608							} else { 
1609							
1610								configs[ s ].ajax_selects[ id ][ xange ] = checked 
1611								
1612							}; 
1613						
1614						} else {
1615						
1616							// Simulate manual clicks either way
1617							configs[ s ].ajax_selects[ id ] = { };
1618						
1619							if( checked ){
1620								
1621								$.extend( true, configs[ s ].ajax_selects[ id ], configs[ s ].alls[ id ] );
1622							
1623							}
1624						}
1625						
1626			}
1627			
1628			// surch( s, true );
1629			configs[ s ].multiselectChange = true;
1630			console.log(configs);
1631			manageMultiselectSearching( s, id, false );
1632		
1633	} // fux: selectAndSearch
1634	
1635	
1636	
1637	// fu: setFeedback
1638	function setFeedback( ) {
1639		$('div.checkDrop-wrap').each(function(){
1640			if( ! $( this ).hasClass( 'passover' ) ){
1641					var display = '';
1642					var collection = $(this).find('input:checkbox:checked').not('.selectAll');			
1643					collection.each(function(index){
1644						display += $(this).parent().text();
1645						if (index < collection.length - 1)
1646							display += ", ";
1647					});
1648					$(this).children('div.feedback').html(display);
1649			} //xif hasClass
1650		});
1651	} // fux: setFeedback
1652	
1653	
1654	function surch( s, includeRepagination, skipToPage ){
1655		
1656		// Clear all multiselect changes
1657		for( var cmc = 0; cmc < configs[ s ].ajax_changed.length; cmc++ ){
1658			configs[ s ].ajax_changed[ cmc ] = false;
1659		}
1660		
1661		configs[ s ].params.itemsPerPage = configs[ s ].itemsPerPage;		
1662		configs[ s ].params.config.wheres = buildWheresFromForm( s );
1663		
1664		syncSRPC( s );
1665		
1666		/*<cfif request.signature.content eq 'Photos-Videos'>
1667		
1668			#v.js#.params.base = 'destinations'; #v.js#.params.id = #v.request.destination.id_destinations#;
1669		
1670		<cfelseif not hasForm>
1671		
1672			#v.js#.params.base = 'destinations'; #v.js#.params.id = #v.request.destination.id_destinations#;
1673		
1674		</cfif>*/
1675		
1676		
1677		// Only send the aggregate requests when a change in search criteria happens
1678		// During pagination simply modify the pagination display
1679		if( includeRepagination ){
1680			// retrigger 'feedback' bar
1681			//triggerFeedbackSlider();
1682			$( '#feedbackProgress' + s).fadeOut();
1683			
1684			
1685			configs[ s ].curSearchIndex++;
1686		
1687			configs[ s ].page = 1;
1688			configs[ s ].params.page = configs[ s ].page;
1689			configs[ s ].params.count = true;
1690		
1691			if( configs[ s ].specialFishingSearch != '' ){
1692			
1693				configs[ s ].params.specialFishingSearch = configs[ s ].curFishTypes;
1694			
1695			}
1696		
1697			if( configs[ s ].specialLodgingSearch != '' ){
1698			
1699				configs[ s ].params.specialLodgingSearch = configs[ s ].specialLodgingSearch;
1700			
1701			}
1702		
1703		
1704			if( configs[ s ].specialSearch != '' ){
1705			
1706				configs[ s ].params.specialSearch = configs[ s ].specialSearch;
1707			
1708			}
1709
1710			if( typeof( configs[ s ].tp_request ) != "undefined" ){
1711				configs[ s ].params.tp_request = configs[ s ].tp_request;
1712			}
1713		
1714		
1715			
1716			// Get the count
1717			$.cfc( 'ajax.search', 'search' + configs[ s ].manualSearch, configs[ s ].params, function( r ){ 
1718				
1719					if( skipToPage != undefined ){
1720						repaginate( s, r, skipToPage ); 
1721					} else{
1722						repaginate( s, r ); 
1723					}
1724				
1725			} );
1726			
1727			configs[ s ].params.count = false;
1728			configs[ s ].params.featuredOnly = true;
1729			configs[ s ].params.itemsPerPage = 500000;	
1730				
1731			// Get all of the featured items for this set separately
1732			$.cfc( 'ajax.search', 'search' + configs[ s ].manualSearch, configs[ s ].params, function( r ){ mergeFeatured( s, r ); } );
1733			
1734			
1735			configs[ s ].params.featuredOnly = false;
1736			configs[ s ].params.itemsPerPage = configs[ s ].itemsPerPage;	
1737
1738			
1739			// Get all of the geodata for the entire set
1740			$.cfc( 'ajax.search', 'geodata' + configs[ s ].manualSearch, configs[ s ].params, function( r ){ cacheGeodata( s, r ); } );
1741			
1742		
1743		} else {
1744		
1745			configs[ s ].params.page = configs[ s ].page;
1746			paginateTop( s );
1747			paginate( s );
1748		
1749		}
1750		
1751		configs[ s ].params.count = false;
1752		
1753		// Swap in loading graphic
1754		//$( '##resultsSet' ).html( '<div align="center"><br/><br/><img src="https://assets.gotravelsites.com/interface/loading.gif" /></div>' );
1755		
1756		// Scrape form for configurations and update params object
1757		/*
1758		$.cfc( 'ajax.search', 'search<cfif v.request.signature.content eq 'Photos-Videos'>Media<!--- <cfelseif v.request.signature.content eq 'Houseboat-Rentals'>Houseboats ---><cfelseif not hasForm>NearbyDests</cfif>', #v.js#.params, updateResults#v.index# );
1759		*/
1760		
1761		syncSRPC( s );
1762		
1763		if( skipToPage != undefined ){ 
1764				
1765				configs[ s ].page = skipToPage; 
1766				configs[ s ].params.page =  configs[ s ].page; 
1767		
1768		} 
1769			
1770		$.cfc( 'ajax.search', 'search' + configs[ s ].manualSearch, configs[ s ].params, configs[ s ].search );
1771		
1772		setFeedback( );
1773		
1774		return false;
1775		
1776	} // fux: surch
1777	
1778	
1779		  function syncSRPC( s, upgrade ){
1780			  
1781			  if( upgrade != undefined && upgrade ){
1782				  
1783				  if( srpCookie == undefined ){ srpCookie = { }; }
1784				  
1785				  if( srpCookie[ url ] == undefined ){ srpCookie[ url ] = { }; }
1786				  
1787					srpCookie[ url ].tab = configs.tab
1788					srpCookie[ url ].scrollY = configs.scrollY;
1789					srpCookie[ url ][ s ] = {  };
1790						
1791						
1792						//srpCookie[ url ][ s ].params = configs[ s ].params;
1793						srpCookie[ url ][ s ].wheres = configs[ s ].params.config.wheres;
1794						
1795						srpCookie[ url ][ s ].showMap = configs[ s ].showMap;
1796						srpCookie[ url ][ s ].plotAllResults = configs[ s ].plotAllResults;
1797						srpCookie[ url ][ s ].mode = configs[ s ].mode;
1798						srpCookie[ url ][ s ].itemsPerPage = configs[ s ].itemsPerPage;
1799						srpCookie[ url ][ s ].page = configs[ s ].page;
1800						srpCookie[ url ][ s ].searchable = configs[ s ].searchable;
1801						srpCookie[ url ][ s ].custom = configs[ s ].custom;
1802						
1803						//console.log( "Searchable: " + srpCookie[ url ][ s ].searchable );
1804						
1805						srpCookie[ url ][ s ].fo = configs[ s ].featuredOrder;
1806						srpCookie[ url ][ s ].uo = configs[ s ].upgradedOrder;
1807						
1808						srpCookie[ url ][ s ].localesPresent = configs[ s ].localesPresent;
1809						srpCookie[ url ][ s ].localeIDs = configs[ s ].localeIDs ;
1810					
1811					var expires = new Date( );
1812						expires.setMinutes( expires.getMinutes( ) + 60 );
1813					
1814					$.cookie( url, $.toJSON( srpCookie[ url ] ), { expires: expires } );
1815					
1816			  } // xupgrade
1817				  
1818		  }
1819		  
1820	// fu: triggerFeedbackSlider
1821	function triggerFeedbackSlider(){
1822		$('.progressBarSlider').width(0).animate( { "width" : "100%" }, 1500);
1823	}
1824            
1825

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.