PageSourceSearch

https://ezestate.net/wp-content/themes/wpresidence-child/js/ajaxcalls.js?ver=1.0

js ezestate.net collected 2026-10-08 03:29:29 UTC 111,302 bytes, 2,736 lines download raw bytes

1/*global $, jQuery, ajaxcalls_vars, document, control_vars, window, control_vars,Modernizr,mapfunctions_vars,wpestate_open_menu,grecaptcha,wpestate_show_no_results,wpestate_load_on_demand_pins,get_custom_value,wpestate_enable_half_map_pin_action,wpestate_lazy_load_carousel_property_unit,Chart,widgetId1,widgetId2,widgetId3,widgetId4,wpestate_get_custom_value_tab_search*/
2///////////////////////////////////////////////////////////////////////////////////////////
3
4function wpestate_load_stats_tabs(listing_id) {
5    "use strict";
6    var ajaxurl     =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
7    var nonce = jQuery('#wpestate_tab_stats').val();
8    jQuery.ajax({
9        type: 'POST',
10        url: ajaxurl,
11        dataType: 'json',
12        data: {
13            'action'            :   'wpestate_load_stats_property',
14            'postid'            :   listing_id,
15            'security'          :   nonce,
16        },
17        success: function (data) {  
18            wpestate_show_prop_stat_graph_tab (data.array_values , data.labels,listing_id);
19        },
20        error: function (errorThrown) {}
21    });//end ajax     
22}
23
24
25
26function wpestate_show_prop_stat_graph_tab(values,labels ,listing_id){
27    "use strict";
28    var ctx         =   jQuery("#myChart").get(0).getContext('2d');
29    var myNewChart  =   new Chart(ctx);
30    var data = {
31    labels:labels ,
32    datasets: [
33        {
34            label: "My First dataset",
35            fillColor: "rgba(220,220,220,0.5)",
36            strokeColor: "rgba(220,220,220,0.8)",
37            highlightFill: "rgba(220,220,220,0.75)",
38            highlightStroke: "rgba(220,220,220,1)",
39            data: values
40        },
41    ]
42    };
43    
44    var options = {
45        scaleBeginAtZero : true,
46        scaleShowGridLines : true,
47        scaleGridLineColor : "rgba(0,0,0,.05)",
48        scaleGridLineWidth : 1,
49        scaleShowHorizontalLines: true,
50        scaleShowVerticalLines: true,
51        barShowStroke : true,
52        barStrokeWidth : 2,
53        barValueSpacing : 5,
54        barDatasetSpacing : 1,
55        legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].fillColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
56    };
57    var myBarChart = new Chart(ctx).Bar(data, options);
58}
59
60
61
62function wpestate_load_stats(listing_id) {
63    "use strict";
64    var ajaxurl     =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
65    var nonce = jQuery('#wpestate_tab_stats').val();
66
67    jQuery.ajax({
68        type: 'POST',
69        url: ajaxurl,
70        dataType: 'json',
71        data: {
72            'action'            :   'wpestate_load_stats_property',
73            'postid'            :   listing_id,
74            'security'          :   nonce,
75        },
76        success: function (data) {  
77            wpestate_show_prop_stat_graph (data.array_values , data.labels,listing_id);
78        },
79        error: function (errorThrown) {}
80    });//end ajax     
81}
82
83function wpestate_show_prop_stat_graph(values,labels ,listing_id){
84    "use strict";
85    var ctx         =   jQuery("#myChart_"+listing_id).get(0).getContext('2d');
86    var myNewChart  =   new Chart(ctx);
87    var data = {
88    labels:labels ,
89    datasets: [
90         {
91            label: "My First dataset",
92            fillColor: "rgba(220,220,220,0.5)",
93            strokeColor: "rgba(220,220,220,0.8)",
94            highlightFill: "rgba(220,220,220,0.75)",
95            highlightStroke: "rgba(220,220,220,1)",
96            data: values
97        },
98    ]
99    };
100    
101    var options = {
102        scaleBeginAtZero : true,
103        scaleShowGridLines : true,
104        scaleGridLineColor : "rgba(0,0,0,.05)",
105        scaleGridLineWidth : 1,
106        scaleShowHorizontalLines: true,
107        scaleShowVerticalLines: true,
108        barShowStroke : true,
109        barStrokeWidth : 2,
110        barValueSpacing : 5,
111        barDatasetSpacing : 1,
112        legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].fillColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
113    };
114 
115    var myBarChart = new Chart(ctx).Bar(data, options);
116}
117
118
119//////////////////////////////////////////////////////////////////////////////////////////////
120/// ajax filtering on header search ; jslint checked
121////////////////////////////////////////////////////////////////////////////////////////////
122function wpestate_start_filtering_ajax(newpage) {
123    "use strict";   
124  
125    var action, category, city, area, rooms, baths, min_price, price_max, ajaxurl,postid,halfmap, all_checkers;
126    action      =   jQuery('#adv_actions').attr('data-value');
127    category    =   jQuery('#adv_categ').attr('data-value');
128    city        =   jQuery('#advanced_city').attr('data-value');
129    area        =   jQuery('#advanced_area').attr('data-value');
130    rooms       =   parseFloat(jQuery('#adv_rooms').val(), 10);
131    baths       =   parseFloat(jQuery('#adv_bath').val(), 10);
132    min_price   =   parseFloat(jQuery('#price_low').val(), 10);
133    price_max   =   parseFloat(jQuery('#price_max').val(), 10);
134    postid      =   parseFloat(jQuery('#adv-search-1').attr('data-postid'), 10);
135    ajaxurl     =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
136    var order= jQuery('#a_filter_order').attr('data-value');
137    halfmap    = 0;
138    
139    var nonce = jQuery('#wpestate_ajax_filtering').val();
140  
141    if( jQuery('#google_map_prop_list_sidebar').length ){
142        halfmap    = 1;
143    }   
144  
145    postid=1;
146    if(  document.getElementById('search_wrapper') ){
147        postid      =   parseInt(jQuery('#search_wrapper').attr('data-postid'), 10);
148    }
149    
150    all_checkers = '';
151    jQuery('.search_wrapper .extended_search_check_wrapper  input[type="checkbox"]').each(function () {
152        if (jQuery(this).is(":checked")) {
153            all_checkers = all_checkers + "," + jQuery(this).attr("name-title");
154        }
155    });
156    
157    halfmap    = 0;
158    
159    if( jQuery('#google_map_prop_list_sidebar').length ){
160        halfmap    = 1;
161    }   
162     
163    var geo_lat     =   '';
164    var geo_long    =   '';
165    var geo_rad     =   '';
166    
167    if( jQuery("#geolocation_search").length > 0){    
168        geo_lat     =   jQuery('#geolocation_lat').val();
169        geo_long    =   jQuery('#geolocation_long').val();
170        geo_rad     =   jQuery('#geolocation_radius').val();
171
172    }
173    jQuery('#listing_ajax_container').empty();
174    jQuery('#listing_loader').show();
175    jQuery.ajax({
176        type: 'POST',
177        url: ajaxurl,
178           dataType: 'json',
179        data: {
180            'action'            :   'wpestate_ajax_filter_listings_search',
181            'action_values'     :   action,
182            'category_values'   :   category,
183            'city'              :   city,
184            'area'              :   area,
185            'advanced_rooms'    :   rooms,
186            'advanced_bath'     :   baths,
187            'price_low'         :   min_price,
188            'price_max'         :   price_max,
189            'newpage'           :   newpage,
190            'postid'            :   postid,
191            'halfmap'           :   halfmap,
192            'all_checkers'      :   all_checkers,
193            'geo_lat'           :   geo_lat,
194            'geo_long'          :   geo_long,
195            'geo_rad'           :   geo_rad,
196            'order'             :   order,
197            'security'          :   nonce
198        },
199        success: function (data) { 
200
201            jQuery('#listing_loader').hide();
202            jQuery('.listing_loader_title').show();
203            jQuery('.pagination_nojax').hide();
204            //jQuery('#listing_ajax_container').empty().append(data);
205            jQuery('.entry-title.title_prop').addClass('half_results').text(data.no_founs);
206            
207            jQuery('#listing_ajax_container').empty().append(data.cards);
208            
209            
210            wpestate_restart_js_after_ajax();
211          
212        },
213        error: function (errorThrown) {}
214    });//end ajax     
215}
216
217
218//////////////////////////////////////////////////////////////////////////////////////////////
219/// ajax filtering on header search ; jslint checked
220////////////////////////////////////////////////////////////////////////////////////////////
221function wpestate_custom_search_start_filtering_ajax(newpage) {
222    "use strict";
223  
224    var   temp_val,array_last_item,how_holder,slug_holder,val_holder, ajaxurl,postid , slider_min, slider_max, halfmap, all_checkers,term_id;
225  
226    array_last_item     =   parseInt( mapfunctions_vars.fields_no,10);
227    val_holder          =   [];
228    slug_holder         =   [];
229    how_holder          =   [];
230 
231    slug_holder         =   mapfunctions_vars.slugs;
232    how_holder          =   mapfunctions_vars.hows;
233    
234    if( mapfunctions_vars.slider_price ==='yes' ){
235        slider_min = jQuery('#price_low').val();
236        slider_max = jQuery('#price_max').val();
237 
238    }
239   
240    if( (mapfunctions_vars.adv_search_type==='6' || mapfunctions_vars.adv_search_type==='7' ) &&  !jQuery('.halfsearch')[0]){
241      
242        term_id=jQuery('.tab-pane.active .term_id_class').val();   
243      
244        
245        if( mapfunctions_vars.slider_price ==='yes' ){
246            slider_min = jQuery('#price_low_'+term_id).val();
247            slider_max = jQuery('#price_max_'+term_id).val();
248        }
249    
250         for (var i=0; i<array_last_item;i++){
251            if ( how_holder[i]=='date bigger' || how_holder[i]=='date smaller'){
252                temp_val = wpestate_get_custom_value_tab_search (term_id+slug_holder[i]);
253            }else{
254                temp_val = wpestate_get_custom_value_tab_search (slug_holder[i]);
255            }
256            
257            if(typeof(temp_val)==='undefined'){
258                temp_val='';
259            }
260            val_holder.push(  temp_val );
261        }
262        
263    }else{
264        for (var i=0; i<array_last_item;i++){
265            temp_val = wpestate_get_custom_value (slug_holder[i]);
266            if(typeof(temp_val)==='undefined'){
267                temp_val='';
268            }
269            val_holder.push(  temp_val );
270        }
271       
272    }
273  
274           
275    if( (mapfunctions_vars.adv_search_type==='6' || mapfunctions_vars.adv_search_type==='7'||  mapfunctions_vars.adv_search_type==='8' || mapfunctions_vars.adv_search_type==='9') ){
276        var tab_tax=jQuery('.adv_search_tab_item.active').attr('data-tax');
277        
278        if( jQuery('.halfsearch')[0] ){
279            tab_tax=jQuery('.halfsearch').attr('data-tax');
280        }
281       
282        
283        if(tab_tax === 'property_category'){
284            slug_holder[array_last_item]='adv_categ';
285        }else if(tab_tax === 'property_action_category'){
286            slug_holder[array_last_item]='adv_actions';
287        }else if(tab_tax === 'property_city'){
288            slug_holder[array_last_item]='advanced_city';
289        }else if(tab_tax === 'property_area'){
290            slug_holder[array_last_item]='advanced_area';
291        }else if(tab_tax === 'property_county_state'){
292            slug_holder[array_last_item]='county-state';
293        }
294        
295        how_holder[array_last_item]='like';
296  
297        if( jQuery('.halfsearch')[0] ){
298            val_holder[array_last_item] = jQuery('#'+slug_holder[array_last_item]) .parent().find('input
298:hidden').val();
299        }else{
300            val_holder[array_last_item]=jQuery('.adv_search_tab_item.active').attr('data-term');
301        }
302 
303    }
304 
305     
306    all_checkers = '';
307    jQuery('.search_wrapper .extended_search_check_wrapper  input[type="checkbox"]').each(function () {
308        if (jQuery(this).is(":checked")) {
309            all_checkers = all_checkers + "," + jQuery(this).attr("name-title");
310        }
311    });
312    
313 
314    halfmap    = 0;
315    
316    if( jQuery('#google_map_prop_list_sidebar').length ){
317        halfmap    = 1;
318    }   
319    postid=1;
320    if(  document.getElementById('search_wrapper') ){
321        postid      =   parseInt(jQuery('#search_wrapper').attr('data-postid'), 10);
322    }
323    ajaxurl     =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
324 
325 
326 
327    var filter_search_action10 ='';
328    var adv_location10 ='';
329    
330    if( mapfunctions_vars.adv_search_type==='10' ){
331        filter_search_action10   = jQuery('#adv_actions').attr('data-value');
332        adv_location10           = jQuery('#adv_location').val();
333    }
334   
335
336    var filter_search_action11   =  '';
337    var filter_search_categ11    =  '';
338    var keyword_search           =  '';
339    if( mapfunctions_vars.adv_search_type==='11' ){
340        filter_search_action11      = jQuery('#adv_actions').attr('data-value');
341        filter_search_categ11       = jQuery('#adv_categ').attr('data-value');
342        keyword_search              = jQuery('#keyword_search').val();
343    }
344    var geo_lat     =   '';
345    var geo_long    =   '';
346    var geo_rad     =   '';
347    
348    if( jQuery("#geolocation_search").length > 0){    
349        geo_lat     =   jQuery('#geolocation_lat').val();
350        geo_long    =   jQuery('#geolocation_long').val();
351        geo_rad     =   jQuery('#geolocation_radius').val();
352
353    }
354    
355
356    var nonce = jQuery('#wpestate_ajax_filtering').val();
357    var order= jQuery('#a_filter_order').attr('data-value');
358   
359    jQuery('#listing_ajax_container').empty();
360    jQuery('#listing_loader').show();
361    jQuery.ajax({
362        type: 'POST',
363        url: ajaxurl,
364        dataType: 'json',
365        data: {
366            'action'                    :   'wpestate_custom_adv_ajax_filter_listings_search',
367            'val_holder'                :   val_holder,
368            'newpage'                   :   newpage,
369            'postid'                    :   postid,
370            'slider_min'                :   slider_min,
371            'slider_max'                :   slider_max,
372            'halfmap'                   :   halfmap,
373            'all_checkers'              :   all_checkers,
374            'filter_search_action10'    :   filter_search_action10,
375            'adv_location10'            :   adv_location10,
376            'filter_search_action11'    :   filter_search_action11,
377            'filter_search_categ11'     :   filter_search_categ11,
378            'keyword_search'            :   keyword_search,
379            'geo_lat'                   :   geo_lat,
380            'geo_long'                  :   geo_long,
381            'geo_rad'                   :   geo_rad,
382            'order'                     :   order,
383            'security'                  :   nonce,
384        },
385        success: function (data) {  
386         
387            jQuery('#listing_loader').hide();
388            jQuery('.listing_loader_title').show();
389            jQuery('.entry-title.title_prop').addClass('half_results').text(data.no_founs);
390            
391            jQuery('#listing_ajax_container').empty().append(data.cards);
392            
393            
394            
395            wpestate_restart_js_after_ajax();
396            jQuery('.col-md-12.listing_wrapper .property_unit_custom_element.image').each(function(){
397                jQuery(this).parent().addClass('wrap_custom_image'); 
398            });
399        },
400        error: function (errorThrown) {
401         
402        }
403    });//end ajax     
404}
405
406
407
408
409
410////////////////////////////////////////////////////////////////////////////////////////////
411/// redo js after ajax calls - jslint checked
412////////////////////////////////////////////////////////////////////////////////////////////
413function wpestate_restart_js_after_ajax() {
414    "use strict";
415    wpestate_lazy_load_carousel_property_unit();
416    
417    // wpestate_enable_half_map_pin_action();
418    if (typeof wpestate_enable_half_map_pin_action == 'function'){
419        wpestate_enable_half_map_pin_action();
420    }
421    var newpage, post_id, post_image, to_add, icon;
422
423    jQuery('.pagination_ajax_search a').on( 'click', function(event) {
424        event.preventDefault();
425      
426        newpage = parseInt(jQuery(this).attr('data-future'), 10);
427        document.getElementById('scrollhere').scrollIntoView();
428        if( mapfunctions_vars.custom_search==='yes' ){
429           wpestate_custom_search_start_filtering_ajax(newpage);  // should be custom
430        }else{
431            wpestate_start_filtering_ajax(newpage);// 
432        }
433    });
434
435    jQuery('.pagination_ajax a').on( 'click', function(event) {
436        event.preventDefault();
437        newpage = parseInt(jQuery(this).attr('data-future'), 10);
438        document.getElementById('scrollhere').scrollIntoView();
439        wpestate_start_filtering(newpage);
440    });
441    
442    jQuery('.property_listing').on( 'click', function(event) {
443        if(control_vars.new_page_link==='_blank'){
444            return;
445        }
446        var link;
447        link = jQuery(this).attr('data-link'); 
448
449        window.open(link, '_self');
450    });
451   
452    jQuery('.share_unit').on( 'click', function(event) {
453        event.stopPropagation();
454    });
455   
456    var already_in=[];
457  
458    jQuery('.compare-action').unbind('click');
459    jQuery('.compare-action').on( 'click', function(event) {
460        event.stopPropagation();
461        jQuery('.prop-compare').animate({
462            right: "0px"
463            });
464        post_id = jQuery(this).attr('data-pid');
465        for(var i = 0; i < already_in.length; i++) {
466            if(already_in[i] === post_id) {
467                return;
468            }
469        }
470        
471        already_in.push(post_id); 
472        post_image = jQuery(this).attr('data-pimage');
473
474        to_add = '<div class="items_compare ajax_compare" style="display:none;"><img src="' + post_image + '" class="img-responsive"><input type="hidden" value="' + post_id + '" name="selected_id[]" /></div>';
475        jQuery('div.items_compare:first-child').css('background', 'red');
476        if (parseInt(jQuery('.items_compare').length, 10) > 3) {
477            jQuery('.items_compare:first').remove();
478        }
479        jQuery('#submit_compare').before(to_add);
480        jQuery('.items_compare').fadeIn(800);
481    });
482
483    jQuery('#submit_compare').unbind('click');
484    jQuery('#submit_compare').on( 'click', function(event) {
485        jQuery('#form_compare').trigger('submit');
486    });
487    
488    jQuery('.icon-fav').on( 'click', function(event) {
489        event.stopPropagation();
490        icon = jQuery(this);
491        wpestate_add_remove_favorite(icon);
492    });
493   
494    jQuery(".share_list, .icon-fav, .compare-action").on('mouseenter', function(){   jQuery(this).tooltip('show'); })
495    .on('mouseleave', function(){  jQuery(this).tooltip('hide'); });
496        
497       
498    jQuery('.share_list').on( 'click', function(event) {
499        event.stopPropagation();
500        var sharediv = jQuery(this).parent().find('.share_unit');
501        sharediv.toggle();
502        jQuery(this).toggleClass('share_on');
503    });
504    
505   // setTimeout(function() {  jQuery('.property_listing').matchHeight(); }, 1000);
506   
507}
508
509////////////////////////////////////////////////////////////////////////////////////////////
510/// add remove from favorite-jslint checked
511////////////////////////////////////////////////////////////////////////////////////////////
512function wpestate_add_remove_favorite(icon) {
513    "use strict";
514    var post_id, securitypass, ajaxurl;
515    post_id         =  icon.attr('data-postid');
516    securitypass    =  jQuery('#security-pass').val();
517    ajaxurl         =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
518    var nonce = jQuery('#wpestate_ajax_filtering').val();
519    if (parseInt(ajaxcalls_vars.userid, 10) === 0 ) {
520
521        if (!Modernizr.mq('only all and (max-width: 768px)')) {
522            jQuery('.login-links').show();
523            jQuery('#modal_login_wrapper').show(); 
524            jQuery('#loginpop').val('1');
525        }else{
526            jQuery('.mobile-trigger-user').trigger('click');
527        }
528       
529       
530    } else {
531        icon.toggleClass('icon-fav-off');
532        icon.toggleClass('icon-fav-on');
533
534        jQuery.ajax({
535            type: 'POST',
536            url: ajaxurl,
537            dataType: 'json',
538              data: {
539                  'action'            :   'wpestate_ajax_add_fav',
540                  'post_id'           :   post_id,
541                  'security'          :     nonce
542                  },
543           success: function (data) {          
544                if (data.added) {
545                     icon.removeClass('icon-fav-off').addClass('icon-fav-on');
546                } else {
547                     icon.removeClass('icon-fav-on').addClass('icon-fav-off');
548                }
549           },
550           error: function (errorThrown) {
551
552           }
553         });//end ajax
554    }// end login use
555} 
556
557////////////////////////////////////////////////////////////////////////////////////////////
558/// resend listing for approval-jslint checked
559////////////////////////////////////////////////////////////////////////////////////////////
560function wpestate_resend_for_approval(prop_id, selected_div) {
561    "use strict";
562    var ajaxurl, normal_list_no;
563    ajaxurl   =   control_vars.admin_url + 'admin-ajax.php';
564    var nonce = jQuery('#wpestate_property_actions').val();
565    jQuery.ajax({
566        type: 'POST',
567        url: ajaxurl,
568        data: {
569            'action'        :   'wpestate_ajax_resend_for_approval',
570            'propid'        :   prop_id,
571            'security'      :   nonce
572        },
573        success: function (data) {
574  
575            if (data === 'pending') {
576                selected_div.parent().empty().append('<span class="featured_prop">Sent for approval</span>');
577                normal_list_no    =  parseInt(jQuery('#normal_list_no').text(), 10);
578                jQuery('#normal_list_no').text(normal_list_no - 1);
579            } else {
580                selected_div.parent().empty().append(data);
581            }
582        },
583        error: function (errorThrown) {
584
585        }
586    });//end ajax
587}
588
589////////////////////////////////////////////////////////////////////////////////////////////
590/// make property featured-jslint checked
591//////////////////////////////////////////////////////////////////////////////////////////// 
592function wpestate_make_prop_featured(prop_id, selectedspan) {
593    "use strict";
594    var ajaxurl      =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
595    var nonce = jQuery('#wpestate_property_actions').val();
596
597    jQuery.ajax({
598        type: 'POST',
599        url: ajaxurl,
600        data: {
601            'action'        :   'wpestate_ajax_make_prop_featured',
602            'propid'        :   prop_id,
603            'security'      :   nonce
604        },
605        success: function (data) {
606            if (data.trim() === 'done') {
607                selectedspan.empty().html('<span class="label label-success">'+ajaxcalls_vars.prop_featured+'</span>');
608                var featured_list_no = parseInt(jQuery('#featured_list_no').text(), 10);
609                jQuery('#featured_list_no').text(featured_list_no - 1);
610            } else {
611                selectedspan.empty().removeClass('make_featured').addClass('featured_exp').text(ajaxcalls_vars.no_prop_featured);
612            }
613
614        },
615        error: function (errorThrown) {
616        }
617
618    });//end ajax
619}
620
621////////////////////////////////////////////////////////////////////////////////////////////
622/// pay package via paypal recuring-jslint checked
623////////////////////////////////////////////////////////////////////////////////////////////   
624function wpestate_recuring_pay_pack_via_paypal() {
625    "use strict";
626    var ajaxurl, packName, packId;
627    ajaxurl      =   control_vars.admin_url + 'admin-ajax.php';
628     
629    packName = jQuery('.package_selected .pack-listing-title').text();
630    packId = jQuery('.package_selected .pack-listing-title').attr('data-packid');
631  
632    var nonce = jQuery('#wpestate_payments_nonce').val();
633    jQuery.ajax({
634        type: 'POST',
635        url: ajaxurl,
636        data: {
637            'action'        :   'wpestate_ajax_paypal_pack_recuring_generation_rest_api',
638            'packName'      :   packName,
639            'packId'        :   packId,
640            'security'      :   nonce
641        },
642        success: function (data) {      
643           window.location.href = data;
644        },
645        error: function (errorThrown) {
646
647        }
648    });//end ajax    
649}
650
651jQuery(".pack-listing .buypackage").on( 'click', function(event) {
652    "use strict";
653    var stripe_pack_id,stripetitle2,stripetitle,stripepay;
654    jQuery(".pack-listing input").each(function(){
655        if( jQuery(this).is(":checked")){
656            jQuery(this).attr('checked', false); 
657            jQuery(this).parent().parent().removeClass("package_selected");
658        }
659    });
660    jQuery(this).find('input').attr('checked', true); 
661    jQuery(this).parent().addClass("package_selected");
662    
663    stripetitle         = jQuery(this).parent().find('.pack-listing-title').attr('data-stripetitle');
664    stripetitle2        = jQuery(this).parent().find('.pack-listing-title').attr('data-stripetitle2');
665    stripepay           = jQuery(this).parent().find('.pack-listing-title').attr('data-stripepay');
666    stripe_pack_id      = jQuery(this).parent().find('.pack-listing-title').attr('data-packid');
667 
668    jQuery('.stripe_buttons').attr("id",stripetitle2);
669    jQuery('#stripe_script').attr("data-amount",stripepay);
670    jQuery('#stripe_script').attr("data-description",stripetitle);
671  
672    jQuery('#pack_id').val(stripe_pack_id);
673    jQuery('#pack_title').val(stripetitle2);
674    jQuery('#pay_ammout').val(stripepay);
675    jQuery('#stripe_form').attr('data-amount',stripepay);
676    
677    
678    jQuery('.wpestate_stripe_pay_desc').html(control_vars.stripe_pay_for+" "+stripetitle2 );
679    jQuery('#wpestate_stripe_form_button_sumit').html(control_vars.stripe_pay+" "+stripepay/100+" "+control_vars.submission_curency);
680        
681    // enable stripe code
682      
683      
684});
685
686
687
688////////////////////////////////////////////////////////////////////////////////////////////
689/// pay package via paypal-jslint checked
690////////////////////////////////////////////////////////////////////////////////////////////   
691function wpestate_pay_pack_via_paypal() {
692    "use strict";
693    var  ajaxurl, packName, packId;
694    ajaxurl     =   control_vars.admin_url + 'admin-ajax.php';  
695    packName    =   jQuery('.package_selected .pack-listing-title').text();
696    packId      =   jQuery('.package_selected .pack-listing-title').attr('data-packid');
697    var nonce = jQuery('#wpestate_payments_nonce').val();
698    jQuery.ajax({
699        type: 'POST',
700        url: ajaxurl,
701        data: {
702            'action'        :   'wpestate_ajax_paypal_pack_generation',
703            'packName'      :   packName,
704            'packId'        :   packId,
705            'security'      :   nonce
706        },
707        success: function (data) {
708          
709           window.location.href = data;
710        },
711        error: function (errorThrown) {
712     
713        }
714    });//end ajax
715
716}
717////////////////////////////////////////////////////////////////////////////////////////////
718/// listing pay -jslint checked
719////////////////////////////////////////////////////////////////////////////////////////////
720function wpestate_listing_pay(prop_id, selected_div, is_featured, is_upgrade) {
721    "use strict";
722    var ajaxurl      =   control_vars.admin_url + 'admin-ajax.php';
723    var nonce = jQuery('#wpestate_payments_nonce').val();
724    jQuery.ajax({
725        type: 'POST',
726        url: ajaxurl,
727        data: {
728            'action'        :   'wpestate_ajax_listing_pay',
729            'propid'        :   prop_id,
730            'is_featured'   :   is_featured,
731            'is_upgrade'    :   is_upgrade,
732            'security'      :   nonce
733        },
734        success: function (data) {
735            window.location.href = data;
736        },
737        error: function (errorThrown) {
738        }
739    });//end ajax
740}
741
742////////////////////////////////////////////////////////////////////////////////////////////
743/// start filtering -jslint checked
744////////////////////////////////////////////////////////////////////////////////////////////
745function wpestate_start_filtering(newpage) {
746    "use strict";
747    jQuery('#gmap-loading').show();
748    jQuery('#grid_view').addClass('icon_selected');
749    jQuery('#list_view').removeClass('icon_selected');
750    
751    var action, category, county, city, area, order, ajaxurl,page_id;
752    // get action vars
753    action = jQuery('#a_filter_action').attr('data-value');
754    // get category
755    category = jQuery('#a_filter_categ').attr('data-value');
756    
757    // get county
758    county = jQuery('#a_filter_county').attr('data-value');
759 
760    // get city
761    city = jQuery('#a_filter_cities').attr('data-value');
762    // get area
763    area = jQuery('#a_filter_areas').attr('data-value');
764    // get order
765    order = jQuery('#a_filter_order').attr('data-value');
766    ajaxurl =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
767    page_id =   jQuery('#page_idx').val();
768    
769    jQuery('#listing_ajax_container').empty();
770    jQuery('#listing_loader').show();
771    var nonce = jQuery('#wpestate_ajax_filtering').val();
772
773   
774    jQuery.ajax({
775        type: 'POST',
776        url: ajaxurl,
777        dataType: 'json',
778        data: {
779            'action'            :   'wpestate_ajax_filter_listings',
780            'action_values'     :   action,
781            'category_values'   :   category,
782            'county'            :   county,
783            'city'              :   city,
784            'area'              :   area,
785            'order'             :   order,
786            'newpage'           :   newpage,
787            'page_id'           :   page_id,
788            'security'          :   nonce
789        },
790        success: function (data) {
791              
792            jQuery('#listing_loader').hide();
793            jQuery('#listing_ajax_container').empty().append(data.to_show);
794            jQuery('.pagination_nojax').hide();
795            wpestate_restart_js_after_ajax();
796            
797            // map update
798            var no_results = parseInt(data.no_results);
799             if(no_results!==0){
800                wpestate_load_on_demand_pins(data.markers,no_results,0);
801            }else{
802                wpestate_show_no_results();
803            }
804            
805            jQuery('.col-md-12.listing_wrapper .property_unit_custom_element.image').each(function(){
806                jQuery(this).parent().addClass('wrap_custom_image'); 
807            });
808            
809            jQuery('#gmap-loading').hide();
810
811        },
812        error: function (errorThrown) {
813          
814        }
815    });//end ajax
816}
817
818
819////////////////////////////////////////////////////////////////////////////////////////////
820/// change pass on profile-jslint checked
821////////////////////////////////////////////////////////////////////////////////////////////   
822function wpestate_change_pass_profile() {
823    "use strict";
824    var oldpass, newpass, renewpass, securitypass, ajaxurl;
825    oldpass         =  jQuery('#oldpass').val();
826    newpass         =  jQuery('#newpass').val();
827    renewpass       =  jQuery('#renewpass').val();
828    securitypass    =  jQuery('#security-pass').val();
829    ajaxurl         =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
830
831    jQuery.ajax({
832        type: 'POST',
833        url: ajaxurl,
834        data: {
835            'action'            :   'wpestate_ajax_update_pass',
836            'oldpass'           :   oldpass,
837            'newpass'           :   newpass,
838            'renewpass'         :   renewpass,
839            'security-pass'     :   securitypass
840        },
841        success: function (data) {
842            jQuery('#profile_pass').empty().append('<div class="login-alert">
842' + data + '<div>');
843            jQuery('#oldpass, #newpass, #renewpass').val('');
844        },
845        error: function (errorThrown) {
846        }
847    });
848}
849
850
851////////////////////////////////////////////////////////////////////////////////////////////
852/// user register -jslint checked
853////////////////////////////////////////////////////////////////////////////////////////////
854
855function wpestate_register_user(type) {
856    "use strict";
857    var capthca,user_login_register, user_email_register, user_pass, user_pass_retype, nonce, ajaxurl,new_user_type;
858    /* 1- topbar
859     * 2- widget
860     * 3- shortcode
861     * 4- modal !?
862     * 5 -mobile
863     */
864    
865    capthca='';
866  
867    ajaxurl             =  ajaxcalls_vars.admin_url + 'admin-ajax.php'; 
868    jQuery('#register_message_area_topbar').empty().append('<div class="login-alert">'+control_vars.procesing+'</div>');
869   
870    if(type===1){
871        if(control_vars.usecaptcha==='yes'){
872            capthca= grecaptcha.getResponse(
873                widgetId1
874            );
875        }
876        
877        user_login_register =  jQuery('#user_login_register_topbar').val();
878        user_email_register =  jQuery('#user_email_register_topbar').val();
879        nonce               =  jQuery('#security-register-topbar').val(); 
880        if(ajaxcalls_vars.userpass === 'yes'){
881            user_pass           =  jQuery('#user_password_topbar').val();
882            user_pass_retype    =  jQuery('#user_password_topbar_retype').val();
883        }
884        
885        
886        new_user_type= jQuery('#new_user_type_topbar').val();
887        
888        if ( !jQuery('#user_terms_register_topbar').is(":checked") ) {
889            jQuery('#register_message_area_topbar').empty().append('<div class="login-alert">'+control_vars.terms_cond+'</div>');
890            return;
891        }
892    }else if(type===2){
893       
894        if(control_vars.usecaptcha==='yes'){
895            capthca= grecaptcha.getResponse(
896                widgetId3
897            );
898        }
899        
900        user_login_register =  jQuery('#user_login_register_wd').val();
901        user_email_register =  jQuery('#user_email_register_wd').val();
902        nonce               =  jQuery('#security-register').val(); 
903        if(ajaxcalls_vars.userpass === 'yes'){
904            user_pass           =  jQuery('#user_password_wd').val();
905            user_pass_retype    =  jQuery('#user_password_wd_retype').val();
906        }
907        
908        new_user_type= jQuery('#new_user_type_wd').val();
909        
910        if ( !jQuery('#user_terms_register_wd').is(":checked") ) {
911            jQuery('#register_message_area_wd').empty().append('<div class="login-alert">'+control_vars.terms_cond+'</div>');
912            return;
913        }
914    }else if(type===3){
915       
916        if(control_vars.usecaptcha==='yes'){
917            capthca= grecaptcha.getResponse(
918                widgetId4
919            );
920        }
921        
922        user_login_register =  jQuery('#user_login_register').val();
923        user_email_register =  jQuery('#user_email_register').val();
924        nonce               =  jQuery('#security-register').val(); 
925        if(ajaxcalls_vars.userpass === 'yes'){
926            user_pass           =  jQuery('#user_password').val();
927            user_pass_retype    =  jQuery('#user_password_retype').val();
928        }
929        
930        new_user_type= jQuery('#new_user_type').val();
931        
932        if ( !jQuery('#user_terms_register_sh').is(":checked") ) {
933            jQuery('#register_message_area').empty().append('<div class="login-alert">'+control_vars.terms_cond+'</div>');
934            return;
935        }
936    }else if(type===5){
937      
938        if(control_vars.usecaptcha==='yes'){
939            capthca= grecaptcha.getResponse(
940                widgetId2
941            );
942        }
943        user_login_register =  jQuery('#user_login_register_mobile').val();
944        user_email_register =  jQuery('#user_email_register_mobile').val();
945        nonce               =  jQuery('#security-register-mobile').val(); 
946        if(ajaxcalls_vars.userpass === 'yes'){
947            user_pass           =  jQuery('#user_password_mobile').val();
948            user_pass_retype    =  jQuery('#user_password_mobile_retype').val();
949        }
950        
951        new_user_type= jQuery('#new_user_type_mobile').val();
952         
953   
954         
955         
956        if ( !jQuery('#user_terms_register_mobile').is(":checked") ) {
957            jQuery('#register_message_area_mobile').empty().append('<div class="login-alert">'+control_vars.terms_cond+'</div>');
958            return;
959        }
960    }
961    
962 
963
964    var nonce = jQuery('#wpestate_ajax_log_reg').val();
965    
966    jQuery.ajax({
967        type: 'POST',
968        url: ajaxurl,
969        data: {
970            'action'                    :   'wpestate_ajax_register_user',
971            'user_login_register'       :   user_login_register,
972            'user_email_register'       :   user_email_register,
973            'user_pass'                 :   user_pass,
974            'user_pass_retype'          :   user_pass_retype,
975            'type'                      :   type,
976            'security'                  :   nonce,
977            'capthca'                   :   capthca,
978            'new_user_type'             :   new_user_type
979        },
980
981        success: function (data) {
982           // This outputs the result of the ajax request
983        
984         
985            if(type===1){
986                jQuery('#register_message_area_topbar').empty().append('<div class="login-alert">
986' + data + '</div>');
987                jQuery('#user_login_register_topbar').val('');
988                jQuery('#user_email_register_topbar').val('');
989                jQuery('#user_password_topbar').val('');
990                jQuery('#user_password_topbar_retype').val('');
991                jQuery('#new_user_type_topbar').val('0');
992            }else  if(type===2){
993                jQuery('#register_message_area_wd').empty().append('<div class="login-alert">' + data + '</div>');
994                jQuery('#user_login_register_wd').val('');
995                jQuery('#user_email_register_wd').val('');
996                jQuery('#user_password_wd').val('');
997                jQuery('#user_password_wd_retype').val('');
998                jQuery('#new_user_type_wd').val('0');
999            }else  if(type===3){
1000                jQuery('#register_message_area').empty().append('<div class="login-alert">' + data + '</div>');
1001                jQuery('#user_login_register').val('');
1002                jQuery('#user_email_register').val('');
1003                jQuery('#user_password').val('');
1004                jQuery('#user_password_retype').val('');
1005                jQuery('#new_user_type').val('0');
1006            }else  if(type===5){
1007                jQuery('#register_message_area_mobile').empty().append('<div class="login-alert">' + data + '</div>');
1008                jQuery('#user_login_register_mobile').val('');
1009                jQuery('#user_email_register_mobile').val('');
1010                jQuery('#user_password_mobile').val('');
1011                jQuery('#user_password_mobile_retype').val('');
1012                jQuery('#new_user_type_mobile').val('0');
1013            }
1014        },
1015        error: function (errorThrown) {
1016        }
1017    });
1018}
1019
1020
1021
1022
1023
1024////////////////////////////////////////////////////////////////////////////////////////////
1025/// on ready -jslint checked
1026////////////////////////////////////////////////////////////////////////////////////////////
1027function wpestate_forgot(type) {
1028    "use strict";
1029   
1030    var  forgot_email, securityforgot, postid, ajaxurl;
1031     postid                =  jQuery('#postid').val();
1032     
1033    if(type===1){
1034        forgot_email          =  jQuery('#forgot_email').val();
1035        securityforgot        =  jQuery('#security-forgot').val();
1036    }
1037    if(type===2){
1038        forgot_email          =  jQuery('#forgot_email_topbar').val();
1039        securityforgot        =  jQuery('#security-forgot-topbar').val();
1040    }
1041    if(type===3){
1042        forgot_email          =  jQuery('#forgot_email_shortcode').val();
1043        securityforgot        =  jQuery('#security-login-forgot_wd').val();
1044    }
1045    if(type===5){
1046        forgot_email          =  jQuery('#forgot_email_mobile').val();
1047        securityforgot        =  jQuery('#security-forgot-mobile').val();
1048        postid                =  jQuery('#postid-mobile').val();
1049    }
1050    
1051    postid                =  jQuery('#postid').val();
1052    ajaxurl               =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
1053    var nonce = jQuery('#wpestate_ajax_log_reg').val();
1054    jQuery.ajax({
1055        type: 'POST',
1056        url: ajaxurl,
1057        data: {
1058            'action'            :   'wpestate_ajax_forgot_pass',
1059            'forgot_email'      :   forgot_email,
1060            'security'          :   nonce,
1061            'postid'            :   postid,
1062            'type'              :   type,
1063            'security'          :   nonce
1064        },
1065
1066        success: function (data) {
1067        
1068            if(type===1){
1069                jQuery('#forgot_email').val('');
1070                jQuery('#forgot_pass_area').empty().append('<div class="login-alert">' + data + '<div>');        
1071            }
1072            if(type===2){
1073                jQuery('#forgot_email_topbar').val('');
1074                jQuery('#forgot_pass_area_topbar').empty().append('<div class="login-alert">' + data + '<div>');        
1075            }
1076            if(type===3){
1077                jQuery('#forgot_email_shortcode').val('');
1078                jQuery('#forgot_pass_area_shortcode').empty().append('<div class="login-alert">
1078' + data + '<div>');        
1079            }
1080            if(type===5){
1081                jQuery('#forgot_email_mobile').val('');
1082                jQuery('#forgot_pass_area_mobile').empty().append('<div class="login-alert">' + data + '<div>');        
1083            }
1084        },
1085        error: function (errorThrown) {
1086        }
1087    });
1088}
1089
1090////////////////////////////////////////////////////////////////////////////////////////////
1091/// on ready-jslint checked
1092////////////////////////////////////////////////////////////////////////////////////////////   
1093function wpestate_login_wd() {
1094    "use strict";
1095    var login_user, login_pwd, ispop, ajaxurl, security;
1096
1097    login_user          =  jQuery('#login_user_wd').val();
1098    login_pwd           =  jQuery('#login_pwd_wd').val();
1099    security            =  jQuery('#security-login').val();
1100    ispop               =  jQuery('#loginpop_wd').val();
1101    ajaxurl             =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
1102
1103    jQuery('#login_message_area_wd').empty().append('<div class="login-alert">' + ajaxcalls_vars.login_loading + '</div>');
1104    var nonce = jQuery('#wpestate_ajax_log_reg').val();
1105    jQuery.ajax({
1106        type: 'POST',
1107        dataType: 'json',
1108        url: ajaxurl,
1109        data: {
1110            'action'            :   'wpestate_ajax_loginx_form',
1111            'login_user'        :   login_user,
1112            'login_pwd'         :   login_pwd,
1113            'ispop'             :   ispop,
1114            'security'          :   nonce
1115        },
1116
1117        success: function (data) {
1118            jQuery('#login_message_area_wd').empty().append('<div class="login-alert">' + data.message + '<div>');
1119            if (data.loggedin === true) {
1120                if (parseInt(data.ispop, 10) === 1) {
1121                    ajaxcalls_vars.userid = data.newuser;
1122                    jQuery('#ajax_login_container').remove();
1123                } else {
1124                    document.location.href = ajaxcalls_vars.login_redirect;
1125                }
1126                jQuery('#user_not_logged_in').hide();
1127                jQuery('#user_logged_in').show();
1128            } else {
1129                jQuery('#login_user').val('');
1130                jQuery('#login_pwd').val('');
1131            }
1132        },
1133        error: function (errorThrown) {
1134          
1135        }
1136    });
1137}
1138
1139
1140////////////////////////////////////////////////////////////////////////////////////////////
1141/// on ready-jslint checked
1142////////////////////////////////////////////////////////////////////////////////////////////   
1143function wpestate_login_topbar() {
1144    "use strict";
1145    var login_user, login_pwd, ispop, ajaxurl, security,ispop;
1146
1147    login_user          =  jQuery('#login_user_topbar').val();
1148    login_pwd           =  jQuery('#login_pwd_topbar').val();
1149    security            =  jQuery('#security-login-topbar').val();
1150    ajaxurl             =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
1151    ispop               =  jQuery('#loginpop').val();
1152
1153    if( jQuery('#loginpop_submit').val()==='3'){
1154       ispop=3;
1155    }
1156
1157
1158    jQuery('#login_message_area_topbar').empty().append('<div class="login-alert">' + ajaxcalls_vars.login_loading + '</div>');
1159    var nonce = jQuery('#wpestate_ajax_log_reg').val();
1160    jQuery.ajax({
1161        type: 'POST',
1162        dataType: 'json',
1163        url: ajaxurl,
1164        data: {
1165            'action'            :   'wpestate_ajax_loginx_form_topbar',
1166            'login_user'        :   login_user,
1167            'login_pwd'         :   login_pwd,
1168            'ispop'             :   ispop,
1169            'security'          :   nonce
1170        },
1171
1172        success: function (data) {
1173            var bgcolor ="";
1174            if(data.loggedin == true){
1175                bgcolor="alert-success";
1176            }else{
1177                bgcolor ="alert-danger";
1178            }
1179            jQuery('#login_message_area_topbar').empty().append('<div class="login-alert '+bgcolor+'">' + data.message + '<div>');
1180            if (data.loggedin === true) {
1181                 if (parseInt(data.ispop, 10) === 1) {
1182                   
1183                    ajaxcalls_vars.userid = data.newuser;
1184                   
1185                    jQuery('#user_menu_u.user_not_loged').unbind('click');
1186                    jQuery('#user_menu_u').removeClass('user_not_loged').addClass('user_loged');
1187                    jQuery('#modal_login_wrapper').hide();
1188                    wp_estate_update_menu_bar(data.newuser);
1189                    wpestate_open_menu();
1190                }else if (parseInt(data.ispop, 10) === 2) {
1191                    location.reload();
1192                }else if (parseInt(data.ispop, 10) === 3) {
1193                    ajaxcalls_vars.userid = data.newuser;
1194                    jQuery('#user_menu_u.user_not_loged').unbind('click');
1195                    jQuery('#user_menu_u').removeClass('user_not_loged').addClass('user_loged');
1196                    jQuery('#modal_login_wrapper').hide();
1197                    wp_estate_update_menu_bar(data.newuser);
1198                    wpestate_open_menu();
1199                 }else {
1200                    document.location.href = ajaxcalls_vars.login_redirect;
1201                }
1202                
1203             
1204            } else {
1205                jQuery('#login_user').val('');
1206                jQuery('#login_pwd').val('');
1207            }
1208        },
1209        error: function (errorThrown) {
1210         
1211        }
1212    });
1213}
1214
1215
1216function wpestate_login_mobile() {
1217    "use strict";
1218    var login_user, login_pwd, ispop, ajaxurl, security;
1219
1220    login_user          =  jQuery('#login_user_mobile').val();
1221    login_pwd           =  jQuery('#login_pwd_mobile').val();
1222    security            =  jQuery('#security-login-mobile').val();
1223    ajaxurl             =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
1224
1225    jQuery('#login_message_area_mobile').empty().append('<div class="login-alert">' + ajaxcalls_vars.login_loading + '</div>');
1226    var nonce = jQuery('#wpestate_ajax_log_reg').val();
1227    jQuery.ajax({
1228        type: 'POST',
1229        dataType: 'json',
1230        url: ajaxurl,
1231        data: {
1232            'action'            :   'wpestate_ajax_loginx_form_mobile',
1233            'login_user'        :   login_user,
1234            'login_pwd'         :   login_pwd,
1235             'security'          :   nonce
1236        },
1237
1238        success: function (data) {
1239     
1240            jQuery('#login_message_area_mobile').empty().append('<div class="login-alert">' + data.message + '<div>');
1241            if (data.loggedin === true) {
1242               
1243               if (parseInt(jQuery('#loginpop').val(), 10) === 2) {
1244                    location.reload();
1245                } else {
1246                    document.location.href = ajaxcalls_vars.login_redirect;
1247                }
1248            } else {
1249                jQuery('#login_user_mobile').val('');
1250                jQuery('#login_pwd_mobile').val('');
1251            }
1252        },
1253        error: function (errorThrown) {
1254           
1255        }
1256    });
1257}
1258
1259//////////////////////////////////////////////////////////////////////////////////
1260// login function -jslint checked
1261////////////////////////////////////////////////////////////////////////////////
1262function wpestate_login() {
1263    "use strict";
1264    var login_user, login_pwd, security, ispop, ajaxurl;
1265    login_user          =  jQuery('#login_user').val();
1266    login_pwd           =  jQuery('#login_pwd').val();
1267    security            =  jQuery('#security-login').val();
1268    ispop               =  jQuery('#loginpop').val();
1269    ajaxurl             =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
1270
1271    jQuery('#login_message_area').empty().append('<div class="login-alert">' + ajaxcalls_vars.login_loading + '</div>');
1272    var nonce = jQuery('#wpestate_ajax_log_reg').val();
1273    jQuery.ajax({
1274        type: 'POST',
1275        dataType: 'json',
1276        url: ajaxurl,
1277        data: {
1278            'action'            :   'wpestate_ajax_loginx_form',
1279            'login_user'        :   login_user,
1280            'login_pwd'         :   login_pwd,
1281            'ispop'             :   ispop,
1282            'security'          :   nonce
1283        },
1284        success: function (data) {
1285            jQuery('#login_message_area').empty().append('<div class="login-alert">' + data.message + '<div>');
1286            if (data.loggedin === true) {
1287                if (parseInt(data.ispop, 10) === 1) {
1288                   
1289                    ajaxcalls_vars.userid = data.newuser;
1290                    jQuery('#loginmodal').modal('hide');
1291                    wp_estate_update_menu_bar(data.newuser);
1292                } else {
1293                    document.location.href = ajaxcalls_vars.login_redirect;
1294                }
1295                jQuery('#user_not_logged_in').hide();
1296                jQuery('#user_logged_in').show();
1297            } else {
1298                jQuery('#login_user').val('');
1299                jQuery('#login_pwd').val('');
1300            }
1301        },
1302        error: function (errorThrown) {
1303        }
1304    });
1305}
1306
1307
1308
1309////////////////////////////////////////////////////////////////////////////////
1310// update bar after login -jslint checked
1311////////////////////////////////////////////////////////////////////////////////
1312function wp_estate_update_menu_bar(newuser) {
1313    "use strict";
1314    var usericon, ajaxurl;
1315    ajaxurl =   control_vars.admin_url + 'admin-ajax.php';
1316    var nonce = jQuery('#wpestate_ajax_filtering').val();
1317
1318    jQuery.ajax({
1319        type: 'POST',
1320        dataType: 'json',
1321        url: ajaxurl,
1322        data: {
1323            'action'            :   "wpestate_update_menu_bar",
1324            'newuser'           :    newuser,
1325            'security'          :    nonce
1326        },
1327        success: function (data) {
1328           
1329            jQuery('#user_menu_u').after(data.menu);
1330          
1331            usericon = '<a class="navicon-button x"><div class="navicon"></div></a><div class="menu_user_picture" style="background-image: url(' + data.picture + ')"></div>';
1332            jQuery('#user_menu_u').append(usericon).addClass('user_loged');
1333            jQuery('.submit_action').remove();
1334            jQuery('.submit_listing').remove();
1335            jQuery('#agent_property_ajax_nonce').val(data.nonce_contact);
1336            
1337        },
1338        error: function (errorThrown) {
1339        }
1340    });//end ajax
1341}
1342
1343////////////////////////////////////////////////////////////////////////////////////////////
1344// on ready -jslint checked
1345//  developer listing on tab click !!
1346////////////////////////////////////////////////////////////////////////////////////////////
1347jQuery(document).ready(function ($) {
1348    "use strict";
1349    
1350    
1351    
1352    $('.wpestate_social_login').on('click',function(){
1353       var ajaxurl         =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1354       var social_type     = $(this).attr('data-social'); 
1355       var nonce           = $(this).parent().find('.wpestate_social_login_nonce').val();
1356        $.ajax({
1357            type: 'POST',
1358            url: ajaxurl,
1359            data: {
1360                'action'       :   'wpestate_social_login_generate_link',
1361                'social_type'  :    social_type,
1362                'nonce'        :    nonce 
1363               
1364            },
1365            success: function (data) {
1366                window.location.href = data;
1367            },
1368            error: function (errorThrown) {
1369            }
1370        });
1371        
1372    });
1373    
1374    $('.developer_listing .term_bar_item').on( 'click', function(event) {
1375       
1376        // display load more
1377        var listing_parent_pointer = $(this).parents('.single_listing_block');	
1378        $('.load_more_ajax_cont .listing_load_more', listing_parent_pointer).fadeIn();
1379		
1380        $('.term_bar_item').removeClass('active_term');
1381        $(this).addClass('active_term');
1382        var ajaxurl         =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1383        var term_name       =   $(this).attr('data-term_name');
1384        var agency_id       =   $('.term_bar_wrapper').attr('data-agency_id');
1385        var post_id         =   $('.term_bar_wrapper').attr('data-post_id');
1386        var is_agency       =   0;
1387        var nonce = jQuery('#wpestate_developer_listing_nonce').val();
1388        if( $('.single-estate_agency').length >0){
1389            is_agency=1;
1390        }
1391      
1392        $('.agency_listings_wrapper').empty();
1393        $('#listing_loader').show();
1394      
1395    
1396       
1397        $.ajax({
1398            type: 'POST',
1399            url: ajaxurl,
1400            data: {
1401                'action'        :   'wpestate_agency_listings',
1402                'term_name'     :   term_name,
1403                'agency_id'     :   agency_id,
1404		'post_id'       :   post_id,
1405                'is_agency'     :   is_agency,
1406                'security'      :   nonce
1407               
1408            },
1409            success: function (data) {
1410              
1411                $('#listing_loader').hide();
1412                $('.agency_listings_wrapper').append(data);
1413                wpestate_restart_js_after_ajax();
1414               
1415                
1416            },
1417            error: function (errorThrown) {
1418            }
1419        });
1420       
1421       
1422        
1423    });
1424
1425
1426    ////////////////////////////////////////////////////////////////////////////////////////////
1427    // agent page listing tabs processing
1428    ////////////////////////////////////////////////////////////////////////////////////////////
1429
1430    $('.agent_listing .term_bar_item').on( 'click', function(event) {
1431        
1432        // display load more
1433        var listing_parent_pointer = $(this).parents('.single_listing_block');	
1434        $('.load_more_ajax_cont .listing_load_more', listing_parent_pointer).fadeIn();
1435		
1436		
1437        $('.term_bar_item').removeClass('active_term');
1438        $(this).addClass('active_term');
1439        var ajaxurl         =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1440        var term_name       =   $(this).attr('data-term_name');
1441        var agent_id        =   $('.term_bar_wrapper').attr('data-agent_id');
1442        var post_id         =   $('.term_bar_wrapper').attr('data-post_id');
1443        var nonce           =   jQuery('#wpestate_agent_listings_nonce').val();
1444        $('.agency_listings_wrapper').empty();
1445        $('#listing_loader', listing_parent_pointer).show();
1446      
1447
1448       
1449        $.ajax({
1450            type: 'POST',
1451            url: ajaxurl,
1452            data: {
1453                'action'        :   'wpestate_agent_listings',
1454                'term_name'     :   term_name,
1455                'agent_id'     :   agent_id,
1456                'post_id'     :   post_id,   
1457                'security'      : nonce,
1458            },
1459            success: function (data) {
1460				
1461                $('#listing_loader', listing_parent_pointer).hide();
1462                $('.agency_listings_wrapper').append(data);
1463                wpestate_restart_js_after_ajax();
1464               
1465                
1466            },
1467            error: function (errorThrown) {
1468            }
1469        });
1470       
1471       
1472        
1473    });
1474	
1475	
1476////////////////////////////////////////////////////////////////////////////////////////////
1477// agent / developer load more processing
1478////////////////////////////////////////////////////////////////////////////////////////////
1479 
1480    $('body').on( 'click', '.listing_load_more', function(event){
1481        
1482        var this_point              =   $(this);
1483        var listing_parent_pointer  =   $(this).parents('.single_listing_block');		
1484        var loaded_items            =   $('.agency_listings_wrapper .listing_wrapper', listing_parent_pointer).length;
1485        var active_tab              =   $('.active_term', listing_parent_pointer );
1486        var ajaxurl                 =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1487        var term_name               =   $(active_tab).attr('data-term_name');
1488        var agent_id                =   $('.term_bar_wrapper', listing_parent_pointer).attr('data-agent_id');
1489        var post_id                 =   $('.term_bar_wrapper', listing_parent_pointer).attr('data-post_id'); 
1490        var agency_id               =   $('.term_bar_wrapper', listing_parent_pointer).attr('data-agency_id');
1491        var is_agency               =   0;
1492        
1493        if( $('.single-estate_agency').length >0){
1494            is_agency=1;
1495        }
1496        $('#listing_loader', listing_parent_pointer).fadeIn();
1497
1498        
1499        if( agent_id ){
1500          
1501            var action_name = 'wpestate_agent_listings';
1502            var nonce = jQuery('#wpestate_agent_listings_nonce').val();
1503        }
1504        if( agency_id ){
1505            
1506            var action_name = 'wpestate_agency_listings';
1507            var nonce = jQuery('#wpestate_developer_listing_nonce').val();
1508        }
1509	  
1510      
1511  
1512        $.ajax({
1513            type: 'POST',
1514            url: ajaxurl,
1515            data: {
1516                'action'        :   action_name ,
1517                'term_name'     :   term_name,
1518                'agent_id'      :   agent_id,  
1519                'agency_id'     :   agency_id,
1520                'post_id'       :   post_id,  
1521                'loaded'        :   loaded_items,
1522                'is_agency'     :   is_agency,
1523                'security'      :   nonce
1524            },
1525            success: function (data) {
1526 
1527                $('#listing_loader', listing_parent_pointer).fadeOut();
1528                var count = (data.match(/is/g) || []).length;
1529                if( count === 0 ){
1530                    this_point.fadeOut();
1531                }else{
1532                    $('.agency_listings_wrapper').append(data);
1533                }
1534
1535                wpestate_restart_js_after_ajax();
1536            },
1537            error: function (errorThrown) {
1538            
1539            }
1540        });
1541 
1542    });
1543	
1544    
1545    
1546    ///////////////////////////////////////////////////////////////////////////////////////////
1547    //// stripe cancel
1548    ///////////////////////////////////////////////////////////////////////////////////////////
1549   $('.disable_listing').on( 'click', function(event) {
1550      
1551        event.stopPropagation();
1552        var prop_id     =   $(this).attr('data-postid');
1553        var ajaxurl     =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1554        var is_disabled =   0;
1555        if ( $(this).hasClass('disabledx') ){
1556            is_disabled=1;
1557            $(this).removeClass('disabledx');
1558        }else{
1559            $(this).addClass('disabledx');
1560        }
1561        var element     = $(this);
1562        var container   = $(this).parent().parent().parent(); 
1563        var is_agent    =   0;
1564        if(jQuery(this).hasClass('disable_agent')){
1565            var nonce       = jQuery('#wpestate_agent_actions').val();
1566            is_agent=1;
1567        }else{
1568            var nonce       = jQuery('#wpestate_property_actions').val();
1569        }
1570     
1571        $.ajax({
1572            type: 'POST',
1573            url: ajaxurl,
1574            data: {
1575                'action'       :   'wpestate_disable_listing',
1576                'security'     :   nonce,
1577                'prop_id'      :   prop_id,
1578                'is_agent'     :   is_agent
1579                
1580            },
1581            success: function (data) {
1582                var label_text='';
1583                if (is_disabled===1){
1584                    element.empty().append('<i class="fa fa-play"></i>');
1585                    container.find('.user_dashboard_status').empty().append('<span class="label label-info">'+ajaxcalls_vars.disabled+'</span>');
1586                 
1587                  
1588                    if( jQuery('.page-template-user_dashboard_agent_list').length > 0){
1589                        label_text= ajaxcalls_vars.enableagent;
1590                    }else{
1591                        label_text= ajaxcalls_vars.enablelisting;
1592                    }
1593                    
1594                    element.tooltip('hide')
1595                    .attr('data-original-title',label_text )
1596                    .tooltip('fixTitle')
1597                    .tooltip('show');
1598                    
1599
1600  
1601                }else{
1602                    if( jQuery('.page-template-user_dashboard_agent_list').length > 0){
1603                        label_text= ajaxcalls_vars.disableagent;
1604                    }else{
1605                        label_text= ajaxcalls_vars.disablelisting;
1606                    }
1607                     
1608                    element.empty().append('<i class="fa fa-pause"></i>');
1609                    container.find('.user_dashboard_status').empty().append('<span class="label label-success">'+ajaxcalls_vars.published+'</span>');
1610                    element.tooltip('hide')
1611                    .attr('data-original-title', label_text)
1612                    .tooltip('fixTitle')
1613                    .tooltip('show');
1614                    
1615                }
1616               
1617                
1618            },
1619            error: function (errorThrown) {
1620            }
1621        });
1622    });
1623
1624    ///////////////////////////////////////////////////////////////////////////////////////////
1625    //// stripe cancel
1626    ///////////////////////////////////////////////////////////////////////////////////////////
1627    $('#stripe_cancel').on( 'click', function(event) {
1628       
1629        var stripe_user_id, ajaxurl;
1630        stripe_user_id    =   $(this).attr('data-stripeid');
1631        ajaxurl         =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1632        $('#stripe_cancel').text(ajaxcalls_vars.saving);
1633        var nonce = jQuery('#wpestate_stripe_cancel_nonce').val();
1634        
1635        $.ajax({
1636            type: 'POST',
1637            url: ajaxurl,
1638            data: {
1639                'action'                  :   'wpestate_cancel_stripe',
1640                'stripe_customer_id'      :   stripe_user_id,
1641                'security'                :     nonce,
1642               
1643            },
1644            success: function (data) {
1645                $('#stripe_cancel').text(ajaxcalls_vars.stripecancel);
1646            },
1647            error: function (errorThrown) {
1648            }
1649        });
1650    });
1651
1652
1653    ////////////////////////////////////////////////////////////////////////////////////////////
1654    /// resend for approval  
1655    ///////////////////////////////////////////////////////////////////////////////////////////
1656    $('.resend_pending').on( 'click', function(event) {
1657      
1658        var prop_id = $(this).attr('data-listingid');
1659        wpestate_resend_for_approval(prop_id, $(this));
1660    });
1661
1662    ///////////////////////////////////////////////////////////////////////////////////////////  
1663    ////////  set featured inside membership
1664    ///////////////////////////////////////////////////////////////////////////////////////////  
1665    $('.make_featured').on( 'click', function(event) {
1666        
1667        var prop_id = $(this).attr('data-postid');
1668        wpestate_make_prop_featured(prop_id, $(this));
1669        $(this).unbind( "click" );
1670    });
1671    
1672    jQuery('#wpestate_stripe_booking_recurring').on('click',function(){
1673        
1674        var modalid=jQuery(this).attr('data-modalid');
1675        jQuery('#'+modalid).show();
1676        jQuery('#'+modalid+' .wpestate_stripe_form_1').show();
1677        
1678        wpestate_start_stripe(1,modalid);
1679    });
1680
1681    ///////////////////////////////////////////////////////////////////////////////////////////  
1682    ////////  pack upgrade via paypal    
1683    ///////////////////////////////////////////////////////////////////////////////////////////  
1684    $('#pick_pack').on( 'click', function(event) {
1685      
1686        var pay_paypal;
1687        pay_paypal='<div class="modal fade" id="paypal_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-body listing-submit">'+ajaxcalls_vars.paypal+'</div></div></div></div></div>';
1688        jQuery('body').append(pay_paypal);
1689        jQuery('#paypal_modal').modal();
1690            
1691            
1692        if ($('#pack_recuring').is(':checked')) {
1693            wpestate_recuring_pay_pack_via_paypal();
1694        } else {
1695            wpestate_pay_pack_via_paypal();
1696        }
1697    });
1698
1699    ///////////////////////////////////////////////////////////////////////////////////////////  
1700    //////// listing pay via paypal
1701    ///////////////////////////////////////////////////////////////////////////////////////////  
1702    $('.listing_submit_normal').on( 'click', function(event) {
1703        var prop_id, featured_checker, is_featured, is_upgrade,pay_paypal;
1704        pay_paypal='<div class="modal fade" id="paypal_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-body listing-submit">'+ajaxcalls_vars.paypal+'</div></div></div></div></div>';
1705        jQuery('body').append(pay_paypal);
1706        jQuery('#paypal_modal').modal();
1707        
1708        
1709        prop_id = $(this).attr('data-listingid');
1710        featured_checker = $(this).parent().find('input');
1711        is_featured = 0;
1712        is_upgrade = 0;
1713
1714        if (featured_checker.prop('checked')) {
1715            is_featured = 1;
1716        } else {
1717            is_featured = 0;
1718        }
1719
1720        wpestate_listing_pay(prop_id, $(this), is_featured, is_upgrade);
1721    });
1722
1723    jQuery('.woo_pay_submit').on('click',function () {
1724        var pay_paypal, prop_id, book_id, invoice_id, is_featured, is_upgrade,ajaxurl,depozit,is_submit,pack_id;
1725        prop_id     =   jQuery(this).attr('data-propid');
1726        depozit     =   jQuery(this).attr('data-deposit');
1727        is_featured =   jQuery(this).attr('data-is_featured');
1728        pack_id     =   jQuery('.package_selected').attr('data-id');
1729        is_upgrade  =   0;
1730        is_submit   =   1;
1731        if(jQuery('#open_packages').length>0){
1732            is_submit=0;
1733        }
1734        book_id     =   '';
1735        invoice_id  =   '';
1736       
1737        ajaxurl     =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1738        jQuery.ajax({
1739                type: 'POST',
1740                url: ajaxurl,
1741                data: {
1742                    'action'        :   'wpestate_woo_pay',
1743                    'propid'        :   prop_id,
1744                    'depozit'       :   depozit,
1745                    'is_submit'     :   is_submit,
1746                    'is_featured'   :   is_featured,
1747                    'pack_id'       :   pack_id,
1748                    'book_id'       :   book_id,
1749                    'invoiceid'     :   invoice_id,
1750//                    'price_pack'    :   price_pack,
1751//                    'security'      :   nonce,
1752                },
1753                success: function (data) {
1754                    if(data!==false){
1755                        window.location.href= ajaxcalls_vars.checkout_url;
1756                    }
1757                },
1758                error: function (errorThrown) {}
1759        });//end ajax  
1760    });
1761    
1762    $('.listing_upgrade').on( 'click', function(event) {
1763        var is_upgrade, is_featured, prop_id;
1764        is_upgrade = 1;
1765        is_featured = 0;
1766        prop_id = $(this).attr('data-listingid');
1767        wpestate_listing_pay(prop_id, $(this), is_featured, is_upgrade);
1768    });
1769
1770   
1771 
1772    ///////////////////////////////////////////////////////////////////////////////////////////
1773    /////// Property page  + ajax call on contact
1774    ///////////////////////////////////////////////////////////////////////////////////////////
1775
1776        
1777    $('.agent_submit_class').on( 'click', function(event) {
1778
1779        var parent,contact_name, contact_email, contact_phone, contact_coment, agent_id, property_id, nonce, ajaxurl;
1780        parent=$(this).parent();
1781        contact_name    =   parent.find('#agent_contact_name').val();
1782        contact_email   =   parent.find('#agent_user_email').val();
1783        contact_phone   =   parent.find('#agent_phone').val();
1784        contact_coment  =   parent.find('#agent_comment').val();
1785        agent_id        =   parent.find('#agent_id').val();
1786        property_id     =   parent.find('#agent_property_id').val();
1787        nonce           =   parent.find('#agent_property_ajax_nonce').val();
1788        ajaxurl         =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1789        var schedule_day    =   parent.find('#schedule_day').val();
1790        var schedule_hour   =   parent.find('#schedule_hour').val();
1791        
1792        if(ajaxcalls_vars.use_gdpr==='yes'){
1793            if ( !$('#wpestate_agree_gdpr').is(':checked') ){
1794                parent.find('#alert-agent-contact').empty().append(ajaxcalls_vars.gdpr_terms);
1795                return;
1796            }
1797        }
1798        
1799        
1800        parent.find('#alert-agent-contact').empty().append(ajaxcalls_vars.sending);
1801
1802        $.ajax({
1803            type: 'POST',
1804            dataType: 'json',
1805            url: ajaxurl,
1806            data: {
1807                'action'    :   'wpestate_ajax_agent_contact_form',
1808                'name'      :   contact_name,
1809                'email'     :   contact_email,
1810                'phone'     :   contact_phone,
1811                'comment'   :   contact_coment,
1812                'agent_id'  :   agent_id,
1813                'propid'    :   property_id,
1814                'schedule_day'  :   schedule_day,
1815                'schedule_hour' :   schedule_hour,
1816                'nonce'     :   nonce
1817            },
1818            success: function (data) {
1819             
1820                if (data.sent) {
1821                    parent.find('#agent_contact_name').val('');
1822                    parent.find('#agent_user_email').val('');
1823                    parent.find('#agent_phone').val('');
1824                    parent.find('#agent_comment').val('');
1825                    parent.find('#schedule_day').val('');
1826                    parent.find('#schedule_hour').val('');
1827                }
1828                parent.find('#alert-agent-contact').empty().append(data.response);
1829            },
1830            error: function (errorThrown) {
1831            
1832            }
1833        });
1834    });
1835
1836   
1837    $('.message_submit').on( 'click', function(event) {
1838      
1839        if (parseInt(ajaxcalls_vars.userid, 10) === 0 ) { 
1840            if (!Modernizr.mq('only all and (max-width: 768px)')) {
1841                jQuery('#modal_login_wrapper').show(); 
1842                jQuery('#loginpop').val('1');
1843            }else{
1844                jQuery('.mobile-trigger-user').trigger('click');
1845            }
1846        } else {
1847          
1848            var parent=$(this).parent();
1849            var contact_name    =   parent.find('#agent_contact_name').val();
1850            var contact_email   =   parent.find('#agent_user_email').val();
1851            var contact_phone   =   parent.find('#agent_phone').val();
1852            var contact_coment  =   parent.find('#agent_comment').val();
1853            var agent_id        =   parent.find('#agent_id').val();
1854            var property_id     =   parent.find('#agent_property_id').val();
1855            var nonce           =   parent.find('#agent_property_ajax_nonce').val();
1856            var ajaxurl         =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1857            var schedule_day    =   parent.find('#schedule_day').val();
1858            var schedule_hour   =   parent.find('#schedule_hour').val();
1859            
1860            
1861            
1862            parent.find('#alert-agent-contact').empty().append(ajaxcalls_vars.sending);
1863
1864            $.ajax({
1865                type: 'POST',
1866                dataType: 'json',
1867                url: ajaxurl,
1868                data: {
1869                    'action'        :   'wpestate_ajax_send_message',
1870                    'name'          :   contact_name,
1871                    'email'         :   contact_email,
1872                    'phone'         :   contact_phone,
1873                    'comment'       :   contact_coment,
1874                    'agent_id'      :   agent_id,
1875                    'propid'        :   property_id,
1876                    'schedule_day'  :   schedule_day,
1877                    'schedule_hour' :   schedule_hour,
1878                    'nonce'         :   nonce
1879                },
1880                success: function (data) {
1881                  
1882                    if (data.sent) {
1883                        parent.find('#agent_contact_name').val('');
1884                        parent.find('#agent_user_email').val('');
1885                        parent.find('#agent_phone').val('');
1886                        parent.find('#agent_comment').val('');
1887                        parent.find('#schedule_day').val('');
1888                        parent.find('#schedule_hour').val('');
1889                    }
1890                    parent.find('#alert-agent-contact').empty().append(data.response);
1891                },
1892                error: function (errorThrown) {
1893                
1894                }
1895            });
1896        }
1897    });
1898
1899    ///////////////////////////////////////////////////////////////////////////////////////////  
1900    ////////  property listing listing
1901    ////////////////////////////////////////////////////////////////////////////////////////////       
1902
1903    $('.listing_filters_head li').on( 'click', function(event) {
1904      
1905        var pick, value, parent;
1906        pick = $(this).text();
1907        value = $(this).attr('data-value');
1908        parent = $(this).parent().parent();
1909        parent.find('.filter_menu_trigger').text(pick).append('<span class="caret caret_filter"></span>').attr('data-value',value);
1910        parent.find('input:hidden'). val(value);
1911       
1912        wpestate_start_filtering(1);
1913        
1914       
1915    });
1916    
1917    
1918    
1919    
1920    ///////////////////////////////////////////////////////////////////////////////////////////  
1921    //////// advanced search filtering
1922    ////////////////////////////////////////////////////////////////////////////////////////////       
1923
1924    $('.adv_listing_filters_head li').on( 'click', function(event) {
1925     
1926        var pick, value, parent, args,page_id,ajaxurl;
1927        ajaxurl         =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1928        pick        = $(this).text();
1929        value       = $(this).attr('data-value');
1930        parent      = $(this).parent().parent();
1931        parent.find('.filter_menu_trigger').text(pick).append('<span class="caret caret_filter"></span>').attr('data-value',value);
1932        args        = $('#searcharg').val();
1933        page_id     = $('#page_idx').val();
1934        $('#listing_ajax_container').empty();
1935        $('#listing_loader').show();
1936        var nonce = jQuery('#wpestate_search_nonce').val();
1937        $.ajax({
1938            type: 'POST',
1939            url: ajaxurl,
1940
1941            data: {
1942                'action'    :   'wpestate_advanced_search_filters',
1943                'args'      :   args,
1944                'value'     :   value,
1945                'page_id'   :   page_id,
1946                'security'  :   nonce
1947            },
1948            success: function (data) {
1949                $('#listing_loader').hide();
1950                $('#listing_ajax_container').append(data);
1951                wpestate_restart_js_after_ajax();
1952                wpestate_add_pagination_orderby();
1953            },
1954            error: function (errorThrown) {
1955            }
1956        }); //end ajax
1957    });
1958
1959   
1960    function wpestate_add_pagination_orderby(){
1961       
1962        var   order = $('#a_filter_order').attr('data-value');
1963        jQuery('.pagination a').each(function(){
1964            var href = $(this).attr('href');
1965            href=href+"&order_search="+order;
1966            $(this).attr('href',href);
1967        });
1968    }
1969
1970    ///////////////////////////////////////////////////////////////////////////////////////////  
1971    ////////  Ajax add to favorites on listing
1972    ////////////////////////////////////////////////////////////////////////////////////////////        
1973    $('.icon-fav').on( 'click', function(event) {
1974   
1975        event.stopPropagation();
1976        var icon = $(this);
1977        wpestate_add_remove_favorite(icon);
1978    });
1979
1980    // remove from fav listing on user profile
1981    $('.icon-fav-on-remove').on( 'click', function(event) {
1982        event.stopPropagation();
1983        $(this).parent().parent().remove();
1984        
1985    });
1986
1987    ///////////////////////////////////////////////////////////////////////////////////////////  
1988    ////////  Ajax add to favorites on propr
1989    ////////////////////////////////////////////////////////////////////////////////////////////        
1990    $('#add_favorites').on( 'click', function(event) {
1991      
1992        var post_id, securitypass, ajaxurl;
1993        post_id         =  $('#add_favorites').attr('data-postid');
1994        securitypass    =  $('#security-pass').val();
1995        ajaxurl         =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
1996        var nonce = jQuery('#wpestate_ajax_filtering').val();
1997        
1998        if (parseInt(ajaxcalls_vars.userid, 10)  === 0) {
1999            if (!Modernizr.mq('only all and (max-width: 768px)')) {
2000                jQuery('#modal_login_wrapper').show(); 
2001                jQuery('#loginpop').val('1');
2002            }else{
2003                jQuery('.mobile-trigger-user').trigger('click');
2004            }
2005       
2006        } else {
2007            $('#add_favorites').text(ajaxcalls_vars.saving);
2008            $.ajax({
2009                type: 'POST',
2010                url: ajaxurl,
2011                dataType: 'json',
2012                data: {
2013                    'action'            :   'wpestate_ajax_add_fav',
2014                    'post_id'           :    post_id,
2015                    'security'          :     nonce
2016                },
2017                success: function (data) {
2018                    if (data.added) {
2019                        $('#add_favorites').text(ajaxcalls_vars.favorite).removeClass('isnotfavorite').addClass('isfavorite');
2020                    } else {
2021                        $('#add_favorites').text(ajaxcalls_vars.add_favorite).removeClass('isfavorite').addClass('isnotfavorite');
2022                    }
2023                },
2024                error: function (errorThrown) {
2025                }
2026            }); //end ajax
2027        }// end check login
2028    });
2029
2030
2031    ////////////////////////////////////////////////////////////////////////////////
2032    // register calls and functions
2033    ////////////////////////////////////////////////////////////////////////////////
2034    $('#wp-submit-register').on( 'click', function(event) {
2035     
2036        wpestate_register_user(3);
2037    });
2038
2039    jQuery('#user_email_register, #user_login_register, #user_password, #user_password_retype').keydown(function (e) {
2040      
2041        if (e.keyCode === 13) {
2042            e.preventDefault();
2043            wpestate_register_user(3);
2044        }
2045    });
2046
2047    ///////////////////////////////////////////////////////////////////////////////////////////  
2048    ////////  WIDGET Register ajax
2049    ////////////////////////////////////////////////////////////////////////////////////////////
2050    $('#wp-submit-register_wd').on( 'click', function() {
2051
2052        wpestate_register_user(2);
2053    });
2054
2055    $('#user_email_register_wd, #user_login_register_wd').keydown(function (e) {
2056     
2057        if (e.keyCode === 13) {
2058            e.preventDefault();
2059            wpestate_register_user(2);
2060        }
2061    });
2062   
2063    ///////////////////////////////////////////////////////////////////////////////////////////  
2064    ////////  TOPBAR Register ajax
2065    ////////////////////////////////////////////////////////////////////////////////////////////
2066    $('#wp-submit-register_topbar').on( 'click', function() {
2067
2068        wpestate_register_user(1);
2069    });
2070
2071    $('#user_email_register_topbar, #user_login_register_topbar, #user_password_topbar, #user_password_topbar_retype').keydown(function (e) {
2072      
2073        if (e.keyCode === 13) {
2074            e.preventDefault();
2075            wpestate_register_user(1);
2076        }
2077    });
2078    
2079     $('#wp-submit-register_mobile').on( 'click', function() {
2080
2081        wpestate_register_user(5);
2082    });
2083
2084    $('#user_email_register_mobile, #user_login_register_mobile, #user_password_mobile, #user_password_mobile_retype').keydown(function (e) {
2085
2086        if (e.keyCode === 13) {
2087            e.preventDefault();
2088            wpestate_register_user(5);
2089        }
2090    });
2091    
2092    
2093    ///////////////////////////////////////////////////////////////////////////////////////////  
2094    ////////  login/forgot password  actions
2095    ////////////////////////////////////////////////////////////////////////////////////////////  
2096    $('#forgot_pass').on( 'click', function(event) {
2097
2098        event.preventDefault();
2099        $("#login-div").hide();
2100        $("#forgot-pass-div-sh").show();
2101    });
2102
2103    $('#return_login').on( 'click', function(event) {
2104   
2105        event.preventDefault();
2106        $("#forgot-pass-div-sh").hide();
2107        $("#login-div").show();
2108    });
2109
2110
2111    $('#forgot_pass_topbar').on( 'click', function(event) {
2112
2113        event.preventDefault();
2114        $("#login-div_topbar,#login-div-title-topbar,#register-div-topbar,#login-div_topbar,#register-div-title-topbar").hide();
2115        $("#forgot-div-title-topbar,#forgot-pass-div").show();
2116        $('#forgot_pass_topbar').hide();
2117    });
2118
2119
2120    $('#forgot_pass_mobile').on( 'click', function(event) {
2121
2122        event.preventDefault();
2123        $("#login-div_mobile,#login-div-title-mobile").hide();
2124        $("#forgot-div-title-mobile,#forgot-pass-div-mobile").show();
2125    });
2126
2127
2128    $('#return_login_topbar').on( 'click', function(event) {
2129
2130        event.preventDefault();
2131        $("#forgot-div-title-topbar,#forgot-pass-div").hide();
2132        $("#login-div_topbar,#login-div-title-topbar").show();
2133    });
2134
2135    $('#return_login_mobile').on( 'click', function(event) {
2136
2137        event.preventDefault();
2138        $("#forgot-div-title-mobile,#forgot-pass-div-mobile").hide();
2139        $("#login-div_mobile,#login-div-title-mobile").show();
2140    });
2141
2142    $('#forgot_pass_widget').on( 'click', function(event) {
2143
2144        event.preventDefault();
2145        $("#login-div-title,#login-div").hide();
2146        $("#forgot-pass-div_shortcode,#forgot-div-title_shortcode").show();
2147    });
2148
2149    $('#return_login_shortcode').on( 'click', function(event) {
2150
2151        event.preventDefault();
2152        $("#forgot-pass-div_shortcode,#forgot-div-title_shortcode").hide();
2153        $("#login-div-title,#login-div").show();
2154    });
2155
2156    ///////////////////////////////////////////////////////////////////////////////////////////  
2157    ////////  forgot pass  
2158    ////////////////////////////////////////////////////////////////////////////////////////////
2159    $('#wp-forgot-but').on( 'click', function() {
2160
2161        wpestate_forgot(1);
2162    });
2163    
2164    $('#wp-forgot-but-topbar').on( 'click', function() {
2165        wpestate_forgot(2);
2166    });
2167     
2168    $('#wp-forgot-but-mobile').on( 'click', function() {
2169        wpestate_forgot(5);
2170    });
2171    
2172    
2173    $('#wp-forgot-but_shortcode').on( 'click', function() {
2174        wpestate_forgot(3);
2175    });
2176    
2177
2178    $('#forgot_email').keydown(function (e) {
2179
2180        if (e.keyCode === 13) {
2181            e.preventDefault();
2182            wpestate_forgot(1);
2183        }
2184    });
2185
2186    $('#forgot_email_topbar').keydown(function (e) {
2187
2188        if (e.keyCode === 13) {
2189            e.preventDefault();
2190            wpestate_forgot(2);
2191        }
2192    });
2193    
2194    $('#forgot_email_topbar').keydown(function (e) {
2195
2196        if (e.keyCode === 13) {
2197            e.preventDefault();
2198            wpestate_forgot(3);
2199        }
2200    });
2201    
2202    
2203    ///////////////////////////////////////////////////////////////////////////////////////////  
2204    //////// TOPBAR  login/forgot password  actions
2205    ////////////////////////////////////////////////////////////////////////////////////////////     
2206    $('#widget_register_topbar').on( 'click', function(event) {
2207
2208        event.preventDefault();
2209        $('#login-div_topbar,#widget_register_topbar,#login-div-title-topbar,#forgot-div-title-topbar,#forgot-pass-div').hide();
2210        $('#register-div-topbar,#register-div-title-topbar,#widget_login_topbar,#forgot_pass_topbar').show();
2211   
2212    });
2213
2214    $('#widget_login_topbar').on( 'click', function(event) {
2215
2216        event.preventDefault();
2217        $('#login-div_topbar,#widget_register_topbar,#login-div-title-topbar,#forgot_pass_topbar').show();
2218        $('#register-div-topbar,#register-div-title-topbar,#widget_login_topbar,#forgot-div-title-topbar,#forgot-pass-div').hide();
2219    });
2220    
2221    $('#widget_register_mobile').on( 'click', function(event) {
2222
2223        event.preventDefault();
2224        $('#login-div_mobile').hide();
2225        $('#register-div-mobile').show();
2226        $('#login-div-title-mobile').hide();
2227        $('#register-div-title-mobile').show();
2228    });
2229
2230    $('#widget_login_mobile').on( 'click', function(event) {
2231
2232        event.preventDefault();
2233        $('#login-div_mobile').show();
2234        $('#register-div-mobile').hide();
2235        $('#login-div-title-mobile').show();
2236        $('#register-div-title-mobile').hide();
2237    });
2238    
2239    
2240    
2241    
2242    ///////////////////////////////////////////////////////////////////////////////////////////  
2243    //////// WIDGET  login/forgot password  actions
2244    ////////////////////////////////////////////////////////////////////////////////////////////     
2245    $('#widget_register_sw').on( 'click', function(event) {
2246
2247        event.preventDefault();
2248        $('.loginwd_sidebar #login-div').hide();
2249        $('.loginwd_sidebar #register-div').show();
2250        $('.loginwd_sidebar #login-div-title').hide();
2251        $('.loginwd_sidebar #register-div-title').show();
2252    });
2253
2254    $('#widget_login_sw').on( 'click', function(event) {
2255
2256        event.preventDefault();
2257        $('.loginwd_sidebar #register-div').hide();
2258        $('.loginwd_sidebar #login-div').show();
2259        $('.loginwd_sidebar #register-div-title').hide();
2260        $('.loginwd_sidebar #login-div-title').show();
2261    });
2262
2263    ///////////////////////////////////////////////////////////////////////////////////////////  
2264    ////////  login  ajax
2265    ////////////////////////////////////////////////////////////////////////////////////////////
2266    $('#wp-login-but').on( 'click', function() {
2267        wpestate_login();
2268    });
2269
2270    $('#login_pwd, #login_user').keydown(function (e) {
2271        if (e.keyCode === 13) {
2272            e.preventDefault();
2273            wpestate_login();
2274        }
2275    });
2276
2277    ///////////////////////////////////////////////////////////////////////////////////////////  
2278    ////////  WIDGET login  ajax
2279    ////////////////////////////////////////////////////////////////////////////////////////////
2280
2281    $('#wp-login-but-wd').on( 'click', function() {
2282        wpestate_login_wd();
2283    });
2284
2285    $('#login_pwd_wd, #login_user_wd').keydown(function (e) {
2286        if (e.keyCode === 13) {
2287            e.preventDefault();
2288            wpestate_login_wd();
2289        }
2290    });
2291
2292    ///////////////////////////////////////////////////////////////////////////////////////////  
2293    ////////  TOPBAR  login  ajax
2294    ////////////////////////////////////////////////////////////////////////////////////////////
2295
2296    $('#wp-login-but-topbar').on( 'click', function() {
2297        wpestate_login_topbar();
2298    });
2299
2300    $('#login_pwd_topbar, #login_user_topbar').keydown(function (e) {	
2301        if (e.keyCode === 13) {
2302            e.preventDefault();
2303            wpestate_login_topbar();
2304        }
2305    });
2306
2307    $('#wp-login-but-mobile').on( 'click', function() {
2308        wpestate_login_mobile();
2309    });
2310
2311    $('#login_pwd_mobile, #login_user_mobile').keydown(function (e) {
2312        if (e.keyCode === 13) {
2313            e.preventDefault();
2314            wpestate_login_mobile();
2315        }
2316    });
2317    
2318
2319    ///////////////////////////////////////////////////////////////////////////////////////////  
2320    ////////  Ajax update password
2321    //////////////////////////////////////////////////////////////////////////////////////////// 
2322    $('#oldpass, #newpass, #renewpass').keydown(function (e) {
2323        if (e.keyCode === 13) {
2324            e.preventDefault();
2325            wpestate_change_pass_profile();
2326        }
2327    });
2328
2329    $('#change_pass').on( 'click', function(event) {
2330        wpestate_change_pass_profile();
2331    });
2332  
2333    ///////////////////////////////////////////////////////////////////////////////////////////  
2334    ////////  update profile
2335    ////////////////////////////////////////////////////////////////////////////////////////////   
2336   $('#register_agent').on( 'click', function(event) {
2337        var firstname       =  $('#firstname').val();
2338        var secondname      =  $('#secondname').val();
2339        var useremail       =  $('#useremail').val();
2340        var userphone       =  $('#userphone').val();
2341        var usermobile      =  $('#usermobile').val();
2342        var userskype       =  $('#userskype').val();
2343        var usertitle       =  $('#usertitle').val();
2344        var description     =  $('#about_me').val();
2345        var userfacebook    =  $('#userfacebook').val();
2346        var usertwitter     =  $('#usertwitter').val();
2347        var userlinkedin    =  $('#userlinkedin').val();
2348        var userpinterest   =  $('#userpinterest').val();
2349        var userinstagram   =  $('#userinstagram').val();
2350        var userurl         =  $('#website').val();
2351        var agent_username          =   $('#agent_username').val();
2352        var agent_password          =   $('#agent_password').val();
2353        var agent_repassword        =   $('#agent_repassword').val();        
2354        var agent_category_submit   =   $('#agent_category_submit').val();
2355        var agent_action_submit     =   $('#agent_action_submit').val();
2356        var agent_city              =   $('#agent_city').val();
2357        var agent_county            =   $('#agent_county').val();       
2358        var agent_member            =   $('#agent_member').val();
2359        var agent_area              =   $('#agent_area').val();
2360        var is_agent_edit           =   $('#is_agent_edit').val();
2361        var user_id                 =   $('#user_id').val();
2362        var agent_id                =   $('#agent_id').val();
2363        var ajaxurl                     =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
2364        var securityprofile             =   $('#security-profile').val();
2365        var upload_picture              =   $('#upload_picture').val();
2366        var profile_image_url           =   $('#profile-image').attr('data-profileurl');
2367        var profile_image_url_small     =   $('#profile-image').attr('data-smallprofileurl');
2368       
2369        // customparameters
2370        var agent_custom_label = [];
2371        $('.agent_custom_label').each(function(){
2372                agent_custom_label.push( $(this).val() );
2373        });
2374
2375        var agent_custom_value = [];
2376        $('.agent_custom_value').each(function(){
2377                agent_custom_value.push( $(this).val() );
2378        });
2379        var nonce = jQuery('#wpestate_register_agent_nonce').val();
2380   
2381        window.scrollTo(0,0);
2382        $.ajax({
2383            type: 'POST',
2384            url: ajaxurl,
2385            dataType: 'json',
2386            data: {
2387                'action'            :   'wpestate_ajax_register_agent',
2388                'agent_username'    :   agent_username,
2389                'agent_password'    :   agent_password,
2390                'agent_repassword'  :   agent_repassword,
2391                'firstname'         :   firstname,
2392                'secondname'        :   secondname,
2393                'useremail'         :   useremail,
2394                'userphone'         :   userphone,
2395                'usermobile'        :   usermobile,
2396                'userskype'         :   userskype,
2397                'usertitle'         :   usertitle,
2398                'description'       :   description,
2399                'upload_picture'    :   upload_picture,
2400                'security-profile'  :   securityprofile,
2401                'profile_image_url' :   profile_image_url,
2402                'profile_image_url_small':profile_image_url_small,
2403                'userfacebook'      :   userfacebook,
2404                'usertwitter'       :   usertwitter,
2405                'userlinkedin'      :   userlinkedin,
2406                'userpinterest'     :   userpinterest,
2407                'userinstagram'     :   userinstagram,
2408                'userurl'           :   userurl,
2409                'agent_category_submit'     :   agent_category_submit,
2410                'agent_action_submit'       :   agent_action_submit,
2411                'agent_city'                :   agent_city,
2412                'agent_county'              :   agent_county,
2413                'agent_area'                :   agent_area,
2414                'agentedit'                 :   is_agent_edit,
2415                'userid'                    :   user_id,
2416                'agentid'                   :   agent_id,
2417                'agent_member'          : agent_member,
2418		'agent_custom_label' 	: agent_custom_label,
2419                'agent_custom_value' 	: agent_custom_value,
2420                'security'              :   nonce
2421				
2422            },
2423            success: function (data) {
2424                $('#profile_message').empty().append('<div class="login-alert">' + data.mesaj + '<div>');
2425                if(data.added ){
2426                    setTimeout(function() {    
2427                        window.open (ajaxcalls_vars.agent_list,'_self',false); 
2428                    }, 1500);
2429                }
2430            },
2431            error: function (errorThrown) {
2432             
2433            }
2434        });
2435    });
2436
2437
2438    $('#update_profile').on( 'click', function(event) {
2439
2440        var  firstname,secondname,userurl,usermobile, userinstagram,userpinterest, userlinkedin, usertwitter, userfacebook, profile_image_url, profile_image_url_small, firstname, secondname, useremail, userphone, userskype, usertitle, description, ajaxurl, securityprofile, upload_picture;
2441        firstname       =  $('#firstname').val();
2442        secondname      =  $('#secondname').val();
2443        useremail       =  $('#useremail').val();
2444        userphone       =  $('#userphone').val();
2445        usermobile      =  $('#usermobile').val();
2446        userskype       =  $('#userskype').val();
2447        usertitle       =  $('#usertitle').val();
2448        description     =  $('#about_me').val();
2449        userfacebook    =  $('#userfacebook').val();
2450        usertwitter     =  $('#usertwitter').val();
2451        userlinkedin    =  $('#userlinkedin').val();
2452        userpinterest   =  $('#userpinterest').val();
2453        userinstagram   =  $('#userinstagram').val();
2454        userurl         =  $('#website').val();
2455        var agent_member    =   $('#agent_member').val();
2456        
2457        var agent_category_submit  =   $('#agent_category_submit').val();
2458        var agent_action_submit    =   $('#agent_action_submit').val();
2459        var agent_city     =   $('#agent_city').val();
2460        var agent_county   =   $('#agent_county').val();
2461        var agent_area     =   $('#agent_area').val();    
2462        var nonce = jQuery('#wpestate_update_profile_nonce').val();
2463         
2464        ajaxurl         =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
2465        securityprofile =  $('#security-profile').val();
2466        upload_picture  =  $('#upload_picture').val();
2467        profile_image_url  = $('#profile-image').attr('data-profileurl');
2468        profile_image_url_small  = $('#profile-image').attr('data-smallprofileurl');
2469       
2470       // customparameters
2471        var agent_custom_label = [];
2472        $('.agent_custom_label').each(function(){
2473                agent_custom_label.push( $(this).val() );
2474        });
2475
2476        var agent_custom_value = [];
2477        $('.agent_custom_value').each(function(){
2478                agent_custom_value.push( $(this).val() );
2479        });
2480
2481
2482       
2483        window.scrollTo(0,0);
2484        $.ajax({
2485            type: 'POST',
2486            url: ajaxurl,
2487            data: {
2488                'action'            :   'wpestate_ajax_update_profile',
2489                'firstname'         :   firstname,
2490                'secondname'        :   secondname,
2491                'useremail'         :   useremail,
2492                'userphone'         :   userphone,
2493                'usermobile'        :   usermobile,
2494                'userskype'         :   userskype,
2495                'usertitle'         :   usertitle,
2496                'description'       :   description,
2497                'upload_picture'    :   upload_picture,
2498                'security-profile'  :   securityprofile,
2499                'profile_image_url' :   profile_image_url,
2500                'profile_image_url_small':profile_image_url_small,
2501                'userfacebook'      :   userfacebook,
2502                'usertwitter'       :   usertwitter,
2503                'userlinkedin'      :   userlinkedin,
2504                'userpinterest'     :   userpinterest,
2505                'userinstagram'     :   userinstagram,
2506                'userurl'           :   userurl,
2507                'agent_category_submit'     :   agent_category_submit,
2508                'agent_action_submit'       :   agent_action_submit,
2509                'agent_city'                :   agent_city,
2510                'agent_county'              :   agent_county,
2511                'agent_area'                :   agent_area,
2512                'agent_member'              :   agent_member,
2513                'agent_custom_label' 	: agent_custom_label,
2514                'agent_custom_value' 	: agent_custom_value,
2515                'security'              :   nonce,
2516        
2517            },
2518            success: function (data) {
2519            
2520                $('#profile_message').append('<div class="login-alert alert-success">' + data + '<div>');
2521                window.scrollTo(0,0);
2522            },
2523            error: function (errorThrown) {
2524            }
2525        });
2526    });
2527
2528
2529    
2530    $('#update_profile_agency').on( 'click', function() {
2531
2532        var agency_opening_hours,agency_license,agency_long,agency_lat, agency_address,agency_area,agency_county,agency_city,agency_action_submit, agency_action_submit,agency_category_submit, agency_taxes,agency_website,agency_languages,agency_name,userurl,usermobile, userinstagram,userpinterest, userlinkedin, usertwitter, userfacebook, profile_image_url, profile_image_url_small, firstname, secondname, useremail, userphone, userskype, usertitle, description, ajaxurl, securityprofile, upload_picture;
2533        agency_name     =  $('#agency_title').val();
2534        useremail       =  $('#useremail').val();
2535        userphone       =  $('#userphone').val();
2536        usermobile      =  $('#usermobile').val();
2537        userskype       =  $('#userskype').val();
2538  
2539        description     =  $('#about_me').val();
2540        userfacebook    =  $('#userfacebook').val();
2541        usertwitter     =  $('#usertwitter').val();
2542        userlinkedin    =  $('#userlinkedin').val();
2543        userpinterest   =  $('#userpinterest').val();
2544        userinstagram   =  $('#userinstagram').val();
2545      
2546        
2547        agency_languages=  $('#agency_languages').val();
2548        agency_website  =  $('#agency_website').val();
2549        agency_taxes    =  $('#agency_taxes').val();
2550        agency_license  =  $('#agency_license').val();
2551     
2552        
2553        agency_category_submit  =   $('#agency_category_submit').val();
2554        agency_action_submit    =   $('#agency_action_submit').val();
2555        agency_city     =   $('#agency_city').val();
2556        agency_county   =   $('#agency_county').val();
2557        agency_area     =   $('#agency_area').val();
2558        agency_address  =   $('#agency_address').val();
2559        agency_lat      =   $('#agency_lat').val();
2560        agency_long     =   $('#agency_long').val();
2561        agency_opening_hours  = $('#agency_opening_hours ').val();
2562        securityprofile             = $('#security-profile').val();
2563        upload_picture              = $('#upload_picture').val();
2564        profile_image_url           = $('#profile-image').attr('data-profileurl');
2565        profile_image_url_small     = $('#profile-image').attr('data-smallprofileurl');
2566      
2567        
2568        ajaxurl         =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
2569      
2570        var nonce = jQuery('#wpestate_update_profile_nonce').val();
2571        window.scrollTo(0,0);
2572        $.ajax({
2573            type: 'POST',
2574            url: ajaxurl,
2575            data: {
2576                'action'            :   'wpestate_ajax_update_profile_agency',
2577                'agency_name'         :   agency_name,
2578                'useremail'         :   useremail,
2579                'userphone'         :   userphone,
2580                'usermobile'        :   usermobile,
2581                'userskype'         :   userskype,
2582                'usertitle'         :   usertitle,
2583                'description'       :   description,
2584                'upload_picture'    :   upload_picture,
2585                'security-profile'  :   securityprofile,
2586                'profile_image_url' :   profile_image_url,
2587                'profile_image_url_small':profile_image_url_small,
2588                'userfacebook'      :   userfacebook,
2589                'usertwitter'       :   usertwitter,
2590                'userlinkedin'      :   userlinkedin,
2591                'userpinterest'     :   userpinterest,
2592                'userinstagram'     :   userinstagram,
2593                'userurl'           :   userurl,
2594                'agency_languages'  :   agency_languages,
2595                'agency_website'    :   agency_website,
2596                'agency_taxes'      :   agency_taxes,
2597                'agency_license'    :   agency_license,
2598                'agency_category_submit':agency_category_submit,
2599                'agency_action_submit':agency_action_submit,
2600                'agency_city'       :   agency_city,
2601                'agency_county'     :   agency_county,
2602                'agency_area'       :   agency_area,
2603                'agency_address'    :   agency_address,
2604                'agency_lat'        :   agency_lat,
2605                'agency_opening_hours' : agency_opening_hours,
2606                'agency_long'       :   agency_long,
2607                'security'          :   nonce
2608            },
2609            success: function (data) {
2610                $('#profile_message').append('<div class="login-alert alert-success">' + data + '<div>');
2611                window.scrollTo(0,0);
2612            },
2613            error: function (errorThrown) {
2614            }
2615        });
2616    });
2617    
2618    
2619    
2620//    update developer profile 
2621    $('#update_profile_developer').on( 'click', function() {
2622
2623        var developer_license ,developer_long,developer_lat, developer_address,developer_area,developer_county,developer_city,developer_action_submit, developer_action_submit,developer_category_submit, developer_taxes,developer_website,developer_languages,developer_name,userurl,usermobile, userinstagram,userpinterest, userlinkedin, usertwitter, userfacebook, profile_image_url, profile_image_url_small, firstname, secondname, useremail, userphone, userskype, usertitle, description, ajaxurl, securityprofile, upload_picture;
2624        developer_name  =  $('#developer_title').val();
2625        useremail       =  $('#useremail').val();
2626        userphone       =  $('#userphone').val();
2627        usermobile      =  $('#usermobile').val();
2628        userskype       =  $('#userskype').val();
2629  
2630        description     =  $('#about_me').val();
2631        userfacebook    =  $('#userfacebook').val();
2632        usertwitter     =  $('#usertwitter').val();
2633        userlinkedin    =  $('#userlinkedin').val();
2634        userpinterest   =  $('#userpinterest').val();
2635        userinstagram   =  $('#userinstagram').val();
2636      
2637        
2638        developer_languages =  $('#developer_languages').val();
2639        developer_website   =  $('#developer_website').val();
2640        developer_taxes     =  $('#developer_taxes').val();
2641        developer_license   =  $('#developer_license').val();
2642     
2643        
2644        developer_category_submit  =   $('#developer_category_submit').val();
2645        developer_action_submit    =   $('#developer_action_submit').val();
2646        developer_city             =   $('#developer_city').val();
2647        developer_county           =   $('#developer_county').val();
2648        developer_area             =   $('#developer_area').val();
2649        developer_address          =   $('#developer_address').val();
2650        developer_lat              =   $('#developer_lat').val();
2651        developer_long             =   $('#developer_long').val();
2652        securityprofile             = $('#security-profile').val();
2653        upload_picture              = $('#upload_picture').val();
2654        profile_image_url           = $('#profile-image').attr('data-profileurl');
2655        profile_image_url_small     = $('#profile-image').attr('data-smallprofileurl');
2656      
2657        
2658        ajaxurl         =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
2659         var nonce = jQuery('#wpestate_update_profile_nonce').val();
2660        window.scrollTo(0,0);
2661        $.ajax({
2662            type: 'POST',
2663            url: ajaxurl,
2664            data: {
2665                'action'            :   'wpestate_ajax_update_profile_developer',
2666                'developer_name'    :   developer_name,
2667                'useremail'         :   useremail,
2668                'userphone'         :   userphone,
2669                'usermobile'        :   usermobile,
2670                'userskype'         :   userskype,
2671                'usertitle'         :   usertitle,
2672                'description'       :   description,
2673                'upload_picture'    :   upload_picture,
2674                'security-profile'  :   securityprofile,
2675                'profile_image_url' :   profile_image_url,
2676                'profile_image_url_small':profile_image_url_small,
2677                'userfacebook'      :   userfacebook,
2678                'usertwitter'       :   usertwitter,
2679                'userlinkedin'      :   userlinkedin,
2680                'userpinterest'     :   userpinterest,
2681                'userinstagram'     :   userinstagram,
2682                'userurl'           :   userurl,
2683                'developer_languages'  :   developer_languages,
2684                'developer_website'   :   developer_website,
2685                'developer_taxes'      :   developer_taxes,
2686                'developer_license'    :   developer_license,
2687                'developer_category_submit': developer_category_submit,
2688                'developer_action_submit'  : developer_action_submit,
2689                'developer_city'       :   developer_city,
2690                'developer_county'     :   developer_county,
2691                'developer_area'       :   developer_area,
2692                'developer_address'    :   developer_address,
2693                'developer_lat'        :   developer_lat,
2694                'developer_long'       :   developer_long,
2695                'security'             :    nonce
2696            },
2697            success: function (data) {
2698                $('#profile_message').append('<div class="login-alert alert-success">' + data + '<div>');
2699                window.scrollTo(0,0);
2700            },
2701            error: function (errorThrown) {
2702            }
2703        });
2704    });
2705    
2706    //delete profile
2707
2708    $('#delete_profile').on( 'click', function(event) {
2709        var ajaxurl;
2710        ajaxurl         =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
2711        var nonce = jQuery('#wpestate_update_profile_nonce').val();
2712        var result = confirm(ajaxcalls_vars.delete_account);
2713        if (result) {
2714            //Logic to delete the item
2715
2716            $.ajax({
2717                type: 'POST',
2718                url: ajaxurl,
2719                data: {
2720                    'action'       :   'wpestate_delete_profile',
2721                    'security'      : nonce,
2722                },
2723                success: function (data) {
2724                   window.location = '/';
2725                },
2726                error: function (errorThrown) {
2727
2728                }
2729            });
2730        }
2731    });
2732    
2733    //end delete profile 
2734 
2735}); // end ready jquery
2736//End ready ********************************************************************

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.