PageSourceSearch

https://shootreviews.com/wp-content/themes/listingpro/assets/js/main.js

js shootreviews.com collected 2026-10-08 20:44:11 UTC 184,991 bytes, 5,110 lines download raw bytes

1/* Main.js contains all main JS  */
2/*  Author : CrdioStudio Dev team */
3
4/*moin 31-03-017 strt*/
5jQuery.noConflict();
6
7jQuery(window).on('resize load live', function (){
8	jQuery(window).resize( function () {
9		
10		if (jQuery(window).width() <= 768) {
11			jQuery('a.open-map-view').on('click', function(event) {
12				event.preventDefault();
13				jQuery('.sidemap-container').addClass('open-map');
14				jQuery('header').addClass('map-view-content');
15			});
16			
17
18			jQuery('a.open-img-view').on('click', function(event) {
19				event.preventDefault();
20				jQuery('.sidemap-container').removeClass('open-map');
21				jQuery('header').removeClass('map-view-content');
22			});
23			
24			if(jQuery('#wpadminbar').length > 0) {
25				jQuery('html body').css('margin-top','-46px');
26			}
27		} else {
28			jQuery('.sidemap-container').removeClass('open-map');
29			if(jQuery('#wpadminbar').length > 0) {
30				jQuery('html body').css('margin-top','0px');
31			}
32			
33			jQuery('a.open-map-view').on('click', function(event) {
34				event.preventDefault();
35				jQuery('.sidemap-container').addClass('open-map');
36				jQuery('header').addClass('map-view-content');
37			});
38			
39
40			jQuery('a.open-img-view').on('click', function(event) {
41				event.preventDefault();
42				jQuery('.sidemap-container').removeClass('open-map');
43				jQuery('header').removeClass('map-view-content');
44			});
45		}
46		if (jQuery(window).width() <= 480) {
47			jQuery('#more_filters').hide();
48		} else {
49			jQuery('#more_filters').show();
50		}
51
52	});
53});
54jQuery(document).ready(function() {
55	
56	jQuery('.lp_cancel_notic').click(function (e) {
57
58       e.preventDefault();
59
60       jQuery('.lp_notification_wrapper').slideToggle(400);
61
62	})
63
64    jQuery('.claimformtrigger2').click(function(){
65        jQuery('header').addClass('lp-head-zindex');
66        var divHeight = jQuery('.leftside').height();
67        jQuery('.rightside').css('height', divHeight+'px');
68    })
69
70    jQuery('.lp-click-zindex').click(function() {
71        jQuery('header').removeClass('lp-head-zindex');
72    });
73
74    jQuery('.lp-tagline-submit-tagline label input[type="checkbox"]').click(function(event) {
75        if(jQuery(this).prop("checked") == true) {
76            jQuery(".with-title-cond").fadeIn(700);
77
78        } else if (jQuery(this).prop("checked") == false) {
79            jQuery(".with-title-cond").fadeOut(700);
80
81        }
82    });
83
84	jQuery('.stickynavbar ul li').each(function (e) {
85		var tagetID	=	jQuery(this).find('a').attr('href');
86		if( jQuery(tagetID).length == 0 )
87		{
88			jQuery(this).remove();
89		}
90    });
91
92
93	// Search Top margin in map view
94	var hh = jQuery('header').outerHeight();
95	var ab = jQuery('.absolute');
96	ab.css('top', hh);
97	
98	
99	// Touch Behaviorr for Mobile devices
100	if (jQuery('.chosen-container').length > 0) {
101	  	jQuery('.chosen-container').on('touchstart', function(e) {
102			e.stopPropagation(); e.preventDefault();
103			// Trigger the mousedown event.
104			jQuery(this).trigger('mousedown');
105	  	});
106	}
107	
108	jQuery('#see_filter').on('click', function(event) {
109		event.preventDefault();
110		var filter = jQuery('#more_filters');
111		jQuery(this).next('#more_filters').toggleClass('open_filter');
112		if(filter.hasClass('open_filter')) {
113			jQuery(this).next('#more_filters').slideDown(400);
114		}else {
115			jQuery(this).next('#more_filters').slideUp(400);
116		};
117	});
118	
119	
120	
121	
122});
123/*moin 31-03-017 ends*/
124
125/* by zaheer on 30 march */
126jQuery(document).ready(function($){
127	var loc = jQuery('.ui-widget').data('option');
128	var apiType = jQuery('#page').data('ipapi');
129	
130	var currentlocationswitch = '1';
131	
132	currentlocationswitch = jQuery('#page').data('lpcurrentloconhome');
133	if( currentlocationswitch == "0" ){
134		loc = 'locationifoff';
135		jQuery('.lp-location-search .ui-widget > i').fadeOut('fast');
136	}
137
138	if (loc == 'yes') {
139		if( (jQuery('.form-group').is('.lp-location-search') || jQuery('.form-group').is('.lp-location-inner-search')) && (jQuery('body').is('.home') || jQuery('body').is('.app-view-home'))){
140			if(apiType==="geo_ip_db"){
141				jQuery.getJSON('https://geoip-db.com/json/geoip.php?jsonp=?') 
142				 .done (function(location)
143				{
144					var c_loc = location.city;
145					var lp_s_loc = c_loc;
146					if (jQuery('#page').data('lpattern') == 'with_region') {
147						c_loc = location.city+" "+location.state+", "+location.country_name;
148						lp_s_loc = location.city+" "+location.state;
149					}
150					//jQuery('.lp-home-sear-location').val(location.city);
151					//jQuery(".chosen-select").val('').trigger('chosen:updated');
152					jQuery("#searchlocation").prop('disabled', true).trigger('chosen:updated');
153					jQuery('#searchlocation').find('#def_location').text(c_loc);
154					jQuery('#searchlocation').find('#def_location').val(c_loc);
155					jQuery('#cities').val(c_loc);
156					jQuery('input[name=lp_s_loc]').val(lp_s_loc);
157					// jQuery(".select2-selection__rendered").attr("title",location.city).text(location.city);
158					jQuery("#searchlocation").prop('disabled', false).trigger('chosen:updated');
159					jQuery('.select2-selection__rendered').parent('.select2-selection').addClass('slide-right');
160					jQuery('.lp-location-search .ui-widget > i').fadeOut('slow');
161				});
162			}
163			else if(apiType==="ip_api"){
164				jQuery.get("https://ipapi.co/json", function(location) {
165					var c_loc = location.city;
166					var lp_s_loc = c_loc;
167					if (jQuery('#page').data('lpattern') == 'with_region') {
168						c_loc = location.city+" "+location.region_code+", "+location.country_name;
169						lp_s_loc = location.city+" "+location.region_code;
170					}
171					jQuery("#searchlocation").prop('disabled', true).trigger('chosen:updated');
172					jQuery('#searchlocation').find('#def_location').text(c_loc);
173					jQuery('#searchlocation').find('#def_location').val(c_loc);
174					jQuery('#cities').val(c_loc);
175					jQuery('input[name=lp_s_loc]').val(lp_s_loc);
176					// jQuery(".select2-selection__rendered").attr("title",location.city).text(location.city);
177					jQuery("#searchlocation").prop('disabled', false).trigger('chosen:updated');
178					jQuery('.select2-selection__rendered').parent('.select2-selection').addClass('slide-right');
179					jQuery('.lp-location-search .ui-widget > i').fadeOut('slow');
180				}, "json");
181			}
182			else{
183					lpGetGpsLocName(function (lpgetcurrentcityvalue) {
184						lpgpsclocation = lpgetcurrentcityvalue;
185						jQuery("#searchlocation").prop('disabled', true).trigger('chosen:updated');
186						jQuery('#searchlocation').find('#def_location').text(lpgpsclocation);
187						jQuery('#searchlocation').find('#def_location').val(lpgpsclocation);
188						jQuery('#cities').val(lpgpsclocation);
189						jQuery('input[name=lp_s_loc]').val(lpgpsclocation);
190						// jQuery(".select2-selection__rendered").attr("title",lpgpsclocation).text(lpgpsclocation);
191						jQuery("#searchlocation").prop('disabled', false).trigger('chosen:updated');
192						jQuery('.select2-selection__rendered').parent('.select2-selection').addClass('slide-right');
193						jQuery('.lp-location-search .ui-widget > i').fadeOut('slow');
194					});
195			}
196			
197		}
198	}else if (loc == 'no') {
199		jQuery('.lp-location-search .ui-widget > i').on('click', function(event) {
200			event.preventDefault();
201			jQuery(this).addClass('fa-circle-o-notch fa-spin');
202			jQuery(this).removeClass('fa-crosshairs');
203			if(jQuery('.form-group').is('.lp-location-search')){
204				if(apiType==="geo_ip_db"){
205					jQuery.getJSON('https://geoip-db.com/json/geoip.php?jsonp=?')
206					 .done (function(location)
207					{
208						//jQuery('.lp-home-sear-location').val(location.city);
209						//jQuery(".chosen-select").val('').trigger('chosen:updated');
210						jQuery('.chosen-single').addClass('remove-margin');
211						jQuery("#searchlocation").prop('disabled', true).trigger('chosen:updated');
212						
213						if(location.city==null){
214						}
215						else{
216                            jQuery('#select2-searchlocation-container').text(location.city);
217							// jQuery('#searchlocation').find('#def_location').text(location.city);
218							jQuery('#searchlocation').find('#def_location').val(location.city);
219							jQuery('#cities').val(location.city);
220							jQuery('input[name=lp_s_loc]').val(location.city);
221							// jQuery(".select2-selection__rendered").attr("title",location.city).text(location.city);
222						}
223						jQuery("#searchlocation").prop('disabled', false).trigger('chosen:updated');
224						jQuery('.select2-selection__rendered').parent('.select2-selection').addClass('slide-right');
225						jQuery('.lp-location-search .ui-widget > i').fadeOut('slow');
226					});
227				}
228				else if(apiType==="ip_api"){
229					jQuery.get("https://ipapi.co/json", function(location) {
230						
231						jQuery('.chosen-single').addClass('remove-margin');
232						jQuery("#searchlocation").prop('disabled', true).trigger('chosen:updated');
233						
234						if(location.city==null){
235						}
236						else{
237                            jQuery('#select2-searchlocation-container').text(location.city);
238							// jQuery('#searchlocation').find('#def_location').text(location.city);
239							jQuery('#searchlocation').find('#def_location').val(location.city);
240							jQuery('#cities').val(location.city);
241							jQuery('input[name=lp_s_loc]').val(location.city);
242						}
243						
244						// jQuery(".select2-selection__rendered").attr("title",location.city).text(location.city);
245						jQuery("#searchlocation").prop('disabled', false).trigger('chosen:updated');
246						jQuery('.select2-selection__rendered').parent('.select2-selection').addClass('slide-right');
247						jQuery('.lp-location-search .ui-widget > i').fadeOut('slow');
248						
249					}, "json");
250				}
251				else{
252					
253					lpGetGpsLocName(function (lpgetcurrentcityvalue) {
254						
255						lpgpsclocation = lpgetcurrentcityvalue;
256						jQuery('.chosen-single').addClass('remove-margin');
257						jQuery("#searchlocation").prop('disabled', true).trigger('chosen:updated');
258						
259						jQuery('#select2-searchlocation-container').text(lpgpsclocation);
260						jQuery('#searchlocation').find('#def_location').val(lpgpsclocation);
261						jQuery('#cities').val(lpgpsclocation);
262						jQuery('input[name=lp_s_loc]').val(lpgpsclocation);
263						
264						// jQuery(".select2-selection__rendered").attr("title",lpgpsclocation).text(lpgpsclocation);
265						jQuery("#searchlocation").prop('disabled', false).trigger('chosen:updated');
266						jQuery('.select2-selection__rendered').parent('.select2-selection').addClass('slide-right');
267						jQuery('.lp-location-search .ui-widget > i').fadeOut('slow');
268					});
269					
270				}
271			}
272		});
273	}
274
275
276
277jQuery('#lp-new-ad-compaignForm').on('submit', function(e){
278        var $this = jQuery(this);
279		if($this.data('type')=="adsperclick"){
280			totalPrice = jQuery('input[name="ads_price"]').val();
281			var spotlight = 0,
282				topos = 0,
283				sidebar = 0;
284			if ($this.find('#spotlightcmp').is(':checked')){
285                spotlight = $this.find('#spotlightcmp').data('price');
286			}
287            if ($this.find('#camp-for-search').is(':checked')){
288                topos = $this.find('#camp-for-search').data('price');
289            }
290            if ($this.find('#for-sidebar-camp').is(':checked')){
291                sidebar = $this.find('#for-sidebar-camp').data('price');
292            }
293            var minbujet = spotlight+topos+sidebar;
294            if (totalPrice <= minbujet){
295            	e.preventDefault();
296            	e.stopPropagation();
297            	alert($this.data('string')+' '+minbujet);
298            	return false;
299			}
300		}else{
301			totalPrice = jQuery('input[name="ads_price"]').val();
302		}
303        
304        method = jQuery('input[name="method"]:checked').val();
305        currency = $this.find('input[name="currency"]').val();
306        listing_id = jQuery('input[name=lp_ads_for_listing]').val();
307        listing_name = jQuery('input[name=lp_ads_title]').val();
308        taxRate = $this.find('input[name="taxprice"]').val();
309
310        if (listing_id==='' || method==='' ) {
311            alert(jQuery('input#ad-blank-errorMsg').val());
312            e.preventDefault();
313        }
314        else if(method==='stripe'){
315			
316            totalPrice = parseFloat(totalPrice)*100;
317            totalPrice = parseFloat(totalPrice).toFixed();
318
319            handler.open({
320                name: listing_name,
321                description: "",
322                zipCode: true,
323                amount: totalPrice,
324                currency: currency
325            });
326            e.preventDefault();
327        }
328        else if(method==='2checkout'){
329            var packages = [];
330            jQuery('input.checked_class[type="checkbox"]:checked').each(function () {
331                packages.push($this.data('package'));
332            });
333            jQuery('#myCCForm #tprice').val(totalPrice);
334            jQuery('#myCCForm #listing_id_2check').val(listing_id);
335            jQuery('#myCCForm #packages').val(packages);
336            jQuery('#myCCForm #taxprice').val($this.find('input[name="taxprice"]').val());
337            jQuery("button.lp-2checkout-modal2").trigger('click');
338            e.preventDefault();
339        }
340
341    });
342});
343/* end by zaheer on 30 march */
344
345jQuery(window).load(function() {
346	
347	
348	jQuery('.lp-suggested-search').on('click', function(event) {
349
350		jQuery("#input-dropdown").niceScroll({
351			cursorcolor:"#363F48",
352			cursoropacitymax: 1,
353			boxzoom:false,
354			cursorwidth: "10px",
355			cursorborderradius: "0px",
356			cursorborder: "0px solid #fff",
357			touchbehavior:true,
358			preventmultitouchscrolling: false,
359			cursordragontouch: true,	
360			background: "#f7f7f7",
361			horizrailenabled: false,
362			autohidemode: false,
363			zindex : "999999",
364		});
365
366	});
367	
368	
369	// Notices Box Script
370	jQuery('.notice a.close').on('click', function(event) {
371		event.preventDefault();
372		jQuery(this).parent('.notice').fadeOut('slow');
373	});
374
375	jQuery('.lp-header-full-width .lp-menu-bar .header-filter, .lp-menu-bar .header-filter.pos-relative.form-group').css('display', 'block');
376
377	var logoH = jQuery('.lp-logo').outerHeight();
378	var acHgt = jQuery('.header-right-panel.clearfix');
379	var a = parseInt(logoH + 10);
380	var b = jQuery('.header-right-panel').height();
381	var c = a - b;
382	var d = c/2;
383	//alert(b);
384	acHgt.css({ 'padding-top': d+'px' });
385
386	jQuery('.rating-symbol:nth-child(1)').hover(function() {
387		jQuery('.review.angry').css({
388			'opacity': '1',
389			'visibility': 'visible',
390		});
391	}, function() {
392		jQuery('.review.angry').css({
393			'opacity': '0',
394			'visibility': 'hidden',
395		});
396	});
397	jQuery('.rating-symbol:nth-child(2)').hover(function() {
398		jQuery('.review.cry').css({
399			'opacity': '1',
400			'visibility': 'visible',
401		});
402	}, function() {
403		jQuery('.review.cry').css({
404			'opacity': '0',
405			'visibility': 'hidden',
406		});
407	});
408	jQuery('.rating-symbol:nth-child(3)').hover(function() {
409		jQuery('.review.sleeping').css({
410			'opacity': '1',
411			'visibility': 'visible',
412		});
413	}, function() {
414		jQuery('.review.sleeping').css({
415			'opacity': '0',
416			'visibility': 'hidden',
417		});
418	});
419	jQuery('.rating-symbol:nth-child(4)').hover(function() {
420		jQuery('.review.smily').css({
421			'opacity': '1',
422			'visibility': 'visible',
423		});
424	}, function() {
425		jQuery('.review.smily').css({
426			'opacity': '0',
427			'visibility': 'hidden',
428		});
429	});
430	jQuery('.rating-symbol:nth-child(5)').hover(function() {
431		jQuery('.review.cool').css({
432			'opacity': '1',
433			'visibility': 'visible',
434		});
435	}, function() {
436		jQuery('.review.cool').css({
437			'opacity': '0',
438			'visibility': 'hidden',
439		});
440	});
441	
442	
443
444	var rtngSym = jQuery('.rating-symbol');
445	var rtngTip = jQuery('input.rating-tooltip');
446	
447	
448	jQuery('.rating-symbol:first-of-type').hover(function() {
449		jQuery(this).closest('span').addClass('active-stars-wrap');
450		jQuery('.active-stars-wrap .rating-symbol:first-of-type .rating-symbol-foreground span').css('color', '#de9147');
451	}, function() { jQuery('.active-stars-wrap').removeClass('active-stars-wrap'); });
452	jQuery('.rating-symbol:nth-of-type(2)').hover(function() {
453        jQuery(this).closest('span').addClass('active-stars-wrap');
454		jQuery('.active-stars-wrap .rating-symbol:first-of-type .rating-symbol-foreground span').css('color', '#de9147');
455		jQuery('.active-stars-wrap .rating-symbol:nth-of-type(2) .rating-symbol-foreground span').css('color', '#de9147');
456	}, function() { jQuery('.active-stars-wrap').removeClass('active-stars-wrap'); });
457	jQuery('.rating-symbol:nth-of-type(3)').hover(function() {
458        jQuery(this).closest('span').addClass('active-stars-wrap');
459		jQuery('.active-stars-wrap .rating-symbol:first-of-type .rating-symbol-foreground span').css('color', '#dec435');
460		jQuery('.active-stars-wrap .rating-symbol:nth-of-type(2) .rating-symbol-foreground span').css('color', '#dec435');
461		jQuery('.active-stars-wrap .rating-symbol:nth-of-type(3) .rating-symbol-foreground span').css('color', '#dec435');
462	}, function() { jQuery('.active-stars-wrap').removeClass('active-stars-wrap'); });
463	jQuery('.rating-symbol:nth-of-type(4)').hover(function() {
464        jQuery(this).closest('span').addClass('active-stars-wrap');
465		jQuery('.active-stars-wrap .rating-symbol:first-of-type .rating-symbol-foreground span').css('color', '#c5de35');
466		jQuery('.active-stars-wrap .rating-symbol:nth-of-type(2) .rating-symbol-foreground span').css('color', '#c5de35');
467		jQuery('.active-stars-wrap .rating-symbol:nth-of-type(3) .rating-symbol-foreground span').css('color', '#c5de35');
468		jQuery('.active-stars-wrap .rating-symbol:nth-of-type(4) .rating-symbol-foreground span').css('color', '#c5de35');
469	}, function() { jQuery('.active-stars-wrap').removeClass('active-stars-wrap'); });
470	jQuery('.rating-symbol:nth-of-type(5)').hover(function() {
471        jQuery(this).closest('span').addClass('active-stars-wrap');
472		jQuery('.active-stars-wrap .rating-symbol:first-of-type .rating-symbol-foreground span').css('color', '#73cf42');
473		jQuery('.active-stars-wrap .rating-symbol:nth-of-type(2) .rating-symbol-foreground span').css('color', '#73cf42');
474		jQuery('.active-stars-wrap .rating-symbol:nth-of-type(3) .rating-symbol-foreground span').css('color', '#73cf42');
475		jQuery('.active-stars-wrap .rating-symbol:nth-of-type(4) .rating-symbol-foreground span').css('color', '#73cf42');
476		jQuery('.active-stars-wrap .rating-symbol:nth-of-type(5) .rating-symbol-foreground span').css('color', '#73cf42');
477	}, function() { jQuery('.active-stars-wrap').removeClass('active-stars-wrap'); });
478	
479	
480	
481	rtngSym.on('click', function(event) {
482		event.preventDefault();
483		var thsVal 	= jQuery('input.rating-tooltip').val();
484
485		//alert(thsVal);
486		if (thsVal == 1) {
487			jQuery('.review.angry').addClass('visible');
488			jQuery('.rating-symbol:first-of-type').addClass('angry');
489			jQuery('.rating-symbol').removeClass('cry');
490			jQuery('.rating-symbol').removeClass('sleeping');
491			jQuery('.rating-symbol').removeClass('smily');
492			jQuery('.rating-symbol').removeClass('cool');
493		}else{
494			jQuery('.review.angry').removeClass('visible');
495		};
496
497		if (thsVal == 2) {
498			jQuery('.review.cry').addClass('visible');
499			jQuery('.rating-symbol:first-of-type').addClass('cry');
500			jQuery('.rating-symbol:nth-of-type(2)').addClass('cry');
501			jQuery('.rating-symbol').removeClass('angry');
502			jQuery('.rating-symbol').removeClass('sleeping');
503			jQuery('.rating-symbol').removeClass('smily');
504			jQuery('.rating-symbol').removeClass('cool');
505		}else{
506			jQuery('.review.cry').removeClass('visible');
507		};
508
509		if (thsVal == 3) {
510			jQuery('.review.sleeping').addClass('visible');
511			jQuery('.rating-symbol:first-of-type').addClass('sleeping');
512			jQuery('.rating-symbol:nth-of-type(2)').addClass('sleeping');
513			jQuery('.rating-symbol:nth-of-type(3)').addClass('sleeping');
514			jQuery('.rating-symbol').removeClass('angry');
515			jQuery('.rating-symbol').removeClass('cry');
516			jQuery('.rating-symbol').removeClass('smily');
517			jQuery('.rating-symbol').removeClass('cool');
518		}else{
519			jQuery('.review.sleeping').removeClass('visible');
520		};
521
522		if (thsVal == 4) {
523			jQuery('.review.smily').addClass('visible');
524			jQuery('.rating-symbol:first-of-type').addClass('smily');
525			jQuery('.rating-symbol:nth-of-type(2)').addClass('smily');
526			jQuery('.rating-symbol:nth-of-type(3)').addClass('smily');
527			jQuery('.rating-symbol:nth-of-type(4)').addClass('smily');
528			jQuery('.rating-symbol').removeClass('angry');
529			jQuery('.rating-symbol').removeClass('cry');
530			jQuery('.rating-symbol').removeClass('sleeping');
531			jQuery('.rating-symbol').removeClass('cool');
532		}else{
533			jQuery('.review.smily').removeClass('visible');
534		};
535
536		if (thsVal == 5) {
537			jQuery('.review.cool').addClass('visible');
538			jQuery('.rating-symbol:first-of-type').addClass('cool');
539			jQuery('.rating-symbol:nth-of-type(2)').addClass('cool');
540			jQuery('.rating-symbol:nth-of-type(3)').addClass('cool');
541			jQuery('.rating-symbol:nth-of-type(4)').addClass('cool');
542			jQuery('.rating-symbol:nth-of-type(5)').addClass('cool');
543			jQuery('.rating-symbol').removeClass('angry');
544			jQuery('.rating-symbol').removeClass('cry');
545			jQuery('.rating-symbol').removeClass('sleeping');
546			jQuery('.rating-symbol').removeClass('smily');
547		}else{
548			jQuery('.review.cool').removeClass('visible');
549		};
550		
551		var CheckMultiRatingState	=	jQuery('#rewies_form').data('multi-rating');
552		var ratingSumTotal	=	0;
553		if( CheckMultiRatingState == 1 )
554		{
555			var activeRatingLength	=	jQuery('.lp-multi-rating-val').length;
556            jQuery('.lp-multi-rating-val').each(function (index) {
557                ratingSumTotal += Number(jQuery(this).val());
558            })
559			var activeRatingClass	=	Math.round(ratingSumTotal/activeRatingLength);
560
561            jQuery('.lp-review-stars').removeClass(function (index, css) {
562                return (css.match (/\bactive-rating-avg\S+/g) || []).join(' ');
563            });
564            jQuery('.lp-review-stars').addClass('active-rating-avg'+activeRatingClass);
565
566            jQuery('.lp-review-stars i.fa:nth-child('+ Number(activeRatingClass+1) +')').removeClass('fa-star-o').addClass('fa-star');
567            jQuery('.lp-review-stars i.fa:nth-child('+ Number(activeRatingClass+1) +')').prevAll('.fa-star-o').removeClass('fa-star-o').addClass('fa-star');
568            jQuery('.lp-review-stars i.fa:nth-child('+ Number(activeRatingClass+1) +')').nextAll('.fa-star').removeClass('fa-star-o').addClass('fa-star-o');
569
570		}
571	});
572});
573
574		
575jQuery(document).ready(function(){
576	'use-strict';
577
578	// Disable next button
579	var checkdInput = jQuery('.checkboxx input.checked_class');
580	checkdInput.on('change', function(event) {
581		event.preventDefault();
582		if (checkdInput.is(':checked')) {
583			jQuery('a#lp-next').css('display', 'block');
584			jQuery('a#lp-next').removeClass('hide');
585			jQuery('span.show').removeClass('show');
586			jQuery('.promotional-section > .lp-face.lp-pay-options.lp-dash-sec > span').addClass('hide');
587		}else {
588			jQuery('a#lp-next').addClass('hide');
589			jQuery('.promotional-section > .lp-face.lp-pay-options.lp-dash-sec > span').addClass('show');
590		};
591	});
592
593	var rdoInput = jQuery('.lp-method-wrap input.radio_checked');
594	rdoInput.on('change', function(event) {
595		event.preventDefault();
596		if (rdoInput.is(':checked')) {
597			jQuery('input.lp-next2.promotebtn').css('display', 'block');
598			jQuery('input.lp-next2.promotebtn').removeClass('hide');
599			jQuery('.promotional-section span.proceed-btn').removeClass('show');
600			jQuery('.promotional-section span.proceed-btn').addClass('hide');
601		}else {
602			jQuery('input.lp-next2.promotebtn').addClass('hide');
603			jQuery('.promotional-section span.proceed-btn').addClass('show');
604		};
605		
606	});
607	
608	//Dashboard promotional script
609	jQuery('.promotional-section a.lp-submit-btn').on('click', function(event) {
610		event.preventDefault();
611		jQuery(this).parent('.promotional-section').slideUp(500);
612		jQuery(this).parent('.promotional-section').next('.lp-card > form#ads_promotion').slideDown(1000);
613	});
614
615	// Dashboard Left Panel Script
616	
617	var dash = jQuery('.dashboard-tabs.lp-main-tabs.text-center > ul > li.dropdown > a');
618		
619	var dashli = jQuery('.dashboard-tabs.lp-main-tabs.text-center > ul > li.dropdown');
620		
621	var dashul = jQuery('.dashboard-tabs.lp-main-tabs.text-center > ul > li.dropdown > ul');
622
623		
624	dash.on('click', function(event) {
625			
626	event.preventDefault();
627			
628	if(dashli.hasClass('opened')) {
629		
630		jQuery( dashli ).removeClass('opened');
631			
632		jQuery(dashul).removeClass('opened');
633				
634		jQuery(this).parent('li').addClass('opened');
635				
636		jQuery(this).next('ul').addClass('opened');
637			
638	} else {
639
640		//if(dashli.hasClass('dropdown'))
641		
642		jQuery(dashul).removeClass('opened');
643			
644		jQuery( dashli ).removeClass('opened');
645			
646		jQuery(this).parent('li').addClass('opened');
647			
648		jQuery(this).next('ul').addClass('opened');
649
650		
651		};
652		
653	});
654
655	
656	// Review Script
657	jQuery('h3#reply-title').on('click', function(event) {
658		event.preventDefault();
659		var thiss = jQuery(this);
660		if (thiss.hasClass('active')) {
661			jQuery(this).removeClass('active');
662			jQuery(this).next('#rewies_form').slideUp();
663			jQuery(this).next('#rewies_formm').slideUp();
664		}else{
665			jQuery(this).addClass('active');
666			jQuery(this).next('#rewies_form').slideDown();
667			jQuery(this).next('#rewies_formm').slideDown();
668		};
669		//jQuery(this).next('#rewies_form').toggleClass('open_review_form');
670	});
671	jQuery('#clicktoreview').on('click', function(event) {
672		event.preventDefault();
673		
674		var thiss = jQuery('#reply-title');
675			thiss.addClass('active');
676			thiss.next('#rewies_form').slideDown();	
677			thiss.next('#rewies_formm').slideDown();	
678			jQuery('html, body').animate({
679                scrollTop: jQuery('#reply-title').offset().top
680            }, 2000);
681	});
682	
683	jQuery('.leadformtrigger').on('click', function(e){
684            e.preventDefault();
685            jQuery('.app-view-lead-form').slideToggle(500);
686
687    });
688    jQuery('.open-lead-form-app-view').on('click', function(e){
689		if(jQuery('.app-view-lead-form')[0]){
690			jQuery('.app-view-lead-form').slideToggle(500);
691			jQuery('html, body').animate({
692				scrollTop: jQuery('.leadformtrigger').offset().top
693			}, 2000);
694		}
695
696    })
697	
698	jQuery('#rewies_form input[type=file]').change(function(e) {
699		$in = jQuery(this);
700		$in.prev().prev().text($in.val());
701		
702	});
703		// listing layout
704	//jQuery('.listing-simple').addClass('listing_list_view');
705	jQuery('a.grid').on('click', function(event) {
706		event.preventDefault();
707		jQuery('a.list').removeClass('active');
708		jQuery(this).addClass('active');
709		jQuery('.listing-simple').removeClass('listing_list_view');
710		
711        if( jQuery('#list-grid-view-v2').length != 0 && jQuery('#list-grid-view-v2').hasClass('swtch-ll') )
712        {
713            jQuery('#list-grid-view-v2').attr('data-layout-class', 'grid' );
714        }
715
716		if( jQuery('#content-grids').hasClass('v2-toggle') )
717		{
718			jQuery('.loop-switch-class').removeClass('col-md-12');
719			jQuery('.loop-switch-class').addClass('col-md-6');
720			jQuery('.lp-listings.active-view').removeClass('list-style');
721			jQuery('.lp-listings.active-view').addClass('grid-style');
722		}
723		else
724		{
725		jQuery('.post-with-map-container').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-sm-12 list_view');
726		jQuery('.post-with-map-container').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-md-6 col-sm-12 grid_view2');
727		
728		// Listing Simple
729            if( jQuery('#content-grids').hasClass('listing-with-header-filters-wrap') )
730            {
731                jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-sm-12 list_view');
732                jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-md-6 col-sm-12 grid_view2');
733            }
734            else
735            {
736		jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-sm-12 list_view');
737		jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-md-4 col-sm-12 grid_view2');
738            }
739
740            // Listing Sidebar
741            jQuery('.listing-with-sidebar').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-sm-12 list_view');
742            jQuery('.listing-with-sidebar').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-md-6 col-sm-12 grid_view2');
743
744        }
745
746		// Listing with Map
747	});
748	jQuery('a.list').on('click', function(event) {
749		event.preventDefault();
750		jQuery('a.grid').removeClass('active');
751		jQuery(this).addClass('active');
752		jQuery('.listing-simple').addClass('listing_list_view');
753		
754        if( jQuery('#list-grid-view-v2').length != 0 && jQuery('#list-grid-view-v2').hasClass('swtch-ll') )
755        {
756            jQuery('#list-grid-view-v2').attr('data-layout-class', 'list' );
757        }
758
759        if( jQuery('#content-grids').hasClass('v2-toggle') )
760        {
761			jQuery('.loop-switch-class').removeClass('col-md-6');
762			jQuery('.loop-switch-class').addClass('col-md-12');
763			jQuery('.lp-listings.active-view').addClass('list-style');
764			jQuery('.lp-listings.active-view').removeClass('grid-style');
765        }
766        else
767        {
768		// Listing with Map
769		jQuery('.post-with-map-container').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-md-6 col-sm-6 grid_view2');
770		jQuery('.post-with-map-container').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-sm-12 list_view');
771		
772		// Listing Simple
773            if( jQuery('#content-grids').hasClass('listing-with-header-filters-wrap') )
774            {
775                jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-md-6 col-sm-6 grid_view2');
776                jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-sm-12 list_view');
777            }
778            else
779            {
780		jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-md-4 col-sm-6 grid_view2');
781		jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-sm-12 list_view');
782            }
783
784            jQuery('.listing-with-sidebar').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-md-6 col-sm-6 grid_view3');
785            jQuery('.listing-with-sidebar').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-sm-12 list_view');
786        }
787
788	});
789
790//============================================ Harry Code ==================================================//
791	// Open Hours Script
792	jQuery('a.show-all-timings').on('click', function(event) {
793		event.preventDefault();
794		jQuery(this).toggleClass('opened');
795		jQuery(this).next('ul.hidding-timings').slideToggle(400);
796	});
797	
798	// shebi Script
799	jQuery( ".detail-page2-tab-content .review-form h3" ).removeAttr( "id" );
800	
801	jQuery('.listing-app-view .listing-app-view-bar .pricy-form-group #lp-find-near-me-outer ul > li > a').click(function() {
802		jQuery(this).toggleClass('margin-right-0 lp-remove-border');
803	});
804	
805	
806	
807	var inputs = document.querySelectorAll( '.inputfile' );
808	Array.prototype.forEach.call( inputs, function( input )
809	{
810		var label	 = input.nextElementSibling,
811			labelVal = label.innerHTML;
812
813		input.addEventListener( 'change', function( e )
814		{
815			var fileName = '';
816			if( this.files && this.files.length > 1 )
817				fileName = ( this.getAttribute( 'data-multiple-caption' ) || '' ).replace( '{count}', this.files.length );
818			else
819				fileName = e.target.value.split( '\\' ).pop();
820
821			if( fileName )
822				label.querySelector( 'span' ).innerHTML = fileName;
823			else
824				label.innerHTML = labelVal;
825		});
826
827		// Firefox bug fix
828		input.addEventListener( 'focus', function(){ input.classList.add( 'has-focus' ); });
829		input.addEventListener( 'blur', function(){ input.classList.remove( 'has-focus' ); });
830	});
831
832/* from sheibi */
833	
834if(jQuery('body').hasClass('home') || jQuery('body').hasClass('app-view-home')){
835   jQuery('.listing-app-view.home .map-view-list-container2,.listing-app-view.app-view-home .map-view-list-container2').slick({
836    centerMode: false,
837    centerPadding: '0px',
838    infinite: true,
839    accesibility: false,
840    draggable: true,
841    swipe: true,
842    touchMove: false,
843    autoplaySpeed: 1400,
844    speed: 100,
845    slidesToShow: 2,
846    dots: true, 
847    arrows: false
848  });
849   
850    jQuery('.listing-app-view.home .lp-location-slider,.listing-app-view.app-view-home .lp-location-slider').slick({
851    centerMode: false,
852    centerPadding: '0px',
853    infinite: true,
854    accesibility: false,
855    draggable: true,
856    swipe: true,
857    touchMove: false,
858    autoplaySpeed: 1400,
859    speed: 100,
860    slidesToShow: 3,
861    dots: true,  
862    arrows: false
863  }); 
864  }
865  if( jQuery('.listing-category-slider4').length > 0 )
866  {
867      jQuery('.listing-category-slider4').slick({
868          centerMode: false,
869          centerPadding: '0px',
870          infinite: true,
871          accesibility: false,
872          draggable: true,
873          swipe: true,
874          touchMove: false,
875          autoplaySpeed: 1400,
876          speed: 100,
877          slidesToShow: 4,
878          dots: false,
879          arrows: true,
880          responsive: [
881              {
882                  breakpoint: 768,
883                  settings: {
884                      arrows: false,
885                      centerMode: false,
886                      centerPadding: '0px',
887                      slidesToShow: 4
888                  }
889              },
890              {
891                  breakpoint: 480,
892                  settings: {
893                      arrows: false,
894                      centerMode: false,
895                      centerPadding: '0px',
896                      slidesToShow: 1
897                  }
898              }
899          ]
900      });
901  }
902
903
904 jQuery('#map-view-icon2').click(function () {
905   jQuery("#search-filter-attr-filter").animate({width: "toggle"}, 5);
906 });
907
908   jQuery('.listing-app-view .lp-search-toggle .user-menu').click(function(e){
909           
910    jQuery(".lp-user-menu").toggleClass("main");
911    
912  });
913  
914jQuery(document).mouseup(function(e){
915	var container = jQuery(".lp-user-menu");
916	if (!container.is(e.target) && container.has(e.target).length === 0){
917		jQuery('.lp-user-menu').removeClass('main');
918	}
919});
920 jQuery('.lp-detail-page-template-3 #clicktoreview2').on('click', function(event) {
921  event.preventDefault(); 
922   jQuery(".single-tabber2 ul li").removeClass('active');
923   jQuery(".detail-page2-tab-content .tab-content .tab-pane").removeClass('active');
924    jQuery('.single-tabber2 ul .lpreviews').addClass('active');
925    jQuery('.detail-page2-tab-content .tab-content .lpreviews').addClass('active');
926	
927	jQuery('html, body').animate({
928                scrollTop: jQuery('#review-section').offset().top
929            }, 200
930		);
931    
932  
933 });
934	// end shoaib Script
935	
936	jQuery('[data-toggle="tooltip"]').tooltip();
937
938	// Open review reply
939	jQuery('a.see_more_btn').on('click', function(event) {
940		event.preventDefault();
941		var $this = jQuery(this);
942		if($this.hasClass('closedd')){
943			$this.removeClass('closedd');
944			$this.addClass('openedd');
945			jQuery(this).find('i').removeClass('fa-arrow-down');
946			jQuery(this).find('i').addClass('fa-arrow-up');
947			
948		}
949		else{
950			$this.removeClass('openedd');
951			$this.addClass('closedd');
952			jQuery(this).find('i').removeClass('fa-arrow-up');
953			jQuery(this).find('i').addClass('fa-arrow-down');
954			
955		}
956		jQuery(this).next('.review-content').slideToggle(200);		
957	});
958	
959	
960	jQuery('a.open-reply').on('click', function(event) {
961		event.preventDefault();
962		var $this = jQuery(this);
963		if($this.hasClass('closeddd')){
964			$this.removeClass('closeddd');
965			$this.addClass('openeddd');
966			jQuery(this).find('i').removeClass('fa-arrow-down');
967			jQuery(this).find('i').addClass('fa-arrow-up');
968			
969		}
970		else{
971			$this.removeClass('openeddd');
972			$this.addClass('closeddd');
973			jQuery(this).find('i').removeClass('fa-arrow-up');
974			jQuery(this).find('i').addClass('fa-arrow-down');
975			
976		}
977		jQuery(this).next('.post_response').slideToggle(200);		
978	});
979
980	
981	jQuery(document).ready(function(){
982		jQuery('select.hours-start2').prop("disabled", true);
983		jQuery('select.hours-end2').prop("disabled", true);
984		jQuery(".lp-check-doubletime .enable2ndday").change(function() {
985			if(this.checked) {
986				jQuery('select.hours-start2').prop("disabled", false);
987				jQuery('select.hours-end2').prop("disabled", false);
988				jQuery('.hours-select.lp-slot2-time').slideToggle(300);
989			}
990			else{
991				jQuery('select.hours-start2').prop("disabled", true);
992				jQuery('select.hours-end2').prop("disabled", true);
993				jQuery('.hours-select.lp-slot2-time').slideToggle(300);
994			}
995		});	
996	});	
997	
998	
999
1000	// Remove Hours Script
1001	
1002	jQuery(document).on('click','a.remove-hours',function(event){
1003		event.preventDefault();
1004		jQuery(this).parent('.hours').remove();
1005	});
1006	// Toggle Script for Currency area
1007	jQuery('a.toggle-currencey-area').on('click', function(event) {
1008		event.preventDefault();
1009		jQuery(this).next('.currency-area').slideToggle(400);
1010		jQuery(this).toggleClass('active');
1011	});
1012		// Magnific Popup 
1013	jQuery('.review-img-slider').magnificPopup({
1014		delegate: 'a',
1015      	type: 'image',
1016      	tLoading: 'Loading image #%curr%...',
1017      	mainClass: 'mfp-img-mobile',
1018      	gallery: {
1019            enabled: true,
1020            navigateByImgClick: true,
1021            preload: [0,1] // Will preload 0 - before current, and 1 after the current image
1022      	},
1023      	image: {
1024            tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
1025            titleSrc: function(item) {
1026          		return item.el.attr('title') + '<small>by Listingpro team</small>';
1027            }
1028      	}
1029			
1030
1031	});
1032	
1033	jQuery(document).ready(function(){
1034		jQuery(".fulldayopen").change(function() {
1035			if(this.checked) {
1036				jQuery('select.hours-start').prop("disabled", true);
1037				jQuery('select.hours-end').prop("disabled", true);
1038				jQuery('select.hours-start2').prop("disabled", true);
1039				jQuery('select.hours-end2').prop("disabled", true);
1040			}
1041			else{
1042				jQuery('select.hours-start').prop("disabled", false);
1043				jQuery('select.hours-end').prop("disabled", false);
1044				jQuery('select.hours-start2').prop("disabled", false);
1045				jQuery('select.hours-end2').prop("disabled", false);
1046			}
1047		});	
1048	});
1049	
1050	jQuery(document).ready(function() {
1051		jQuery(".add-more").click(function() {
1052			jQuery("#lp_feature_panel").slideToggle("slow");
1053		});
1054		
1055
1056		
1057	});
1058		var hdrHeight = jQuery('header.header-normal').outerHeight();
1059
1060		jQuery('.top-section .absolute').css('top', hdrHeight);
1061		
1062		
1063	if(jQuery('body').is('.single-listing')){	
1064		if (jQuery(window).width() >= 768) { 
1065			// Listing Detail Gallery
1066			jQuery("a[rel^='prettyPhoto']").prettyPhoto({
1067				animation_speed:'fast',
1068				theme:'dark_rounded',
1069				slideshow:7000,
1070				autoplay_slideshow: true,
1071				social_tools: '',
1072				deeplinking: false,
1073				show_title: false,
1074			}); 
1075		}else{
1076            jQuery("a[rel^='prettyPhoto']").prettyPhoto({
1077                animation_speed:'fast',
1078                theme:'dark_rounded',
1079                slideshow:7000,
1080                autoplay_slideshow: true,
1081                social_tools: '',
1082                deeplinking: false,
1083                show_title: false,
1084            });
1085        }
1086	}
1087
1088	
1089	
1090
1091
1092	jQuery('a.onlineform').on('click', function(event) {
1093		event.preventDefault();
1094		jQuery(this).next('.booking-form').slideToggle(400);
1095		jQuery(this).toggleClass('active');
1096	});
1097
1098	jQuery('.listing-second-view .ask-question-area > a.ask_question_popup').on('click', function(event) {
1099		event.preventDefault();
1100		jQuery(this).next('.faq-form').slideToggle(400);
1101	});
1102	
1103	if(jQuery('body').is('.single-listing')){
1104		var sliderstyle = jQuery('body').data('sliderstyle');
1105		
1106		if(sliderstyle=="style1"){
1107			var images = jQuery( ".listing-slide" ).data('images-num');
1108			var center_mode = true;
1109			if(images > 5 ) {
1110				images = 5;
1111				center_mode = true;
1112			}else {
1113				center_mode = false;
1114			}
1115			// Listing Detail Slider
1116			jQuery('.listing-slide').slick({
1117				centerPadding: '10px',
1118				slidesToShow: images,
1119				autoplay: true,
1120				draggable: false,
1121				autoplaySpeed: 5000,
1122				centerMode: center_mode,
1123				focusOnSelect: true,
1124				arrows: true,
1125				responsive: [
1126					{
1127						breakpoint: 768,
1128						settings: {
1129							arrows: false,
1130							centerMode: false,
1131							centerPadding: '0px',
1132							slidesToShow: 5
1133						}
1134					},
1135					{
1136						breakpoint: 480,
1137						settings: {
1138							arrows: true,
1139							centerMode: false,
1140							centerPadding: '0px',
1141							slidesToShow: 1
1142						}
1143					}
1144				]
1145			});
1146		}
1147		else if(sliderstyle=="style2"){
1148			
1149			var images = jQuery( ".listing-slide" ).data('images-num');
1150			//alert(images);
1151			var center_mode = true;
1152			var variable = true;
1153			if(images > 3 ) {
1154				center_mode = false;
1155			} else if(images = 3) {
1156				//jQuery('.listing-slide img').css('height','auto');
1157				jQuery('.single-page-slider-container').addClass('three-imgs');
1158				variable = false;
1159			} else if(images = 2) {
1160				jQuery('.single-page-slider-container').addClass('new-cls');
1161			} else if(images = 1) {
1162				jQuery('.single-page-slider-container').addClass('one-img');
1163			} else {
1164				center_mode = false;
1165				variable = false;
1166			}
1167			
1168			// Listing Detail Slider
1169			jQuery('.listing-slide').slick({
1170				slidesToShow: 2,
1171				autoplay: true,
1172				draggable: false,
1173				autoplaySpeed: 5000,
1174				centerMode: true,
1175				focusOnSelect: true,
1176				variableWidth: variable,
1177				adaptiveHeight: true,
1178				responsive: [
1179					{
1180						breakpoint: 768,
1181						settings: {
1182							arrows: true,
1183							centerMode: false,
1184							centerPadding: '0px',
1185							//slidesToShow: 5
1186						}
1187					},
1188					{
1189						breakpoint: 480,
1190						settings: {
1191							arrows: true,
1192							centerMode: false,
1193							centerPadding: '0px',
1194							slidesToShow: 1
1195						}
1196					}
1197				]
1198			});
1199
1200		} else if(sliderstyle=="style3"){
1201
1202            var images = jQuery( ".listing-slide" ).data('images-num');
1203            var slidestoshow = 2;
1204            if (images == 1) {
1205                jQuery('.listing-slide img').css('width','100%');
1206                slidestoshow = 1;
1207            }else if(images == 2){
1208                slidestoshow = 2;
1209            }else if(images == 3){
1210                slidestoshow = 2;
1211            }else if(images == 4){
1212                slidestoshow = 3;
1213            }else if(images == 6){
1214                slidestoshow = 4;
1215            }else if(images == 8){
1216                slidestoshow = 6;
1217            }else if(images == 10){
1218                slidestoshow = 8;
1219            }else if(images >= 12){
1220                slidestoshow = 10;
1221            }
1222
1223            // Listing Detail Slider
1224            jQuery('.listing-slide').slick({
1225                slidesToShow: 2,
1226                autoplay: true,
1227                draggable: false,
1228                autoplaySpeed: 5000,
1229                centerMode: true,
1230                focusOnSelect: true,
1231                variableWidth: true,
1232                adaptiveHeight: true,
1233                responsive: [
1234                    {
1235                        breakpoint: 9999,
1236                        settings: {
1237                            slidesToShow: slidestoshow,
1238                        }
1239                    },
1240                    {
1241                        breakpoint: 768,
1242                        settings: {
1243                            arrows: true,
1244                            centerMode: false,
1245                            centerPadding: '0px',
1246                            //slidesToShow: 5
1247                        }
1248                    },
1249                    {
1250                        breakpoint: 480,
1251                        settings: {
1252                            arrows: true,
1253                            centerMode: false,
1254                            centerPadding: '0px',
1255                            slidesToShow: 1
1256                        }
1257                    }
1258                ]
1259            });
1260        }
1261	}
1262	
1263    // Listing Detail Slider
1264	if( jQuery( '.listing-slide2' ).length	!= 0 )
1265	{
1266        jQuery('.listing-slide2').slick({
1267            slidesToShow: 1,
1268            autoplay: false,
1269            draggable: false,
1270            autoplaySpeed: 5000,
1271            centerMode: true,
1272            centerPadding: '0px',
1273            focusOnSelect: true,
1274            variableWidth: variable,
1275            adaptiveHeight: true,
1276            responsive: [
1277                {
1278                    breakpoint: 768,
1279                    settings: {
1280                        arrows: true,
1281                        centerMode: false,
1282                        centerPadding: '0px',
1283                        //slidesToShow: 5
1284                    }
1285                },
1286                {
1287                    breakpoint: 480,
1288                    settings: {
1289                        arrows: false,
1290                        centerMode: false,
1291                        centerPadding: '0px',
1292                        slidesToShow: 1
1293                    }
1294                }
1295            ]
1296        })
1297	}
1298
1299	jQuery( ".select2" ).select2();
1300	
1301	if(jQuery('body').is('.single-listing')){	
1302		jQuery('.review-img-slider').slick({
1303	  	infinite: true,
1304	  	slidesToShow: 3,
1305	  	slidesToScroll: 1,
1306		autoplay: false,
1307  		autoplaySpeed: 5000,
1308	  	arrows:true,
1309	  	dots:false,
1310	   	responsive: [
1311			{
1312		  		breakpoint: 790,
1313		  		settings: {
1314					arrows: false,
1315					centerMode: true,
1316					centerPadding: '40px',
1317					slidesToShow: 2
1318		 		}
1319			},
1320			{
1321			  	breakpoint: 480,
1322			  	settings: {
1323					slidesToShow: 1
1324			  	}
1325			}
1326	  	]
1327		});
1328		/* end  by haroon */
1329		
1330		jQuery('.post-slide').slick({
1331		  infinite: true,
1332		  slidesToShow: 2,
1333		  slidesToScroll: 1,
1334		  arrows:false,
1335		  dots:true,
1336		   responsive: [
1337			{
1338			  breakpoint: 2,
1339			  settings: {
1340				arrows: false,
1341				centerMode: true,
1342				centerPadding: '40px',
1343				slidesToShow: 3
1344			  }
1345			},
1346			{
1347			  breakpoint: 480,
1348			  settings: {
1349				slidesToShow: 1
1350			  }
1351			}
1352		  ]
1353		});
1354		
1355		//Slick One Per Slide Testimonials
1356		jQuery('.testimonial-slider').slick({
1357			dots: true,
1358			infinite: true,
1359			autoplay: true,
1360			autoplaySpeed: 1000,
1361			speed: 1000,
1362			arrows: false,
1363			slidesToShow: 1
1364		});
1365	}
1366	// Accordion
1367	var icons = {
1368		header: "fa fa-plus",
1369		activeHeader: "fa fa-minus"
1370	};
1371		jQuery( "#accordion" ).accordion({
1372			icons: icons,
1373			heightStyle: "content",
1374		});
1375	jQuery( "#toggle" ).button().on('click',function() {
1376		if ( jQuery( "#accordion" ).accordion( "option", "icons" ) ) {
1377			jQuery( "#accordion" ).accordion( "option", "icons", null );
1378		} else {
1379			jQuery( "#accordion" ).accordion( "option", "icons", icons );
1380	}
1381	});
1382	// Popup Gallery
1383	jQuery('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
1384	  disableOn: 319,
1385	  type: 'iframe',
1386	  iframe: {
1387	    	markup: '<div class="mfp-iframe-scaler">'+
1388            		'<div class="mfp-close"></div>'+
1389            		'<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+
1390            		'</div>', 
1391        patterns: {
1392            youtube: {
1393	              index: 'youtube.com/', 
1394	              id: 'v=', 
1395	              src: '//www.youtube.com/embed/%id%?rel=0&autoplay=1' 
1396		        }
1397		     },
1398		     srcAction: 'iframe_src', 
1399     },
1400	  mainClass: 'mfp-fade',
1401	  removalDelay: 160,
1402	  preloader: false,
1403	  fixedContentPos: false
1404	});
1405	
1406	jQuery('.popup-gallery').magnificPopup({
1407		delegate: '.image-popup',
1408		type: 'image',
1409		tLoading: 'Loading image #%curr%...',
1410		mainClass: 'mfp-img-mobile',
1411		gallery: {
1412			enabled: true,
1413			navigateByImgClick: true,
1414			preload: [0,1] // Will preload 0 - before current, and 1 after the current image
1415		}
1416	});
1417	//Boostrap Rating
1418	//http://dreyescat.github.io/bootstrap-rating/
1419	 jQuery('input.check').on('change', function () {
1420          alert('Rating: ' + jQuery(this).val());
1421        });
1422		if(jQuery('body').is('.single-listing')){
1423        jQuery('#programmatically-set').on('click' , function () {
1424          jQuery('#programmatically-rating').rating('rate', jQuery('#programmatically-value').val());
1425        });
1426        jQuery('#programmatically-get').on('click' , function () {
1427          alert(jQuery('#programmatically-rating').rating('rate'));
1428        });
1429        
1430        jQuery('.rating-tooltip-manual').rating({
1431          extendSymbol: function () {
1432            var title;
1433            jQuery(this).tooltip({
1434              container: 'body',
1435              placement: 'bottom',
1436              trigger: 'manual',
1437              title: function () {
1438                return title;
1439              }
1440            });
1441            jQuery(this).on('rating.rateenter', function (e, rate) {
1442              title = rate;
1443              jQuery(this).tooltip('show');
1444            })
1445            .on('rating.rateleave', function () {
1446              jQuery(this).tooltip('hide');
1447            });
1448          }
1449        });
1450        jQuery('.rating').each(function () {
1451          jQuery('<span class="label label-default"></span>')
1452            .text(jQuery(this).val() || ' ')
1453            .insertAfter(this);
1454        });
1455        jQuery('.rating').on('change', function () {
1456          jQuery(this).next('.label').text(jQuery(this).val());
1457        });
1458		}
1459	 // Mapbox 
1460	jQuery(window).load(function(){
1461		
1462		if (jQuery(this).width() < 981) {
1463			jQuery(".claimformtrigger").on('click' , function() {
1464				if(jQuery('.claimform').hasClass('claimform-open')) {
1465					jQuery('.claimform').removeClass("claimform-open");
1466					jQuery('.claimform').hide(); 
1467				} else { 
1468					jQuery(this).closest('.post-row').addClass('rowopen');
1469					jQuery('.claimform').addClass("claimform-open"); 
1470					jQuery('.claimform').show();
1471				}
1472			});
1473		}
1474		
1475		jQuery(window).resize(function () {
1476			
1477			if (jQuery(this).width() < 781) {
1478					jQuery('.mobilemap').removeAttr('id');
1479					jQuery('.mobilemap').removeClass('md-modal');
1480					jQuery('.mobilemap').removeClass('md-effect-3');
1481					jQuery('.mobilelink').removeClass('md-trigger');
1482					jQuery('.mobile-map-space .md-overlayi').removeClass('md-overlay');
1483					jQuery('.listing-container-right .md-overlayi').removeClass('md-overlay');
1484					jQuery(".mobilelink").on('click' , function() {  
1485						if(jQuery('.mobilemap').hasClass('map-open')) {
1486							jQuery('.mobilemap').removeClass("map-open"); 
1487							jQuery('.mobilemap .mapbilemap-content').css({"opacity":"0","margin-top":"-520px"});
1488							jQuery("a.mobilelink").text("View on map");
1489						}
1490						else{   
1491							jQuery('.mobilemap').addClass("map-open"); 
1492							jQuery('.mobilemap .mapbilemap-content').css({"opacity":"1","margin-top":"0px"});
1493							jQuery("a.mobilelink").text("Close map");
1494						}
1495				    });
1496					jQuery(".quickformtrigger").on('click' , function() { 
1497						if(jQuery('.quickform').hasClass('quickform-open')) {
1498							jQuery('.quickform').removeClass("quickform-open");
1499							jQuery('.quickform').slideUp(600); 
1500							
1501							}
1502						else{
1503							jQuery('.quickform').addClass("quickform-open"); 
1504							jQuery('.quickform').slideDown(600);
1505						}
1506					});
1507			} else {
1508					var headertop = jQuery('header').height();
1509					jQuery('.section-fixed').css('padding-top',headertop+'px');
1510		
1511			}
1512			  
1513		}).resize();//triggcurrentColorer the event manually when the page is loaded
1514
1515		jQuery('.listing-sidebar-left .form-inline').fadeTo( 600 , 1);
1516		jQuery('.post-with-map-container .form-inline').fadeTo( 600 , 1);	
1517		jQuery('#menu').css('display','block');
1518		jQuery('.spinner').css("display","none");
1519		//jQuery('.single-page-slider-container').css("opacity","1");
1520		
1521			
1522/*
1523 * L.TileLayer is used for standard xyz-numbered tile layers.
1524 */
1525
1526
1527L.Google = L.Class.extend({
1528	includes: L.Mixin.Events,
1529
1530	options: {
1531		minZoom: 0,
1532		maxZoom: 18,
1533		tileSize: 256,
1534		subdomains: 'abc',
1535		errorTileUrl: '',
1536		attribution: '',
1537		opacity: 1,
1538		continuousWorld: false,
1539		noWrap: false,
1540		mapOptions: {
1541			backgroundColor: '#dddddd'
1542		}
1543	},
1544
1545	// Possible types: SATELLITE, ROADMAP, HYBRID, TERRAIN
1546	initialize: function(type, options) {
1547		L.Util.setOptions(this, options);
1548
1549		this._ready = google.maps.Map != undefined;
1550		if (!this._ready) L.Google.asyncWait.push(this);
1551
1552		this._type = type || 'SATELLITE';
1553	},
1554
1555	onAdd: function(map, insertAtTheBottom) {
1556		this._map = map;
1557		this._insertAtTheBottom = insertAtTheBottom;
1558
1559		// create a container div for tiles
1560		this._initContainer();
1561		this._initMapObject();
1562
1563		// set up events
1564		map.on('viewreset', this._resetCallback, this);
1565
1566		this._limitedUpdate = L.Util.limitExecByInterval(this._update, 150, this);
1567		map.on('move', this._update, this);
1568
1569		map.on('zoomanim', this._handleZoomAnim, this);
1570
1571		//20px instead of 1em to avoid a slight overlap with google's attribution
1572		map._controlCorners['bottomright'].style.marginBottom = "20px";
1573
1574		this._reset();
1575		this._update();
1576	},
1577
1578	onRemove: function(map) {
1579		this._map._container.removeChild(this._container);
1580		//this._container = null;
1581
1582		this._map.off('viewreset', this._resetCallback, this);
1583
1584		this._map.off('move', this._update, this);
1585
1586		this._map.off('zoomanim', this._handleZoomAnim, this);
1587
1588		map._controlCorners['bottomright'].style.marginBottom = "0em";
1589		//this._map.off('moveend', this._update, this);
1590	},
1591
1592	getAttribution: function() {
1593		return this.options.attribution;
1594	},
1595
1596	setOpacity: function(opacity) {
1597		this.options.opacity = opacity;
1598		if (opacity < 1) {
1599			L.DomUtil.setOpacity(this._container, opacity);
1600		}
1601	},
1602
1603	setElementSize: function(e, size) {
1604		e.style.width = size.x + "px";
1605		e.style.height = size.y + "px";
1606	},
1607
1608	_initContainer: function() {
1609		var tilePane = this._map._container,
1610			first = tilePane.firstChild;
1611
1612		if (!this._container) {
1613			this._container = L.DomUtil.create('div', 'leaflet-google-layer leaflet-top leaflet-left');
1614			this._container.id = "_GMapContainer_" + L.Util.stamp(this);
1615			this._container.style.zIndex = "auto";
1616		}
1617
1618		tilePane.insertBefore(this._container, first);
1619
1620		this.setOpacity(this.options.opacity);
1621		this.setElementSize(this._container, this._map.getSize());
1622	},
1623
1624	_initMapObject: function() {
1625		if (!this._ready) return;
1626		this._google_center = new google.maps.LatLng(0, 0);
1627		var map = new google.maps.Map(this._container, {
1628		    center: this._google_center,
1629		    zoom: 0,
1630		    tilt: 0,
1631		    mapTypeId: google.maps.MapTypeId[this._type],
1632		    disableDefaultUI: false,
1633		    keyboardShortcuts: false,
1634		    draggable: false,
1635		    disableDoubleClickZoom: true,
1636		    scrollwheel: false,
1637		    streetViewControl: true,
1638		    styles: this.options.mapOptions.styles,
1639		    backgroundColor: this.options.mapOptions.backgroundColor
1640		});
1641
1642		var _this = this;
1643		this._reposition = google.maps.event.addListenerOnce(map, "center_changed",
1644			function() { _this.onReposition(); });
1645		this._google = map;
1646
1647		google.maps.event.addListenerOnce(map, "idle",
1648			function() { _this._checkZoomLevels(); });
1649	},
1650
1651	_checkZoomLevels: function() {
1652		//setting the zoom level on the Google map may result in a different zoom level than the one requested
1653		//(it won't go beyond the level for which they have data).
1654		// verify and make sure the zoom levels on both Leaflet and Google maps are consistent
1655		if (this._google.getZoom() !== this._map.getZoom()) {
1656			//zoom levels are out of sync. Set the leaflet zoom level to match the google one
1657			this._map.setZoom( this._google.getZoom() );
1658		}
1659	},
1660
1661	_resetCallback: function(e) {
1662		this._reset(e.hard);
1663	},
1664
1665	_reset: function(clearOldContainer) {
1666		this._initContainer();
1667	},
1668
1669	_update: function(e) {
1670		if (!this._google) return;
1671		this._resize();
1672
1673		var center = e && e.latlng ? e.latlng : this._map.getCenter();
1674		var _center = new google.maps.LatLng(center.lat, center.lng);
1675
1676		this._google.setCenter(_center);
1677		this._google.setZoom(this._map.getZoom());
1678
1679		this._checkZoomLevels();
1680		//this._google.fitBounds(google_bounds);
1681	},
1682
1683	_resize: function() {
1684		var size = this._map.getSize();
1685		if (this._container.style.width == size.x &&
1686		    this._container.style.height == size.y)
1687			return;
1688		this.setElementSize(this._container, size);
1689		this.onReposition();
1690	},
1691
1692
1693	_handleZoomAnim: function (e) {
1694		var center = e.center;
1695		var _center = new google.maps.LatLng(center.lat, center.lng);
1696
1697		this._google.setCenter(_center);
1698		this._google.setZoom(e.zoom);
1699	},
1700
1701
1702	onReposition: function() {
1703		if (!this._google) return;
1704		google.maps.event.trigger(this._google, "resize");
1705	}
1706});
1707
1708L.Google.asyncWait = [];
1709L.Google.asyncInitialize = function() {
1710	var i;
1711	for (i = 0; i < L.Google.asyncWait.length; i++) {
1712		var o = L.Google.asyncWait[i];
1713		o._ready = true;
1714		if (o._container) {
1715			o._initMapObject();
1716			o._update();
1717		}
1718	}
1719	L.Google.asyncWait = [];
1720};
1721
1722
1723
1724	L.HtmlIcon = L.Icon.extend({
1725		options: {
1726			/*
1727			html: (String) (required)
1728			iconAnchor: (Point)
1729			popupAnchor: (Point)
1730			*/
1731		},
1732
1733		initialize: function(options) {
1734			L.Util.setOptions(this, options);
1735		},
1736
1737		createIcon: function() {
1738			var div = document.createElement('div');
1739			div.innerHTML = this.options.html;
1740			if (div.classList)
1741				div.classList.add('leaflet-marker-icon');
1742			else
1743				div.className += ' ' + 'leaflet-marker-icon';
1744			return div;
1745		},
1746
1747		createShadow: function() {
1748			return null;
1749		}
1750	});
1751		
1752			
1753                jQuery( ".all-list-map" ).on('click', function() {
1754					var defmaplat = jQuery('body').data('defaultmaplat');
1755					var defmaplong = jQuery('body').data('defaultmaplot');
1756					jQuery('.map-pop').empty();
1757					if(jQuery('#map-section').is('.map-container3')) {
1758						jQuery('.map-pop').html('<div class="mapSidebar" id="map"></div>');
1759					}else{
1760						jQuery('.map-pop').html('<div class="listingmap" id="map"></div>');
1761					}
1762					var map = null
1763					$mtoken = jQuery('#page').data("mtoken");	
1764                    $mtype = jQuery('#page').data("mtype");	
1765					$mapboxDesign = jQuery('#page').data("mstyle");
1766					
1767					if($mtoken != '' && $mtype == 'mapbox'){
1768
1769                        L.mapbox.accessToken = $mtoken;
1770                        map = L.mapbox.map('map');
1771                        L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
1772                            maxZoom: 18,
1773                            attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
1774                            '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
1775                            'Imagery © <a href="http://mapbox.com">Mapbox</a>',
1776                            id: jQuery('#page').data("mstyle"),
1777                            accessToken: $mtoken
1778                        }).addTo(map);
1779						 
1780						var markers = new L.MarkerClusterGroup();
1781						initializeMap(markers);
1782						if(markers===undefined){}else{
1783							map.fitBounds(markers.getBounds());
1784							map.scrollWheelZoom.disable();
1785						}
1786					}else{
1787						
1788						var map = new L.Map('map', {
1789							minZoom: 3,							
1790						}
1790).setView(new L.LatLng(defmaplat, defmaplong), 18);
1791						if($mtype == 'google'){
1792                            L.tileLayer('http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}',{
1793                                maxZoom: 6,
1794                                subdomains:['mt0','mt1','mt2','mt3'],
1795                                noWrap: true,
1796                            });
1797                            var googleLayer = new L.Google('ROADMAP');						
1798                            map.addLayer(googleLayer);
1799                        }else{
1800                            L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
1801                        }
1802						var markers = new L.MarkerClusterGroup();
1803						initializeMap(markers);
1804						if(markers===undefined){}else{
1805							
1806							map.fitBounds(markers.getBounds(), {padding: [50, 50]});
1807							
1808						}							
1809					}
1810						
1811						
1812						
1813						
1814					function initializeMap(markers) {
1815						markers.clearLayers();
1816						
1817						jQuery(".lp-grid-box-contianer").each(function(i){
1818			
1819							var LPtitle  = jQuery(this).data("title");
1820							var LPposturl  = jQuery(this).data("posturl");
1821							var LPlattitue  = jQuery(this).data("lattitue");
1822							var LPlongitute  = jQuery(this).data("longitute");
1823							var LPpostid  = jQuery(this).data("postid");
1824                            if( jQuery('.v2-map-load').length == 1 )
1825                            {
1826                                var LPaddress  = jQuery(this).find('.gaddress').text();
1827                                var LPimageSrc  = jQuery(this).find('.lp-listing-top-thumb').find('img').attr('src');
1828								var LPiconSrc  = jQuery(this).find('.cat-icon').find('img').attr('src');
1829								if (typeof jQuery("body").data('deficon') !== 'undefined'){
1830                                    LPiconSrc = jQuery("body").data('deficon');
1831								}
1832                               
1833                            }
1834                            else
1835                            {
1836							var LPaddress  = jQuery(this).find('.gaddress').text();
1837							var LPimageSrc  = jQuery(this).find('.lp-grid-box-thumb').find('img').attr('src');
1838							var LPiconSrc  = jQuery(this).find('.cat-icon').find('img').attr('src');
1839								if (typeof jQuery("body").data('deficon') !== 'undefined'){
1840                                    LPiconSrc = jQuery("body").data('deficon');
1841								}
1842                            }
1843							
1844							if(LPlattitue != '' && LPlongitute != ''){
1845								var LPimage = '';
1846								if(LPimageSrc != ''){
1847									LPimage = LPimageSrc;
1848								}
1849								
1850								var LPicon = '';
1851								if(LPiconSrc != ''){
1852									LPicon = LPiconSrc;
1853								}
1854								
1855								var markerLocation = new L.LatLng(LPlattitue, LPlongitute); // London
1856
1857								var CustomHtmlIcon = L.HtmlIcon.extend({
1858									options : {
1859										html : "<div class='lpmap-icon-shape pin card"+LPpostid+"'><div class='lpmap-icon-contianer'><img src='"+LPicon+"' /></div></div>",
1860									}
1861								});
1862
1863								if (LPimage == 'undefined') {
1864									LPimage = jQuery(this).find('.lp-grid-box-thumb').find('img').attr('src');
1865								}
1866
1867								var customHtmlIcon = new CustomHtmlIcon(); 
1868
1869								var marker = new L.Marker(markerLocation, {icon: customHtmlIcon}).bindPopup('<div class="map-post"><div class="map-post-thumb"><a href="'+LPposturl+'"><img src="'+LPimage+'" ></a></div><div class="map-post-des"><div class="map-post-title"><h5><a href="'+LPposturl+'">'+LPtitle+'</a></h5></div><div class="map-post-address"><p><i class="fa fa-map-marker"></i> '+LPaddress+'</p></div></div></div>').addTo(map);
1870								markers.addLayer(marker);
1871								map.addLayer(markers);
1872							
1873							}
1874							
1875						});
1876					};
1877						
1878					
1879				});
1880				
1881				jQuery(document).on('click', '.footer-btn-right.map-view-btn, .v2-map-load .v2mapwrap, .listing-app-view-bar .right-icons a, .sidemap-fixed .sidemarpInside', function(e){
1882					if(jQuery('#map').is('.mapSidebar')) {
1883						
1884						var defmaplat = jQuery('body').data('defaultmaplat');
1885						var defmaplong = jQuery('body').data('defaultmaplot');
1886					
1887						jQuery('.map-pop').empty();
1888						jQuery('.map-pop').html('<div class="mapSidebar" id="map"></div>');
1889						var map = null
1890						$mtoken = jQuery('#page').data("mtoken");			
1891						$mtype = jQuery('#page').data("mtype");			
1892						$mapboxDesign = jQuery('#page').data("mstyle");					
1893						
1894						if($mtoken != '' && $mtype == 'mapbox'){
1895
1896                            L.mapbox.accessToken = $mtoken;
1897                            map = L.mapbox.map('map')
1898                                .setView([defmaplat, defmaplong], 2);
1899                            L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
1900                                maxZoom: 18,
1901                                id: jQuery('#page').data("mstyle"),
1902                                accessToken: jQuery('#page').data("mtoken")
1903                            }).addTo(map);
1904							 
1905							var markers = new L.MarkerClusterGroup();
1906							initializeMap(markers);
1907							map.fitBounds(markers.getBounds(), {padding: [50, 50]});
1908							jQuery(document).on('click','.open-map-view', function() { 
1909							  L.Util.requestAnimFrame(map.invalidateSize,map,!1,map._container);
1910							});
1911							
1912						}else{
1913							
1914							var map = new L.Map('map', {
1915								minZoom: 3,
1916							}).setView(new L.LatLng(defmaplat, defmaplong), 6);
1917                            if($mtype == 'google'){
1918                                L.tileLayer('http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}',{
1919                                    maxZoom: 6,
1920                                    subdomains:['mt0','mt1','mt2','mt3'],
1921                                    noWrap: true,
1922                                });
1923                                var googleLayer = new L.Google('ROADMAP');						
1924                                map.addLayer(googleLayer);
1925                            }else{
1926                                L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
1927                            }
1928							
1929							
1930							var markers = new L.MarkerClusterGroup();
1931								resmarkers = initializeMap(markers);
1932								//if(resmarkers!== "undefined"){
1933								//console.log(resmarkers);
1934								//if(typeof resmarkers  == 'undefined'){}
1935								if( resmarkers  === undefined){}
1936								else{
1937									map.fitBounds(markers.getBounds(), {padding: [50, 50]});
1938									map.scrollWheelZoom.enable();
1939									map.invalidateSize();
1940									map.dragging.enable();
1941									jQuery(document).on('click','.open-map-view', function() { 
1942									  L.Util.requestAnimFrame(map.invalidateSize,map,!1,map._container);
1943									});
1944								}
1945                            
1946							
1947						}
1948
1949                        function initializeMap(markers) {
1950
1951                            if( jQuery('.lp-grid-box-contianer').length !=0 ){
1952                                markers.clearLayers();
1953                                jQuery(".lp-grid-box-contianer").each(function(i){
1954
1955                                    var LPtitle  = jQuery(this).data("title");
1956                                    var LPposturl  = jQuery(this).data("posturl");
1957                                    var LPlattitue  = jQuery(this).data("lattitue");
1958                                    var LPlongitute  = jQuery(this).data("longitute");
1959                                    var LPpostid  = jQuery(this).data("postid");
1960                                    var LPiconSrc = '';
1961
1962                                    if (jQuery('.v2-map-load').length == 1) {
1963                                        if (jQuery('.v2-map-load').hasClass('v2_map_load_old')) {
1964                                            var LPaddress = jQuery(this).find('.gaddress').text();
1965                                            var LPimageSrc = jQuery(this).find('.lp-grid-box-thumb').find('img').attr('src');
1966                                            if (typeof jQuery("body").data('deficon') !== 'undefined') {
1967                                                // your code here
1968                                                LPiconSrc = jQuery("body").data('deficon');
1969                                            } else {
1970                                                LPiconSrc = jQuery(this).find('.cat-icon').find('img').attr('src');
1971                                            }
1972                                        } else {
1973                                            var LPaddress = jQuery(this).find('.lp-listing-location').find('a').text();
1974                                            var LPimageSrc = jQuery(this).find('.lp-listing-top-thumb').find('img').attr('src');
1975
1976                                            if (typeof jQuery("body").data('deficon') !== 'undefined') {
1977                                                // your code here
1978                                                LPiconSrc = jQuery("body").data('deficon');
1979                                            } else {
1980                                                LPiconSrc = jQuery(this).find('.cat-icon').find('img').attr('src');
1981                                            }
1982                                        }
1983                                    } else if (jQuery('.lp-compact-view-outer').length > 0){
1984                                        var LPaddress  = jQuery(this).find('.lp_list_address').text();
1985                                        var LPimageSrc  = jQuery(this).find('.lp-listing-top-thumb').find('img').attr('src');
1986                                        var LPiconSrc  = jQuery(this).find('.cat-icon').find('img').attr('src');
1987                                        if (typeof jQuery("body").data('deficon') !== 'undefined'){
1988                                            LPiconSrc = jQuery("body").data('deficon');
1989                                        }
1990                                    } else {
1991                                        var LPaddress = jQuery(this).find('.gaddress').text();
1992                                        var LPimageSrc = jQuery(this).find('.listing-app-view-new-wrap').find('img').attr('src');
1993                                        if ( LPimageSrc === undefined){
1994                                            LPimageSrc = jQuery(this).data('feaimg');
1995                                        }
1996                                        if ( LPimageSrc === undefined){
1997                                            if (jQuery('.lp-grid-box-thumb .show-img').length > 0){
1998                                                LPimageSrc = jQuery(this).find('.lp-grid-box-thumb .show-img img').attr('src');
1999                                            }else {
2000                                                LPimageSrc = jQuery(this).find('.lp-grid-box-thumb .show img').attr('src');
2001                                            }
2002                                        }
2003                                        if (typeof jQuery("body").data('deficon') !== 'undefined') {
2004                                            // your code here
2005                                            LPiconSrc = jQuery("body").data('deficon');
2006                                        } else {
2007                                            LPiconSrc = jQuery(this).find('.cat-icon').find('img').attr('src');
2008                                        }
2009                                    }
2010                                    if(LPlattitue != '' && LPlongitute != ''){
2011
2012                                        var LPimage = '';
2013                                        if(LPimageSrc != ''){
2014                                            LPimage = LPimageSrc;
2015                                        }
2016
2017                                        var LPicon = '';
2018                                        if(LPiconSrc != ''){
2019                                            LPicon = LPiconSrc;
2020                                        }
2021
2022                                        var markerLocation = new L.LatLng(LPlattitue, LPlongitute); // London
2023
2024                                        var CustomHtmlIcon = L.HtmlIcon.extend({
2025                                            options : {
2026                                                html : "<div class='lpmap-icon-shape pin card"+LPpostid+"'><div class='lpmap-icon-contianer'><img src='"+LPicon+"' /></div></div>",
2027                                            }
2028                                        });
2029
2030                                        var customHtmlIcon = new CustomHtmlIcon();
2031
2032                                        var marker = new L.Marker(markerLocation, {icon: customHtmlIcon}).bindPopup('<div class="map-post"><div class="map-post-thumb"><a target="_blank" href="'+LPposturl+'">
2032<img src="'+LPimage+'" ></a></div><div class="map-post-des"><div class="map-post-title"><h5><a target="_blank" href="'+LPposturl+'">'+LPtitle+'</a></h5></div><div class="map-post-address"><p><i class="fa fa-map-marker"></i> '+LPaddress+'</p></div></div></div>').addTo(map);
2033                                        markers.addLayer(marker);
2034                                        map.addLayer(markers);
2035
2036                                    }
2037
2038                                });
2039                                return true;
2040                            }
2041                        }
2042					
2043					}
2044				});
2045					
2046		 if(jQuery('#cpmap').is('.contactmap')) {
2047			 
2048			 jQuery('#cpmap').empty();
2049			var map = null;
2050			 $mtoken = jQuery('#page').data("mtoken");
2051             $mtype = jQuery('#page').data("mtype");	
2052				$siteURL = jQuery('#page').data("site-url");
2053				$lat = jQuery('.cp-lat').data("lat");
2054				$lan = jQuery('.cp-lan').data("lan");
2055				if($mtoken != '' && $mtype == 'mapbox'){
2056                    L.mapbox.accessToken = $mtoken;
2057
2058                    $mapboxDesign = jQuery('#page').data("mstyle");
2059                    var map = L.mapbox.map('cpmap')
2060                        .setView([$lat,$lan], 14);
2061                    L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
2062                        id: jQuery('#page').data("mstyle"),
2063                        accessToken: jQuery('#page').data("mtoken")
2064                    }).addTo(map);
2065                    map.scrollWheelZoom.disable();
2066
2067                }else{
2068					
2069				    var map = new L.Map('cpmap', '').setView(new L.LatLng($lat, $lan), 16);
2070					if($mtype == 'google'){	
2071						var googleLayer = new L.Google('ROADMAP');						
2072						map.addLayer(googleLayer);
2073                    }else{
2074                        L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
2075                    }
2076						
2077						map.scrollWheelZoom.disable();
2078					}
2079					
2080					var markers = new L.MarkerClusterGroup();
2081					var $pinicon = jQuery('#cpmap').data('pinicon');
2082					if($pinicon===""){
2083						$pinicon = "<div class='lpmap-icon-shape pin'><div class='lpmap-icon-contianer'><img src='"+$siteURL+"wp-content/themes/listingpro/assets/images/pins/lp-logo.png'  /></div></div>";
2084					}
2085					else{
2086						$pinicon = "<div style='width:50px; height:50px; margin: -50px 0 0 -20px;'><img src='"+$pinicon+"'  /></div>";
2087					}
2088					
2089						var markerLocation = new L.LatLng($lat, $lan); // London
2090
2091						var CustomHtmlIcon = L.HtmlIcon.extend({
2092							options : {
2093								html : $pinicon,
2094							}
2095						});
2096
2097						var customHtmlIcon = new CustomHtmlIcon(); 
2098
2099						var marker = new L.Marker(markerLocation, {icon: customHtmlIcon}).bindPopup('').addTo(map);
2100						markers.addLayer(marker);
2101						
2102			
2103			}else if(jQuery('#map').is('.singlebigpost')) {
2104				jQuery( ".singlebigmaptrigger" ).click(function() {
2105					
2106					$mtoken = jQuery('#page').data("mtoken");
2107					$siteURL = jQuery('#page').data("site-url");
2108                    $mtype = jQuery('#page').data("mtype");
2109					$lat = jQuery('.singlebigmaptrigger').data("lat");
2110					$lan = jQuery('.singlebigmaptrigger').data("lan");
2111					if($mtoken != '' && $mtype == 'mapbox'){
2112
2113                        L.mapbox.accessToken = $mtoken;
2114                        var map = L.mapbox.map('map')
2115                            .setView([$lat,$lan], 14);
2116                        L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
2117                            id: jQuery('#page').data("mstyle"),
2118                            accessToken: jQuery('#page').data("mtoken")
2119                        }).addTo(map);
2120						
2121						var markers = new L.MarkerClusterGroup();
2122						
2123							var markerLocation = new L.LatLng($lat, $lan); // London
2124
2125							var CustomHtmlIcon = L.HtmlIcon.extend({
2126								options : {
2127									html : "<div class='lpmap-icon-shape pin '><div class='lpmap-icon-contianer'><img src='"+$siteURL+"wp-content/themes/listingpro/assets/images/pins/lp-logo.png'  /></div></div>",
2128								}
2129							});
2130
2131							var customHtmlIcon = new CustomHtmlIcon(); 
2132
2133							var marker = new L.Marker(markerLocation, {icon: customHtmlIcon}).bindPopup('').addTo(map);
2134							markers.addLayer(marker);
2135							map.fitBounds(markers.getBounds());
2136						
2137							map.scrollWheelZoom.disable();
2138							map.invalidateSize();
2139						
2140						
2141					}else{
2142							var map = new L.Map('map', {center: new L.LatLng($lat,$lan), zoom: 14});
2143                            if($mtype == 'google'){
2144                                var googleLayer = new L.Google('ROADMAP');
2145                                map.addLayer(googleLayer);
2146                            }else{
2147                                L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
2148                            }
2149							var markers = new L.MarkerClusterGroup();						
2150							var markerLocation = new L.LatLng($lat, $lan); // London
2151							var CustomHtmlIcon = L.HtmlIcon.extend({
2152								options : {
2153									html : "<div class='lpmap-icon-shape pin '><div class='lpmap-icon-contianer'><img src='"+$siteURL+"wp-content/themes/listingpro/assets/images/pins/lp-logo.png'  /></div></div>",
2154								}
2155							});
2156
2157							var customHtmlIcon = new CustomHtmlIcon(); 
2158
2159							var marker = new L.Marker(markerLocation, {icon: customHtmlIcon}).bindPopup('').addTo(map);
2160							markers.addLayer(marker);
2161							map.fitBounds(markers.getBounds());
2162						
2163							map.scrollWheelZoom.disable();
2164							map.invalidateSize();
2165					}
2166					
2167				});
2168			}
2169
2170		});
2171				
2172		
2173	// Autocomplete
2174	
2175    jQuery.widget( "custom.combobox", {
2176      _create: function() {
2177        this.wrapper = jQuery( "<span>" )
2178          .addClass( "custom-combobox" )
2179          .insertAfter( this.element );
2180
2181        this.element.hide();
2182        this._createAutocomplete();
2183        this._createShowAllButton();
2184      },
2185      _createAutocomplete: function() {
2186        var selected = this.element.children( ":selected" ),
2187          value = selected.val() ? selected.text() : "";
2188
2189        this.input = jQuery( "<input>" )
2190          .appendTo( this.wrapper )
2191          .val( value )
2192          .attr( "title", "" )
2193          .addClass( "custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left lp-search-input location_input lp-home-locaton-input" )
2194          .autocomplete({
2195            delay: 0,
2196            minLength: 0,
2197            source: $.proxy( this, "_source" )
2198          })
2199		  .tooltip({
2200            tooltipClass: "ui-state-highlight"
2201          });
2202
2203      },
2204
2205      _createShowAllButton: function() {
2206        var input = this.input,
2207          wasOpen = false;
2208
2209        jQuery( "<a>" )
2210          .attr( "tabIndex", -1 )
2211          .attr( "title", "Show All Items" )
2212          .tooltip()
2213          .appendTo( this.wrapper )
2214          .button({
2215            icons: {
2216              primary: "ui-icon-triangle-1-s"
2217            },
2218            text: false
2219          })
2220          .removeClass( "ui-corner-all" )
2221          .addClass( "custom-combobox-toggle ui-corner-right" )
2222          .mousedown(function() {
2223            wasOpen = input.autocomplete( "widget" ).is( ":visible" );
2224          })
2225          .on('click' , function() {
2226            input.focus();
2227
2228            // Close if already visible
2229            if ( wasOpen ) {
2230              return;
2231            }
2232
2233            // Pass empty string as value to search for, displaying all results
2234            input.autocomplete( "search", "" );
2235          });
2236      },
2237
2238      _source: function( request, response ) {
2239        var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
2240        response( this.element.children( "option" ).map(function() {
2241          var text = jQuery( this ).text();
2242          if ( this.value && ( !request.term || matcher.test(text) ) )
2243            return {
2244              label: text,
2245              value: text,
2246              option: this
2247            };
2248        }) );
2249      },
2250
2251      _removeIfInvalid: function( event, ui ) {
2252
2253        // Selected an item, nothing to do
2254        if ( ui.item ) {
2255          return;
2256        }
2257
2258        // Search for a match (case-insensitive)
2259        var value = this.input.val(),
2260          valueLowerCase = value.toLowerCase(),
2261          valid = false;
2262        this.element.children( "option" ).each(function() {
2263          if ( jQuery( this ).text().toLowerCase() === valueLowerCase ) {
2264            this.selected = valid = true;
2265            return false;
2266          }
2267        });
2268
2269        // Found a match, nothing to do
2270        if ( valid ) {
2271          return;
2272        }
2273
2274        // Remove invalid value
2275        this.input
2276          .val( "" )
2277          .attr( "title", value + " didn't match any item" )
2278          .tooltip( "open" );
2279        this.element.val( "" );
2280        this._delay(function() {
2281          this.input.tooltip( "close" ).attr( "title", "" );
2282        }, 2500 );
2283        this.input.autocomplete( "instance" ).term = "";
2284      },
2285
2286      _destroy: function() {
2287        this.wrapper.remove();
2288        this.element.show();
2289      }
2290    });
2291	
2292    jQuery( ".comboboxs" ).combobox();
2293		jQuery( "#toggle" ).on('click' , function(){
2294		jQuery( ".comboboxs" ).toggle();
2295    });	
2296   // jQuery( "#searchcategory" ).combobox();
2297		jQuery( "#toggle" ).on('click' , function(){
2298		jQuery( "#searchcategory" ).toggle();
2299    });	
2300    jQuery( ".ui-autocomplete" ).autocomplete({
2301	  appendTo: ".input-group"
2302	});    
2303	jQuery('.custom-combobox-input').autocomplete({ minLength: 0 });
2304	jQuery('.custom-combobox-input').on( "click", function(){
2305		jQuery(this).autocomplete("search", "");
2306	});
2307	
2308  
2309	// Location Placeholder
2310	jQuery(".location_input").attr("placeholder", "Your Location");
2311	jQuery(".comboboxCategory .location_input").attr("placeholder", "Food");
2312	jQuery(".postSubmitCat .location_input").attr("placeholder", "Chose one or more than one categories");
2313	
2314	
2315	jQuery(document).on('click', '.md-close', function(){	
2316		jQuery('.md-modal').modal('hide');
2317		jQuery('.md-modal').removeClass('md-show');
2318		jQuery('.modal-backdrop').remove();
2319	});
2320	
2321// Popup Data
2322jQuery(document).on('click', '.qickpopup', function(){
2323  // variables
2324
2325  var LPtitle  = jQuery(this).closest('.lp-grid-box-contianer').data("title");
2326  var LPlattitue  = jQuery(this).closest('.lp-grid-box-contianer').data("lattitue");
2327  var LPlongitute  = jQuery(this).closest('.lp-grid-box-contianer').data("longitute");
2328  var LPpostID  = jQuery(this).closest('.lp-grid-box-contianer').data("postid");
2329
2330    var feaImg  =  jQuery(this).closest('.lp-grid-box-contianer').data("feaimg");
2331
2332    var mapPin	=	jQuery(this).data('mappin');
2333        jQuery('#listing-preview-popup .md-close').hide();
2334        var docHeight = jQuery( document ).height();
2335        jQuery( "body" ).prepend( '<div id="full-overlay"></div>' );
2336        jQuery('#full-overlay').css('height',docHeight+'px');
2337        jQuery('#listing-preview-popup .popup-inner-left-padding').html('').
2337css('min-hegiht', '300px');
2338        if(jQuery('#listing-preview-popup').is('.md-show')) {
2339        }else{
2340            jQuery('#listing-preview-popup').modal({
2341                show: 'true'
2342            });
2343            jQuery('#listing-preview-popup').addClass('md-show');
2344        }
2345        jQuery.ajax({
2346            url: ajax_search_term_object.ajaxurl,
2347            dataType: "json",
2348            data: {
2349                'action':'quick_preivew_cb',
2350                'LPpostID' : LPpostID,
2351				'lpNonce' : jQuery('#lpNonce').val()
2352            },
2353            success:function(data) {
2354                jQuery('#listing-preview-popup .md-close').show().children('i').css('right', '20px');
2355                jQuery('#listing-preview-popup .popup-inner-left-padding').html(data);
2356                var mapinSrc	=	'';
2357
2358
2359                mapinSrc	=	jQuery(data).find('span.cat-icon').find('img').attr('src');
2360                if(mapinSrc != '') {
2361                    mapPin	=	mapinSrc;
2362                }
2363
2364                var markers = false;
2365                $mtoken = jQuery('#page').data("mtoken");
2366                $siteURL = jQuery('#page').data("site-url");
2367                $lat = LPlattitue;
2368                $lan = LPlongitute;
2369                $mapboxDesign = jQuery('#page').data("mstyle");
2370                $mtype = jQuery('#page').data("mtype");	
2371                if($mtoken != '' && $mtype == 'mapbox'){
2372                    L.mapbox.accessToken = $mtoken;
2373                    map = L.mapbox.map('quickmap'+LPpostID);
2374                    L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
2375                        id: jQuery('#page').data("mstyle"),
2376                        accessToken: jQuery('#page').data("mtoken")
2377                    }).addTo(map);
2378                }else{
2379                    
2380                    var map = new L.Map('quickmap'+LPpostID, {center: new L.LatLng($lat,$lan), zoom: 14});
2381                    if($mtype == 'google'){
2382                        var googleLayer = new L.Google('ROADMAP');
2383                        map.addLayer(googleLayer);
2384                    }else{
2385                        L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
2386                    }
2387                        
2388                }
2389                map.setView([$lat,$lan], 14);
2390                markers = new L.MarkerClusterGroup();
2391                var markerLocation = new L.LatLng($lat, $lan); // London
2392                var CustomHtmlIcon = L.HtmlIcon.extend({
2393                    options : {
2394                        html : '<div class="lpmap-icon-shape pin"><div class="lpmap-icon-contianer"><img src="'+ mapPin +'" /></div></div>',
2395                    }
2396                });
2397                var customHtmlIcon = new CustomHtmlIcon();
2398                var marker = new L.Marker(markerLocation, {icon: customHtmlIcon}).bindPopup('').addTo(map);
2399                markers.addLayer(marker);
2400                jQuery('.md-close.widget-map-click').click(function(e){
2401                    jQuery('#full-overlay').remove();
2402                });
2403                //alert(data.cats_markup);
2404            },
2405            error: function(errorThrown){
2406                alert(errorThrown);
2407            }
2408        });
2409 });
2410	
2411	//href Smooth Scroll
2412	
2413	// handle links with @href started with '#' only
2414 	jQuery('.post-meta-right-box a.secondary-btn[href^="#"]').on('click',function (e) {
2415	    e.preventDefault();
2416
2417	    var target = this.hash;
2418	    var $target = jQuery(target);
2419
2420	    jQuery('html, body').stop().animate({
2421	        'scrollTop': $target.offset().top
2422	    }, 900, 'swing', function () {
2423	        window.location.hash = target;
2424	    });
2425	}); 
2426	var submitlink = jQuery('body').data('submitlink');
2427	var siteurl = jQuery('#page').data('site-url');
2428	var sitelogo = jQuery('#page').data('sitelogo');
2429	
2430	jQuery('#menu').mmenu({
2431		navbar: {
2432			title: ""
2433		},
2434		navbars		: {
2435			height 	: 3,
2436			content :  [ 
2437				'<a href="'+siteurl+'" class="userimage"><img class="icon icons8-Contacts" src="'+sitelogo+'" alt="user"></a>',					
2438			]
2439		}
2440	});
2441	var API = jQuery("#menu").data( "mmenu" );
2442    jQuery(".lpl-button.md-trigger, .sign-login-wrap .md-trigger,.lpl-button.app-view-popup-style").click(function() {
2443		API.close();
2444	});
2445	//Tags Container 
2446	jQuery('.chosen-select2').chosen({
2447		disable_search: true
2448	});
2449	jQuery('.chosen-select1').chosen({
2450		disable_search: true
2451	});
2452	jQuery('.chosen-select7').chosen({
2453		disable_search: true
2454	});
2455    jQuery('.chosen-select5').chosen({
2456        disable_search: true
2457    });
2458	// jQuery( ".chosen-select.chosen-select5" ).select2({minimumResultsForSearch: -1});
2459	
2460	var $tags = jQuery('#searchtags').chosen(),
2461		LPnewTags = function() {
2462                    jQuery('.LPtagsContainer').empty();
2463                    $tags.find(':selected').each(function(i, obj) {
2464                        jQuery('<div class="active-tag">' + obj.value + '<div class="remove-tag"><i class="fa fa-times"></i></div></div>').appendTo('.LPtagsContainer').on('click', function() {
2465                            jQuery(this).remove();
2466                            jQuery(obj).attr('selected', false);
2467                            $tags.trigger("chosen:updated");
2468                            jQuery('.LPtagsContainer input[value="' + obj.value + '"]').remove();
2469                        });
2470
2471                        jQuery('<input type="hidden" name="select_tag" value="' + obj.value + '" />').appendTo('.LPtagsContainer');
2472                    });
2473                };
2474
2475            $tags.on('change', LPnewTags);
2476	
2477		/* Social Share */
2478		var social = jQuery('.post-stat li ul.social-icons.post-socials');
2479		var socialOvrly = jQuery('.reviews.sbutton .md-overlay');
2480
2481		jQuery('.sbutton a.reviews-quantity').on('click', function(event) { 
2482			event.preventDefault();
2483			social.fadeIn(400);
2484
2485			if(socialOvrly.hasClass('hide')){
2486				jQuery(socialOvrly).removeClass('hide');
2487				jQuery(socialOvrly).addClass('show');
2488			}
2489			else{
2490				jQuery(socialOvrly).removeClass('show');
2491				jQuery(socialOvrly).addClass('hide');
2492			}
2493		});
2494
2495		socialOvrly.on('click', function(event) { 
2496			event.preventDefault();
2497			social.fadeOut(400);
2498
2499			if(socialOvrly.hasClass('show')){
2500				jQuery(socialOvrly).removeClass('show');
2501				jQuery(socialOvrly).addClass('hide');
2502			}
2503			else{
2504				jQuery(socialOvrly).removeClass('hide');
2505				jQuery(socialOvrly).addClass('show');
2506			}
2507		});
2508		
2509		// Reserwa Popup
2510		jQuery('a.make-reservation').on('click', function(event) {
2511			event.preventDefault();
2512			jQuery('.ifram-reservation').fadeIn(400);
2513		});
2514		jQuery('a.close-btn').on('click', function(event) {
2515			event.preventDefault();
2516			jQuery('.ifram-reservation').fadeOut(400);
2517		});
2518
2519		//Menu Popup
2520		if ( jQuery(window).width() > 767 ) {
2521			//Menu Popup
2522			jQuery('.widget-box a.open-modal, .menu-hotel a.open-modal').on('click', function(event) {
2523				event.preventDefault();
2524				jQuery('.hotel-menu').fadeIn(400);
2525			});
2526			jQuery('a.close-menu-popup').on('click', function(event) {
2527				event.preventDefault();
2528				jQuery('.hotel-menu').fadeOut(400);
2529			});
2530		} else if(jQuery(window).width() < 767) {
2531			//Menu Popup
2532			jQuery('.widget-box a.open-modal, .menu-hotel a.open-modal').on('click', function(event) {
2533				event.preventDefault();
2534				jQuery('.hotel-menu').slideToggle(400);
2535			});
2536
2537            jQuery('.listing-app-view .hotel-menu a.close-menu-popup').on('click', function(event) {
2538                event.preventDefault();
2539                jQuery('.hotel-menu').slideToggle(400);
2540            });
2541		}
2542
2543
2544		// Resurva Booking Switcher
2545		jQuery('a.switch-fields').on('click', function(event) {
2546			event.preventDefault();
2547			jQuery(this).toggleClass('active');
2548			jQuery('.hidden-items').fadeToggle(400);
2549		});
2550
2551		// Dashboard Notices
2552		jQuery('a.dismiss').on('click', function(event) {
2553			event.preventDefault();
2554			jQuery(this).parent('.panel-dash-dismiss').slideUp(400);
2555		});
2556		
2557		
2558		
2559		
2560		/* Pins Hover */
2561
2562		jQuery(document).on('mouseenter','.lp-grid-box-contianer',function() {
2563			var cardID  = jQuery(this).data("postid");
2564			var	cardclass = '.lpmap-icon-shape.card'+cardID;
2565			if(jQuery(cardclass).hasClass('cardHighlight')) {
2566				jQuery(cardclass).removeClass("cardHighlight"); 
2567			 }
2568			 else{   
2569				jQuery(cardclass).addClass("cardHighlight"); 
2570			 }
2571		  });
2572		  jQuery(document).on('mouseleave','.lp-grid-box-contianer',function() {
2573				var cardID  = jQuery(this).data("postid");
2574				var	cardclass = '.lpmap-icon-shape.card'+cardID;
2575				jQuery(cardclass).removeClass("cardHighlight"); 			 
2576		  });
2577		  
2578		  
2579		  
2580	 /* Select Category */
2581	 jQuery('.postsubmitSelect').on('change', function(){
2582		 jQuery('.feature-fields-error-container').remove();
2583		jQuery('.featuresDataRow').show();
2584		var cvalue =	jQuery(this).val() ;
2585		jQuery('.featuresData').css({'opacity':'0','visibility':'hidden','display':'none'});
2586		jQuery('.featuresDataContainer').find('.featuresData'+cvalue).css({'opacity':'1','visibility':'visible','display':'block'});
2587	});
2588	
2589});
2590jQuery(document).on('change', '.btn-file :file', function() {
2591  var input = jQuery(this),
2592      numFiles = input.get(0).files ? input.get(0).files.length : 1,
2593      label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
2594  input.trigger('fileselect', [numFiles, label]);
2595});
2596
2597
2598
2599
2600
2601
2602jQuery(document).ready(function(){
2603	if(jQuery('form').is('#lp-submit-formdf')) {
2604		var validator = new FormValidator('lp-submit-form', [
2605		{
2606			name: 'postTitle',
2607			display: 'Title',
2608			rules: 'required'
2609		}, {
2610			name: 'category',
2611			display: 'Category',
2612			rules: 'required'
2613		}, {
2614			name: 'postContent',
2615			display: 'Description',
2616			rules: 'required'
2617		},  {
2618			name: 'location',
2619			display: 'Location',
2620			rules: 'required'
2621		},  {
2622			name: 'gAddress',
2623			display: 'Google Address',
2624			rules: 'required'
2625		},{
2626			name: 'email',
2627			rules: 'valid_email',
2628			
2629		},{
2630			name: 'username',
2631			display: 'UserName',
2632			rules: 'required'
2633			
2634		},{
2635			name: 'policycheck',
2636			display: 'Terms and Conditions Check',
2637			rules: 'required'
2638			
2639		}], function(errors, evt) {
2640
2641
2642			var SELECTOR_ERRORS = jQuery('.error_box'),
2643				SELECTOR_SUCCESS = jQuery('.success_box');
2644
2645			if (errors.length > 0) {
2646				SELECTOR_ERRORS.empty();
2647
2648				for (var i = 0, errorLength = errors.length; i < errorLength; i++) {
2649					SELECTOR_ERRORS.append(errors[i].message + '<br />');
2650				}
2651
2652				SELECTOR_SUCCESS.css({ display: 'none' });
2653				SELECTOR_ERRORS.fadeIn(200);
2654			} else {
2655				SELECTOR_ERRORS.css({ display: 'none' });
2656				SELECTOR_SUCCESS.fadeIn(200);
2657			}
2658
2659			
2660		});
2661	}	
2662});
2663var image_custom_uploader;
2664var $thisItem = '';
2665
2666jQuery(document).on('click','.upload-author-image', function(e) {
2667	e.preventDefault();
2668
2669	$thisItem = jQuery(this);
2670	$form = jQuery('#profileupdate');
2671
2672	//If the uploader object has already been created, reopen the dialog
2673	if (image_custom_uploader) {
2674	    image_custom_uploader.open();
2675	    return;
2676	}
2677
2678	//Extend the wp.media object
2679	image_custom_uploader = wp.media.frames.file_frame = wp.media({
2680	    title: 'Choose Image',
2681	    button: {
2682	        text: 'Choose Image'
2683	    },
2684	    multiple: false
2685	});
2686
2687	//When a file is selected, grab the URL and set it as the text field's value
2688	image_custom_uploader.on('select', function() {
2689	    attachment = image_custom_uploader.state().get('selection').first().toJSON();
2690	    var url = '';
2691	    url = attachment['url'];
2692	    var attachId = '';
2693	    attachId = attachment['id'];
2694		
2695	   jQuery( "img.author-avatar" ).attr({
2696	        src: url
2697	    });
2698	  $form.parent().parent().find( ".criteria-image-url" ).attr({
2699	        value: url
2700	    });
2701	    $form.parent().parent().find( ".criteria-image-id" ).attr({
2702	        value: attachId
2703	    });
2704	});
2705
2706	//Open the uploader dialog
2707	image_custom_uploader.open();
2708});
2709									
2710									
2711/* update by zaheer on 25 feb  */									
2712jQuery(document).ready(function($){
2713	jQuery('#listings_checkout input[name=listing_id]').on('change', function() {
2714		jQuery('#listings_checkout input[name=post_id]').val(jQuery(this, '#listings_checkout').val());
2715	});
2716	jQuery('#listings_checkout input[name=plan]').on('change', function() {
2717		jQuery('#listings_checkout input[name=method]').val(jQuery(this, '#listings_checkout').val());
2718	});
2719	
2720	
2721	jQuery('.lp-promotebtn').on('click', function(){
2722		var $this = jQuery(this);
2723		jQuery('#ads_promotion input[name=listing_id]').val($this.data('listingnid'));
2724		var listtitle = $this.data('listingtitle');
2725		jQuery('input[name=cur_listing_title]').val(listtitle);
2726	});
2727	jQuery('#ads_promotion input[name=plan]').on('change', function() {
2728	jQuery('#ads_promotion input[name=method]').val(jQuery(this, '#listings_checkout').val());
2729	});
2730
2731
2732});
2733/* by zaheer on 25 feb */
2734	jQuery('.availableprice_options input').change(function($){
2735		var $total, taxrate='', taxprice, taxTotal;
2736		if(jQuery('span').hasClass('pricetax')){
2737			taxrate = jQuery('span.pricetax').data('taxprice');
2738		}
2739		$oldtotal = jQuery('#totalprice').val();
2740		oldTax = jQuery('input[name="taxprice"]').val();
2741		if (jQuery(this).is(":checked")){
2742			var $val = jQuery(this).val();
2743			$total = parseFloat($val)+parseFloat($oldtotal);
2744			taxprice = parseFloat((taxrate/100)*$val);
2745			taxTotal = parseFloat(oldTax)+parseFloat(taxprice);
2746			$total = $total+taxprice;
2747			$total = $total.toFixed(2);
2748			taxTotal = taxTotal.toFixed(2);
2749			jQuery('#totalprice').val($total);
2750			jQuery('.pricetotal #price').html($total);
2751			jQuery('input[name="lp_total_price"]').val($total);
2752			jQuery('input[name="taxprice"]').val(taxTotal);
2753		}
2754		else{
2755			var $val = jQuery(this).val();
2756			$total = parseFloat($oldtotal)-parseFloat($val);
2757			taxprice = parseFloat((taxrate/100)*$val);
2758			taxTotal = parseFloat(oldTax)-parseFloat(taxprice);
2759			$total = $total-taxprice;
2760			$total = $total.toFixed(2);
2761			taxTotal = taxTotal.toFixed(2);
2762			if($total>0){
2763				jQuery('#totalprice').val($total);
2764				jQuery('.pricetotal #price').html($total);
2765				jQuery('input[name="lp_total_price"]').val($total);
2766				jQuery('input[name="taxprice"]').val(taxTotal);
2767			}
2768			else{
2769				$total = 0.00;
2770				jQuery('#totalprice').val($total);
2771				jQuery('.pricetotal #price').html($total);
2772				jQuery('input[name="lp_total_price"]').val($total);
2773				jQuery('input[name="taxprice"]').val(taxTotal);
2774			}
2775			
2776		}
2777		
2778	});
2779	
2780
2781/* update by zaheer on 25 feb  */
2782jQuery('.lp-front').on('click','.lp-frontBtn' ,function(e) {
2783	e.preventDefault();
2784	//jQuery('.lp-front').hide(200);
2785	jQuery('.lp-front').slideUp(500);
2786	jQuery('.lp-back1').slideDown(1000);
2787	//jQuery('.lp-back').show(500);
2788});
2789jQuery('.lp-back1').on('click','#lp-back1' ,function(e) {
2790	e.preventDefault();
2791	jQuery('.lp-back1').slideUp(500);
2792	jQuery('.lp-front').slideDown(1000);
2793});
2794jQuery('.lp-back1').on('click','#lp-next' ,function(e) {
2795	e.preventDefault();
2796	jQuery('.lp-back1').slideUp(500);
2797	jQuery('.lp-back2').slideDown(1000);
2798});
2799jQuery('.lp-back2').on('click','#lp-back2' ,function(e) {
2800	e.preventDefault();
2801	jQuery('.lp-back2').slideUp(500);
2802	jQuery('.lp-back1').slideDown(1000);
2803});
2804/* end update by zaheer on 25 feb  */
2805
2806//dynamic model for invoices by zaheer
2807jQuery(document).ready(function($){
2808	
2809	jQuery('.invoice-section a.showme').click(function(ev){
2810		var $this = jQuery(this);
2811		$this.after( '<i class="lp-modal-spinn fa-li fa fa-spinner fa-spin"></i>' );
2812             ev.preventDefault();
2813             var rowid = jQuery(this).data('id');
2814				 reqlink = jQuery(this).data('url');
2815				 var invoiceFor = '';
2816				 invoiceFor = jQuery(this).data('lpinvoice');
2817				 //invoiceFor = 'dddf';
2818				 
2819				jQuery.get(reqlink+'?lp_p_id=' + rowid+'&lp_invoice=' + invoiceFor, function(html){
2820                 jQuery('#modal-invoice .modal-body').html('');
2821                 jQuery('#modal-invoice .modal-body').html(html);
2822                 jQuery('#modal-invoice').modal('show', {backdrop: 'static'});
2823				 $this.next( '.lp-modal-spinn' ).hide('');
2824				 $this.next( '.lp-modal-spinn' ).remove('');
2825             });
2826         });
2827		
2828});
2829
2830
2831
2832/* print preview */
2833jQuery(function($) { 'use strict';
2834            jQuery("#modal-invoice").find('.lp-print-list').on('click', function() {
2835                //jQuery.print("#modal-invoice");
2836                /* jQuery("#modal-invoice").print({
2837					noPrintSelector : ".modal-footer",
2838				}); */
2839				
2840				var divToPrint=document.getElementById('modal-invoice');
2841
2842					  var newWin=window.open('','Print-Window');
2843
2844					  newWin.document.open();
2845
2846					  newWin.document.write('<html><body onload="window.print()">'+divToPrint.innerHTML+'</body></html>');
2847
2848					  newWin.document.close();
2849
2850					  setTimeout(function(){newWin.close();},10);
2851								 
2852				});
2853});
2854
2855jQuery(document).ready(function($) {  
2856    jQuery('.googleAddressbtn').on('click', function(e) {
2857        var dtype = jQuery(this).data('type');
2858        if(dtype=="gaddress") {
2859            if( jQuery(this).hasClass('events-dash') )
2860            {
2861                jQuery('.events-map-wrap #inputAddresss').slideUp(300);
2862                jQuery('.lp-custom-lat').slideUp(300);
2863                jQuery('.events-map-wrap #inputAddress').slideDown();
2864                jQuery('.events-map-wrap .googlefulladdress').slideDown(300);
2865                jQuery('.events-map-wrap #latitude').attr('type', 'hidden');
2866                jQuery('.events-map-wrap #longitude').attr('type', 'hidden');
2867                jQuery(this).next('.googleAddressbtn').removeClass('active');
2868                jQuery(this).addClass('active');
2869            }
2870            else
2871            {
2872                jQuery('.post-submit #inputAddresss').slideUp(300);
2873                jQuery('.lp-custom-lat').slideUp(300);
2874                jQuery('.post-submit #inputAddress').slideDown();
2875                jQuery('.post-submit .googlefulladdress').slideDown(300);
2876                jQuery('.post-submit #latitude').attr('type', 'hidden');
2877                jQuery('.post-submit #longitude').attr('type', 'hidden');
2878                jQuery(this).next('.googleAddressbtn').removeClass('active');
2879                jQuery(this).addClass('active');
2880            }
2881        } else {
2882            if( jQuery(this).hasClass('events-dash') )
2883            {
2884                jQuery('.events-map-wrap #inputAddress').slideUp();
2885                jQuery('.events-map-wrap .googlefulladdress').slideUp(300);
2886                jQuery('.events-map-wrap #inputAddresss').slideDown(300);
2887                jQuery('.lp-custom-lat').slideDown(300);
2888                jQuery('.events-map-wrap #latitude').attr('type', 'text');
2889                jQuery('.events-map-wrap #longitude').attr('type', 'text');
2890                jQuery(this).prev('.googleAddressbtn').removeClass('active');
2891                jQuery(this).addClass('active');
2892            }
2893            else
2894            {
2895                jQuery('.post-submit #inputAddress').slideUp();
2896                jQuery('.post-submit .googlefulladdress').slideUp(300);
2897                jQuery('.post-submit #inputAddresss').slideDown(300);
2898                jQuery('.lp-custom-lat').slideDown(300);
2899                jQuery('.post-submit #latitude').attr('type', 'text');
2900                jQuery('.post-submit #longitude').attr('type', 'text');
2901                jQuery(this).prev('.googleAddressbtn').removeClass('active');
2902                jQuery(this).addClass('active');
2903            }
2904        }
2905        e.preventDefault();        
2906    });
2907});
2908
2909
2910/* ======27 may mm=========== */
2911jQuery(document).ready(function($) {
2912    jQuery('#slide-nav.navbar-inverse').after(jQuery('<div class="inverse" id="navbar-height-col"></div>'));  
2913    jQuery('#slide-nav.navbar-default').after(jQuery('<div id="navbar-height-col"></div>'));  
2914    var toggler = '.navbar-toggle';
2915    var pagewrapper = '#page-content';
2916    var navigationwrapper = '.navbar-header';
2917    var menuwidth = '100%';
2918    var slidewidth = '80%';
2919    var menuneg = '-100%';
2920    var slideneg = '-80%';
2921    jQuery("#slide-nav").on("click", toggler, function (e) {
2922        var selected = $(this).hasClass('slide-active');
2923        jQuery('#slidemenu').stop().animate({
2924            left: selected ? menuneg : '0px'
2925        });
2926        jQuery('#navbar-height-col').stop().animate({
2927            left: selected ? slideneg : '0px'
2928        });
2929        jQuery(pagewrapper).stop().animate({
2930            left: selected ? '0px' : slidewidth
2931        });
2932        jQuery(navigationwrapper).stop().animate({
2933            left: selected ? '0px' : slidewidth
2934        });
2935        jQuery(this).toggleClass('slide-active', !selected);
2936        jQuery('#slidemenu').toggleClass('slide-active');
2937        jQuery('#page-content, .navbar, body, .navbar-header').toggleClass('slide-active');
2938    });
2939    var selected = '#slidemenu, #page-content, body, .navbar, .navbar-header';
2940    jQuery(window).on("resize", function () {
2941        if (jQuery(window).width() > 767 && $('.navbar-toggle').is(':hidden')) {
2942            jQuery(selected).removeClass('slide-active');
2943        }
2944    });
2945	
2946	jQuery('.lp_price_trigger_checkout input').on('click', function($){
2947		var taxEnable = jQuery(this).data('taxenable');
2948		plantitle = jQuery(this).data('title');
2949		planprice = jQuery(this).data('planprice');
2950		taxprice = '';
2951		totalprice = '';
2952		if(taxEnable=="1"){
2953			taxrate = jQuery('.lp_price_trigger_checkout input').data('taxrate');
2954			taxprice = (taxrate/100)*planprice;
2955			taxprice = taxprice.toFixed(2);
2956			jQuery('input[name="listings_tax_price"]').attr('value', taxprice);
2957			totalprice = parseFloat(planprice) + parseFloat(taxprice);
2958			totalprice = totalprice.toFixed(2);
2959			jQuery('span#lp_price_plan').text(plantitle);
2960			jQuery('span#lp_price_plan_price').text(planprice);
2961			jQuery('span#lp_tax_price').text(taxprice);
2962			jQuery('span#lp_price_subtotal').text(totalprice);
2963			jQuery('input#lp_paypal_price').val(totalprice);
2964			jQuery('.lp_section_inner .lp_billing_total').show(400);
2965		}
2966		else{
2967			totalprice = parseFloat(planprice);
2968			jQuery('span#lp_price_plan').text(plantitle);
2969			jQuery('span#lp_price_plan_price').text(planprice);
2970			jQuery('span#lp_price_subtotal').text(totalprice);
2971			jQuery('input#lp_paypal_price').val(totalprice);
2972		}
2973		
2974	});
2975	
2976	if(jQuery('form#register .check_policy').is('.termpolicy')){
2977		jQuery("input#lp_usr_reg_btn").prop('disabled',true);
2978		jQuery('.check_policy').on('click', function(){
2979			if(jQuery('#check_policy').is(':checked')){
2980				jQuery("input#lp_usr_reg_btn").prop('disabled',false);
2981			}
2982			else{
2983				jQuery("input#lp_usr_reg_btn").prop('disabled',true);
2984			}
2985		});
2986	}
2987	
2988	if(jQuery('.blue-section .check_policy').is('.termpolicy')){
2989		jQuery("#listingsubmitBTN").prop('disabled',true);
2990		jQuery("#listingsubmitBTN").addClass('dissablebutton');
2991		jQuery('.check_policy').on('click', function(){
2992			if(jQuery('#policycheck').is(':checked')){
2993				jQuery("#listingsubmitBTN").prop('disabled',false);
2994				jQuery("#listingsubmitBTN").removeClass('dissablebutton');
2995			}
2996			else{
2997				jQuery("#listingsubmitBTN").prop('disabled',true);
2998				jQuery("#listingsubmitBTN").addClass('dissablebutton');
2999			}
3000		});
3001	}
3002	if(jQuery('.white-section .check_policy').is('.termpolicy')){
3003		jQuery("#listingsubmitBTN").prop('disabled',true);
3004		jQuery("#listingsubmitBTN").addClass('dissablebutton');
3005		jQuery('.check_policy').on('click', function(){
3006			if(jQuery('#policycheck').is(':checked')){
3007				jQuery("#listingsubmitBTN").prop('disabled',false);
3008				jQuery("#listingsubmitBTN").removeClass('dissablebutton');
3009			}
3010			else{
3011				jQuery("#listingsubmitBTN").prop('disabled',true);
3012				jQuery("#listingsubmitBTN").addClass('dissablebutton');
3013			}
3014		});
3015	}
3016});
3017
3018jQuery( window ).ready(function() {
3019	
3020	if(jQuery('.header-container').hasClass('.lp-vedio-bg')){
3021		jQuery( '#lp_vedio' ).play();
3022	}	
3023	if(jQuery('input').is('.rating-tooltip')){
3024		
3025		jQuery('.rating-tooltip').rating({
3026		  extendSymbol: function (rate) {
3027			jQuery(this).tooltip({
3028			  container: 'body',
3029			  placement: 'bottom',
3030			  title: 'Rate ' + rate
3031			});
3032		  }
3033		});
3034	
3035	}
3036	
3037});
3038
3039jQuery(document).ready(function($){
3040	
3041	
3042	if(jQuery('.lp-home-banner-contianer').is('.lp-home-banner-with-loc')){
3043		
3044		var locType = jQuery('.lp_auto_loc_container h1,p.lp-app-view2-des').data('locnmethod'); 
3045		
3046		var currentlocationswitch = '1';
3047		var currentlocationswitch = jQuery('#page').data('lpcurrentloconhome');
3048		if( currentlocationswitch == "0" ){
3049			locType = 'locationifoff';
3050		}
3051		
3052		
3053		var apiType = jQuery('#page').data('ipapi');
3054		
3055		if(locType=="withip"){
3056			if(apiType==="geo_ip_db"){
3057				$.getJSON('https://geoip-db.com/json/geoip.php?jsonp=?') 
3058				 .done (function(location)
3059				 {
3060					 var locc = location.city;
3061					 if(locc == null){
3062						 
3063					 }else{
3064						 jQuery('.lp-dyn-city').text(location.city);
3065					 }
3066					
3067				 });
3068			}
3069			else if(apiType==="ip_api"){
3070				jQuery.get("https://ipapi.co/json", function(location) {
3071					var locc = location.city;
3072					 if(locc == null){
3073						 
3074					 }else{
3075						 jQuery('.lp-dyn-city').text(location.city);
3076					 }
3077				}, "json");
3078			}
3079			else{
3080				lpGetGpsLocName(function (lpgetcurrentcityvalue) {
3081					lpgpsclocation = lpgetcurrentcityvalue;
3082					jQuery('.lp-dyn-city').text(lpgpsclocation);
3083				});
3084			}
3085			
3086		}
3087		
3088	}
3089
3090
3091    if(jQuery('.lp-header-search-tagline').length != 0){
3092
3093
3094        var locType = jQuery('.lp_auto_loc_container .lp-header-search-tagline').data('locnmethod');
3095        var currentlocationswitch = '1';
3096        var currentlocationswitch = jQuery('#page').data('lpcurrentloconhome');
3097        if( currentlocationswitch == "0" ){
3098            locType = 'locationifoff';
3099        }
3100
3101
3102        var apiType = jQuery('#page').data('ipapi');
3103
3104        if(locType=="withip"){
3105            if(apiType==="geo_ip_db"){
3106                $.getJSON('https://geoip-db.com/json/geoip.php?jsonp=?')
3107                    .done (function(location)
3108                    {
3109                        var locc = location.city;
3110                        if(locc == null){
3111
3112                        }else{
3113                            jQuery('.lp-dyn-city').text(location.city);
3114                        }
3115
3116                    });
3117            }
3118            else if(apiType==="ip_api"){
3119                jQuery.get("https://ipapi.co/json", function(location) {
3120                    var locc = location.city;
3121                    if(locc == null){
3122
3123                    }else{
3124                        jQuery('.lp-dyn-city').text(location.city);
3125                    }
3126                }, "json");
3127            }
3128            else{
3129                lpGetGpsLocName(function (lpgetcurrentcityvalue) {
3130                    lpgpsclocation = lpgetcurrentcityvalue;
3131                    jQuery('.lp-dyn-city').text(lpgpsclocation);
3132                });
3133            }
3134
3135        }
3136
3137    }
3138
3139    // lp-header-search-tagline
3140	
3141});
3142function hexToRGB(hexStr) {
3143    var col = {};
3144    col.r = parseInt(hexStr.substr(1,2),16);
3145    col.g = parseInt(hexStr.substr(3,2),16);
3146    col.b = parseInt(hexStr.substr(5,2),16);
3147    return col;
3148}
3149
3150/* for recurring stripe */
3151jQuery(document).ready(function(){
3152	var plantype = '';
3153	var recurringtext = '';
3154	var recurringhtml = '';
3155	var $thislisting = '';
3156	var $thisplan = '';
3157	var $recurringon = '';
3158	$recurringon = jQuery('form#listings_checkout').data('recurring');
3159	if($recurringon==="yes"){
3160		jQuery('#listings_checkout input[type=radio]').on('change', function($){
3161			if( jQuery('#listings_checkout input[name=listing_id]').is(':checked') && jQuery('#listings_checkout input[name=plan]').is(':checked') ){
3162
3163				$thislisting = jQuery('#listings_checkout input[name=listing_id]:checked');
3164				$thisplan = jQuery('#listings_checkout input[name=plan]:checked').val();
3165				plantype = $thislisting.closest('.lp-user-listings').data('plantype');
3166				if(plantype==="Pay Per Listing"){
3167					
3168					recurringtext = $thislisting.closest('.lp-user-listings').data('recurringtext');
3169					recurringhtml = '<div class="checkbox"><input type="checkbox" id="listing-recurring-recurrsive" name="lp-recurring-option" value="yes"><label for="listing-recurring-recurrsive">'+recurringtext+'</label></div>';
3170						if($thisplan==="stripe"){
3171							jQuery('div.lp-recurring-button-wrap').html( recurringhtml );
3172						}
3173						else{
3174							jQuery('div.lp-recurring-button-wrap').html('');
3175						}
3176				}
3177				else{
3178					jQuery('div.lp-recurring-button-wrap').html('');
3179				}
3180			}
3181			else{
3182				jQuery('div.lp-recurring-button-wrap').html('');
3183			}
3184			
3185			
3186		});
3187	}
3188	
3189	/* for dynamic location */
3190	if (jQuery('input#cities').length) {
3191		jQuery('input#cities').cityAutocomplete();
3192	}
3193	if (jQuery('input#citiess').length) {
3194		jQuery('input#citiess').cityAutocomplete();
3195	}
3196
3197    jQuery(document).on('click','#citiess', function(e) {
3198        var target = e.target;
3199        if (!jQuery(target).is('.help') ) {
3200            if(jQuery('input#citiess').length){
3201                var isseleted = jQuery('input#citiess').data('isseleted');
3202                if(isseleted == false){
3203                    jQuery('input#citiess').val('');
3204                }
3205            }
3206        }
3207    });
3208	
3209	if (jQuery('input#citiess').length) {
3210		jQuery('#citiess').on('input', function(){
3211			jQuery(this).data('isseleted', false);
3212		});
3213	}
3214	
3215})
3216/* for recurring stripe */
3217jQuery(document).ready(function($){
3218	jQuery('#select-plan-form .select-plan-form input[name=plans-posts]').on('click', function(){
3219		jQuery("a.lp_change_plan_action").hide('');
3220		jQuery("div.lp-action-div form").hide('');
3221	});
3222});
3223
3224/* for range slider */
3225var nearmeunit = jQuery("#lp-find-near-me").data('nearmeunit');
3226if(jQuery('#distance_range').length != 0)
3227{
3228jQuery('#distance_range').bootstrapSlider({
3229    
3230    formatter: function(value) {
3231        return value+' ' + nearmeunit;
3232    },
3233    tooltip: 'always'
3234});
3235    
3236}
3237
3238/* for show click on div radius */
3239jQuery('li.lp-tooltip-outer').on('click', function(){
3240	var $this = jQuery(this);
3241	jQuery('.lp-tooltip-div').removeClass('active');
3242	$this.find('.lp-tooltip-div').addClass('active');
3243	
3244});
3245
3246/* for hide div on outer click to divs */
3247jQuery(document).mouseup(function(e) 
3248{
3249    var container = jQuery(".lp-tooltip-div");
3250    // if the target of the click isn't the container nor a descendant of the container
3251    if (!container.is(e.target) && container.has(e.target).length === 0) 
3252    {
3253        jQuery('.lp-tooltip-div').removeClass('active');
3254    }
3255	
3256	var containerr = jQuery(".lp-tooltip-div-hidden");
3257	if (!containerr.is(e.target) && containerr.has(e.target).length === 0) 
3258    {
3259        jQuery('.lp-tooltip-div-hidden').removeClass('active');
3260    }
3261	
3262	var foodmenucontainer = jQuery(".hotel-menu .inner-menu");
3263	if (!foodmenucontainer.is(e.target) && foodmenucontainer.has(e.target).length === 0) 
3264    {
3265		jQuery(".hotel-menu").fadeOut();
3266	}
3267	
3268	
3269});
3270
3271jQuery("li.lp-tooltip-outer").hover(function() {
3272    var $this = jQuery(this);
3273    jQuery('.lp-tooltip-div').removeClass('active');
3274    jQuery('.lp-tooltip-div-hidden').removeClass('active');
3275    $this.find('.lp-tooltip-div').addClass('active');
3276    if($this.find('a.near-me-btn, a.near-me-btn-style-3').hasClass('active')){
3277        jQuery('.lp-tooltip-div-hidden').addClass('active');
3278    }
3279});
3280
3281/* for first tab auto active on listing detail page style 2 */
3282jQuery(document).ready(function($) {
3283	jQuery('.lp-detail-page-template-3 #reply-title2 ul li').first().addClass('active');
3284	jQuery('.lp-detail-page-template-3 .detail-page2-tab-content .tab-pane').first().addClass('active');
3285	
3286	/* app view search dumm loader */
3287	jQuery(document).on('click', '.listing-app-view .app-view-filters .close', function(){
3288		
3289		var docHeight = jQuery( document ).height();
3290		jQuery( "body" ).prepend( '<div id="full-overlay"></div>' );
3291		jQuery('#full-overlay').css('height',docHeight+'px');
3292		jQuery('#full-overlay').addClass('content-loading');
3293		var timer = '';
3294		 function lpcloseloadnow(){
3295			jQuery('#full-overlay').remove();
3296			jQuery('#full-overlay').removeClass('content-loading');
3297			clearTimeout(timer);
3298		}
3299		timer = setTimeout(lpcloseloadnow, 2000);
3300        if (jQuery('div.promoted-listings div.app-view-new-ads-sli
3300der').length) {
3301            jQuery('div.app-view-new-ads-slider').slick({
3302                arrows: false,
3303            });
3304        }
3305        if (jQuery('div.promoted-listings div.app-view-new-ads-slider').length) {
3306            jQuery('div.app-view-new-ads-slider').slick({
3307                arrows: false,
3308            });
3309        }
3310	});
3311	
3312	/* multiselect for google location  */
3313	jQuery(document).on('click','.city-autocomplete .help', function(){
3314		var $thisSelected = jQuery(this).text();
3315		var $thisSelecteds = $thisSelected.split(",")[0];
3316		var $selectLocationData = '<div class="lpsinglelocselected '+$thisSelected+'">'+$thisSelected+'<i class="fa fa-times lp-removethisloc"></i><input type="hidden" name="location[]" value="'+$thisSelecteds+'"></div>';
3317		jQuery( $selectLocationData ).appendTo( ".lp-selected-locs" );
3318		
3319		if(jQuery('div').hasClass('lp-selected-locs')){
3320			jQuery("input#citiess").val('');
3321		}
3322		
3323	});
3324	
3325	jQuery(document).on('click','.lp-removethisloc', function(){
3326		jQuery(this).closest('.lpsinglelocselected').remove();
3327	});
3328	
3329	jQuery('.top-search-form .lp-search-btn-header .lp-search-btn').on('click', function(){
3330		var locvals=$.trim($("input#cities").val());
3331		if(locvals.length>0)
3332		{}else{
3333			jQuery('input[name="lp_s_loc"]').val('');
3334		}
3335	});
3336	
3337	
3338	/* when google location and user don't select the suggestions and hit enters */
3339	jQuery('input#cities').on('change', function(){
3340		jQuery('input[name=lp_s_loc]').val(jQuery(this).val());
3341	});
3342	
3343	jQuery(document).on('click', '.city-autocomplete .help', function(){
3344		$thisVal = jQuery(this).text();
3345		substrr = $thisVal.split(",")[0];
3346		jQuery('input[name=lp_s_loc]').val(substrr);
3347	})
3348
3349
3350
3351	/* overlay close on cross click */
3352	jQuery('.md-close.widget-map-click').on('click', function(e){
3353		jQuery('#full-overlay').css('height','0px');
3354	});
3355
3356	
3357});
3358
3359
3360function lpshowsidemap() {
3361		if(jQuery('#map').is('.mapSidebar')) {
3362			if( jQuery('.v2-map-load').length == 1 ){
3363                jQuery( "<div class='v2mapwrap'></div>" ).appendTo( jQuery( ".v2-map-load" ) );
3364                jQuery( ".v2-map-load .v2mapwrap" ).trigger('click');
3365			}
3366			jQuery( "<div class='sidemarpInside'></div>" ).appendTo( jQuery( ".sidemap-fixed" ) );
3367			jQuery( ".sidemap-fixed .sidemarpInside" ).trigger('click');
3368		}
3369}
3370if (window.attachEvent){
3371	window.attachEvent('onload', lpshowsidemap);
3372}
3373else if (window.addEventListener){
3374	window.addEventListener('load', lpshowsidemap, false);
3375}
3376else {
3377	document.addEventListener('load', lpshowsidemap, false);
3378} 
3379
3380/* for 1.2.7 */
3381jQuery(document).ready(function($){
3382	if(jQuery('form#registertmp .check_policyy').is('.termpolicy')){
3383		jQuery("input#lp-template-registerbtn").prop('disabled',true);
3384		jQuery('.check_policyy').on('click', function(){
3385			if(jQuery('#check_policyy').is(':checked')){
3386				jQuery("input#lp-template-registerbtn").prop('disabled',false);
3387			}
3388			else{
3389				jQuery("input#lp-template-registerbtn").prop('disabled',true);
3390			}
3391		});
3392	}
3393
3394    jQuery('.lp-qoute-butn a#freeQuoteForm').click(function (e) {
3395        e.preventDefault();
3396        jQuery('html, body').animate({
3397            scrollTop: jQuery('#freeQuoteFormWrap').offset().top
3398        }, 1000);
3399    });
3400	jQuery('.contact-right #contactMSGForm').submit(function(e){
3401		var uname = jQuery(this).find('input[name=uname]').val();
3402		var uemail = jQuery(this).find('input[name=uemail]').val();
3403		var umessage = jQuery(this).find('textarea[name=umessage]').val();
3404		
3405		if(uname ==''|| uname==null ){
3406			jQuery(this).find('input[name=uname]').addClass('lp-required-field');
3407			e.preventDefault();
3408		}
3409		
3410		
3411		if(uemail ==''|| uemail==null){
3412			jQuery(this).find('input[name=uemail]').addClass('lp-required-field');
3413			e.preventDefault();
3414		}
3415		
3416		if(lpisValidEmailAddress(uemail) ){
3417		}else{
3418			jQuery(this).find('input[name=uemail]').addClass('lp-required-field');
3419			e.preventDefault();
3420		}
3421		
3422		
3423		if(umessage ==''|| umessage==null ){
3424			jQuery(this).find('textarea[name=umessage]').addClass('lp-required-field');
3425			e.preventDefault();
3426		}
3427		
3428		
3429		
3430	});
3431	
3432
3433	jQuery("input#lp-featuredimage").change(function (){
3434       lp_change_curerntImgUrl(this);
3435     });
3436	 
3437	/* end preview image*/
3438
3439
3440    jQuery('.app-view-header .lp-search-toggle .user-menu i, .app-view-popup-style, .event-by-going-wrap .app-view-popup-style').click(function() {
3441        jQuery('#app-view-login-popup').fadeIn(function () {
3442            jQuery('#app-view-login-popup').css({
3443                'top': '20%',
3444                'transform': 'translateY(0%)',
3445                'opacity': 1,
3446                'overflow': 'visible'
3447            });
3448        });
3449    });
3450    jQuery('.style2-popup-login .md-close').click(function(e){
3451        jQuery('#app-view-login-popup').fadeOut(function () {
3452            jQuery('#app-view-login-popup').css({
3453                'opacity' : 1,
3454                'display' : 'none'
3455            });
3456        });
3457    });
3458
3459});
3460
3461/* preview image on listing edit change url of current image */
3462
3463function lp_change_curerntImgUrl(input) {
3464    if (input.files && input.files[0]) {
3465        jQuery('.submit_new_style-outer .lp-listing-featuredimage label').css({"max-width": "189px"});
3466        var reader = new FileReader();
3467
3468        reader.onload = function (e) {
3469            jQuery('.lpchangeinstantimg').attr('src', e.target.result);
3470            jQuery('.lpchangeinstantimg').css({"width": "63px", "height": "63px"});
3471        }
3472
3473        reader.readAsDataURL(input.files[0]);
3474    }
3475}
3476jQuery(window).scroll(function () {
3477    //if you hard code, then use console
3478    //.log to determine when you want the
3479    //nav bar to stick.
3480
3481    if (jQuery(window).scrollTop() > 790) {
3482        jQuery('.profile-sticky-bar').addClass('navbar-fixed');
3483        jQuery('.profile-sticky-bar').fadeIn(500);
3484    }
3485    if (jQuery(window).scrollTop() < 790) {
3486        jQuery('.profile-sticky-bar').removeClass('navbar-fixed');
3487        jQuery('.profile-sticky-bar').fadeOut(500);
3488    }
3489});
3490jQuery(document).on('click', '.stickynavbar ul li a', function(e)
3491{
3492    e.preventDefault();
3493    var targetID	=	jQuery(this).attr('href');
3494    jQuery('html,body').animate(
3495        {
3496            scrollTop: jQuery(targetID).offset().top - 125
3497        },
3498        500);
3499});
3500/* for email address */
3501function lpisValidEmailAddress(emailAddress) {
3502	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
3503	return pattern.test(emailAddress);
3504}
3505
3506/* for 1.2.15 */
3507jQuery(document).ready(function(){
3508	jQuery('#lp_delete_accountpopup input.lp_assign_data').on('click', function(){
3509		jQuery('.lp_delte_user_confirm').removeAttr("disabled")
3510	});
3511
3512    jQuery('.lp_privacy_policy_Wrap input.lpprivacycheckboxopt').on('click', function(){
3513        if (jQuery(this).closest('#claimform').hasClass('lp-form-planclaim-st')) {
3514            var claimuserlogin = false,
3515                ppolicy = false;
3516            if (jQuery('body').hasClass('logged-in')) {
3517                claimuserlogin = true;
3518            }
3519            if (jQuery('#claimform .lpprivacycheckboxopt').length > 0) {
3520                ppolicy = true;
3521            }
3522            claimformvalidation(claimuserlogin, ppolicy);
3523        } else {
3524            if (jQuery(this).is(':checked')) {
3525                jQuery(this).closest('form').find('input[type=submit]').removeAttr("disabled");
3526            } else {
3527                jQuery(this).closest('form').find('input[type=submit]').attr("disabled", "disabled");
3528            }
3529        }
3530    });
3531	
3532	
3533	
3534});
3535/* end for 1.2.15 */
3536
3537
3538/* for version 2.0 */
3539
3540jQuery(document).ready(function(){
3541
3542    /* for claim submit checkout form  */
3543    jQuery('#claim_payment_checkout').on('submit', function(e) {
3544        var $this = jQuery(this);
3545        claimerID = $this.find('input[name=claimerID]').val();
3546        claimPost = $this.find('input[name=claimPost]').val();
3547        claimPrice = $this.find('input[name=claimPrice]').val();
3548        currency = $this.find('input[name=currency]').val();
3549        claimPrice = parseFloat(claimPrice) * 100;
3550        claimPrice = parseFloat(claimPrice).toFixed();
3551        handler.open({
3552            name: "For Claim",
3553            description: "",
3554            zipCode: true,
3555            amount: claimPrice,
3556            currency: currency,
3557        });
3558        e.preventDefault();
3559    })
3560
3561});
3562
3563
3564/* FOR ADDITIONAL FILTER */
3565/*-------------------------------------------------------------------------------------------------*/
3566
3567// More Filter Tooltip
3568
3569jQuery(document).ready(function() {
3570
3571
3572    jQuery('.lp_add_more_filter a').on('mouseover', function(){
3573
3574        jQuery('.lp_more_filter_tooltip_outer').css("visibility","visible");
3575
3576    });
3577
3578    jQuery('.lp_add_more_filter a').on('mouseout', function(){
3579
3580        jQuery('.lp_more_filter_tooltip_outer').css("visibility","hidden");
3581
3582    });
3583
3584});
3585
3586
3587
3588// More Filter Button click and over lay on map
3589
3590jQuery(document).ready(function(){
3591
3592    jQuery('.lp_add_more_filter a').click( function(e) {
3593        e.preventDefault();
3594        e.stopPropagation();
3595
3596        jQuery('.outer_all_page_overflow').toggle();
3597
3598        // Map over lay display block
3599        if(jQuery('.overlay_on_map_for_filter').is(':hidden')){
3600
3601            jQuery('.overlay_on_map_for_filter').css('display','block');
3602        }else{
3603
3604            jQuery('.overlay_on_map_for_filter').css('display','none');
3605        }
3606
3607    });
3608
3609    jQuery('.outer_all_page_overflow').click( function(e) {
3610        //e.stopPropagation();
3611    });
3612
3613    // Hide on click out side div
3614    jQuery('body').click( function() {
3615        //jQuery('.outer_all_page_overflow').hide();
3616        // Map over lay display none
3617        jQuery('.overlay_on_map_for_filter').css('display','none');
3618    });    
3619    
3620    jQuery('#filter_cancel_all').on('click', function() {
3621		 jQuery('.outer_all_page_overflow').slideUp();
3622		 jQuery('.overlay_on_map_for_filter').css('display','none');
3623		// Map overlay display none
3624		
3625	});
3626
3627});
3628
3629jQuery(document).on('click', '#filter_cancel_all', function() {
3630	 jQuery('.outer_all_page_overflow').slideUp();
3631	 jQuery('.overlay_on_map_for_filter').css('display','none');
3632	 jQuery('.outer_all_page_overflow').hide(500);
3633	// Map overlay display none
3634	
3635});
3636
3637
3638
3639
3640/* **************************For payment checkout script******************************* */
3641
3642jQuery(document).ready(function(){
3643    jQuery('#listings_checkout_form input[name=listing_id]').click(function(){
3644        if( jQuery('#listings_checkout_form input[name=listing_id]').is(':checked') ){
3645            if( jQuery('#listings_checkout_form input[name=plan]').is(':checked') ){
3646                //both are checked
3647                jQuery('.lp_payment_step_next.firstStep').addClass('active');
3648				lp_make_checkout_step_active('firstStep');
3649                jQuery('.lp_payment_step_next.firstStep').prop('disabled', false);
3650            }else{
3651                jQuery('.lp-checkout-steps .firstStep').removeClass('current');
3652                jQuery('.lp_payment_step_next.firstStep').removeClass('active');
3653                jQuery('.lp_payment_step_next.firstStep').prop('disabled', true);
3654            }
3655        }
3656
3657    });
3658
3659
3660    jQuery('#listings_checkout_form input[name=plan]').click(function(){
3661        if( jQuery('#listings_checkout_form input[name=plan]').is(':checked') ){
3662            jQuery('input[name=method]').val(jQuery(this).val());
3663            if( jQuery('#listings_checkout_form input[name=listing_id]').is(':checked') ){
3664                //both are checked
3665				jQuery('.lp_payment_step_next.firstStep').addClass('active');
3666				lp_make_checkout_step_active('firstStep');
3667                jQuery('.lp_payment_step_next.firstStep').prop('disabled', false);
3668            }else{
3669                jQuery('.lp-checkout-steps .firstStep').removeClass('current');
3670                jQuery('.lp_payment_step_next.firstStep').removeClass('active');
3671                jQuery('.lp_payment_step_next.firstStep').prop('disabled', true);
3672            }
3673        }
3674    });
3675
3676
3677    // add class for change border and background color lisitng section.
3678    jQuery('.lp-user-listings .radio-danger').click(function() {
3679        $this = jQuery(this);
3680        jQuery('.lp-user-listings').removeClass('active-checkout-listing');
3681        $this.closest('.lp-user-listings').addClass('active-checkout-listing');
3682    });
3683	
3684	/* first step */
3685    jQuery(document).on('click', 'button.firstStep', function(){
3686    	if(jQuery('.inactive-payment-mode').length) {
3687		    jQuery('.inactive-payment-mode').hide();
3688		}
3689        jQuery('#listings_checkout_form input[name=listing_id]').not(':checked').closest('.lp-user-listings').css('display', 'none');
3690        jQuery('#listings_checkout_form input[name=plan]').not(':checked').closest('.lp-method-wrap').css('display', 'none');
3691        lp_show_mini_subtotal();
3692        //update values in hidden fields
3693		lp_reset_mincart_checkout_form_data();
3694        //display block selected lisiting details.
3695        lp_show_recurring_switch();
3696        // display terms and conditions
3697        jQuery('.lp-new-term-style').css('display', 'block');
3698		jQuery('button.lp_payment_step_next.secondStep').css("display", "block");
3699		jQuery(this).addClass('secondStep');
3700		jQuery(this).removeClass('firstStep');
3701		if (jQuery(".terms-checkbox-container input[type=checkbox]").length){
3702			jQuery('.lp_payment_step_next.secondStep').prop('disabled', true);
3703		}else{
3704			lp_make_checkout_step_active('secondStep');
3705		}
3706		
3707		
3708
3709    });
3710	
3711	/* checkbox of terms and conditions */
3712    jQuery(".terms-checkbox-container input[type=checkbox]").on('click', function(){
3713        if(jQuery(this).is(':checked')) {
3714            jQuery('.lp_payment_step_next.secondStep').prop('disabled', false);
3715            lp_make_checkout_step_active('secondStep');
3716            var urloftermcond = jQuery(".lpcheckouttac").attr('href');
3717            //window.open(urloftermcond, '_blank');
3718        }else{
3719            jQuery('.lp_payment_step_next.secondStep').prop('disabled', true);
3720            lp_make_checkout_step_passive('secondStep');
3721        }
3722    });
3723	/* second step */
3724    jQuery(document).on('click','button.lp_payment_step_next.secondStep', function(){
3725        jQuery('.lp-checkout-steps .firstStep').addClass('completed');
3726        jQuery('button.lp_payment_step_next.thirdStep').css("display", "block");
3727        jQuery(this).addClass('thirdStep');
3728        jQuery(this).removeClass('secondStep');
3729        $planprice = jQuery('input[name=plan_price]').val();
3730
3731        if(jQuery('input[name="lp-recurring-option"]').is(':checked')) {
3732            jQuery(this).prop("type", "submit");
3733		} else {
3734            if (parseFloat($planprice) == 0) {
3735                /* price zero or 100% discount */
3736                $listings_id = jQuery('input[name=listings_id]').val();
3737                lp_make_this_listing_publish_withdiscount($listings_id);
3738            }else{
3739                jQuery(this).prop("type", "submit");
3740            }
3741		}
3742    });
3743
3744	/* third step */
3745    jQuery(document).on('click', 'button.lp_payment_step_next.thirdStep', function(){
3746        jQuery('.lp-checkout-steps .secondStep').addClass('completed');
3747    });
3748
3749
3750    // script on click to open print section print specific div
3751    jQuery('#print-section-receipt').click(function(){
3752
3753        var printContents = document.getElementById('printarea').innerHTML;
3754        var originalContents = document.body.innerHTML;
3755        document.body.innerHTML = printContents;
3756        window.print();
3757        document.body.innerHTML = originalContents;
3758        location.reload();
3759
3760    });
3761
3762    /* script for coupon switch on checkout page*/
3763    jQuery('input[name=lp_checkbox_coupon]').on('click', function(){
3764        jQuery(this).toggleClass('active');
3765        if(jQuery(this).hasClass('active')){
3766            lp_make_couponsfields_active();
3767        }else{
3768            lp_make_couponsfields_passive();
3769			/* reset the minicart and checkout form data */
3770			lp_reset_mincart_checkout_form_data();
3771			 jQuery('li.checkout_discount_val').remove();
3772        }
3773    });
3774	
3775	
3776	
3777	
3778	
3779	
3780	
3781
3782    /* script for notification div */
3783    var $currHeight = jQuery(window).height();
3784    var $currDivHeight = jQuery('.lp_notification_wrapper').height();
3785    $currHeight =  $currHeight - $currDivHeight;
3786    var $currHeight = $currHeight+'px';
3787    jQuery('.lp_notification_wrapper').css({"top":$currHeight});
3788
3789    /* script for on resize */
3790    jQuery( window ).resize(function() {
3791        var $currHeight = jQuery(window).height();
3792        var $currDivHeight = jQuery('.lp_notification_wrapper').height();
3793        $currHeight =  $currHeight - $currDivHeight;
3794        var $currHeight = $currHeight+'px';
3795        jQuery('.lp_notification_wrapper').css({"top":$currHeight});
3796    });
3797    /* cancel notice */
3798    
3799	
3800	/* new dashborad menu */
3801	jQuery("#menu-toggle").click(function(e) {
3802            e.preventDefault();
3803            if(jQuery(window).width() > 767){
3804            jQuery("#wrapper").toggleClass("active");
3805            }
3806    });
3807
3808	jQuery('p#reply-title').on('click', function(event) {
3809		event.preventDefault();
3810		var thiss = jQuery(this);
3811		if (thiss.hasClass('active')) {
3812			jQuery(this).removeClass('active');
3813			jQuery(this).next('#lp-ad-click-inner').slideUp();
3814			jQuery(this).next('#lp-ad-click-innerm').slideUp();
3815		}else{
3816			jQuery(this).addClass('active');
3817			jQuery(this).next('#lp-ad-click-inner').slideDown();
3818			jQuery(this).next('#lp-ad-click-innerm').slideDown();
3819		};
3820		//jQuery(this).next('#rewies_form').toggleClass('open_review_form');
3821	});
3822	var TargetHeight	=	jQuery('.lp-inbox-outer').height();
3823	//jQuery('.user-recent-listings-inner .padding-0:last').height(TargetHeight+'px');
3824	jQuery('.user-recent-listings-inner .padding-0:first').height(TargetHeight+'px');
3825	var TargetHeight	=	jQuery('.lp-left-panel-height').height(),
3826	TargetHeight		=	TargetHeight+100;
3827	
3828	
3829	/* for header search new*/
3830	jQuery('#click-search-view').on('click', function(){
3831		$this = jQuery(this);
3832		jQuery('.lp-search-section-header-view').toggleClass('active-section-header-view');
3833    });
3834	
3835
3836	/* see more and see less activiey on user dashboard */
3837	jQuery('button.lp_see_more_activities').on('click', function(){
3838		$this = jQuery(this);
3839		$thisval = $this.text();
3840		$thisReplace = $this.data('replacetext');
3841		$this.toggleClass('active');
3842		jQuery('div.lp_hid_this_activity').slideToggle();
3843		$this.text($thisReplace);
3844		$this.data('replacetext', $thisval);
3845	});
3846	
3847	/* invoices preview */
3848    var foldSettings = {
3849        easing: 'linear',
3850        duration: 1000,
3851        size: 5,
3852        horizFirst: false,
3853        /* complete: function () {
3854            $(this).toggleClass("active");
3855        } */
3856    }
3857    jQuery('a.lp_preview_this_invoice, .lp_right_preview_this_invoice').on('click', function(e){
3858        var $this = jQuery(this);
3859        $inoviceno = $this.closest('.lp-listing-outer-container').data('inoviceno');
3860        $date = $this.closest('.lp-listing-outer-container').data('date');
3861        $amount = $this.closest('.lp-listing-outer-container').data('amount');
3862        $amountOnly = $this.closest('.lp-listing-outer-container').data('orprice');
3863        $tax = $this.closest('.lp-listing-outer-container').data('tax');
3864        $method = $this.closest('.lp-listing-outer-container').data('method');
3865        $plan = $this.closest('.lp-listing-outer-container').data('plan');
3866        $duration = $this.closest('.lp-listing-outer-container').data('duration');
3867        $status = $this.closest('.lp-listing-outer-container').data('status');
3868		$listTitle = $this.closest('.lp-listing-outer-container').data('listtitle');
3869        $fullAmount=$amount;
3870        if($this.hasClass('lp_preview_this_invoice')){
3871            jQuery('div.lp_popup_preview_invoice .lppopinvoice').text($inoviceno);
3872            jQuery('div.lp_popup_preview_invoice .lppopdate').text($date);
3873            jQuery('div.lp_popup_preview_invoice .lppopsubamount').text($amount);
3874            jQuery('div.lp_popup_preview_invoice .lppopamount').text($amount);
3875            jQuery('div.lp_popup_preview_invoice .lppoptaxprice').text($tax);
3876            jQuery('div.lp_popup_preview_invoice .lppopplanprice').text($amountOnly);
3877			jQuery('div.lp_popup_preview_invoice .lppoplist').text($listTitle);
3878
3879            jQuery('#lpinvoiceforpdf .lppopinvoice').text($inoviceno);
3880            jQuery('#lpinvoiceforpdf .lppopdate').text($date);
3881            jQuery('#lpinvoiceforpdf .lppopamount').text($amount);
3882			jQuery('#lpinvoiceforpdf .lllistname').text($listTitle);
3883
3884            jQuery('#lpinvoiceforpdf .lppopamountqqq').text($tax);
3885            jQuery('#lpinvoiceforpdf .lppopamountwww').text($fullAmount);
3886
3887            if($method=="wire"){
3888                $imgSrc = jQuery('p.lp-pay-with img').data('srcwire');
3889                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3890            }else if($method=="stripe"){
3891                $imgSrc = jQuery('p.lp-pay-with img').data('srcstripe');
3892                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3893            }else if($method=="paypal"){
3894                $imgSrc = jQuery('p.lp-pay-with img').data('srcpaypal');
3895                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3896            }else if($method == 'paystack') {
3897             	$imgSrc = jQuery('p.lp-pay-with img').data('srcpaystack');
3898            	jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3899			}else if($method == 'razorpay') {
3900			    $imgSrc = jQuery('p.lp-pay-with img').data('srcrazorpay');
3901			    jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3902            }else if($method == 'payfast') {
3903                $imgSrc = jQuery('p.lp-pay-with img').data('srcpayfast');
3904                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3905			}
3906            jQuery('div.lp_popup_preview_invoice .lppopmethod').text($method);
3907            jQuery('div.lp_popup_preview_invoice .lppopplan').text($plan);
3908            jQuery('div.lp_popup_preview_invoice .lppopduration').text($duration);
3909
3910            jQuery('#lpinvoiceforpdf .lppopmethod').text($method);
3911            jQuery('#lpinvoiceforpdf .lppopplan').text($plan);
3912            jQuery('#lpinvoiceforpdf .lppopduration').text($duration);
3913
3914
3915            jQuery( "div.lp_popup_preview_invoice" ).toggle( "fold", foldSettings );
3916            $this.closest('.lp-listing-outer-container').find('.lp_right_preview_this_invoice input').prop('checked', true);
3917            e.preventDefault();
3918        }
3919        if($this.hasClass('lp_right_preview_this_invoice') || $this.hasClass('lp_preview_this_invoice')){
3920            jQuery('div.lp_right_preview_invoice .lppopinvoice').text($inoviceno);
3921            jQuery('div.lp_right_preview_invoice .lppopdate').text($date);
3922            jQuery('div.lp_right_preview_invoice .lppopamount').text($amount);
3923            jQuery('div.lp_right_preview_invoice .lppopplanprice').text($amountOnly);
3924            jQuery('div.lp_right_preview_invoice .lppoptaxprice').text($tax);
3925            jQuery('div.lp_right_preview_invoice .lppopmethod').text($method);
3926            jQuery('div.lp_right_preview_invoice .lppopplan').text($plan);
3927            jQuery('div.lp_right_preview_invoice .lppopduration').text($duration);
3928            jQuery('div.lp_right_preview_invoice .lppopstatus').text($status);
3929
3930
3931            jQuery('#lpinvoiceforpdf .lppopinvoice').text($inoviceno);
3932            jQuery('#lpinvoiceforpdf .lppopdate').text($date);
3933            jQuery('#lpinvoiceforpdf .lppopamount').text($amountOnly);
3934
3935
3936            jQuery('#lpinvoiceforpdf .lppopmethod').text($method);
3937            jQuery('#lpinvoiceforpdf .lppopplan').text($plan);
3938            jQuery('#lpinvoiceforpdf .lppopduration').text($duration);
3939
3940        }
3941
3942        //e.preventDefault();
3943    });
3944	
3945	/* close invoices preview */
3946	jQuery(document).on('click', '.close_invoice_prev', function(e){
3947		$this = jQuery(this);
3948		jQuery( "div.lp_popup_preview_invoice" ).toggle( "fold", foldSettings );
3949		e.preventDefault();
3950	});
3951
3952
3953    jQuery('button.lp-cancle-btn').on('click', function(e){
3954        e.preventDefault();
3955        jQuery('.lp-ad-step-two').fadeOut( function () {
3956            jQuery('.lp_camp_invoice_wrp').fadeIn();
3957        });
3958    });
3959
3960
3961    /* show preview of currnt ad place */
3962	jQuery('input[name="lpadsoftype[]"]').on('click', function(){
3963        $this = jQuery(this);
3964        adsduration_pd = '';
3965        lp_make_campaign_paybutton_active();
3966        $newprice = 0;
3967		$campType = lp_get_camp_type();
3968		if($campType=='adsperduration'){
3969			lp_set_camp_duration_price_in_preview(jQuery('input[name=adsduration_pd]').val());
3970			
3971		}else if($campType=='adsperclick'){
3972			lp_set_camp_budget_price_in_preview(jQuery('input[name=adsprice_pc]').val());
3973		}
3974		
3975        if($this.is(":checked")){
3976           
3977			
3978
3979            if($this.val()=="lp_random_ads"){
3980                jQuery('.lp-invoices-all-stats li.spotlight span i.fa-check-circle').removeClass('lp-gray-this-ccircle');
3981				jQuery('.lpcampain-spotlight .greencheck').removeClass('graycheck');
3982            }
3983            if($this.val()=="lp_top_in_search_page_ads"){
3984                jQuery('.lp-invoices-all-stats li.searchpage span i.fa-check-circle').removeClass('lp-gray-this-ccircle');
3985				jQuery('.lpcampain-topsearch .greencheck').removeClass('graycheck');
3986            }
3987            if($this.val()=="lp_detail_page_ads"){
3988                jQuery('.lp-invoices-all-stats li.detailpage span i.fa-check-circle').removeClass('lp-gray-this-ccircle');
3989				jQuery('.lpcampain-sidebar .greencheck').removeClass('graycheck');
3990            }
3991
3992        }else{
3993            
3994
3995            if($this.val()=="lp_random_ads"){
3996                jQuery('.lp-invoices-all-stats li.spotlight span i.fa-check-circle').addClass('lp-gray-this-ccircle');
3997				jQuery('.lpcampain-spotlight .greencheck').addClass('graycheck');
3998            }
3999            if($this.val()=="lp_top_in_search_page_ads"){
4000                jQuery('.lp-invoices-all-stats li.searchpage span i.fa-check-circle').addClass('lp-gray-this-ccircle');
4001				jQuery('.lpcampain-topsearch .greencheck').addClass('graycheck');
4002            }
4003            if($this.val()=="lp_detail_page_ads"){
4004                jQuery('.lp-invoices-all-stats li.detailpage span i.fa-check-circle').addClass('lp-gray-this-ccircle');
4005				jQuery('.lpcampain-sidebar .greencheck').addClass('graycheck');
4006            }
4007
4008        }
4009
4010
4011
4012    });
4013
4014    /* on type in days */
4015   jQuery(document).on('input',"input[name=adsduration_pd]", function(){
4016       jQuery(this).val(jQuery(this).val().replace(/[^\d].+/, ""));
4017        $thisval = jQuery(this).val();
4018		lp_set_camp_duration_price_in_preview($thisval);
4019		lp_make_campaign_paybutton_active();
4020		
4021		
4022    });
4023
4024    jQuery(document).on('click',".lp-view-all-btn", function(){
4025		location.reload();
4026    });
4027
4028
4029    /* exit preview */
4030    jQuery('button.lp-exist-preview').on('click',function(){
4031        jQuery('.lp_campaign_preview').hide(300);
4032        jQuery('.lp_selected_active_ad').hide(300);
4033        jQuery('.lp_campaign_invoice_pmethod').show(300);
4034    });
4035
4036    /* click on pay now btn */
4037    jQuery('button.lp_campaign_paynow').on('click', function(){
4038        //jQuery(this).attr('type', 'submit');
4039        jQuery('.lp_campaign_preview').hide(300);
4040        //jQuery('.lp_selected_active_ad').show(300);
4041        jQuery('.lp_campaign_invoice_pmethod').show(300);
4042        jQuery(this).addClass('startpayforcampaignsss');
4043    });
4044    
4045	 /* campaign popup code ends */
4046	 
4047	 
4048	
4049	/* on type on ads price input */
4050    jQuery("input[name=adsprice_pc]").keyup(function(){
4051        $thisval = jQuery(this).val();
4052		lp_set_camp_budget_price_in_preview($thisval);
4053		lp_make_campaign_paybutton_active();
4054		
4055    });
4056	
4057	jQuery("input[name=adsduration_pd]").keyup(function(){
4058        lp_make_campaign_paybutton_active();
4059    });
4060	
4061	
4062    jQuery('.lp-search-listing-camp').on('change', function () {
4063        lp_make_campaign_paybutton_active();
4064    });
4065	
4066    jQuery('.lpadspreview').on('click', function () {
4067        packeg = '';
4068        jQuery('.lploading').fadeIn();
4069       clicks =  jQuery(this).attr('data-clicks');
4070       mode =  jQuery(this).attr('data-mode');
4071       budget =  jQuery(this).attr('data-budget');
4072       credit =  jQuery(this).attr('data-credit');
4073       duration =  jQuery(this).attr('data-duration');
4074       method =  jQuery(this).attr('data-method');
4075       currency =  jQuery(this).attr('data-currency');
4076       transid =  jQuery(this).attr('data-transid');
4077       packeg =  jQuery(this).attr('data-packeg0');
4078       packeg1 =  jQuery(this).attr('data-packeg1');
4079       if(packeg1){
4080          packeg += packeg1; 
4081        } 
4082       packeg2 =  jQuery(this).attr('data-packeg2');
4083        if(packeg2){
4084          packeg += packeg2; 
4085        }         
4086        if(mode == 'perclick'){
4087            jQuery('#lp-ad-click-inner').show();
4088            jQuery('.adsremaining').html(credit);
4089            jQuery('#lp-ad-click-inner').find('.lp-total-clicks-inner').find('h4').text(clicks);
4090           }else{
4091             jQuery('#lp-ad-click-inner').hide();
4092              jQuery('.adsremaining').html(duration);
4093        }
4094       
4095       jQuery('.lp-ad-all-attached-packages').html(packeg);
4096       jQuery('.lp-ad-payment-price').html(budget);
4097       jQuery('.lp-ad-payment-method').html(method);
4098       jQuery('.adstransid').html(transid);
4099       
4100       jQuery('.lploading').fadeOut();
4101        
4102       
4103    });
4104
4105});
4106
4107
4108jQuery(document).ready(function() {
4109    jQuery('.lp-claim-plan-btn').click(function() {
4110		$sPlanID = jQuery('input[name=plan_id]:checked').val();
4111		jQuery('input[name=lp_claimed_plan]').val($sPlanID);
4112        jQuery('.lp-claim-plan-container').addClass('active');
4113        jQuery('.lp-claim-plans').addClass('active');
4114    });
4115});
4116
4117jQuery(document).ready(function() {
4118   jQuery('.lp-confi-bottom-bar').click(function() {
4119       jQuery('.lp_confirmation').slideToggle(700);
4120       jQuery('.unhidebar-section').slideToggle(700);
4121   });
4122
4123   jQuery('.unhidebar-section').click(function() {
4124       jQuery('.lp_confirmation').slideToggle(700);
4125       jQuery('.unhidebar-section').slideToggle(700);
4126   });
4127   // dashboard search bar click to show
4128   jQuery('.lp-filter-search-listing').click(function() {
4129       jQuery('.lp-dash-search-stats-inner').slideToggle(400);
4130   });
4131});
4132
4133// remove class dashboard menu width less then 768
4134jQuery(window).resize(function(){
4135	if(jQuery(window).width()<768){
4136	 jQuery('.lp-dashboard-new').removeClass('active');
4137	}
4138});
4139/* aq on 31-7 */
4140
4141/*----------------lead form customizer---*/
4142jQuery(document).ready(function () {
4143	/*-------Lead form success area remove------*/
4144	jQuery('.lp-cross-suces-layout').click(function() {
4145        jQuery('.lp-lead-success-msg-outer').fadeOut('700');
4146    });
4147	
4148    //lead form label color change on radio checked and unchecked
4149    jQuery('.lp-lead-radio-container input[type=radio]').click(function () {
4150        jQuery('.lp-lead-radio-container input[type=radio]:not(:checked)').parent().removeClass("active-radio");
4151        jQuery('.lp-lead-radio-container input[type=radio]:checked').parent().addClass("active-radio");
4152    });
4153    //lead form label color change on checkbox checked and unchecked
4154    jQuery('.lp-lead-check-container input[type=checkbox]').click(function () {
4155        jQuery('.lp-lead-check-container input[type=checkbox]:not(:checked)').parent().removeClass("active-checkbox");
4156        jQuery('.lp-lead-check-container input[type=checkbox]:checked').parent().addClass("active-checkbox");
4157    });  
4158    // range slide color fill on move
4159    jQuery('input[type="range"].lp-range-slide').change(function () {
4160    var val = (jQuery(this).val() - jQuery(this).attr('min')) / (jQuery(this).attr('max') - jQuery(this).attr('min'));
4161    jQuery(this).css('background-image',
4162                '-webkit-gradient(linear, left top, right top, '
4163                + 'color-stop(' + val + ', #b3c0ce), '
4164                + 'color-stop(' + val + ', #eef2f4)'
4165                + ')'
4166                );
4167    }); 
4168    // time picker
4169	if( jQuery('.datetimepicker1').length != 0 )
4170	{
4171		var timeFormat	=	'LT';
4172		if( jQuery('#wp-timeformat').val() == 'H:i' )
4173		{
4174			timeFormat	=	'HH:mm';
4175		}
4176
4177        jQuery('.datetimepicker1').datetimepicker({
4178            format: timeFormat,
4179        });
4180	}
4181
4182    // calender picker
4183	if( jQuery('.datetimepicker2').length != 0 )
4184	{
4185        jQuery('.datetimepicker2').datetimepicker({
4186            format: 'L'
4187        });
4188	}
4189
4190    // calender and time picker
4191	if( jQuery('.datetimepicker3').length != 0 )
4192	{
4193        jQuery('.datetimepicker3').datetimepicker();
4194	}
4195
4196});
4197/* on 4auguest by z */
4198jQuery(document).ready(function(){
4199    jQuery('#listings_checkout_form').on('submit', function(e){
4200        var $this = jQuery(this);
4201        var method = $this.find('input[name="plan"]:checked').val();
4202        if(method === 'paypal'){
4203            if(  jQuery('input[name="lp-recurring-option"]:checked').length > 0 && jQuery('input[name="plan_time"]').val() == '' ){
4204                alert('Sorry! A plan should have a duration for recurring payment');
4205                return false;
4206            }
4207        }
4208    });
4209
4210    /* for checkout stripe and 2checkout */
4211    jQuery('#listings_checkout_form').on('submit', function(e){
4212        var $this = jQuery(this);
4213
4214        method = $this.find('input[name="plan"]:checked').val();
4215        listing_id = $this.find('input[name="listing_id"]:checked').val();
4216        post_title = $this.find('input[name="listing_id"]:checked').data('title');
4217        errormsg = jQuery('input[name="errormsg"]').val();
4218        plan_price = jQuery('span.lp-subtotal-total-price').data('subtotal');
4219        currency = jQuery('input[name=currency]').val();
4220        if(method==='stripe'){
4221            if(  jQuery('input[name="lp-recurring-option"]:checked').length > 0 && jQuery('input[name="plan_time"]').val() == '' ){
4222                alert('Sorry! A plan should have a duration for recurring payment');
4223                return false;
4224            }else{
4225                plan_price = plan_price*100;
4226                //jQuery('#stripe-submit').trigger( "click" );
4227                handler.open({
4228                    name: post_title,
4229                    description: "",
4230                    zipCode: true,
4231                    amount: plan_price,
4232                    currency: currency,
4233                });
4234                e.preventDefault();
4235            }
4236        }
4237        else if(method==='2checkout'){
4238            plan_price = jQuery('span.lp-subtotal-total-price').data('subtotal');
4239            listing_id = $this.find('input[name="listing_id"]:checked').val();
4240            jQuery('#myCCForm input#tprice').val(plan_price);
4241            jQuery('#myCCForm input#listing_id').val(listing_id);
4242            jQuery("button.lp-2checkout-modal").trigger('click');
4243            e.preventDefault();
4244        }
4245
4246    });
4247
4248 jQuery('.lp_payment_methods_ads .lp-payement-images').on('click', function(e){
4249
4250        $this = jQuery(this);
4251		lp_make_campaign_paybutton_active();
4252
4253    });
4254
4255    jQuery('button.lp-add-new-btn').on('click', function(){
4256        jQuery('.lp_camp_invoice_wrp').fadeOut(function () {
4257            jQuery('.lp-ad-step-two').fadeIn();
4258        });
4259    });
4260    
4261    jQuery('a.lp-all-camp-bck').on('click', function(e){
4262		jQuery('.lp-ad-step-two').hide(300);
4263        jQuery('.lp_camp_invoice_wrp').show(300);
4264		e.preventDefault();
4265    });
4266
4267});
4268/* on 4auguest by z ends */
4269/* ends here */
4270/* =====================for mini sub-total================== */
4271function lp_show_mini_subtotal(){
4272
4273    var $tax =jQuery('#listings_checkout_form input[name=listing_id]:checked').data('taxenable');
4274    var $taxRate = jQuery('#listings_checkout_form input[name=listing_id]:checked').data('taxrate');
4275    var $method = jQuery('#listings_checkout_form input[name=plan]:checked').val();
4276    var $price = jQuery('#listings_checkout_form input[name=listing_id]:checked').data('planprice');
4277    var $orgPrice = $price;
4278    var $orgPrice = parseFloat($orgPrice).toFixed(2);
4279    var $planID = jQuery('#listings_checkout_form input[name=listing_id]:checked').data('planid');
4280    var $planTime = jQuery('#listings_checkout_form input[name=listing_id]:checked').data('plantime');
4281    var $listingID = jQuery('#listings_checkout_form input[name=listing_id]:checked').val();
4282    var $lpRecurring = jQuery('#listings_checkout_form .lp-onoff-switch-checkbox .switch-checkbox-label .switch-checkbox-label input:checked').val();
4283    var $taxPrice = '';
4284    var $currencyPos = jQuery('#listings_checkout_form').data('currencypos');
4285    var $currencySym = jQuery('#listings_checkout_form').data('currencysymbol');
4286    if($tax=="1"){
4287        $taxPrice = ($taxRate/100)*$price;
4288        $price = parseFloat($price) + parseFloat($taxPrice);
4289
4290        $taxPrice = parseFloat($taxPrice).toFixed(2);
4291    }
4292    $price = parseFloat($price).toFixed(2);
4293    jQuery('span.lp-subtotal-plan').text('');
4294    jQuery('span.lp-subtotal-price').text('');
4295    jQuery('span.lp-subtotal-taxamount').text('');
4296    jQuery('span.lp-subtotal-price').text('');
4297    jQuery('span.lp-subtotal-p-price').text('');
4298    jQuery('span.lp-subtotal-total-price').text('');
4299    jQuery('span.lp-subtotal-plan').text(jQuery('#listings_checkout_form input[name=listing_id]:checked').data('title'));
4300    //setting values in form
4301    lp_add_checkout_data_fields($listingID, $planID, $price, $lpRecurring, $method, $planTime);
4302    switch($currencyPos){
4303        case('left'):
4304            jQuery('span.lp-subtotal-p-price').text($currencySym+$orgPrice);
4305            jQuery('span.lp-subtotal-price').text($currencySym+$price);
4306            jQuery('span.lp-subtotal-taxamount').text($currencySym+$taxPrice);
4307            jQuery('span.lp-subtotal-total-price').text($currencySym+$price);
4308            jQuery('span.lp-subtotal-total-price').attr('data-subtotal',$price);
4309            break;
4310        case('right'):
4311            jQuery('span.lp-subtotal-p-price').text($orgPrice+$currencySym);
4312            jQuery('span.lp-subtotal-price').text($price+$currencySym);
4313            jQuery('span.lp-subtotal-taxamount').text($taxPrice+$currencySym);
4314            jQuery('span.lp-subtotal-total-price').text($price+$currencySym);
4315            jQuery('span.lp-subtotal-total-price').attr('subtotal',$price);
4316            break;
4317        default:
4318            jQuery('span.lp-subtotal-p-price').text($currencySym+$orgPrice);
4319            jQuery('span.lp-subtotal-price').text($currencySym+$price);
4320            jQuery('span.lp-subtotal-taxamount').text($currencySym+$taxPrice);
4321            jQuery('span.lp-subtotal-total-price').text($currencySym+$price);
4322            jQuery('span.lp-subtotal-total-price').attr('datasubtotal',$price);
4323
4324    }
4325
4326
4327    jQuery('.lp-checkout-coupon-outer').css('display', 'block');
4328    jQuery('.active-checkout-listing').addClass('lp-checkout-wrapper-new-without-radius');
4329}
4330
4331/* ====================function for recurring option====================== */
4332
4333function lp_show_recurring_switch(){
4334    var $sPlan = jQuery('input[name=plan]:checked').val();
4335    if($sPlan=="stripe" || $sPlan=="paypal"){
4336        jQuery('.lp-checkout-recurring-wrap').css('display', 'block');
4337    }else if($sPlan == "wire" ){
4338        jQuery('.lp-checkout-recurring-wrap input[name="lp-recurring-option"]').prop("checked", false);
4339		jQuery('.lp-checkout-recurring-wrap').css('display', 'none');
4340	}
4341}
4342
4343/* ====================function for recurring option====================== */
4344
4345function lp_add_checkout_data_fields(listingID, planID, price, recurring, method, $planTime) {
4346    var $tax =jQuery('#listings_checkout_form input[name=listing_id]:checked').data('taxenable');
4347    jQuery('input[name=post_id]').val(listingID);
4348    jQuery('input[name=method]').val(method);
4349    if($tax=='1') {
4350        jQuery('input[name=listings_tax_price]').val(price);
4351    }
4352    jQuery('input[name=prc_plan]').val(planID);
4353    jQuery('input[name=lprecurring]').val(recurring);
4354    jQuery('input[name=plan_time]').val($planTime);
4355}
4356
4357/* ==================== function to show active fields of coupons============ */
4358function lp_make_couponsfields_active(){
4359    jQuery('input.coupon-text-field').prop('disabled', false);
4360    jQuery('button.coupon-apply-bt').prop('disabled', false);
4361}
4362
4363/* ==================== function to show disable fields of coupons============ */
4364function lp_make_couponsfields_passive(){
4365    jQuery('input.coupon-text-field').prop('disabled', true);
4366    jQuery('button.coupon-apply-bt').prop('disabled', true);
4367}
4368/* ====================function for adding data in input hidden fields=========*/
4369
4370function lp_add_checkout_data_fields_in_form(listingID, post_title, planID, price, $tax, $taxRate) {
4371    jQuery('input[name=plan_price]').val(price);
4372    jQuery('input[name=post_title]').val(post_title);
4373    jQuery('input[name=listings_id]').val(listingID);
4374    jQuery('input[name=post_id]').val(listingID);
4375    jQuery('input[name=plan_id]').val(planID);
4376    if($tax){
4377        taxprice = ($taxRate/100)*price;
4378        taxprice = taxprice.toFixed(2);
4379        jQuery('input[name="listings_tax_price"]').val(taxprice);
4380    }
4381    lp_update_date_in_mini_cart(price, $tax, $taxRate);
4382}
4383/* ====================function for update data in mini cart====================*/
4384function lp_update_date_in_mini_cart($price, $tax, $taxRate) {
4385
4386    var $currencyPos = jQuery('#listings_checkout_form').data('currencypos');
4387    var $currencySym = jQuery('#listings_checkout_form').data('currencysymbol');
4388    var $orgPrice = $price;
4389    var $orgPrice = parseFloat($orgPrice).toFixed(2);
4390    var $taxPrice = '';
4391    var $currencyPos = jQuery('#listings_checkout_form').data('currencypos');
4392    var $currencySym = jQuery('#listings_checkout_form').data('currencysymbol');
4393    if($tax=="1"){
4394        $taxPrice = ($taxRate/100)*$price;
4395        $price = parseFloat($price) + parseFloat($taxPrice);
4396        $price = parseFloat($price).toFixed(2);
4397
4398        $taxPrice = parseFloat($taxPrice).toFixed(2);
4399    }
4400
4401    switch($currencyPos){
4402        case('left'):
4403            //jQuery('span.lp-subtotal-p-price').text($currencySym+$orgPrice);
4404            jQuery('span.lp-subtotal-price').text($currencySym+$price);
4405            jQuery('span.lp-subtotal-taxamount').text($currencySym+$taxPrice);
4406            jQuery('span.lp-subtotal-total-price').text($currencySym+$price);
4407            jQuery('span.lp-subtotal-total-price').attr('data-subtotal',$price);
4408            break;
4409        case('right'):
4410            //jQuery('span.lp-subtotal-p-price').text($orgPrice+$currencySym);
4411            jQuery('span.lp-subtotal-price').text($price+$currencySym);
4412            jQuery('span.lp-subtotal-taxamount').text($taxPrice+$currencySym);
4413            jQuery('span.lp-subtotal-total-price').text($price+$currencySym);
4414            jQuery('span.lp-subtotal-total-price').attr('data-subtotal',$price);
4415            break;
4416        default:
4417            jQuery('span.lp-subtotal-p-price').text($currencySym+$orgPrice);
4418            jQuery('span.lp-subtotal-price').text($currencySym+$price);
4419            jQuery('span.lp-subtotal-taxamount').text($currencySym+$taxPrice);
4420            jQuery('span.lp-subtotal-total-price').text($currencySym+$price);
4421            jQuery('span.lp-subtotal-total-price').attr('data-subtotal',$price);
4422
4423    }
4424}
4425
4426/* =====================reset mincart and checkout data  ======================== */
4427function lp_reset_mincart_checkout_form_data(){
4428    var $price = jQuery('input[name=listing_id]:checked').data('planprice');
4429    var $listingID = jQuery('input[name=listing_id]:checked').val();
4430    var $post_title = jQuery('input[name=listing_id]:checked').data('title');
4431    var $planID = jQuery('input[name=listing_id]:checked').data('planid');
4432    var $tax =jQuery('input[name=listing_id]:checked').data('taxenable');
4433    var $taxRate = jQuery('input[name=listing_id]:checked').data('taxrate');
4434    lp_add_checkout_data_fields_in_form($listingID, $post_title, $planID, $price, $tax, $taxRate);
4435}
4436
4437/* =====================active checkout steps bar  ======================== */
4438function lp_make_checkout_step_active($stepname){
4439	jQuery('.lp_payment_steps_area li.'+$stepname+'').addClass('current');
4440}
4441
4442/* =====================active checkout steps bar  ======================== */
4443function lp_make_checkout_step_passive($stepname){
4444	jQuery('.lp_payment_steps_area li.'+$stepname+'').removeClass('current');
4445}
4446
4447/* =====================active checkout steps button on all selections ======================== */
4448function lp_make_campaign_paybutton_active(){
4449    var selected_option = jQuery('.lp-search-listing-camp').val();
4450    var atLeastOnePlaceAd = jQuery('input[name="lpadsoftype[]"]:checked').length > 0;
4451    var atLeastOneMethodAd = jQuery('input[name="method"]:checked').length > 0;
4452    var adsterms = jQuery('#lp-campaignTerms:checked').length > 0;
4453
4454    var adPriceField = 1;
4455    var adDurationField = 1;
4456
4457    if(jQuery('input[name="adsduration_pd"]').length > 0){
4458        adDurationField = jQuery('input[name="adsduration_pd"]').val();
4459    }
4460
4461    if(jQuery('input[name="adsprice_pc"]').length > 0){
4462        adPriceField = jQuery('input[name="adsprice_pc"]').val();
4463    }
4464
4465    if( selected_option!='' && selected_option!='0' &&  atLeastOnePlaceAd!='' &&  adsterms!='' &&  adsterms!='0' && atLeastOnePlaceAd!='0' && atLeastOneMethodAd!='' && atLeastOneMethodAd!='0' && adDurationField!='' && adDurationField!='0' && adPriceField!='' && adPriceField!='0' ){
4466        jQuery('button.lp_campaign_paynow').attr('disabled', false);
4467        jQuery('button.lp_campaign_paynow').attr('type', 'submit');
4468    }else{
4469        jQuery('button.lp_campaign_paynow').attr('disabled', true);
4470        jQuery('button.lp_campaign_paynow').attr('type', 'button');
4471    }
4472}
4473
4474jQuery(document).on('click', '#lp-campaignTerms', function () {
4475    lp_make_campaign_paybutton_active();
4476});
4477
4478jQuery(document).on('click', '.show-loop-map-popup', function (e) {
4479    e.preventDefault();
4480    if(jQuery('#grid-show-popup').is('.md-show')) {
4481    }else{
4482        jQuery('#grid-show-popup').modal({
4483            show: 'true'
4484        });
4485        jQuery('#grid-show-popup').addClass('md-show');
4486    }
4487    var $this   =   jQuery(this),
4488        LAT     =   $this.data('lat'),
4489        LNG     =   $this.data('lng'),
4490        LPpostID     =   $this.data('lid');
4491
4492    jQuery.ajax({
4493        url: ajax_search_term_object.ajaxurl,
4494        data: {
4495            'action':'show_map_pop_cb',
4496            'LPpostID' : LPpostID,
4497            'lpNonce' : jQuery('#lpNonce').val()
4498        },
4499        success:function(data) {
4500
4501            jQuery('#grid-show-popup .grid-show-popup').html(data);
4502            var markerSrc	=	jQuery('#grid-show-popup .grid-show-popup .quickmap').attr('data-marker-src');
4503            var markers = false;
4504            $mtoken = jQuery('#page').data("mtoken");
4505            $mtype = jQuery('#page').data("mtype");	
4506            $siteURL = jQuery('#page').data("site-url");
4507            $lat = LAT;
4508            $lan = LNG;
4509            if($mtoken != '' && $mtype == 'mapbox'){
4510                L.mapbox.accessToken = $mtoken;
4511                map = L.mapbox.map('quickmap'+LPpostID);
4512                L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
4513                    id: jQuery('#page').data("mstyle"),
4514                    accessToken: jQuery('#page').data("mtoken")
4515                }).addTo(map);
4516            }else{
4517                var map = new L.Map('quickmap'+LPpostID, {center: new L.LatLng($lat,$lan), zoom: 14});
4518                if($mtype == 'google'){
4519                    var googleLayer = new L.Google('ROADMAP');
4520                    map.addLayer(googleLayer);
4521                }else{
4522                    L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
4523                }
4524            }
4525            map.setView([$lat,$lan], 14);
4526            markers = new L.MarkerClusterGroup();
4527            var markerLocation = new L.LatLng($lat, $lan); // London
4528            var CustomHtmlIcon = L.HtmlIcon.extend({
4529                options : {
4530                    html : "<div class='lpmap-icon-shape pin '><div class='lpmap-icon-contianer'><img src='"+markerSrc+"'  /></div></div>",
4531                }
4532            });
4533            var customHtmlIcon = new CustomHtmlIcon();
4534            var marker = new L.Marker(markerLocation, {icon: customHtmlIcon}).bindPopup('').addTo(map);
4535            markers.addLayer(marker);
4536            jQuery('.md-close.widget-map-click').click(function(e){
4537                var loaderImg   =   jQuery('#grid-show-popup .grid-show-popup').data('loader');
4538                jQuery('#full-overlay').remove();
4539                jQuery('#grid-show-popup .grid-show-popup').html('<img src="'+ loaderImg +'" />');
4540            });
4541            //alert(data.cats_markup);
4542        },
4543        error: function(errorThrown){
4544            alert(errorThrown);
4545        }
4546    });
4547});
4548
4549jQuery(document).on('click', '.open-multi-rate-box', function (e) {
4550    e.preventDefault();
4551    var $this		=	jQuery(this),
4552        targetBox	=	'#'+$this.data('rate-box');
4553    jQuery( targetBox ).slideToggle(500);
4554});
4555
4556jQuery('button.printthisinvoice').click(function(e){
4557
4558        var printContents = document.getElementById('listing-invoices-popup').innerHTML;
4559        var originalContents = document.body.innerHTML;
4560        document.body.innerHTML = printContents;
4561        window.print();
4562        document.body.innerHTML = originalContents;
4563        location.reload();
4564		e.preventDefault();
4565
4566    });
4567	
4568jQuery(document).ready(function(){
4569	if(jQuery('.lp-user-listings.active-checkout-listing').length){
4570		jQuery( ".lp-user-listings" ).each(function( index ) {
4571			if(jQuery(this).hasClass('active-checkout-listing')){}else{
4572				jQuery(this).remove();
4573			}
4574			
4575		});
4576	}
4577	
4578});
4579
4580// App view menu in tabs
4581jQuery(document).ready(function () {
4582	jQuery('.lp-menu-type-heading').on('click',function () {
4583		//jQuery('.lp-menu-type-heading').removeClass('active');
4584		jQuery(this).toggleClass('active');
4585		jQuery('.active-menu-toggle').slideUp('slow', function(){
4586			jQuery('.active-menu-toggle').removeClass('active-menu-toggle')
4587		});
4588		var getmenutype = '.'+jQuery(this).attr("data-target");
4589		jQuery(getmenutype).slideToggle('slow');
4590	});
4591	jQuery('.lp-appview-group-heading').on('click',function(){
4592		//jQuery('.lp-appview-group-heading').removeClass('active');
4593		jQuery(this).toggleClass('active');
4594		var getmenugroup = '.'+jQuery(this).attr("data-target");
4595		//jQuery('.lp-appview-menu-items-bygroup').slideUp('slow');
4596		jQuery(this).next(getmenugroup).slideToggle('slow');
4597	})
4598});
4599
4600
4601
4602jQuery(document).ready(function(){
4603
4604    //dashboard weekly monthly active
4605	jQuery('.lp_stats_duration_filter li button').on('click', function(){
4606
4607		jQuery('.lp_stats_duratonBtn').removeClass('active');
4608
4609        jQuery(this).addClass('active');
4610
4611    });
4612
4613
4614    //If width is less than 640
4615    if(jQuery(window).width()<641){
4616        jQuery('#main_icon').on('click', function() {
4617            jQuery('#main_icon').toggleClass('fa fa-times');
4618            jQuery('#sidebar').toggle(300);
4619        });
4620    }
4621    
4622
4623    //New archive style grid switcher
4624	jQuery('.lp-grid-two').on('click', function(){
4625		
4626		
4627		jQuery('.lp-sidebar-filters-style').removeClass('lp-grid-width1');
4628		jQuery('.lp-sidebar-filters-style').removeClass('lp-grid-width3');
4629
4630        jQuery('.lp-sidebar-filters-style').addClass('lp-grid-width2');
4631		jQuery('.lp-grid-two').addClass('active');
4632		jQuery('.lp-grid-one').removeClass('active');
4633		jQuery('.lp-grid-three').removeClass('active');		
4634
4635    });
4636	jQuery('.lp-grid-one').on('click', function(){
4637
4638		jQuery('.lp-sidebar-filters-style').removeClass('lp-grid-width2');
4639		jQuery('.lp-sidebar-filters-style').removeClass('lp-grid-width3');
4640
4641        jQuery('.lp-sidebar-filters-style').addClass('lp-grid-width1');
4642		jQuery('.lp-grid-one').addClass('active');
4643		jQuery('.lp-grid-two').removeClass('active');
4644		jQuery('.lp-grid-three').removeClass('active');
4645
4646    });
4647	jQuery('.lp-grid-three').on('click', function(){
4648
4649		jQuery('.lp-sidebar-filters-style').removeClass('lp-grid-width1');
4650		jQuery('.lp-sidebar-filters-style').removeClass('lp-grid-width2');
4651
4652        jQuery('.lp-sidebar-filters-style').addClass('lp-grid-width3');
4653		jQuery('.lp-grid-three').addClass('active');
4654		jQuery('.lp-grid-two').removeClass('active');
4655		jQuery('.lp-grid-one').removeClass('active');
4656    });
4657
4658    
4659    
4660});
4661
4662
4663jQuery(document).on('click', '.app-view-popup-style', function(){
4664    jQuery( "body" ).prepend( '<div id="full-overlay-lp"></div>' );
4665    jQuery("#full-overlay-lp").css({
4666        "width": "100vw",
4667        "height": "100vh",
4668        "position": "fixed",
4669        "background": "#000000c7",
4670        "z-index": "3",
4671    });
4672    jQuery(".md-close i").click(function(){
4673        jQuery('#full-overlay-lp').remove();
4674        jQuery('#app-view-login-popup').fadeOut(function () {
4675            jQuery('#app-view-login-popup').css({
4676                'opacity' : 0,
4677                'display' : 'none'
4678            });
4679        });
4680    });
4681});
4682
4683/* ======function to get currency symbol===== */
4684
4685function lp_get_currency_sysmbol(){
4686	$code = jQuery('#lp-new-ad-compaignForm').data('camp-currency');
4687	return $code;
4688}
4689/* ======function to get tax percent===== */
4690
4691function lp_get_tax_percent(){
4692	$code = jQuery('#lp-new-ad-compaignForm').data('tax-percent');
4693	return $code;
4694}
4695
4696/* ======function to get selected campaigns org price===== */
4697
4698function lp_get_selected_camp_price(){
4699	$totalCamPrice = 0;
4700	jQuery('input[name="lpadsoftype[]"]:checked').each(function() {
4701						$thisAd = jQuery(this).data('orgprice');
4702						$totalCamPrice = parseFloat($totalCamPrice) + parseFloat($thisAd);
4703					});
4704					//console.log($totalCamPrice);
4705					return $totalCamPrice;
4706					
4707}
4708/* ======function to get selected campaigns with tax price===== */
4709function lp_get_selected_camp_withtax_price(){
4710	$totalCamPrice = 0;
4711	jQuery('input[name="lpadsoftype[]"]:checked').each(function() {
4712						$thisAd = jQuery(this).data('price');
4713						$totalCamPrice = parseFloat($totalCamPrice) + parseFloat($thisAd);
4714					});
4715					//console.log($totalCamPrice);
4716					return $totalCamPrice;
4717					
4718}
4719/* ======function to get tax price of campaigns===== */
4720function lp_get_selected_camp_onlytax_price(){
4721	$totalCamPrice = 0;
4722	jQuery('input[name="lpadsoftype[]"]:checked').each(function() {
4723						$thisAd = jQuery(this).data('taxprice');
4724						$totalCamPrice = parseFloat($totalCamPrice) + parseFloat($thisAd);
4725					});
4726					//console.log($totalCamPrice);
4727					return $totalCamPrice;
4728					
4729}
4730/* ======function to set camp duration price in preview===== */
4731function lp_set_camp_duration_price_in_preview($thisval){
4732		$daysString = jQuery('.lp-cmp-duration').data('days-text');
4733		$taxPercent = lp_get_tax_percent();
4734		$taxtotalPrice = lp_get_selected_camp_onlytax_price();
4735		$taxtotalPrice = $thisval*$taxtotalPrice;
4736        $taxtotalPrice = $taxtotalPrice.toFixed(2);
4737		jQuery('input[name=taxprice]').val($taxtotalPrice);
4738		jQuery('input[name=ads_days]').val($thisval);
4739		$thisvalWithDays = $thisval+' '+$daysString;
4740		jQuery('.lp-cmp-duration h6').text($thisvalWithDays);
4741		$totalCamPrice = lp_get_selected_camp_price();
4742		$totalCamPrice = parseFloat($thisval) * parseFloat($totalCamPrice);
4743		console.log($totalCamPrice);
4744        $totalCamPrice = $totalCamPrice.toFixed(2);
4745		jQuery('.lp-cmp-subtotal h6').text(lp_get_currency_sysmbol()+''+$totalCamPrice);
4746		$totalCamPriceWithTax = lp_get_selected_camp_withtax_price();
4747		$totalCamPriceWithTax = parseFloat($thisval) * parseFloat($totalCamPriceWithTax);
4748        $totalCamPriceWithTax = $totalCamPriceWithTax.toFixed(2);		
4749		console.log($totalCamPriceWithTax);
4750		jQuery('.lp-cmp-alltotal h5').text(lp_get_currency_sysmbol()+''+$totalCamPriceWithTax);
4751		jQuery('input[name=ads_price]').val($totalCamPriceWithTax);
4752		
4753		
4754		console.log($taxtotalPrice);
4755		jQuery('.lp-cmp-taxtotal h6').text($taxtotalPrice);
4756					
4757}
4758/* ======function to set camp price in preview===== */
4759function lp_set_camp_budget_price_in_preview($thisval){
4760	$taxPercent = lp_get_tax_percent();
4761		$thisvalWithCurr = lp_get_currency_sysmbol()+''+$thisval;
4762		jQuery('.lp-cmp-budget h6').text($thisvalWithCurr);
4763		jQuery('.lp-cmp-subtotal h6').text($thisvalWithCurr);
4764		$taxPrice = 0;
4765		if($taxPercent){
4766			$taxPrice = ($taxPercent/100)*$thisval;
4767			$taxPrice = $taxPrice.toFixed(2);
4768			jQuery('input[name=taxprice]').val($taxPrice);
4769			$taxPriceWithCurr = lp_get_currency_sysmbol()+''+$taxPrice;
4770			jQuery('.lp-cmp-taxtotal h6').text($taxPriceWithCurr);
4771			
4772		}
4773		
4774		$totalAmount = parseFloat($thisval) + parseFloat($taxPrice);
4775		jQuery('input[name=ads_price]').val($totalAmount);
4776		jQuery('.lp-cmp-alltotal h5').text($totalAmount);
4777}
4778/* ======function to set camp type===== */
4779function lp_get_camp_type(){
4780	$camptype = jQuery('#lp-new-ad-compaignForm').data('type');
4781	return $camptype;
4782}
4783
4784
4785
4786// Add hours
4787jQuery(document).on('click', 'button.add-hours', function(event) {
4788    event.preventDefault();
4789    var $this = jQuery(this);
4790    var lp2times = $this.closest('#day-hours-BusinessHours').data('lpenabletwotimes');
4791    var sorryMsg = jQuery(this).data('sorrymsg');
4792    var alreadyadded = jQuery(this).data('alreadyadded');
4793    var error = false;
4794    var fullday = '';
4795    var fullhoursclass = '';
4796
4797    var lpdash = "~";
4798
4799    if(lp2times=="disable"){
4800
4801        var weekday = jQuery('select.weekday').val();
4802        if(jQuery(".fulldayopen").is(":checked")){
4803            jQuery('.fulldayopen').attr('checked', false);
4804            jQuery('select.hours-start').prop("disabled", false);
4805            jQuery('select.hours-end').prop("disabled", false);
4806            var startVal ='';
4807            var endVal ='';
4808            var hrstart ='';
4809            var hrend ='';
4810            fullday = $this.data('fullday');
4811            fullhoursclass = 'fullhours';
4812            lpdash = "";
4813        }
4814        else{
4815            var startVal = jQuery('select.hours-start').val();
4816            var endVal = jQuery('select.hours-end').val();
4817            var hrstart = jQuery('select.hours-start').find('option:selected').val();
4818            var hrend = jQuery('select.hours-end').find('option:selected').val();
4819
4820            var startVal_digit = hrstart.replace(':', '');
4821            var endVal_digit = hrend.replace(':', '');
4822
4823            if (startVal_digit.indexOf('am') > -1) {
4824                startVal_digit = startVal_digit.replace('am', '');
4825            }
4826            else if (startVal_digit.indexOf('pm') > -1) {
4827                startVal_digit = startVal_digit.replace('pm', '');
4828                if (startVal_digit != '1200' && startVal_digit != '1230') {
4829                    startVal_digit = parseInt(startVal_digit) + 1200;
4830                }
4831            }
4832            if (endVal_digit.indexOf('am') > -1) {
4833                endVal_digit = endVal_digit.replace('am', '');
4834                endVal_digit = parseInt(endVal_digit);
4835                if(endVal_digit >= 1200){
4836                    endVal_digit = parseInt(endVal_digit) - 1200;
4837                }
4838
4839            }
4840            else if (endVal_digit.indexOf('pm') > -1) {
4841                endVal_digit = endVal_digit.replace('pm', '');
4842                endVal_digit = parseInt(endVal_digit) + 1200;
4843            }
4844
4845            if(startVal_digit > endVal_digit){
4846                nextWeekday = jQuery("select.weekday option:selected+option").val();
4847                if(typeof nextWeekday === "undefined"){
4848                    nextWeekday = jQuery("select.weekday").find("option:first-child").val();
4849                }
4850
4851                weekday = weekday+"~"+nextWeekday;
4852            }
4853
4854
4855        }
4856
4857
4858
4859        if( $this.hasClass('lp-add-hours-st') )
4860        {
4861            var remove = '<i class="fa fa-times"></i>';
4862        }
4863        else
4864        {
4865            var remove  =   jQuery(this).data('remove');
4866        }
4867        jQuery('.hours-display .hours').each(function(index, element) {
4868            var weekdayTExt = jQuery(element).children('.weekday').text();
4869            if(weekdayTExt == weekday){
4870                alert(sorryMsg+'! '+weekday+' '+alreadyadded);
4871                error = true;
4872            }
4873        });
4874        if(error != true){
4875            jQuery('.hours-display').append("<div class='hours "+fullhoursclass+"'><span class='weekday'>"+ weekday +"</span><span class='start-end fullday'>"+fullday+"</span><span class='start'>"+ hrstart +"</span><span>"+lpdash+"</span><span class='end'>"+ hrend +"</span><a class='remove-hours' href='#'>"+remove+"</a><input name='business_hours["+weekday+"][open]' value='"+startVal+"' type='hidden'><input name='business_hours["+weekday+"][close]' value='"+endVal+"' type='hidden'></div>");
4876            var current = jQuery('select.weekday').find('option:selected');
4877            var nextval = current.next();
4878            current.removeAttr('selected');
4879            nextval.attr('selected','selected');
4880            jQuery('select.weekday').trigger('change.select2');
4881        }
4882    }
4883    else{
4884        var lptwentlyfourisopen = '';
4885        /* 2times */
4886        var weekday = jQuery('select.weekday').val();
4887        var weekday1 = weekday;
4888        var weekday2 = weekday;
4889
4890        if(jQuery(".fulldayopen").is(":checked")){
4891
4892            lptwentlyfourisopen = 'yes';
4893
4894            jQuery('.fulldayopen').attr('checked', false);
4895            jQuery('select.hours-start').prop("disabled", false);
4896            jQuery('select.hours-end').prop("disabled", false);
4897
4898            jQuery('select.hours-start2').prop("disabled", false);
4899            jQuery('select.hours-end2').prop("disabled", false);
4900
4901            var startVal1 ='';
4902            var endVal1 ='';
4903            var hrstart1 ='';
4904            var hrend1 ='';
4905
4906            var startVal2 ='';
4907            var endVal2 ='';
4908            var hrstart2 ='';
4909            var hrend2 ='';
4910
4911
4912
4913            fullday = $this.data('fullday');
4914            fullhoursclass = 'fullhours';
4915
4916            lpdash = "";
4917        }
4918        else{
4919            var startVal1 = jQuery('select.hours-start').val();
4920            var endVal1 = jQuery('select.hours-end').val();
4921            var hrstart1 = jQuery('select.hours-start').find('option:selected').val();
4922            var hrend1 = jQuery('select.hours-end').find('option:selected').val();
4923
4924            var startVal1_digit = hrstart1.replace(':', '');
4925            var endVal1_digit = hrend1.replace(':', '');
4926
4927            if (startVal1_digit.indexOf('am') > -1) {
4928                startVal1_digit = startVal1_digit.replace('am', '');
4929            }
4930            else if (startVal1_digit.indexOf('pm') > -1) {
4931                startVal1_digit = startVal1_digit.replace('pm', '');
4932                if (startVal1_digit != '1200' && startVal1_digit != '1230') {
4933                    startVal1_digit = parseInt(startVal1_digit) + 1200;
4934                }
4935            }
4936            if (endVal1_digit.indexOf('am') > -1) {
4937                endVal1_digit = endVal1_digit.replace('am', '');
4938                endVal1_digit = parseInt(endVal1_digit);
4939                if( endVal1_digit >= 1200 ){
4940                    endVal1_digit = parseInt(endVal1_digit) - 1200;
4941                }
4942            }
4943            else if (endVal1_digit.indexOf('pm') > -1) {
4944                endVal1_digit = endVal1_digit.replace('pm', '');
4945                endVal1_digit = parseInt(endVal1_digit) + 1200;
4946            }
4947
4948
4949            if(startVal1_digit > endVal1_digit){
4950
4951                nextWeekday = jQuery("select.weekday option:selected+option").val();
4952                if(typeof nextWeekday === "undefined"){
4953                    nextWeekday = jQuery("select.weekday").find("option:first-child").val();
4954
4955                }
4956
4957                weekday1 = weekday+"~"+nextWeekday;
4958                jQuery('.hours-display .hours').each(function (e) {
4959                    var $this	=	jQuery(this);
4960                    if($this.find('span.weekday:contains("'+weekday1+'")').length > 0) {
4961                        alert(sorryMsg+'! '+weekday1+' '+alreadyadded);
4962                        error = true;
4963                    }
4964                });
4965
4966            }
4967
4968
4969            var startVal2 = jQuery('select.hours-start2').val();
4970            var endVal2 = jQuery('select.hours-end2').val();
4971            var hrstart2 = jQuery('select.hours-start2').find('option:selected').text();
4972            var hrend2 = jQuery('select.hours-end2').find('option:selected').text();
4973
4974            var startVal2_digit = hrstart2.replace(':', '');
4975            var endVal2_digit = hrend2.replace(':', '');
4976
4977            if (startVal2_digit.indexOf('am') > -1) {
4978                startVal2_digit = startVal2_digit.replace('am', '');
4979            }
4980            else if (startVal2_digit.indexOf('pm') > -1) {
4981                startVal2_digit = startVal2_digit.replace('pm', '');
4982                if (startVal2_digit != '1200' && startVal2_digit != '1230') {
4983                    startVal2_digit = parseInt(startVal2_digit) + 1200;
4984                }
4985            }
4986            if (endVal2_digit.indexOf('am') > -1) {
4987                endVal2_digit = endVal2_digit.replace('am', '');
4988                endVal2_digit = parseInt(endVal2_digit);
4989                if( endVal2_digit >= 1200 ){
4990                    endVal2_digit = parseInt(endVal2_digit) - 1200;
4991                }
4992            }
4993            else if (endVal2_digit.indexOf('pm') > -1) {
4994                endVal2_digit = endVal2_digit.replace('pm', '');
4995                endVal2_digit = parseInt(endVal2_digit) + 1200;
4996            }
4997
4998
4999            if(startVal2_digit > endVal2_digit){
5000                nextWeekday = jQuery("select.weekday option:selected+option").val();
5001                if(typeof nextWeekday === "undefined"){
5002                    nextWeekday = jQuery("select.weekday").find("option:first-child").val();
5003                }
5004
5005                weekday2 = weekday+"~"+nextWeekday;
5006                jQuery('.hours-display .hours').each(function (e) {
5007                    var $this	=	jQuery(this);
5008                    if($this.find('span.weekday:contains("'+weekday2+'")').length > 0) {
5009                        alert(sorryMsg+'! '+weekday2+' '+alreadyadded);
5010                        error = true;
5011                    }
5012                });
5013            }
5014        }
5015        
5016
5017        
5018        if( $this.hasClass('lp-add-hours-st') )
5019        {
5020            var remove = '<i class="fa fa-times"></i>';
5021        }
5022        else
5023        {
5024            var remove  =   jQuery(this).data('remove');
5025        }
5026
5027        if(error != true){
5028
5029            if( (jQuery(".lp-check-doubletime .enable2ndday").is(":checked")) && (lptwentlyfourisopen==="") ){
5030
5031                jQuery('.hours-display').append("<div class='hours "+fullhoursclass+"'><span class='weekday'>"+ weekday +"</span><span class='start-end fullday'>"+fullday+"</span><span class='start'>"+ hrstart1 +"</span><span>"+lpdash+"</span><span class='end'>"+ hrend1 +"</span><a class='remove-hours' href='#'>"+remove+"</a><br><span class='weekday'>&nbsp;</span><span class='start'>"+ hrstart2 +"</span><span>"+lpdash+"</span><span class='end'>"+ hrend2 +"</span><input name='business_hours["+weekday1+"][open][0]' value='"+startVal1+"' type='hidden'><input name='business_hours["+weekday1+"][close][0]' value='"+endVal1+"' type='hidden'><input name='business_hours["+weekday2+"][open][1]' value='"+startVal2+"' type='hidden'><input name='business_hours["+weekday2+"][close][1]' value='"+endVal2+"' type='hidden'></div>");
5032            }else{
5033
5034                jQuery('.hours-display').append("<div class='hours "+fullhoursclass+"'><span class='weekday'>"+ weekday1 +"</span><span class='start-end fullday'>"+fullday+"</span><span class='start'>"+ hrstart1 +"</span><span>"+lpdash+"</span><span class='end'>"+ hrend1 +"</span><a class='remove-hours' href='#'>"+remove+"</a><input name='business_hours["+weekday1+"][open]' value='"+startVal1+"' type='hidden'><input name='business_hours["+weekday1+"][close]' value='"+endVal1+"' type='hidden'></div>");
5035            }
5036            var current = jQuery('select.weekday').find('option:selected');
5037            var nextval = current.next();
5038            current.removeAttr('selected');
5039            nextval.attr('selected','selected');
5040            jQuery('select.weekday').trigger('change.select2');
5041        }
5042
5043        /* 2times */
5044    }
5045});
5046
5047
5048jQuery(document).on('click', '.lp-dot-extra-buttons', function(e){
5049    jQuery(this).find(".lp-user-menu").toggleClass("main");
5050});
5051
5052
5053jQuery(document).ready(function () {
5054    jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").attr("disabled", true);
5055	jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").addClass("LPdisabled");
5056    if (jQuery('.form-group.lp-claim-form-check-circle input').is(':checked')) {
5057        jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").attr("disabled", false);
5058		jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").removeClass("LPdisabled");
5059		
5060    }else{
5061        jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").attr("disabled", true);
5062		
5063		jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").addClass("LPdisabled");
5064		
5065    }
5066    jQuery('.form-group.lp-claim-form-check-circle input').click(function () {
5067        if (jQuery('.form-group.lp-claim-form-check-circle input').is(':checked')) {
5068            jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").attr("disabled", false);
5069			jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").removeClass("LPdisabled");
5070			
5071			
5072        }else{
5073            jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").attr("disabled", true);
5074			jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").addClass("LPdisabled");
5075        }
5076    });
5077});
5078jQuery("#pop").on("click", function(e) {
5079   e.preventDefault();
5080    jQuery('#imagemodal').modal('show'); // imagemodal is the id attribute assigned to the bootstrap modal, then i use the show function
5081   var img_src = jQuery(this).data('imgsrc');
5082   jQuery('#imagemodal').find('img').attr('src', img_src);
5083});
5084jQuery('#my_file').change(function() {
5085  var i = jQuery(this).prev('label').clone();
5086  var file = jQuery('#my_file')[0].files[0].name;
5087  jQuery(this).prev('label').text(file);
5088});
5089jQuery(document).ready(function () {
5090    if(jQuery('.payment-recurring-message').length > 0){
5091        jQuery(document).on('change', '.lp-checkout-recurring-wrap', function () {
5092            var checkboxVal = jQuery('.lp-checkout-recurring-wrap input[name="lp-recurring-option"]').is(':checked');
5093            if ( checkboxVal === false ) {
5094                jQuery('.payment-recurring-message').fadeOut('slow');
5095            }
5096        });
5097        jQuery('.rec_alert_remove').click(function () {
5098            jQuery('.payment-recurring-message').fadeOut('slow');
5099        });
5100    }
5101});
5102jQuery(document).on('click', '.sidebar-filters-map-pop', function (e) {
5103    if(jQuery('.sidemap-container').hasClass('sidebar-filters-map-full')) {
5104        jQuery('.sidemap-container').removeClass('sidebar-filters-map-full');
5105        jQuery(this).text(jQuery(this).attr('data-full-map'));
5106    } else {
5107        jQuery('.sidemap-container').addClass('sidebar-filters-map-full');
5108        jQuery(this).text(jQuery(this).attr('data-close-map'));
5109    }
5110});

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.