PageSourceSearch

https://essays.discount/wp-content/themes/listingpro/assets/js/main.js

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

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.