PageSourceSearch

https://www.tourezi.com/Views/Search/Search.js?v=638423213889397250

js tourezi.com collected 2026-09-26 00:05:23 UTC 82,320 bytes, 1,205 lines download raw bytes

1var numberOfRecords = 10;
2var sortBy = 1;
3var premiumListingsjson;
4var pageType = "Internal";
5var appType = "W";
6var minDistance = 50;
7var DefaultLatitude = $("#hdnLatitude").val();
8var DefaultLongitude = $("#hdnLongitude").val();
9var resultCount = 0;
10function PageDDLList(dis, cat) {
11
12    $("#ulPremiumListingTopPager").hide();
13    $("#divPremiumListingBottomPager").hide();
14   // $("#divPremiumListingAdd").hide();
15
16    $("#ulBasicListingTopPager").hide();
17    $("#divBasicListingBottomPager").hide();
18    $("#divBasicListingAdd").hide();
19
20    $("#ulFreeListingTopPager").hide();
21    $("#divFreeListingBottomPager").hide();
22    $("#divFreeListingAdd").hide();
23    var selectedCatName = ""; var selectedDisName = "";
24    $.ajax({
25        type: "POST",
26        async: false,
27        url: abp.appPath + 'Home/GetHomePageDDLList',
28        success: function (result) {
29            $("#ddlCategory").empty();
30            //$("#ddlCategory").append($("<option></option>").val('0').html('Category'));
31            if (cat != '') {
32                //cat = cat.replace(/%20/g, " ");
33                cat = decodeURIComponent(cat);
34                cat = cat.trim();
35            }
36            for (var i = 0; i < result.Categories.length ; i++) {
37                var IsSelected = '';               
38                //if (result.Categories[i].CategoryName.trim() === cat) {
39
40                //    IsSelected = 'selected'; selectedCatName = result.Categories[i].CategoryName;
41
42                //}
43                if (result.Categories[i].CategoryId == cat) {
44
45                    IsSelected = 'selected'; selectedCatName = result.Categories[i].CategoryName;
46
47                }
48                $("#ddlCategory").append($("<option " + IsSelected + " ></option>").val(result.Categories[i].CategoryId).text(result.Categories[i].CategoryName));
49            }
50            $("#ddlPremiumListingTopShortBy").empty();
51            $("#ddlPremiumListingBottomShortBy").empty();
52            $("#ddlBasicListingTopShortBy").empty();
53            $("#ddlBasicListingBottomShortBy").empty();
54            $("#ddlFreeListingTopShortBy").empty();
55            $("#ddlFreeListingBottomShortBy").empty();
56            for (var i = 0; i < result.SortByList.length ; i++) {
57                $("#ddlPremiumListingTopShortBy").append($("<option></option>").val(result.SortByList[i].Id).html(result.SortByList[i].Name));
58                $("#ddlPremiumListingBottomShortBy").append($("<option></option>").val(result.SortByList[i].Id).html(result.SortByList[i].Name));
59                $("#ddlBasicListingTopShortBy").append($("<option></option>").val(result.SortByList[i].Id).html(result.SortByList[i].Name));
60                $("#ddlBasicListingBottomShortBy").append($("<option></option>").val(result.SortByList[i].Id).html(result.SortByList[i].Name));
61                $("#ddlFreeListingTopShortBy").append($("<option></option>").val(result.SortByList[i].Id).html(result.SortByList[i].Name));
62                $("#ddlFreeListingBottomShortBy").append($("<option></option>").val(result.SortByList[i].Id).html(result.SortByList[i].Name));
63                
64            }
65            $("#ddlDistance").empty();
66            //$("#ddlDistance").append($("<option></option>").val('0').html('Distance'));
67            for (var i = 0; i < result.DistanceList.length ; i++) {
68                var IsSelected = '';
69                if (result.DistanceList[i].Id == dis) { IsSelected = 'selected'; selectedDisName = result.DistanceList[i].Name; }
70                $("#ddlDistance").append($("<option " + IsSelected + " ></option>").val(result.DistanceList[i].Id).html(result.DistanceList[i].Name));
71            }
72        },
73        error: function (err) {
74            //abp.notify.info(err.statusText);
75        }
76    });
77
78    if (selectedCatName != "") {
79        $("#ddlCategory").attr("data-placeholder", selectedCatName);
80    }
81    if (selectedDisName != "")
82       $("#ddlDistance").attr("data-placeholder", selectedDisName);
83    GetListingsWithShortBy(0);
84}
85
86function PageDDLListNew(dis, cat) {
87   
88    $("#ulPremiumListingTopPager").hide();
89    $("#divPremiumListingBottomPager").hide();
90    // $("#divPremiumListingAdd").hide();
91
92    $("#ulBasicListingTopPager").hide();
93    $("#divBasicListingBottomPager").hide();
94    $("#divBasicListingAdd").hide();
95
96    $("#ulFreeListingTopPager").hide();
97    $("#divFreeListingBottomPager").hide();
98    $("#divFreeListingAdd").hide();
99    var selectedCatName = ""; var selectedDisName = "";
100    $.ajax({
101        type: "POST",
102        async: false,
103        url: abp.appPath + 'Home/GetHomePageDDLList',
104        success: function (result) {
105            $("#ddlCategory").empty();
106          
107          
108            //$("#ddlCategory").append($("<option></option>").val('0').html('Category'));
109            if (cat != '') {
110                //cat = cat.replace(/%20/g, " ");
111                cat = decodeURIComponent(cat);
112                cat = cat.trim();
113            }
114            console.log(result);
115            for (var i = 0; i < result.Categories.length ; i++) {
116                var IsSelected = '';
117                //if (result.Categories[i].CategoryName.trim() === cat) {
118
119                //    IsSelected = 'selected'; selectedCatName = result.Categories[i].CategoryName;
120
121                //}
122               
123                if (result.Categories[i].CategoryId == cat) {
124
125                    IsSelected = 'selected'; selectedCatName = result.Categories[i].CategoryName;
126
127                }
128                $("#ddlCategory").append($("<option " + IsSelected + " ></option>").val(result.Categories[i].CategoryId).text(result.Categories[i].CategoryName));
129            }
130            $("#ddlPremiumListingTopShortBy").empty();
131            $("#ddlPremiumListingBottomShortBy").empty();
132            $("#ddlBasicListingTopShortBy").empty();
133            $("#ddlBasicListingBottomShortBy").empty();
134            $("#ddlFreeListingTopShortBy").empty();
135            $("#ddlFreeListingBottomShortBy").empty();
136            for (var i = 0; i < result.SortByList.length ; i++) {
137                $("#ddlPremiumListingTopShortBy").append($("<option></option>").val(result.SortByList[i].Id).html(result.SortByList[i].Name));
138                $("#ddlPremiumListingBottomShortBy").append($("<option></option>").val(result.SortByList[i].Id).html(result.SortByList[i].Name));
139                $("#ddlBasicListingTopShortBy").append($("<option></option>").val(result.SortByList[i].Id).html(result.SortByList[i].Name));
140                $("#ddlBasicListingBottomShortBy").append($("<option></option>").val(result.SortByList[i].Id).html(result.SortByList[i].Name));
141                $("#ddlFreeListingTopShortBy").append($("<option></option>").val(result.SortByList[i].Id).html(result.SortByList[i].Name));
142                $("#ddlFreeListingBottomShortBy").append($("<option></option>").val(result.SortByList[i].Id).html(result.SortByList[i].Name));
143
144            }
145            $("#ddlDistance").empty();
146            //$("#ddlDistance").append($("<option></option>").val('0').html('Distance'));
147            for (var i = 0; i < result.DistanceList.length ; i++) {
148                var IsSelected = '';
149                if (result.DistanceList[i].Id == dis) { IsSelected = 'selected'; selectedDisName = result.DistanceList[i].Name; }
150                $("#ddlDistance").append($("<option " + IsSelected + " ></option>").val(result.DistanceList[i].Id).html(result.DistanceList[i].Name));
151            }
152        },
153        error: function (err) {
154            //abp.notify.info(err.statusText);
155        }
156    });
157
158    if (selectedCatName != "") {
159        $("#ddlCategory").attr("data-placeholder", selectedCatName);
160    }
161    if (selectedDisName != "")
162        $("#ddlDistance").attr("data-placeholder", selectedDisName);
163  //  GetListingsWithShortBy(0);
164}
165function SetDropdown(positionId) {
166    if (positionId == 0) {
167        //Premium Listing Top
168        var selectedValue = $('#ddlPremiumListingTopShortBy').val();
169        var selectedText = $("#ddlPremiumListingTopShortBy").find("option:selected").text();
170        $('#ddlPremiumListingBottomShortBy').val(selectedValue);
171        $('#select2-ddlPremiumListingBottomShortBy-container').empty();
172        $('#select2-ddlPremiumListingBottomShortBy-container').html(selectedText);
173        $('#select2-ddlPremiumListingBottomShortBy-container').attr("title", selectedText);
174
175        //Basic Listing Top
176        selectedValue = "";
177        selectedText = "";
178        selectedValue = $('#ddlBasicListingTopShortBy').val();
179        selectedText = $("#ddlBasicListingTopShortBy").find("option:selected").text();
180        $('#ddlBasicListingBottomShortBy').val(selectedValue);
181        $('#select2-ddlBasicListingBottomShortBy-container').empty();
182        $('#select2-ddlBasicListingBottomShortBy-container').html(selectedText);
183        $('#select2-ddlBasicListingBottomShortBy-container').attr("title", selectedText);
184
185        //Free Listing Top
186        selectedValue = "";
187        selectedText = "";
188        selectedValue = $('#ddlFreeListingTopShortBy').val();
189        selectedText = $("#ddlFreeListingTopShortBy").find("option:selected").text();
190        $('#ddlFreeListingBottomShortBy').val(selectedValue);
191        $('#select2-ddlFreeListingBottomShortBy-container').empty();
192        $('#select2-ddlFreeListingBottomShortBy-container').html(selectedText);
193        $('#select2-ddlFreeListingBottomShortBy-container').attr("title", selectedText);
194
195    } else if (positionId == 1) {
196        //Premium Listing Bottom
197        var selectedValue = $('#ddlPremiumListingBottomShortBy').val();
198        var selectedText = $("#ddlPremiumListingBottomShortBy").find("option:selected").text();
199        $('#ddlPremiumListingTopShortBy').val(selectedValue);
200        $('#select2-ddlPremiumListingTopShortBy-container').empty();
201        $('#select2-ddlPremiumListingTopShortBy-container').html(selectedText);
202        $('#select2-ddlPremiumListingTopShortBy-container').attr("title", selectedText);
203
204        //Basic Listing Bottom
205        selectedValue = "";
206        selectedText = "";
207        selectedValue = $('#ddlBasicListingBottomShortB').val();
208        selectedText = $("#ddlBasicListingBottomShortB").find("option:selected").text();
209        $('#ddlBasicListingTopShortBy').val(selectedValue);
210        $('#select2-ddlBasicListingTopShortBy-container').empty();
211        $('#select2-ddlBasicListingTopShortBy-container').html(selectedText);
212        $('#select2-ddlBasicListingTopShortBy-container').attr("title", selectedText);
213
214        //Free Listing Bottom
215        selectedValue = "";
216        selectedText = "";
217        selectedValue = $('#ddlFreeListingBottomShortBy').val();
218        selectedText = $("#ddlFreeListingBottomShortBy").find("option:selected").text();
219        $('#ddlFreeListingTopShortBy').val(selectedValue);
220        $('#select2-ddlFreeListingTopShortBy-container').empty();
221        $('#select2-ddlFreeListingTopShortBy-container').html(selectedText);
222        $('#select2-ddlFreeListingTopShortBy-container').attr("title", selectedText);
223    }
224}
225
226function GetListingsWithShortBy(positionId) {
227    
228    SetDropdown(positionId);
229
230    var shortById = 1;
231    if (positionId == 0) {
232        shortById = $("#ddlPremiumListingTopShortBy").val();
233    } else if (positionId == 1)
234    { shortById = $("#ddlPremiumListingBottomShortBy").val(); }
235    else if (positionId == 2)
236    { shortById = $("#ddlPremiumListingBottomShortBy").val(); }
237    else if (positionId == 3)
238    { shortById = $("#ddlBasicListingBottomShortBy").val(); }
239    else if (positionId == 4)
240    { shortById = $("#ddlBasicListingBottomShortBy").val(); }
241    else if (positionId == 5)
242    { shortById = $("#ddlFreeListingBottomShortBy").val(); }
243    else if (positionId == 6)
244    { shortById = $("#ddlFreeListingBottomShortBy").val(); }
245
246    //if (shortById == 1)
247    //    sortBy = 'name asc';
248    //else if (shortById == 2)
249    //    sortBy = 'name desc';
250    //else if (shortById == 3)
251    //    sortBy = 'distance asc';
252    //else if (shortById == 4)
253    //    sortBy = 'distance desc';
254    sortBy = shortById;
255
256    GetListings($("#hdnPageIndex").val(), 0);
257}
258function AddRecentSearch() {
259    if ($("#hdnUserId").val() != "") {
260        $.ajax({
261            type: "POST",
262            url: abp.appPath + 'Home/AddRecentSerach',
263            data: {
264                SearchText: $.trim($("#txtSearchKeywords").val().replace(/%20/g, " ")),
265                CategoryId: $.trim($("#ddlCategory").val()),
266                Distance: parseInt($.trim($("#ddlDistance").val())) === 0 ? minDistance : $.trim($("#ddlDistance").val()),
267                UserId: $("#hdnUserId").val()
268            },
269            success: function (Result) {
270                GetUserRecentSearchResult()
271            },
272            error: function (err) {
273                //abp.notify.info(err.statusText);
274                //  $("#imgUploading").attr("style", "display:none;");
275            }
276        });
277    }
278}
279
280function GetAllListing()
281{
282    AddRecentSearch();
283   
284    var category = $.trim($("#ddlCategory option:selected").text())
285    var categoryId = $.trim($("#ddlCategory option:selected").val())
286    var culture = $("#hdnCultureName").val();
287    var location = $("#hdnLocationName").val();
288    location = urlify(location);
289    category = urlify(category);
290    if (categoryId == 0 && $.trim($("#txtSearchKeywords").val()) == "" && $.trim($("#ddlDistance").val()) == 0)
291    {
292        window.location = abp.appPath + 'search/'
293    }
294    else
295    if ($.trim($("#txtSearchKeywords").val()) == "") {
296
297        window.location = abp.appPath + 'search/' + culture + '/' + location + '/' + category + "/" + $.trim($("#ddlDistance").val()) + '/' + categoryId;
298
299    }
300    else {
301       
302      //  var keyword=  ($.trim($("#txtSearchKeywords").val().replace(/<\/?[^>]+(>|$)/g, ""))).replace(/["']/g, "");
303       var keyword = ($.trim($("#txtSearchKeywords").val().replace(/<\/?[^>]+(>|$)/g, ""))).replace(/["]/g, "");
304        keyword = urlify(keyword);
305        window.location = abp.appPath + 'search/' + culture + '/' + location + '/' + category + "/" + keyword + '/' + $.trim($("#ddlDistance").val()) + '/' + categoryId;
306
307        }
308
309
310
311}
312var urlify = function (keyword) {
313
314    return keyword.toLowerCase()
315        .replace(/[^a-z0-9']+/g, "-")/*.replace(/^-+|-+$/g, "-").replace(/^-+|-+$/g, '')*/
316};
317function GetListings(pageIndex, listingTypeId, IsOnLoad) {
318
319    $("#liSort a i").toggleClass("fa-sort-amount-asc")
320    $("#liSort a i").toggleClass("fa-sort-amount-desc")
321   // $("#spnResultCount").text(0+" " + app.localize("Results"));
322   // if (IsOnLoad == 1) {
323       
324        AddRecentSearch();
325      //  GetUserRecentSearchResult()
326        //var category = $.trim($("#ddlCategory option:selected").text())
327        //if ($.trim($("#txtSearchKeywords").val()) == "") {
328            
329        //    window.location = abp.appPath + 'Search/' + category + "/" + $.trim($("#ddlDistance").val()) + '/';
330            
331        //}
332        //else {
333        //    window.location = abp.appPath + 'Search/' + category + "/" + $.trim($("#txtSearchKeywords").val()) + '/' + $.trim($("#ddlDistance").val()) + '/';
334           
335        //}
336 //   }
337    //if (IsOnLoad != 1) {
338    //    alert("load");
339        if ($("#hdnLatitude").val() != "") {
340            DefaultLatitude = $("#hdnLatitude").val();
341        }
342        if ($("#hdnLongitude").val() != "") {
343            DefaultLongitude = $("#hdnLongitude").val();
344        }
345
346        $("#imgUploading").attr("style", "display:block;");
347        $("#hdnPageIndex").val(pageIndex);
348        var newResultCount = resultCount;
349        var searchText = "";
350        
351        if($("#txtSearchKeywords").val()!="" &&$("#txtSearchKeywords").val()!=null )
352        {
353            
354             searchText=$.trim($("#txtSearchKeywords").val().replace(/%20/g, " "))
355        }
356        var categoryId = 0;
357        
358        if ($("#ddlCategory").val() != "" && $("#ddlCategory").val() != null &&$("#ddlCategory").val() !="undefined")
359        {
360          
361            categoryId = $.trim($("#ddlCategory").val());
362        }
363        var distance = minDistance;
364        if ($("#ddlDistance").val() != "" && $("#ddlDistance").val() != null && $("#ddlDistance").val() != "undefined") {
365
366            distance = $.trim($("#ddlDistance").val());
367        }
368        
369        $.ajax({
370            type: "POST",
371            url: abp.appPath + 'Search/GetAllListing?ListingTypeId=' + listingTypeId,
372            data: {
373                Latitude: DefaultLatitude,
374                Longitude: DefaultLongitude,
375                Distance: parseInt(distance == 0 ? minDistance : distance),
376                PageIndex: pageIndex,
377                NoOfRecord: numberOfRecords,
378                SortBy: sortBy,
379                SearchText: searchText,
380                CategoryId: categoryId,
381                UserId: 0,
382                AppType: appType
383            },
384            success: function (result) {
385                //$("#divPremiumNoRecordFound").hide();
386                //$("#divPremiumListing").show();
387                $("#divContent,div#divSearch").removeClass("hide");
388               
389                var IsListingAvailable = false;
390                if (result != null && result != "") {
391                    //Bind Premium Listings.
392                    $("#divSearchListing").empty();
393                    $("#divSearchListing").html(result)
394                    if (result != null) {
395                        $("#ulPremiumListing").empty();
396                        $('#ulFreeListing').empty();
397                        $('#ulBasicListing').empty();
398                      //  premiumListingsjson = result;
399                        var basicHtml = "";
400                        var str = 0;
401
402                        if (str == 1) {
403                            //  $("#spnResultCount").text(result.Listings.ListingResult.length + " " + app.localize("Results"));
404                            //if (result.Listings.ListingResult.length > 0) { IsListingAvailable = true; $("#divPremiumListing").attr("style", "display:block;"); $("#divPremiumNoRecordFound").attr("style", "display:none;"); } else { $("#divPremiumListing").attr("style", "display:none;"); $("#divPremiumNoRecordFound").attr("style", "display:block;"); }
405                            for (var i = 0; i < result.Listings.ListingResult.length ; i++) {
406
407                                if (result.Listings.ListingResult[i].ListingTypeName == "Premium" && result.Listings.ListingResult[i].IsListingFreeToo == false) {
408                                    if (result.Listings.ListingResult[i].IsFavorite == false) {
409                                        $('#ulPremiumListing').append("<li><h3 class='premium-h2'>" + result.Listings.ListingResult[i].ListingName + "<i class='fa fa-star-o pull-right cursor-pointer'  id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></h3><div class='premium-list-img-wrap'><img width='770' height='462' src='" + result.Listings.ListingResult[i].ImageURL + "'><p class='premium-cat'>" + result.Listings.ListingResult[i].Category + "</p></div><div class='premium-list-details '><div class='row'><div class='col-md-12 premium-address-wrap mb15'><p><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div><div class='col-md-3'><p><i class='fa fa-phone'></i> " + result.Listings.ListingResult[i].ContactNo + "</p></div><div class='col-md-7'><p><i class='fa fa-globe'></i> <a href='" + result.Listings.ListingResult[i].WebsiteUrl + "' title='" + result.Listings.ListingResult[i].WebsiteUrl + "' target='_blank'>" + result.Listings.ListingResult[i].WebsiteUrl.substring(0, 20) + "</a></p></div><div class='col-md-2 text-right'><p><a href='" + abp.appPath + "About/PremiumDetails/" + result.Listings.ListingResult[i].ListingName + "-" + result.Listings.ListingResult[i].ListingId + "'>" + app.localize('Details') + " <i class='fa fa-angle-right'></i></a></p></div></div></div></li>");
410                                    }
411                                    else {
412                                        $('#ulPremiumListing').append("<li><h3 class='premium-h2'>" + result.Listings.ListingResult[i].ListingName + "<i class='fa fa-star pull-right cursor-pointer' title='Marked as favorite' id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></h3><div class='premium-list-img-wrap'><img width='770' height='462' src='" + result.Listings.ListingResult[i].ImageURL + "'><p class='premium-cat'>" + result.Listings.ListingResult[i].Category + "</p></div><div class='premium-list-details '><div class='row'><div class='col-md-12 premium-address-wrap mb15'><p><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div><div class='col-md-3'><p><i class='fa fa-phone'></i> " + result.Listings.ListingResult[i].ContactNo + "</p></div><div class='col-md-7'><p><i class='fa fa-globe'></i> <a href='" + result.Listings.ListingResult[i].WebsiteUrl + "' title='" + result.Listings.ListingResult[i].WebsiteUrl + "' target='_blank'>" + result.Listings.ListingResult[i].WebsiteUrl.substring(0, 20) + "</a></p></div><div class='col-md-2 text-right'><p><a href='" + abp.appPath + "About/PremiumDetails/" + result.Listings.ListingResult[i].ListingName + "-" + result.Listings.ListingResult[i].ListingId + "'>" + app.localize('Details') + " <i class='fa fa-angle-right'></i></a></p></div></div></div></li>");
413                                    }
414                                    //if (result.Listings.ListingResult[i].IsFreeListing == true) {
415                                    //    if (result.Listings.ListingResult[i].IsFavorite == false) {
416                                    //        $('#ulFreeListing').append("<li class='free-list-wrap bgColor '><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star-o free-star cursor-pointer'  id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
417                                    //    }
418                                    //    else {
419                                    //        $('#ulFreeListing').append("<li class='free-list-wrap'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star free-star cursor-pointer' title='Marked as favorite' id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
420                                    //    }
421                                    //}
422                                }
423                                if (result.Listings.ListingResult[i].ListingTypeName == "Basic" && result.Listings.ListingResult[i].IsListingFreeToo == false) {
424                                    if (result.Listings.ListingResult[i].IsFavorite == false) {
425                                        $('#ulBasicListing').append("<li><h3 class='paid-h2'>" + result.Listings.ListingResult[i].ListingName + "<i class='fa fa-star-o pull-right cursor-pointer'  id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></h3><div class='row is-flex'><div class='col-md-6'><div class='premium-list-img-wrap'><img width='370' height='222' src='" + result.Listings.ListingResult[i].ImageURL + "'><p class='premium-cat'>" + result.Listings.ListingResult[i].Category + "</p></div></div><div class='col-md-6'><div class='paid-list-details'><p><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p><p><i class='fa fa-phone'></i> " + result.Listings.ListingResult[i].ContactNo + "</p><p><i class='fa fa-globe'></i> <a href='" + result.Listings.ListingResult[i].WebsiteUrl + "' title='" + result.Listings.ListingResult[i].WebsiteUrl + "' target='_blank'>" + result.Listings.ListingResult[i].WebsiteUrl.substring(0, 20) + "</a></p>
425<a class='paid-link-details' href='" + abp.appPath + "About/PaidDetails/" + result.Listings.ListingResult[i].ListingName + "-" + result.Listings.ListingResult[i].ListingId + "'>" + app.localize('Details') + " <i class='fa fa-angle-right'></i></a></div></div></div></li>");
426                                    }
427                                    else {
428                                        $('#ulBasicListing').append("<li><h3 class='paid-h2'>" + result.Listings.ListingResult[i].ListingName + "<i class='fa fa-star pull-right cursor-pointer' title='Marked as favorite' id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></h3><div class='row is-flex'><div class='col-md-6'><div class='premium-list-img-wrap'><img width='370' height='222' src='" + result.Listings.ListingResult[i].ImageURL + "'><p class='premium-cat'>" + result.Listings.ListingResult[i].Category + "</p></div></div><div class='col-md-6'><div class='paid-list-details'><p><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p><p><i class='fa fa-phone'></i> " + result.Listings.ListingResult[i].ContactNo + "</p><p><i class='fa fa-globe'></i> <a href='" + result.Listings.ListingResult[i].WebsiteUrl + "' title='" + result.Listings.ListingResult[i].WebsiteUrl + "' target='_blank'>" + result.Listings.ListingResult[i].WebsiteUrl.substring(0, 20) + "</a></p><a class='paid-link-details' href='" + abp.appPath + "About/PaidDetails/" + result.Listings.ListingResult[i].ListingName + "-" + result.Listings.ListingResult[i].ListingId + "'>" + app.localize('Details') + " <i class='fa fa-angle-right'></i></a></div></div></div></li>");
429                                    }
430                                    //if (result.Listings.ListingResult[i].IsFreeListing == true) {
431                                    //    if (result.Listings.ListingResult[i].IsFavorite == false) {
432                                    //        $('#ulFreeListing').append("<li class='free-list-wrap bgColor '><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star-o free-star cursor-pointer'  id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
433                                    //    }
434                                    //    else {
435                                    //        $('#ulFreeListing').append("<li class='free-list-wrap'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star free-star cursor-pointer' title='Marked as favorite' id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
436                                    //    }
437                                    //}
438
439                                }
440                                if (result.Listings.ListingResult[i].ListingTypeName == "Free" && result.Listings.ListingResult[i].IsListingFreeToo == false) {
441                                    if (result.Listings.ListingResult[i].IsFavorite == false) {
442                                        $('#ulFreeListing').append("<li class='free-list-wrap bgColor '><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star-o free-star cursor-pointer'  id=" + "f_" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
443                                    }
444                                    else {
445                                        $('#ulFreeListing').append("<li class='free-list-wrap'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star free-star cursor-pointer' title='Marked as favorite' id=" + "f_" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
446                                    }
447
448                                }
449
450                                if (result.Listings.ListingResult[i].IsListingFreeToo == true) {
451                                    if (result.Listings.ListingResult[i].IsFavorite == false) {
452                                        $('#ulFreeListing').append("<li class='free-list-wrap bgColor '><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star-o free-star cursor-pointer'  id=" + "f_" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
453                                    }
454                                    else {
455                                        $('#ulFreeListing').append("<li class='free-list-wrap'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star free-star cursor-pointer' title='Marked as favorite' id=" + "f_" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
456                                    }
457                                }
458                            }
459                        }
460                        if (newResultCount > 0) {
461                            $("#divPremiumListingAdd").show();
462                            if (newResultCount > numberOfRecords) {
463                                var previousPagerNumber = parseInt(pageIndex) - parseInt(1);
464                                var previousPagerStyle = "style='cursor:pointer'";
465                                if (pageIndex == 0)
466                                    previousPagerStyle = "style='cursor:default'";
467                                else
468                                    previousPagerStyle = "style='cursor:pointer' onclick='GetListings(" + previousPagerNumber + ",1);'";
469                                var numbertOfPagesWithCeil = Math.
469ceil(newResultCount / numberOfRecords);
470                                $("#ulPremiumListingTopPager").empty();
471                                $("#ulPremiumListingTopPager").append("<li><a " + previousPagerStyle + " aria-label='Previous'><span aria-hidden='true' class='mdi mdi-chevron-double-left'></span></a></li>");
472                                $("#ulPremiumListingBottomPager").empty();
473                                $("#ulPremiumListingBottomPager").append("<li><a " + previousPagerStyle + " aria-label='Previous'><span aria-hidden='true' class='mdi mdi-chevron-double-left'></span></a></li>");
474                                var pageNumber = 0;
475                                for (var i = 0; i < numbertOfPagesWithCeil ; i++) {
476                                    pageNumber = parseInt(i) + parseInt(1);
477                                    var activeClass = "style='cursor:pointer'";
478                                    if (parseInt(pageIndex) == i)
479                                        activeClass = "class='active'";
480                                    var onclickfun = "";
481                                    if (parseInt(pageIndex) != i)
482                                        onclickfun = "onclick='GetListings(" + i + ",1);'";
483                                    $("#ulPremiumListingTopPager").append("<li " + activeClass + "  id=" + pageNumber + "><a " + onclickfun + ">" + pageNumber + "</a></li>");
484                                    $("#ulPremiumListingBottomPager").append("<li " + activeClass + "  id=" + pageNumber + "><a " + onclickfun + ">" + pageNumber + "</a></li>");
485                                }
486                                var nextPagerNumber = parseInt(pageIndex) + parseInt(1);
487                                if (numbertOfPagesWithCeil == nextPagerNumber) {
488                                    $("#ulPremiumListingTopPager").append("<li><a aria-label='Next'><span aria-hidden='true' class='mdi mdi-chevron-double-right'></span></a></li>");
489                                    $("#ulPremiumListingBottomPager").append("<li><a aria-label='Next'><span aria-hidden='true' class='mdi mdi-chevron-double-right'></span></a></li>");
490                                }
491                                else {
492                                    $("#ulPremiumListingTopPager").append("<li><a style='cursor:pointer' onclick='GetListings(" + nextPagerNumber + ",1);' aria-label='Next'><span aria-hidden='true' class='mdi mdi-chevron-double-right'></span></a></li>");
493                                    $("#ulPremiumListingBottomPager").append("<li><a style='cursor:pointer' onclick='GetListings(" + nextPagerNumber + ",1);' aria-label='Next'><span aria-hidden='true' class='mdi mdi-chevron-double-right'></span></a></li>");
494                                }
495                                $("#ulPremiumListingTopPager").show();
496                                $("#ulPremiumListingBottomPager").show();
497                                $("#divPremiumListingBottomPager").show();
498                                GetPaging("ulPremiumListingTopPager");
499                                GetPaging("ulPremiumListingBottomPager");
500                            }
501                            else {
502                                $("#ulPremiumListingTopPager").hide();
503                                $("#ulPremiumListingBottomPager").hide();
504                                $("#divPremiumListingBottomPager").hide();
505                            }
506                        }
507                        else {
508                            $("#ulPremiumListingTopPager").hide();
509                            $("#ulPremiumListingBottomPager").hide();
510                            $("#divPremiumListingBottomPager").hide();
511                            // $("#divPremiumListingAdd").hide();
512                        }
513                    }
514                    else {
515                        $("#divPremiumNoRecordFound").show();
516                        $("#divPremiumListing").hide();
517                    }
518                }
519                $("#imgUploading").attr("style", "display:none;");
520                var bLazy = new Blazy();
521
522            },
523            error: function (err) {
524                // abp.notify.info(err.statusText);
525                $("#imgUploading").attr("style", "display:none;");
526            }
527        });
528  //  }
529}
530
531function GetListingsBrowse(pageIndex, listingTypeId, IsOnLoad) {
532    $("#liSort a i").toggleClass("fa-sort-amount-asc")
533    $("#liSort a i").toggleClass("fa-sort-amount-desc")
534    $("#spnResultCount").text(0 + " " + app.localize("Results"));
535    if (IsOnLoad == 1) {
536
537        AddRecentSearch();
538        GetUserRecentSearchResult()
539        //var category = $.trim($("#ddlCategory option:selected").text())
540        //if ($.trim($("#txtSearchKeywords").val()) == "") {
541        //    window.location = abp.appPath + 'Search/' + category + "/" + $.trim($("#ddlDistance").val()) + '/';
542
543        //}
544        //else {
545        //    window.location = abp.appPath + 'Search/' + category + "/" + $.trim($("#txtSearchKeywords").val()) + '/' + $.trim($("#ddlDistance").val()) + '/';
546
547        //}
548    }
549
550    if ($("#hdnLatitude").val() != "") {
551        DefaultLatitude = $("#hdnLatitude").val();
552    }
553    if ($("#hdnLongitude").val() != "") {
554        DefaultLongitude = $("#hdnLongitude").val();
555    }
556
557    $("#imgUploading").attr("style", "display:block;");
558    $("#hdnPageIndex").val(pageIndex);
559    $.ajax({
560        type: "POST",
561        url: abp.appPath + 'Home/GetAllListing?ListingTypeId=' + listingTypeId,
562        data: {
563            Latitude: DefaultLatitude,
564            Longitude: DefaultLongitude,
565            Distance: parseInt($.trim($("#ddlDistance").val())) === 0 ? minDistance : $.trim($("#ddlDistance").val()),
566            PageIndex: pageIndex,
567            NoOfRecord: numberOfRecords,
568            SortBy: $("#liSort a i").hasClass("fa-sort-amount-asc") ? 1 : 2,
569            SearchText: $.trim($("#txtSearchKeywords").val().replace(/%20/g, " ")),
570            CategoryId: $.trim($("#ddlCategory").val()),
571            UserId: 0
572        },
573        success: function (result) {
574            //$("#divPremiumNoRecordFound").hide();
575            //$("#divPremiumListing").show();
576            $("#divContent,div#divSearch").removeClass("hide");
577
578            var IsListingAvailable = false;
579            if (result != null && result != "") {
580                //Bind Premium Listings.
581               // console.log(result.Listings.ListingResult);
582                if (result.Listings.ListingResult != null) {
583                    $("#ulPremiumListing").empty();
584                    $('#ulFreeListing').empty();
585                    $('#ulBasicListing').empty();
586                    premiumListingsjson = result;
587                    var basicHtml = "";
588                    $("#spnResultCount").text(result.Listings.ListingResult.length + " " + app.localize("Results"));
589                    //if (result.Listings.ListingResult.length > 0) { IsListingAvailable = true; $("#divPremiumListing").attr("style", "display:block;"); $("#divPremiumNoRecordFound").attr("style", "display:none;"); } else { $("#divPremiumListing").attr("style", "display:none;"); $("#divPremiumNoRecordFound").attr("style", "display:block;"); }
590                    for (var i = 0; i < result.Listings.ListingResult.length ; i++) {
591
592                        if (result.Listings.ListingResult[i].ListingTypeName == "Premium" && result.Listings.ListingResult[i].IsListingFreeToo == false) {
593                            if (result.Listings.ListingResult[i].IsFavorite == false) {
594                                $('#ulPremiumListing').append("<li><h3 class='premium-h2'>" + result.Listings.ListingResult[i].ListingName + "<i class='fa fa-star-o pull-right cursor-pointer'  id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></h3><div class='premium-list-img-wrap'><img width='770' height='462' src='" + result.Listings.ListingResult[i].ImageURL + "'><p class='premium-cat'>" + result.Listings.ListingResult[i].Category + "</p></div><div class='premium-list-details '><div class='row'><div class='col-md-12 premium-address-wrap mb15'><p><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div><div class='col-md-3'><p><i class='fa fa-phone'></i> " + result.Listings.ListingResult[i].ContactNo + "</p></div><div class='col-md-7'><p><i class='fa fa-globe'></i> <a href='" + result.Listings.ListingResult[i].WebsiteUrl + "' title='" + result.Listings.ListingResult[i].WebsiteUrl + "' target='_blank'>" + result.Listings.ListingResult[i].WebsiteUrl.substring(0, 20) + "</a></p></div><div class='col-md-2 text-right'><p><a href='" + abp.appPath + "About/PremiumDetails/" + result.Listings.ListingResult[i].ListingName + "-" + result.Listings.ListingResult[i].ListingId + "'>" + app.localize('Details') + " <i class='fa fa-angle-right'></i></a></p></div></div></div></li>");
595                            }
596                            else {
597                                $('#ulPremiumListing').append("<li><h3 class='premium-h2'>" + result.Listings.ListingResult[i].ListingName + "<i class='fa fa-star pull-right cursor-pointer' title='Marked as favorite' id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></h3><div class='premium-list-img-wrap'><img width='770' height='462' src='" + result.Listings.ListingResult[i].ImageURL + "'><p class='premium-cat'>" + result.Listings.ListingResult[i].Category + "</p></div><div class='premium-list-details '><div class='row'><div class='col-md-12 premium-address-wrap mb15'><p><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div><div class='col-md-3'><p><i class='fa fa-phone'></i> " + result.Listings.ListingResult[i].ContactNo + "</p></div><div class='col-md-7'><p><i class='fa fa-globe'></i> <a href='" + result.Listings.ListingResult[i].WebsiteUrl + "' title='" + result.Listings.ListingResult[i].WebsiteUrl + "' target='_blank'>" + result.Listings.ListingResult[i].WebsiteUrl.substring(0, 20) + "</a></p></div><div class='col-md-2 text-right'><p><a href='" + abp.appPath + "About/PremiumDetails/" + result.Listings.ListingResult[i].ListingName + "-" + result.Listings.ListingResult[i].ListingId + "'>" + app.localize('Details') + " <i class='fa fa-angle-right'></i></a></p></div></div></div></li>");
598                            }
599                            //if (result.Listings.ListingResult[i].IsFreeListing == true) {
600                            //    if (result.Listings.ListingResult[i].IsFavorite == false) {
601                            //        $('#ulFreeListing').append("<li class='free-list-wrap bgColor '><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star-o free-star cursor-pointer'  id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
602                            //    }
603                            //    else {
604                            //        $('#ulFreeListing').append("<li class='free-list-wrap'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star free-star cursor-pointer' title='Marked as favorite' id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
605                            //    }
606                            //}
607                        }
608                        if (result.Listings.ListingResult[i].ListingTypeName == "Basic" && result.Listings.ListingResult[i].IsListingFreeToo == false) {
609                            if (result.Listings.ListingResult[i].IsFavorite == false) {
610                                $('#ulBasicListing').append("<li><h3 class='paid-h2'>" + result.Listings.ListingResult[i].ListingName + "<i class='fa fa-star-o pull-right cursor-pointer'  id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></h3><div class='row is-flex'><div class='col-md-6'><div class='premium-list-img-wrap'><img width='370' height='222' src='" + result.Listings.ListingResult[i].ImageURL + "'><p class='premium-cat'>" + result.Listings.ListingResult[i].Category + "</p></div></div><div class='col-md-6'><div class='paid-list-details'><p><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p><p><i class='fa fa-phone'></i> " + result.Listings.ListingResult[i].ContactNo + "</p><p><i class='fa fa-globe'></i> <a href='" + result.Listings.ListingResult[i].WebsiteUrl + "' title='" + result.Listings.ListingResult[i].WebsiteUrl + "' target='_blank'>" + result.Listings.ListingResult[i].WebsiteUrl.substring(0, 20) + "</a></p>
610<a class='paid-link-details' href='" + abp.appPath + "About/PaidDetails?ListingId=" + result.Listings.ListingResult[i].ListingId + "'>" + app.localize('Details') + " <i class='fa fa-angle-right'></i></a></div></div></div></li>");
611                            }
612                            else {
613                                $('#ulBasicListing').append("<li><h3 class='paid-h2'>" + result.Listings.ListingResult[i].ListingName + "<i class='fa fa-star pull-right cursor-pointer' title='Marked as favorite' id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></h3><div class='row is-flex'><div class='col-md-6'><div class='premium-list-img-wrap'><img width='370' height='222' src='" + result.Listings.ListingResult[i].ImageURL + "'><p class='premium-cat'>" + result.Listings.ListingResult[i].Category + "</p></div></div><div class='col-md-6'><div class='paid-list-details'><p><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p><p><i class='fa fa-phone'></i> " + result.Listings.ListingResult[i].ContactNo + "</p><p><i class='fa fa-globe'></i> <a href='" + result.Listings.ListingResult[i].WebsiteUrl + "' title='" + result.Listings.ListingResult[i].WebsiteUrl + "' target='_blank'>" + result.Listings.ListingResult[i].WebsiteUrl.substring(0, 20) + "</a></p><a class='paid-link-details' href='" + abp.appPath + "About/PaidDetails?ListingId=" + result.Listings.ListingResult[i].ListingId + "'>" + app.localize('Details') + " <i class='fa fa-angle-right'></i></a></div></div></div></li>");
614                            }
615                            //if (result.Listings.ListingResult[i].IsFreeListing == true) {
616                            //    if (result.Listings.ListingResult[i].IsFavorite == false) {
617                            //        $('#ulFreeListing').append("<li class='free-list-wrap bgColor '><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star-o free-star cursor-pointer'  id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
618                            //    }
619                            //    else {
620                            //        $('#ulFreeListing').append("<li class='free-list-wrap'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star free-star cursor-pointer' title='Marked as favorite' id=" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
621                            //    }
622                            //}
623
624                        }
625                        if (result.Listings.ListingResult[i].ListingTypeName == "Free" && result.Listings.ListingResult[i].IsListingFreeToo == false) {
626                            if (result.Listings.ListingResult[i].IsFavorite == false) {
627                                $('#ulFreeListing').append("<li class='free-list-wrap bgColor '><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star-o free-star cursor-pointer'  id=" + "f_" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
628                            }
629                            else {
630                                $('#ulFreeListing').append("<li class='free-list-wrap'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star free-star cursor-pointer' title='Marked as favorite' id=" + "f_" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
631                            }
632
633                        }
634
635                        if (result.Listings.ListingResult[i].IsListingFreeToo == true) {
636                            if (result.Listings.ListingResult[i].IsFavorite == false) {
637                                $('#ulFreeListing').append("<li class='free-list-wrap bgColor '><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star-o free-star cursor-pointer'  id=" + "f_" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
638                            }
639                            else {
640                                $('#ulFreeListing').append("<li class='free-list-wrap'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-3 col-md-2 text-center'><img width='103' height='62' src='" + result.Listings.ListingResult[i].ImageURL + "'></div><div class='col-xs-9 col-md-10'><div class='row is-flex-all is-flex-center-v-all'><div class='col-xs-9 col-md-9'><div class='free-details-wrap'><h3>" + result.Listings.ListingResult[i].ListingName + "</h3><p class='address'><i class='fa fa-location-arrow'></i> " + result.Listings.ListingResult[i].Address + "</p></div></div><div class='col-xs-3 col-md-3 text-right'><i class='fa fa-star free-star cursor-pointer' title='Marked as favorite' id=" + "f_" + result.Listings.ListingResult[i].ListingId + " onclick=\" AddFavourite(" + result.Listings.ListingResult[i].ListingId + ")\"></i></div></div></div></div></li>");
641                            }
642                        }
643                    }
644
645                    if (result.Listings.ResultCount > 0) {
646                        $("#divPremiumListingAdd").show();
647                        if (result.Listings.ResultCount > numberOfRecords) {
648                            var previousPagerNumber = parseInt(pageIndex) - parseInt(1);
649                            var previousPagerStyle = "style='cursor:pointer'";
650                            if (pageIndex == 0)
651                                previousPagerStyle = "style='cursor:default'";
652                            else
653                                previousPagerStyle = "style='cursor:pointer' onclick='GetListings(" + previousPagerNumber + ",1);'";
654                            var numbertOfPagesWithCeil = Math.ceil(result.Listings.ResultCount / numberOfRecords);
655                            $("#ulPremiumListingTopPager").empty();
656                            $("#ulPremiumListingTopPager").append("<li><a " + previousPagerStyle + " aria-label='Previous'><span aria-hidden='true' class='mdi mdi-chevron-double-left'></span></a></li>");
657                            $("#ulPremiumListingBottomPager").empty();
658                            $("#ulPremiumListingBottomPager").append("<li><a " + previousPagerStyle + " aria-label='Previous'><span aria-hidden='true' class='mdi mdi-chevron-double-left'></span></a></li>");
659                            var pageNumber = 0;
660                            for (var i = 0; i < numbertOfPagesWithCeil ; i++) {
661                                pageNumber = parseInt(i) + parseInt(1);
662                                var activeClass = "style='cursor:pointer'";
663                                if (parseInt(pageIndex) == i)
664                                    activeClass = "class='active'";
665                                var onclickfun = "";
666                                if (parseInt(pageIndex) != i)
667                                    onclickfun = "onclick='GetListings(" + i + ",1);'";
668                                $("#ulPremiumListingTopPager").append("<li " + activeClass + "  id=" + pageNumber + "><a " + onclickfun + ">" + pageNumber + "</a></li>");
669                                $("#ulPremiumListingBottomPager").append("<li " + activeClass + "  id=" + pageNumber + "><a " + onclickfun + ">" + pageNumber + "</a></li>");
670                            }
671                            var nextPagerNumber = parseInt(pageIndex) + parseInt(1);
672                            if (numbertOfPagesWithCeil == nextPagerNumber) {
673                                $("#ulPremiumListingTopPager").append("<li><a aria-label='Next'><span aria-hidden='true' class='mdi mdi-chevron-double-right'></span></a></li>");
674                                $("#ulPremiumListingBottomPager").append("<li><a aria-label='Next'><span aria-hidden='true' class='mdi mdi-chevron-double-right'></span></a></li>");
675                            }
676                            else {
677                                $("#ulPremiumListingTopPager").append("<li><a style='cursor:pointer' onclick='GetListings(" + nextPagerNumber + ",1);' aria-label='Next'><span aria-hidden='true' class='mdi mdi-chevron-double-right'></span></a></li>");
678                                $("#ulPremiumListingBottomPager").append("<li><a style='cursor:pointer' onclick='GetListings(" + nextPagerNumber + ",1);' aria-label='Next'><span aria-hidden='true' class='mdi mdi-chevron-double-right'></span></a></li>");
679                            }
680                            $("#ulPremiumListingTopPager").show();
681                            $("#ulPremiumListingBottomPager").show();
682                            $("#divPremiumListingBottomPager").show();
683                            GetPaging("ulPremiumListingTopPager");
684                            GetPaging("ulPremiumListingBottomPager");
685                        }
686                        else {
687                            $("#ulPremiumListingTopPager").hide();
688                            $("#ulPremiumListingBottomPager").hide();
689                            $("#divPremiumListingBottomPager").hide();
690                        }
691                    }
692                    else {
693                        $("#ulPremiumListingTopPager").hide();
694                        $("#ulPremiumListingBottomPager").hide();
695                        $("#divPremiumListingBottomPager").hide();
696                       // $("#divPremiumListingAdd").hide();
697                    }
698                }
699                else {
700                    $("#divPremiumNoRecordFound").show();
701                    $("#divPremiumListing").hide();
702                }
703            }
704            $("#imgUploading").attr("style", "display:none;");
705        },
706        error: function (err) {
707            // abp.notify.info(err.statusText);
708            $("#imgUploading").attr("style", "display:none;");
709        }
710    });
711
712}
713$(document).ready(function () {
714   
715  //  alert("in");
716     DefaultLatitude = $("#hdnLatitude").val();
717     DefaultLongitude = $("#hdnLongitude").val();
718  //  $("#divContent,div#divSearch").addClass("hide");
719    $("#imgUploading").attr("style", "display:block;");
720    var query = window.location.search.substring(1);
721   
722    //console.log(query);
723    var newquery = document.URL;
724   
725    var newVars = newquery.replace($("#hdnProjectName").val(),"")
726   
727   // var vars = query.split("?");
728    var vars = newVars.split("/");
729    
730   
731    if (vars.length == 10) {
732        var value = newVars.split("/");      
733
734        if (value.length == 10) {
735            var searchText = value[7] != "" && value[7] != null ? value[7].replace(/%20/g, " ") : value[7];
736            $("#txtSearchKeywords").val(decodeURIComponent(searchText.replace('-'," ")));
737            //$("#txtSearchKeywords").val(value[3]);
738            PageDDLListNew(value[8], value[9]);
739        } else {
740            PageDDLListNew(0, 0);
741            //PageDDLList(0, 0); 
742        }
743    }
744
745    else
746       
747        if (vars.length == 9) {
748            var value = newVars.split("/");
749           
750
751            if (value.length == 9) {
752
753                //$("#txtSearchKeywords").val(value[2]);
754                PageDDLListNew(value[7], value[8]);
755               // PageDDLListNew(value[3], value[2])
756            } else {
757                PageDDLListNew(0, 0);
758                //PageDDLList(0, 0); 
759            }
760        } else {
761            PageDDLListNew(0, 0);
762            //PageDDLList(0, 0);
763            }
764   
765
766    if ($("#hdnUserId").val() != "") {
767        GetUserRecentSearchResult();
768
769       
770      //  GetUserRecentSearchResult()
771    }
772    GetPagination(0)
773    GetLatestNews();
774    GetAddvertisement("W", 1);
775    $("#imgUploading").attr("style", "display:none;");
776    //$("#hrefCollapse").click(function () {
777    //    alert("in");
778    //   $(this).toggleClass('active')
779    //    $("#divCollapse").toggle();
780    //});
781  //  var ajax = app.utils.GetGeoLocation();
782
783});
784
785function GetPagination(pageIndex) {
786    resultCount = $("#hdnNoOfRecord").val();
787    
788    if (resultCount > 0) {
789        $("#divPremiumListingAdd").show();
790        if (resultCount > numberOfRecords) {
791            var previousPagerNumber = parseInt(pageIndex) - parseInt(1);
792            var previousPagerStyle = "style='cursor:pointer'";
793            if (pageIndex == 0)
794                previousPagerStyle = "style='cursor:default'";
795            else
796                previousPagerStyle = "style='cursor:pointer' onclick='GetListings(" + previousPagerNumber + ",1);'";
797            var numbertOfPagesWithCeil = Math.ceil(resultCount / numberOfRecords);
798            $("#ulPremiumListingTopPager").empty();
799            $("#ulPremiumListingTopPager").append("<li><a " + previousPagerStyle + " aria-label='Previous'><span aria-hidden='true' class='mdi mdi-chevron-double-left'></span></a></li>");
800            $("#ulPremiumListingBottomPager").empty();
801            $("#ulPremiumListingBottomPager").append("<li><a " + previousPagerStyle + " aria-label='Previous'><span aria-hidden='true' class='mdi mdi-chevron-double-left'></span></a></li>");
802            var pageNumber = 0;
803            for (var i = 0; i < numbertOfPagesWithCeil ; i++) {
804                pageNumber = parseInt(i) + parseInt(1);
805                var activeClass = "style='cursor:pointer'";
806                if (parseInt(pageIndex) == i)
807                    activeClass = "class='active'";
808                var onclickfun = "";
809                if (parseInt(pageIndex) != i)
810                    onclickfun = "onclick='GetListings(" + i + ",1);'";
811                $("#ulPremiumListingTopPager").append("<li " + activeClass + "  id=" + pageNumber + "><a " + onclickfun + ">" + pageNumber + "</a></li>");
812                $("#ulPremiumListingBottomPager").append("<li " + activeClass + "  id=" + pageNumber + "><a " + onclickfun + ">" + pageNumber + "</a></li>");
813            }
814            var nextPagerNumber = parseInt(pageIndex) + parseInt(1);
815            if (numbertOfPagesWithCeil == nextPagerNumber) {
816                $("#ulPremiumListingTopPager").append("<li><a aria-label='Next'><span aria-hidden='true' class='mdi mdi-chevron-double-right'></span></a></li>");
817                $("#ulPremiumListingBottomPager").append("<li><a aria-label='Next'><span aria-hidden='true' class='mdi mdi-chevron-double-right'></span></a></li>");
818            }
819            else {
820                $("#ulPremiumListingTopPager").append("<li><a style='cursor:pointer' onclick='GetListings(" + nextPagerNumber + ",1);' aria-label='Next'><span aria-hidden='true' class='mdi mdi-chevron-double-right'></span></a></li>");
821                $("#ulPremiumListingBottomPager").append("<li><a style='cursor:pointer' onclick='GetListings(" + nextPagerNumber + ",1);' aria-label='Next'><span aria-hidden='true' class='mdi mdi-chevron-double-right'></span></a></li>");
822            }
823            $("#ulPremiumListingTopPager").show();
824            $("#ulPremiumListingBottomPager").show();
825            $("#divPremiumListingBottomPager").show();
826            GetPaging("ulPremiumListingTopPager");
827            GetPaging("ulPremiumListingBottomPager");
828        }
829        else {
830            $("#ulPremiumListingTopPager").hide();
831            $("#ulPremiumListingBottomPager").hide();
832            $("#divPremiumListingBottomPager").hide();
833        }
834    }
835    else {
836        $("#ulPremiumListingTopPager").hide();
837        $("#ulPremiumListingBottomPager").hide();
838        $("#divPremiumListingBottomPager").hide();
839        // $("#divPremiumListingAdd").hide();
840    }
841}
842function AddFavourite(ListingId) {
843
844    var isFavorite = false;
845    if ($("#hdnUserId").val() == null || $("#hdnUserId").val() == "") {
846        return window.location.href = abp.appPath + 'Account/Login'
847    }
848    if ($("#" + ListingId).hasClass("fa-star-o")) {
849        isFavorite = true;
850    }
851    else if ($("#f_" + ListingId).hasClass("fa-star-o")) {
852        isFavorite = true;
853    }
854    $.ajax({
855        type: "POST",
856        url: abp.appPath + 'Home/AddFavourite',
857        data: {
858            ListingId: ListingId,
859            isFavorite: isFavorite
860        },
861        success: function (Result) {
862            //   console.log(Result.Result);
863
864            //Added by ks 01-11-2017 For SEO - Event Tracking and Goals
865            var currentPageURL = window.location.href;
866            var ListingName = $("#spn_" + ListingId).text();
867            //if (listingTitle == "") {
868            //    listingTitle = $('#f_' + ListingId).parent().text().trim();
869            //}
870            if (Result.Result == true) {
871                if (isFavorite == true) {
872                    $("#" + ListingId).removeClass('fa-star-o');
873                    $("#" + ListingId).attr('title', "Marked as favorite");
874                    $("#" + ListingId).addClass('fa-star');
875
876                    $("#f_" + ListingId).removeClass('fa-star-o');
877                    $("#f_" + ListingId).attr('title', "Marked as favorite");
878                    $("#f_" + ListingId).addClass('fa-star');
879
880                    //Added by ks 01-11-2017 For SEO - Event Tracking and Goals
881                    if ($("#hdnIsCountryIsChina").val() == "False") {
882                       
883                        ga('send', 'event', 'User Engagement – Favourite Listing', ListingName, currentPageURL);
884                    }
885                }
886                else {
887                    $("#" + ListingId).removeClass('fa-star');
888                    $("#" + ListingId).addClass('fa-star-o');
889                    $("#" + ListingId).attr('title', "");
890
891                    $("#f_" + ListingId).removeClass('fa-star');
892                    $("#f_" + ListingId).addClass('fa-star-o');
893                    $("#f_" + ListingId).attr('title', "");
894
895                    //Added by ks 01-11-2017 For SEO - Event Tracking and Goals
896                    if ($("#hdnIsCountryIsChina").val() == "False") {
897                        
898                        ga('send', 'event', 'User Engagement – Unfavourite Listing', ListingName, currentPageURL);
899                    }
900                }
901
902            }
903        },
904        error: function (err) {
905            abp.notify.info(err.statusText);
906            //  $("#imgUploading").attr("style", "display:none;");
907        }
908    });
909}
910function GetLatestNews() {
911    var currentCultureName = $("#hdnCurrentCultureName").val();
912    var location = $("#hdnLocationNew").val();
913    $.ajax({
914        type: "POST",
915        async: false,
916        url: abp.appPath + 'Home/GetLatestNews',
917        success: function (result) {
918          
919            if (result.Result.length > 0) {
920                $("#divLatestNews").attr("style", "display:block; max-width:100%;");
921            }
922           
923            var html = "";
924            html += " <ul class=\"news-list\" >"
925            for (i = 0; i < result.Result.length; i++) {
926                var CreationTime = ConvertJsonDateString(result.Result[i].CreationTime);
927                html += " <li>"
928                html += "<div class=\"row\">"
929                html += "<div class=\"col-xs-12 col-md-12\"><img src='" + result.Result[i].ImageUrl + "' alt='" + result.Result[i].ImageName + "' title='" + result.Result[i].ImageName + "'></div>"
930                html += " <div class=\"col-xs-12 col-md-12\">"
931                html += " <h3>" + result.Result[i].DefaultTitle + "</h3>"
932                html += "<p class=\"author\"> By " + result.Result[i].UserName + "</p>"
933                html += "<p class=\"date\">" + CreationTime + "</p>"
934                html += "<p class=\"blurb\">" + result.Result[i].Description.substring(0, 20) + " ...</p>"
935                //html += "  <a class=\"readmore\" href='" + abp.appPath + "Article/Details?ArticleId=" + result.Result[i].ListingId + "'>" + app.localize('Details') + " <i class=\"fa fa-angle-double-right\" aria-hidden=\"true\"></i></a>"
936                html += "  <a class=\"readmore\" href='" + abp.appPath + "Article/" + currentCultureName + "/" + result.Result[i].SEOTitle  + "'>" + app.localize('Details') + " <i class=\"fa fa-angle-double-right\" aria-hidden=\"true\"></i></a>"
937                html += "</div>"
938                html += "</div>"
939                html += " </li>"
940            }
941            html += "</ul>"
942            $("#divLatestNews").append(html);
943        },
944        error: function (xhr, status, error) {
945            $("#imgUploading").attr("style", "display:none;");
946        }
947
948    });
949}
950
951function ConvertJsonDateString(jsonDate) {
952
953    var shortDate = null;
954    if (jsonDate) {
955        var regex = /-?\d+/;
956        var matches = regex.exec(jsonDate);
957        var dt = new Date(parseInt(matches[0]));
958        var month = dt.getMonth() + 1;
959        var monthString = month > 9 ? month : '0' + month;
960        var day = dt.getDate();
961        var dayString = day > 9 ? day : '0' + day;
962        var year = dt.getFullYear();
963        shortDate = monthString + '/' + dayString + '/' + year;
964    }
965    return shortDate;
966
967
968}
969function Collapse()
970{
971    
972    $(this).toggleClass('active')
973    $("#divCollapse").toggle();
974}
975function GetUserRecentSearchResult() {
976   
977    if ($("#hdnUserId").val() != "") {
978        $("#divRecentSerach").html(" ");
979        $("#divRecentSerach").empty();
980        $.ajax({
981            type: "POST",
982            async: false,
983            url: abp.appPath + 'Home/GetUserRecentSearchResult',
984            success: function (result) {
985                
986                if (result.Result.length > 0) {
987                    var html = "";
988                    //html += " <div class=\"search-intro\"><div class=\"row\"> <div class=\"col-md-6\">" + app.localize("RecentlySearched") + "</div><div class=\"col-md-6\"></div></div></div>"
989                    html += " <div class=\"search-intro\"><a class=\"hrefCollapse-button\" id='hrefCollapse' onclick=Collapse();>" + app.localize("RecentlySearched") + "<i class='fa fa-chevron-up' aria-hidden='true'></i><i class='fa fa-chevron-down' aria-hidden='true'></i></a></div><div id='divCollapse' style=\'display:none\'>"
990                    for (var resultcount = 0; resultcount < result.Result.length; resultcount++) {
991
992                        var keyword = result.Result[resultcount].KeyWord;
993                        if (keyword == "Not available")
994                        {
995                            keyword = "";
996                        }
997                        var distance = result.Result[resultcount].Distance;
998                        var categoryId = result.Result[resultcount].CategoryId;
999                        var categoryName = result.Result[resultcount].CategoryName;
1000                        var categoryWithLanguageId = result.Result[resultcount].CategoryWithLanguageId;
1001                        
1002                        if (categoryId == null) {
1003                            categoryId = 0;
1004                        }
1005                        if (categoryName == null) {
1006                            categoryName = "Category name not available."
1007                        }
1008                        html += "<div style=\"cursor:pointer\"  onclick=\" GetResult(\'" + keyword + "\', " + distance + ", " + categoryWithLanguageId + " )\" class=\"outer-list offset-top-4\"><div class=\"row\"><div class=\"col-md-1 text-center\"><i class=\"fa fa-search\" aria-hidden=\"true\"></i></div><div class=\"col-md-11\"><h3>" + result.Result[resultcount].KeyWord + "</h3><p>" + categoryName + ", " + result.Result[resultcount].Distance + "KM</p></div></div></div>"
1009                    }
1010                    html +="</div>"
1011                    $("#divRecentSerach").append(html);
1012                }
1013                $("#imgUploading").attr("style", "display:none;");
1014            },
1015            error: function (xhr, status, error) {
1016
1017                $("#imgUploading").attr("style", "display:none;");
1018            }
1019        })
1020    }
1021}
1022function GetAddvertisement(appType, pageType) {
1023    // Call ajax for list of advertisement.
1024    var ajaxCall = app.utils.GetAddvertisementForSearch(appType, pageType, DefaultLatitude, DefaultLongitude);
1025    ajaxCall.success(function (result) {
1026        advertisementList = result.Result;      
1027        if (advertisementList.Top != null) {
1028            //$('#divPremiumListingTopAdd img').attr('src', advertisementList.Top.TopImageUrl);
1029            //$("#divPremiumListingTopAdd").click(function () {
1030            //    IncreaseViewCount(advertisementList.Top.AdvertisementId)
1031            //    window.open(advertisementList.Top.TopImageExternalUrl, '_blank');
1032            //});
1033        }
1034        if (advertisementList.Bottom != null) {
1035            if (advertisementList.Bottom.TopImageUrl != "" && advertisementList.Bottom.TopImageUrl != null) {
1036                $("#divPremiumListingAdd").show();
1037                $('#divPremiumListingAdd img').attr('src', advertisementList.Bottom.TopImageUrl);
1038                $("#divPremiumListingAdd").click(function () {
1039                    IncreaseViewCount(advertisementList.Bottom.AdvertisementId)
1040                    window.open(advertisementList.Bottom.TopImageExternalUrl, '_blank');
1041                });
1042            }
1043            //$('#divBasicListingAdd img').attr('src', advertisementList.Bottom.TopImageUrl);
1044            //$("#divBasicListingAdd").click(function () {
1045            //    IncreaseViewCount(advertisementList.Bottom.AdvertisementId)
1046            //    window.open(advertisementList.Bottom.TopImageExternalUrl, '_blank');
1047            //});
1048            //$('#divFreeListingBottomAdd img').attr('src', advertisementList.Bottom.TopImageUrl);
1049            //$("#divFreeListingBottomAdd").click(function () {
1050            //    IncreaseViewCount(advertisementList.Bottom.AdvertisementId)
1051            //    window.open(advertisementList.Bottom.TopImageExternalUrl, '_blank');
1052            //});
1053        }
1054    });
1055}
1056
1057function IncreaseViewCount(advertisementTypeId) {
1058    $.ajax({
1059        type: "Post",
1060        url: abp.appPath + 'Home/IncreaseViewCount',
1061        async: false,
1062        data: {
1063            PageType: pageType,
1064            AppType: appType,
1065            AdvertisementId: advertisementTypeId
1066        },
1067        success: function (result) {
1068
1069        }
1070    })
1071}
1072
1073function GetResult(keyword, distance, categoryId) {
1074   $("#txtSearchKeywords").val(keyword);
1075   // PageDDLList(distance, categoryId);
1076    ////bind ddl value
1077    $("#ddlCategory").val(categoryId).select().change();
1078    $("#ddlDistance").val(distance).select().change();
1079   // GetListings(0, 0);
1080    guiMap();
1081}
1082function ChangeSortingOrder() {
1083
1084    var newquery = document.URL;
1085
1086    var newVars = newquery.replace($("#hdnProjectName").val(), "")
1087
1088    // var vars = query.split("?");
1089    var vars = newVars.split("/");
1090 
1091
1092    //if (vars.length == 8) {
1093    //    var value = newVars.split("/");
1094
1095    //    if (value.length == 8) {
1096    //        var searchText = value[5] != "" && value[5] != null ? value[5].replace(/%20/g, " ") : value[5];
1097    //        $("#txtSearchKeywords").val(decodeURIComponent(searchText));
1098    //        //$("#txtSearchKeywords").val(value[3]);
1099    //        PageDDLListNew(value[6], value[4]);
1100    //    } else {
1101    //        PageDDLListNew(0, 0);
1102    //        //PageDDLList(0, 0); 
1103    //    }
1104    //}
1105    if (vars.length == 8) {
1106        var value = newVars.split("/");
1107
1108        if (value.length == 8) {
1109            var searchText = value[5] != "" && value[5] != null ? value[5].replace(/%20/g, " ") : value[5];
1110            $("#txtSearchKeywords").val(decodeURIComponent(searchText));
1111            //$("#txtSearchKeywords").val(value[3]);
1112            PageDDLListNew(value[6], value[7]);
1113        } else {
1114            PageDDLListNew(0, 0);
1115            //PageDDLList(0, 0); 
1116        }
1117    }
1118    else
1119
1120        //if (vars.length == 7) {
1121        //    var value = newVars.split("/");
1122           
1123
1124        //    if (value.length == 7) {
1125
1126        //        //$("#txtSearchKeywords").val(value[2]);
1127        //        PageDDLListNew(value[5], value[4]);
1128        //        // PageDDLListNew(value[3], value[2])
1129        //    } else {
1130        //        PageDDLListNew(0, 0);
1131        //        //PageDDLList(0, 0); 
1132        //    }
1133        //} else {
1134        //    PageDDLListNew(0, 0);
1135        //    //PageDDLList(0, 0);
1136        //}
1137        if (vars.length == 7) {
1138            var value = newVars.split("/");
1139
1140
1141            if (value.length == 7) {
1142
1143                //$("#txtSearchKeywords").val(value[2]);
1144                PageDDLListNew(value[5], value[6]);
1145                // PageDDLListNew(value[3], value[2])
1146            } else {
1147                PageDDLListNew(0, 0);
1148                //PageDDLList(0, 0); 
1149            }
1150        } else {
1151            PageDDLListNew(0, 0);
1152            //PageDDLList(0, 0);
1153        }
1154    sortBy = $("#liSort a i").hasClass("fa-sort-amount-asc") ? 1 : 2
1155   
1156    GetListings(0,0);
1157}
1158
1159function GetPaging(pager) {
1160    var ulElement = document.getElementById(pager);
1161    var allLi = ulElement.getElementsByTagName("li");
1162    for (var i = 0; i < allLi.length; i++) {
1163        if (i != 0 && i != allLi.length - 1) {
1164            // allLi[i].className += " displayNone";
1165            allLi[i].setAttribute("style", "display:none");
1166        }
1167
1168
1169    }
1170    var ulliElement = ulElement.getElementsByClassName("active");
1171    var ulliid = parseInt(ulliElement[0].id);
1172    var length = allLi.length;
1173    var behindCounter = 0;
1174    for (var i = 1; i <= 2; i++) {
1175        if (ulliid - i > 0) {
1176            var id = ulliid - i;
1177            $(allLi[id]).removeAttr("style");
1178            behindCounter++;
1179        }
1180        //var id = parseInt(ulliid) + parseInt(i);
1181        //  allLi[ulliid - 1 + i].className.replace("displayNone","displayli");
1182        //$(allLi[id]).removeAttr("style");
1183    }
1184    if ((parseInt(ulliid) == parseInt(length - 3)) || (parseInt(ulliid) == parseInt(length - 2))) {
1185
1186        for (var i = 0; i < 5; i++) {
1187
1188            var id = parseInt(length - 2) - parseInt(i)
1189            //  allLi[ulliid - 1 + i].className.replace("displayNone","displayli");
1190            $(allLi[id]).removeAttr("style");
1191
1192        }
1193    }
1194    else {
1195        for (var i = 0; i < 5 - behindCounter; i++) {
1196            var id = parseInt(ulliid) + parseInt(i);
1197            if (id > 0) {
1198                $(allLi[id]).removeAttr("style");
1199            }
1200
1201        }
1202    }
1203}
1204
1205

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.