').appendTo('#respTrackForm' + slot);
$SUL.post(serviceUrl, $SUL('#respTrackForm' + slot).serialize());
}
}
function rotateimage() {
var degree = '90';
var imageclass = $SUL('#centerphoto img').attr('class');
if (imageclass == '' || imageclass == undefined || imageclass == 'undefined') {
$SUL('#centerphoto img').removeAttr('class').addClass('transninety');
}
else if (imageclass == 'transninety') {
$SUL('#centerphoto img').removeAttr('class').addClass('transoneeighty');
}
else if (imageclass == 'transoneeighty') {
$SUL('#centerphoto img').removeAttr('class').addClass('transtwoseventy');
}
else {
$SUL('#centerphoto img').removeAttr('class');
}
}
function initiategoogleads() {
try {
if ((jQuery.browser = jQuery.browser || {}).mobile) {
$SUL(document).on("scroll.pubad", function () {
var instag = $SUL('ins').length;
for (var i = 0; i < instag; i++) {
(adsbygoogle = window.adsbygoogle || []).push({});
console.log('c');
}
$SUL(document).off('scroll.pubad');
});
}
else {
setTimeout(function () {
var instag = $SUL('ins').length;
for (var i = 0; i < instag; i++) {
(adsbygoogle = window.adsbygoogle || []).push({});
console.log('c');
}
}, 4000);
}
} catch (ex) {
}
}
function getRMScrollpercent() {
var bottom = $SUL(window).height() + $SUL(window).scrollTop();
var height = $SUL(document).height();
return Math.round(100 * bottom / height);}
function clearlastseen() {
var storageLen, storageObj, size;
try {
for (storageObj in localStorage) {
if (!localStorage.hasOwnProperty(storageObj)) {
continue;
}
if (storageObj == 'rmlastseen' || storageObj == 'renlastseen') {
storageLen = ((localStorage[storageObj].length + storageObj.length) * 2);
size = (storageLen / 1024).toFixed(2);
if (size > 2.0) {
localStorage.removeItem(storageObj);
}
}
};
}
catch (ex) {
console.log('error at lastseen');
}
}
function thumbnailopen(pos) {
if ($SUL('#thumbnailshowhide').text() == 'Show Thumbnails') {
$SUL('#thumbImgContainer' + pos).removeClass('hide show').addClass('show');
$SUL('#thumbnailshowhide').text('Hide Thumbnails');
}
else {
$SUL('#thumbImgContainer' + pos).removeClass('hide show').addClass('hide');
$SUL('#thumbnailshowhide').text('Show Thumbnails');
}
}
assignImageInViewport = function () {
$SUL('img[data-imgsrc]').each(function (ind, obj) {
var elementTop = $SUL(obj).offset().top;
var elementBottom = elementTop + $SUL(obj).outerHeight();
var viewportTop = $SUL(window).scrollTop();
var viewportBottom = viewportTop + $SUL(window).height();
if (elementBottom > viewportTop && elementTop < viewportBottom) {
var imgsrc = $SUL(obj).attr('data-imgsrc');
if (imgsrc != '' && imgsrc != 'undefined' && imgsrc != undefined) {
$SUL(obj).attr('src', $SUL(obj).attr('data-imgsrc'));
$SUL(obj).removeAttr('data-imgsrc');
}
}
});};
function showPhotosDiv() {
mapArr = ["getdiroverlayL", "schoolTabL", "transportTabL", "neighbourhoodTabL", "storesTabL", "hospitalsTabL"];
$SUL(mapArr).each(function (i, id) {
$SUL('#' + id).parent().removeClass('active');
});
$SUL('#photoTabL').parent().removeClass('active').addClass('active');
$SUL('#photolightbox').removeClass('hide');
$SUL('#maplightbox').removeClass('hide').addClass('hide');}
function showhidethmbnl(pos) {
$SUL('#thumbImgContainer' + pos).toggleClass('show hide');
if ($SUL('#thumbImgContainer' + pos).hasClass('hide')) {
$SUL('#dvShowhidethumbnail' + pos).text('Show Thumbnails');
}
else {
$SUL('#dvShowhidethumbnail' + pos).text('Hide Thumbnails');
}
}
function requestotp(pos) {
countdownsec = 30;
if ($SUL('#dvotptype' + pos + ' input[name=otptype]:checked').length == 1) {
var cookieCnt = addRMcookiecount();
if (Number(cookieCnt) >= 4) {
$SUL('#smsoption' + pos).parent().remove();
}
bindOTPtextbox(pos);
var otptype = $SUL('#dvotptype' + pos + ' input[name=otptype]:checked').val();
if (otptype == 'sms') {
$SUL('#lblotptimeout' + pos).text('Get OTP by SMS');
}
else if (otptype == 'call') {
$SUL('#lblotptimeout' + pos).text('Get OTP on Call');
}
$SUL('#dvRequestOtp' + pos + ' > a').text('Sending');
$SUL('#dvRequestOtp' + pos + ' > a').addClass('disabled').removeAttr('onclick');
$SUL.ajax({
url: "/common/post-responsev3.aspx?type=requestotp&" + $SUL('#frmResponse' + pos).serialize(),
success: function (data) {
$SUL('#dvotpVerify' + pos).removeClass('hide');
$SUL('#dvotpsubVerify' + pos).removeClass('hide');
$SUL('#submitrequestotp' + pos).attr('onclick', 'submitotp(\'' + pos + '\')');
var mobno = $SUL('#hdContactnumber' + pos).val();
$SUL('#lblotpMobinfo' + pos).text(mobno);
startotpcountdown(pos);
$SUL('#dvRequestOtp' + pos + ' > a').text('OTP Sent');
if (otptype == 'sms') {
$SUL('#lblotptype' + pos + '').text('You will soon receive an SMS with OTP pin for verification.');
}
else if (otptype == 'call') {
$SUL('#lblotptype' + pos + '').text('You will soon receive the automated call for verification.');
}
}
});
}
else {
$SUL('#dvRequestOtp' + pos + ' > a').text('Please select any option');
}
}
function addRMcookiecount() {
var cookieCnt = Sulekha.Common.getCookie("otpRMCookie");
if (typeof (cookieCnt) == 'object') {
cookieCnt = 1;
}
else if (typeof (cookieCnt) == 'string') {
cookieCnt = Number(cookieCnt);
cookieCnt++;
}
else {
cookieCnt++;
}
Sulekha.Common.setCookie('otpRMCookie', cookieCnt, 1, '');
return cookieCnt;}
function getRMcookiecount() {
var cookieCnt = Sulekha.Common.getCookie("otpRMCookie");
if (typeof (cookieCnt) == 'object') {
cookieCnt = 1;
}
else if (typeof (cookieCnt) == 'string') {
cookieCnt = Number(cookieCnt);
}
cookieCnt = Number(cookieCnt);
return cookieCnt;}
function bindOTPtextbox(pos) {
if ($SUL('input[name=otpinput]').length > 0) {
$SUL('input[name=otpinput]').off('blur');
$SUL('input[name=otpinput]').on('blur', function () {
$SUL('#lblotpinput' + pos).text('');
});
if ($SUL('#otpone' + pos).length > 0) {
$SUL('#otpone' + pos).off('keyup');
$SUL('#otptwo' + pos).off('keyup');
$SUL('#otpthree' + pos).off('keyup');
$SUL('#otpone' + pos).on('keyup', function (e) {
if ((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105)) {
$SUL('#otptwo' + pos).focus();
}
});
$SUL('#otptwo' + pos).on('keyup', function (e) {
if ((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105)) {
$SUL('#otpthree' + pos).focus();
}
});
$SUL('#otpthree' + pos).on('keyup', function (e) {
if ((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105)) {
$SUL('#otpfour' + pos).focus();
}
});
}
}
}
function startotpcountdown(pos) {
otpcountdown = setInterval(function () {
if (countdownsec > 0) {
countdownsec = countdownsec - 1;
$SUL('#dvotptimeout' + pos + ' > span.time-seconds').text(countdownsec);
}
else {
clearInterval(otpcountdown);
$SUL('#dvRequestOtp' + pos + ' > a').text('Resend OTP');
$SUL('#dvRequestOtp' + pos + ' > a').removeClass('disabled').attr('onclick', 'requestotp(\'' + pos + '\')');
$SUL('#lblotptype' + pos + '').text('Please try resending if you have not received the OTP');
}
}, 1000);}
function submitotp(pos) {
var otpbox = ['otpone', 'otptwo', 'otpthree', 'otpfour'], otpinput = '';
$SUL(otpbox).each(function (i, id) {
otpinput = otpinput + $SUL('#' + id + pos).val();
});
$SUL('#otpinput' + pos).val(otpinput);
if (otpinput == '' || otpinput == 'undefined' || otpinput == undefined) {
$SUL('#lblotpinput' + pos).text('Invalid OTP');
}
else {
var leadid = '', pinservice = '';
try {
if (responseObj[0].ROW_AD_RESPONSES[0].allrespid != undefined && responseObj[0].ROW_AD_RESPONSES[0].allrespid != ''
&& responseObj[0].ROW_AD_RESPONSES[0].allrespid != 'undefined') {
leadid = responseObj[0].ROW_AD_RESPONSES[0].allrespid;
}
if (responseObj[2].pinservice != undefined && responseObj[2].pinservice != '' && responseObj[2].pinservice != 'undefined') {
pinservice = responseObj[2].pinservice;
}
}
catch (ex) {
}
if (leadid != '' && pinservice != '') {
$SUL('#submitrequestotp' + pos).text('Submitting').removeClass('disabled').addClass('disabled');
$SUL.ajax({
url: "/common/post-responsev3.aspx?type=validatemobsendlead&service=" + pinservice + "&leadcontentid=" + leadid + "&" + $SUL('#frmResponse' + pos).serialize(),
success: function (data) {
if (data.result == '1') {
responseObj[1].pinprocess = 2;
fnSuccess(responseObj);
}
else {
$SUL('#lblotpinput' + pos).text('Invalid OTP');
$SUL('#submitrequestotp' + pos).text('Submit OTP').removeClass('disabled');
}
}
});
}
}
}
function changePhone(pos) {
$SUL('#contentDiv' + pos).removeClass('hide');
$SUL('#dvphoneverification' + pos).removeClass('hide').addClass('hide');
$SUL('#dvotpVerify' + pos).removeClass('hide').addClass('hide');
$SUL('#dvotpsubVerify' + pos).removeClass('hide').addClass('hide');
$SUL('#sndbt' + pos).removeClass('hide');
$SUL('#response_openLoading' + pos).removeClass('hide').addClass('hide');
clearInterval(otpcountdown);
$SUL('#dvRequestOtp' + pos + ' > a').text('Request OTP');
$SUL('#dvRequestOtp' + pos + ' > a').removeClass('disabled').attr('onclick', 'requestotp(\'' + pos + '\')');
$SUL('#lblotptype' + pos + '').text('Please try resending if you have not received the OTP');}
function callrecaptchaResponse(actionterm, slot, serviceUrl) {
settimer();
if (recaptchaEnable == 1) {
if (typeof (grecaptcha) == 'object') {
try {
grecaptcha.ready(function () {
try {
grecaptcha.execute('6LcanrgUAAAAAEQnd9-EsnxKxn7rqbnE-jzt1zpx', { action: actionterm }).then(function (token) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer, data: $SUL('#frmResponse' + slot).serialize() + "&token=" + token, success: fnSuccess });
timer = 0;
}, function (token) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " error1", data: $SUL('#frmResponse' + slot).serialize(), success: fnSuccess });
timer = 0;
});
}
catch (exs) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " catch1", data: $SUL('#frmResponse' + slot).serialize(), success: fnSuccess });
timer = 0;
}
});
}
catch (ex) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " catch2", data: $SUL('#frmResponse' + slot).serialize(), success: fnSuccess });
timer = 0;
}
}
else {
try {
$SUL.cachedScript("https://www.recaptcha.net/recaptcha/api.js?render=6LcanrgUAAAAAEQnd9-EsnxKxn7rqbnE-jzt1zpx").done(function () {
try {
grecaptcha.ready(function () {
try {
grecaptcha.execute('6LcanrgUAAAAAEQnd9-EsnxKxn7rqbnE-jzt1zpx', { action: actionterm }).then(
function (token) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer, data: $SUL('#frmResponse' + slot).serialize() + "&token=" + token, success: fnSuccess });
timer = 0;
}, function () {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " error2", data: $SUL('#frmResponse' + slot).serialize(), success: fnSuccess });
timer = 0;
});
}
catch (exs) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " catch3", data: $SUL('#frmResponse' + slot).serialize(), success: fnSuccess });
timer = 0;
}
});
}
catch (ex) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " catch4", data: $SUL('#frmResponse' + slot).serialize(), success: fnSuccess });
timer = 0;
}
});
}
catch (ex) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " catch5", data: $SUL('#frmResponse' + slot).serialize(), success: fnSuccess });
timer = 0;
}
}
}
else {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " catch6", data: $SUL('#frmResponse' + slot).serialize(), success: fnSuccess });
timer = 0;
}
}
function callrecaptchaSimilarads(actionterm, adid, pos, slot, serviceUrl) {
settimer();
if (recaptchaEnable == 1) {
if (typeof (grecaptcha) == 'object') {
try {
grecaptcha.ready(function () {
try {
grecaptcha.execute('6LcanrgUAAAAAEQnd9-EsnxKxn7rqbnE-jzt1zpx', { action: actionterm }).then(function (token) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer, data: $SUL('#frmResponse' + adid + pos).serialize() + "&token=" + token, success: function (result) { relAdRespSuccess(result, adid, slot, pos); } });
timer = 0;
}, function (token) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " error1", data: $SUL('#frmResponse' + adid + pos).serialize(), success: function (result) { relAdRespSuccess(result, adid, slot, pos); } });
timer = 0;
});
}
catch (exs) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " catch1", data: $SUL('#frmResponse' + adid + pos).serialize(), success: function (result) { relAdRespSuccess(result, adid, slot, pos); } });
timer = 0;
}
});
}
catch (ex) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " catch2", data: $SUL('#frmResponse' + adid + pos).serialize(), success: function (result) { relAdRespSuccess(result, adid, slot, pos); } });
timer = 0;
}
}
else {
try {
$SUL.cachedScript("https://www.recaptcha.net/recaptcha/api.js?render=6LcanrgUAAAAAEQnd9-EsnxKxn7rqbnE-jzt1zpx").done(function () {
try {
grecaptcha.ready(function () {
try {
grecaptcha.execute('6LcanrgUAAAAAEQnd9-EsnxKxn7rqbnE-jzt1zpx', { action: actionterm }).then(
function (token) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer, data: $SUL('#frmResponse' + adid + pos).serialize() + "&token=" + token, success: function (result) { relAdRespSuccess(result, adid, slot, pos); } });
timer = 0;
}, function () {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " error2", data: $SUL('#frmResponse' + adid + pos).serialize(), success: function (result) { relAdRespSuccess(result, adid, slot, pos); } });
timer = 0;
});
}
catch (exs) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " catch3", data: $SUL('#frmResponse' + adid + pos).serialize(), success: function (result) { relAdRespSuccess(result, adid, slot, pos); } });
timer = 0;
}
});
}
catch (ex) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " catch4", data: $SUL('#frmResponse' + adid + pos).serialize(), success: function (result) { relAdRespSuccess(result, adid, slot, pos); } });
timer = 0;
}
});
}
catch (ex) {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " catch5", data: $SUL('#frmResponse' + adid + pos).serialize(), success: function (result) { relAdRespSuccess(result, adid, slot, pos); } });
timer = 0;
}
}
}
else {
clearInterval(timerobj);
$SUL.ajax({ type: 'POST', url: serviceUrl + "&timer=" + timer + " catch6", data: $SUL('#frmResponse' + adid + pos).serialize(), success: function (result) { relAdRespSuccess(result, adid, slot, pos); } });
timer = 0;
}
}
function settimer() {
timerobj = setInterval(function () {
timer++;
}, 1);}
function bindneighbourhood() {
var isneighbourhoodpossible = $SUL('input[name=neighbourhoodReq]').val();
if (isneighbourhoodpossible == '1') {
if ($SUL('#subDvsearchSULNeighbourM').length == 1) {
$SUL('#subdvshowNeighbourhoodM').removeClass('hide').addClass('hide');
$SUL('#subDvsearchSULNeighbourM').removeClass('hide');
}
$SUL('#subDvsearchNeighbour').removeClass('hide').addClass('hide');
$SUL('#subDvsearchSULNeighbour').removeClass('hide');
if (!preloadneighbour) {
neighbourHolder = 'searchSULNeighbour';
var lat = $SUL('#neighbourhoodLat').val(), long = $SUL('#neighbourhoodLong').val();
if (lat == undefined || lat == '') {
lat = $SUL('#hdLatNearCitiesMetro').val();
long = $SUL('#hdLongNearCitiesMetro').val();
}
Sulekha.Auth.JSONGetData(gProtocol + window.location.host + "/common/commonv4.aspx?type=neighbour&nearby=1&lat=" + lat + "&long=" + long + "&callback=searchNeighbourSuccessv1");
preloadneighbour = true;
}
}
else {
if ($SUL('#subDvsearchSULNeighbourM').length == 1) {
$SUL('#subdvshowNeighbourhoodM').removeClass('hide');
$SUL('#subDvsearchSULNeighbourM').removeClass('hide').addClass('hide');
}
$SUL('#subDvsearchNeighbour').removeClass('hide');
$SUL('#subDvsearchSULNeighbour').removeClass('hide').addClass('hide');
}
}
var neighbourHolder = "", preloadneighbour = false;//john added neighborhood START
function sulNeighbourSearchv1(holder) {
if ($SUL('#hdnneighbourhood').length > 0) {
neighbourhood = $SUL('#hdnneighbourhood').val();
neighbourhoodurl = $SUL('#hdNeighbourUrl').val();
if ($SUL("#locationtxt").length > 0) {
if ($SUL('#searchlocation').val() == 'neighbour') {
$SUL("#locationtxt").text(neighbourhood);
}
}
}
$SUL("#" + holder).bind('keyup', function (event) {
neighbourHolder = holder;
if (event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 27) {
var neighbourVal = ""; neighbourVal = $SUL("#" + holder).val();
if (neighbourVal.length > 1) {
Sulekha.Auth.JSONGetData(gProtocol + window.location.host + "/common/commonv4.aspx?type=neighbour&term=" + neighbourVal + "&callback=searchNeighbourSuccessv1");
} else {
$SUL("#" + neighbourHolder + "-list-wrap").html("");
}
}
});
$SUL("#" + holder).bind('keydown', function (event) {
if (event.keyCode == 27)
$SUL("#" + holder + "-list-wrap").children('li').remove();
if (event.keyCode == 40 || event.keyCode == 38 || event.keyCode == 13) {
if ($SUL("#" + holder + "-list-wrap li").length > 0 && (event.keyCode == 40 || event.keyCode == 13)) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistNeighbour' + i).hasClass('active')) {
if (event.keyCode == 13) {
j = 1;
$SUL('#autocomplistNeighbour' + i).removeClass('active');
$SUL('#autocomplistNeighbour' + i).trigger('click');
$SUL("#" + holder + "-list-wrap").html("");
break;
}
j = 1;
$SUL('#autocomplistNeighbour' + i).removeClass('active');
if ($SUL('#autocomplistNeighbour' + (parseInt(i) + parseInt(1))).length > 0) {
$SUL('#autocomplistNeighbour' + (parseInt(i) + parseInt(1))).addClass('active').trigger('hover');
break;
} else {
$SUL('#autocomplistNeighbour0').addClass('active').trigger('hover');
break;
}
}
}
if (j == 0) {
$SUL('#autocomplistNeighbour0').addClass('active').trigger('hover');
}
}
if ($SUL("#" + holder + "-list-wrap li").length > 0 && event.keyCode == 38) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistNeighbour' + i).hasClass('active')) {
if (i > 0)
j = 1;
$SUL('#autocomplistNeighbour' + i).removeClass('active');
if ($SUL('#autocomplistNeighbour' + (parseInt(i) - parseInt(1))).length > 0) {
$SUL('#autocomplistNeighbour' + (parseInt(i) - parseInt(1))).addClass('active');
break;
} else {
$SUL('#autocomplistNeighbour' + (totallen - 1)).addClass('active');
break;
}
}
} if (j == 0) { $SUL('#autocomplistNeighbour' + (totallen - 1)).addClass('active'); }
}
}
});
$SUL("#" + holder).bind('click', function () { this.focus(); this.select(); });
$SUL(document).bind('click.neighbour' + holder, function (event) {
if ($SUL("#" + holder + "-list-wrap").length == 1 && $SUL(event.target).attr("id") != holder) {
$SUL("#" + holder + "-list-wrap").html("");
}
});}
function searchNeighbourSuccessv1(a) {
if (a != undefined && a.length > 0) {
if (a[0].ROW_PRC_GET_AJAX_NEIGHBOURHOOD != undefined && a[0].ROW_PRC_GET_AJAX_NEIGHBOURHOOD.length > 0) {
var uslist = '';
var obj = a[0].ROW_PRC_GET_AJAX_NEIGHBOURHOOD
$SUL.each(obj, function (a, c) {
uslist += "
";
});
$SUL("#" + neighbourHolder + "-list-wrap").html(uslist);
$SUL("#" + neighbourHolder + "-list-wrap").removeClass("show hide").addClass('show');
}
}
}
function selectNeighbourhoodv1(a) {
$SUL('#hdNeighbourUrl').remove(); $SUL('#hdNeighbourName').remove();
$SUL('
').val(a.neighbourhood).appendTo('body');
$SUL("#" + neighbourHolder + "-list-wrap").removeClass("hide").addClass("hide");
$SUL("#" + neighbourHolder).val(a.neighbourhood);
//for mapviewfilter setting
mapviewfilters.neighbourhoodid = a.contentid;
//for mapviewfilter setting
if (a.neighbourhood.length > 16) {
$SUL('#locationtxt').text(a.neighbourhood.substr(0, 16) + '...');
}
else
$SUL('#locationtxt').text(a.neighbourhood);}
//john added neighborhood END
//Market Trends START Nov 11 2024
var srchHolder = '';function searchcityneighbourmarketTrends(holder) {
$SUL("#" + holder).bind('keyup', function (event) {
srchHolder = holder;
if (event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 27) {
var cityval = ""; cityval = $SUL("#" + holder).val();
if (cityval.length > 1) {
Sulekha.Auth.JSONGetData(gProtocol + window.location.host + "/common/city_neighbour_search_sync-call.aspx?term=" + cityval);
} else {
$SUL('#hdSelCityUrl').val('');
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").removeClass('show hide').addClass("hide");
}
}
});
$SUL("#" + holder).bind('keydown', function (event) {
if (event.keyCode == 27)
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").children('li').remove();
if (event.keyCode == 40 || event.keyCode == 38 || event.keyCode == 13) {
if ($SUL("#" + srchHolder + "-uscanadacity-list-wrap li").length > 0 && (event.keyCode == 40 || event.keyCode == 13)) {
var i = 0, j = 0, totlen = $SUL('#' + srchHolder + '-uscanadacity-list-wrap li').length;
for (i = 0; i < totlen; i++) {
if ($SUL('#autocomplist' + i).hasClass('active')) {
if (event.keyCode == 13) {
j = 1;
$SUL('#autocomplist' + i).removeClass('active');
$SUL('#autocomplist' + i).trigger('click');
$SUL("#" + holder + "-uscanadacity-list-wrap").html("");
break;
}
j = 1;
$SUL('#autocomplist' + i).removeClass('active');
if ($SUL('#autocomplist' + (parseInt(i) + parseInt(1))).length > 0) {
$SUL('#autocomplist' + (parseInt(i) + parseInt(1))).addClass('active').trigger('hover');
break;
} else {
$SUL('#autocomplist0').addClass('active').trigger('hover');
break;
}
}
}
if (j == 0) {
$SUL('#autocomplist0').addClass('active').trigger('hover');
}
}
if ($SUL("#" + srchHolder + "-uscanadacity-list-wrap li").length > 0 && event.keyCode == 38) {
var i = 0, j = 0, totlen = $SUL('#' + srchHolder + '-uscanadacity-list-wrap li').length;
for (i = 0; i < totlen; i++) {
if ($SUL('#autocomplist' + i).hasClass('active')) {
if (i > 0)
j = 1;
$SUL('#autocomplist' + i).removeClass('active');
if ($SUL('#autocomplist' + (parseInt(i) - parseInt(1))).length > 0) {
$SUL('#autocomplist' + (parseInt(i) - parseInt(1))).addClass('active');
break;
} else {
$SUL('#autocomplist' + (totlen - 1)).addClass('active');
break;
}
}
}
if (j == 0) {
$SUL('#autocomplist' + (totlen - 1)).addClass('active');
}
}
}
});
$SUL("#" + holder).bind('click', function () { this.focus(); this.select(); });
$SUL(document).bind('click.' + holder, function (event) {
if ($SUL("#" + holder + "-uscanadacity-list-wrap").length == 1 && $SUL(event.target).attr("id") != holder) {
$SUL("#" + holder + "-uscanadacity-list-wrap").html("");
$SUL("#uscanadacity-list-wrap").attr("class", "hide");
}
});
$SUL("#" + holder).bind('focus', function (event) {
//$SUL("#" + holder + "-uscanadacity-list-wrap").attr('class', 'show');
});}
function cityniighbourmarketTrendsSuccessv1(a) {
if (a != undefined && a.length > 0) {
if (a[0].ROW_PRC_GET_AJAX_NEIGHBOURHOOD != undefined && a[0].ROW_PRC_GET_AJAX_NEIGHBOURHOOD.length > 0) {
var uslist = '';
var obj = a[0].ROW_PRC_GET_AJAX_NEIGHBOURHOOD
$SUL.each(obj, function (a, c) {
uslist += "
";
});
$SUL("#" + neighbourHolder).html(uslist);
$SUL("#" + neighbourHolder).removeClass("show hide").addClass('show');
}
}
}
function selectcityniighbourmarketTrends(a) {
$SUL('#hdNeighbourUrl').remove(); $SUL('#hdNeighbourName').remove();
$SUL('
').val(a.neighbourhood).appendTo('body');
$SUL("#" + neighbourHolder).removeClass("hide").addClass("hide");
$SUL("#" + neighbourHolder).val(a.neighbourhood);
//for mapviewfilter setting
mapviewfilters.neighbourhoodid = a.contentid;
//for mapviewfilter setting
if (a.neighbourhood.length > 16) {
$SUL('#locationtxt').text(a.neighbourhood.substr(0, 16) + '...');
}
else
$SUL('#locationtxt').text(a.neighbourhood);}
//Market Trends END Nov 11 2024
function sulNeighbourSearch(holder) {
$SUL("#" + holder).bind('keyup', function (event) {
neighbourHolder = holder;
if (event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 27) {
var neighbourVal = ""; neighbourVal = $SUL("#" + holder).val();
if (neighbourVal.length > 1) {
Sulekha.Auth.JSONGetData(gProtocol + window.location.host + "/common/commonv4.aspx?type=neighbour&term=" + neighbourVal + "&callback=searchNeighbourSuccess");
} else {
$SUL("#" + neighbourHolder + "-list-wrap").html("");
}
}
});
$SUL("#" + holder).bind('keydown', function (event) {
if (event.keyCode == 27)
$SUL("#" + holder + "-list-wrap").children('li').remove();
if (event.keyCode == 40 || event.keyCode == 38 || event.keyCode == 13) {
if ($SUL("#" + holder + "-list-wrap li").length > 0 && (event.keyCode == 40 || event.keyCode == 13)) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistNeighbour' + i).hasClass('active')) {
if (event.keyCode == 13) {
j = 1;
$SUL('#autocomplistNeighbour' + i).removeClass('active');
$SUL('#autocomplistNeighbour' + i).trigger('click');
$SUL("#" + holder + "-list-wrap").html("");
break;
}
j = 1;
$SUL('#autocomplistNeighbour' + i).removeClass('active');
if ($SUL('#autocomplistNeighbour' + (parseInt(i) + parseInt(1))).length > 0) {
$SUL('#autocomplistNeighbour' + (parseInt(i) + parseInt(1))).addClass('active').trigger('hover');
break;
} else {
$SUL('#autocomplistNeighbour0').addClass('active').trigger('hover');
break;
}
}
}
if (j == 0) {
$SUL('#autocomplistNeighbour0').addClass('active').trigger('hover');
}
}
if ($SUL("#" + holder + "-list-wrap li").length > 0 && event.keyCode == 38) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistNeighbour' + i).hasClass('active')) {
if (i > 0)
j = 1;
$SUL('#autocomplistNeighbour' + i).removeClass('active');
if ($SUL('#autocomplistNeighbour' + (parseInt(i) - parseInt(1))).length > 0) {
$SUL('#autocomplistNeighbour' + (parseInt(i) - parseInt(1))).addClass('active');
break;
} else {
$SUL('#autocomplistNeighbour' + (totallen - 1)).addClass('active');
break;
}
}
} if (j == 0) { $SUL('#autocomplistNeighbour' + (totallen - 1)).addClass('active'); }
}
}
});
$SUL("#" + holder).bind('click', function () { this.focus(); this.select(); });
$SUL(document).bind('click.neighbour' + holder, function (event) {
if ($SUL("#" + holder + "-list-wrap").length == 1 && $SUL(event.target).attr("id") != holder) {
$SUL("#" + holder + "-list-wrap").html("");
}
});}
function searchNeighbourSuccess(a) {
if (a != undefined && a.length > 0) {
if (a[0].ROW_PRC_GET_AJAX_NEIGHBOURHOOD != undefined && a[0].ROW_PRC_GET_AJAX_NEIGHBOURHOOD.length > 0) {
var uslist = '';
var obj = a[0].ROW_PRC_GET_AJAX_NEIGHBOURHOOD
$SUL.each(obj, function (a, c) {
uslist += "
";
});
$SUL("#" + neighbourHolder + "-list-wrap").html(uslist);
$SUL("#" + neighbourHolder + "-list-wrap").removeClass("show hide").addClass('show');
}
}
}
function selectNeighbourhood(a) {
$SUL('#hdNeighbourUrl').remove(); $SUL('#hdNeighbourName').remove();
$SUL('
').val(a.neighbourhood).appendTo('body');
$SUL("#" + neighbourHolder + "-list-wrap").removeClass("hide").addClass("hide");
$SUL("#" + neighbourHolder).val(a.neighbourhood);
//for mapviewfilter setting
mapviewfilters.neighbourhoodid = a.contentid;
//for mapviewfilter setting
if (a.neighbourhood.length > 16) {
$SUL('#locationtxt').text(a.neighbourhood.substr(0, 16) + '...');
}
else
$SUL('#locationtxt').text(a.neighbourhood);}
function searchadsbyNeighbour(service, pageno, sortbool) {
var searchpage = checknewcombination('');
var searchURL = '';
var neighboururl = $SUL('#hdNeighbourUrl').val(), inputTxt = $SUL('#searchSULNeighbour').val(), neighbourhoodname = $SUL('#hdNeighbourName').val();
var sort = $SUL('#adSortby').val();
var roomcount = $SUL('input[name=rentWanted]:checked').length;
if ($SUL('input[name=rentWanted]:checked').length == 0 && $SUL('input[name=roomWanted]:checked').length == 0 && $SUL('input[name=parkingWanted]:checked').length == 0
&& $SUL('input[name=commercialWanted]:checked').length == 0 && $SUL('input[name=rentOffered]:checked').length == 0 && $SUL('input[name=roomOffered]:checked').length == 0
&& $SUL('input[name=parkingOffered]:checked').length == 0) {
hideplaceprocessing('listingsearch');
Sulekha.Common.alert("Please select any one Need");
if ((jQuery.browser = jQuery.browser || {}).mobile) {
$SUL('#mobilefilter').removeClass('show hide').addClass('hide');
}
}
else {
if (searchpage) {
if (sortbool) {
SearchAdsSearchPage('', pageno, sort);
}
else {
SearchAdsSearchPage('', pageno, '');
}
}
else {
if (sortbool) {
if (roomcount == 1) {
searchURL += 'rentals/' + pageFilterValues.neighbourhoodurl + '_' + pageFilterValues.roomtype + '-for-rent';
}
else {
searchURL += 'rentals/rooms-for-rent_' + pageFilterValues.neighbourhoodurl;
}
}
else {
if (roomcount == 1) {
searchURL += 'rentals/' + neighboururl + '_' + selectedFilterValues.roomtype + '-for-rent';
}
else {
searchURL += 'rentals/rooms-for-rent_' + neighboururl;
}
}
try {
if (pageno != undefined && pageno != 'undefined' && pageno != '' && pageno > 1) {
searchURL += '_' + pageno;
}
}
catch (ex) { }
if (inputTxt == neighbourhoodname) {
if (sortbool) {
$SUL('#formSortLatestAdDiv2').remove();
$SUL('
').appendTo('body');
$SUL('#formSortLatestAdDiv2').html('
');
$SUL('
').val(sort).appendTo('#formSortLatestAd2');
$SUL('
').val(1).appendTo('#formSortLatestAd2');
$SUL('#formSortLatestAd2').attr('action', '/' + searchURL);
$SUL('#formSortLatestAd2').submit();
}
else {
if (neighboururl != undefined && neighboururl != 'undefined' && neighboururl != '') {
window.location.href = '/' + searchURL;
}
else {
hideplaceprocessing('listingsearch');
Sulekha.Common.alert("Please select Neighborhood");
}
}
}
else {
hideplaceprocessing('listingsearch');
Sulekha.Common.alert("Please select Neighborhood");
}
}
}
}
function searchadsbyNeighbourMV(service) {
var searchpage = checknewcombinationMap('');
var searchURL = '';
var neighboururl = $SUL('#hdNeighbourUrl').val();
var roomcount = $SUL('input[name=rentWanted]:checked').length;
if (searchpage) {
SearchAdsSearchPageMV();
}
else {
if (roomcount == 1) {
searchURL += 'rentals/' + neighboururl + '_' + selectedFilterValues.roomtype + '-for-rent';
}
else {
searchURL += 'rentals/rooms-for-rent_' + neighboururl;
}
if (neighboururl != undefined && neighboururl != 'undefined' && neighboururl != '') {
window.location.href = '/' + searchURL;
}
else {
hideplaceprocessing('listingsearch');
Sulekha.Common.alert("Please select State");
}
}
}
function viewmoreRHS(divid) {
$SUL('#' + divid).find('li').removeClass('hide');
$SUL('#' + divid).find('.morebar').remove();}
function viewmoreaptRHS(divid) {
$SUL('#' + divid).find('aside').removeClass('hide');
$SUL('#' + divid).find('.morebar').remove();}
function fnPageNavstcky() {
if ($SUL('#pageNavsticky').length == 1) {
var hdr = $SUL('#pageNavsticky');
var start = $SUL(hdr).next().offset();
$SUL.event.add(window, "scroll.pageNav", function () {
if ($SUL(window).scrollTop() >= start.top) {
$SUL('#pageNavsticky').removeClass("roomnavstick").addClass("roomnavstick");
$SUL('#pageNavsticky ul').removeClass("container container-max").addClass("container container-max");
}
else {
$SUL('#pageNavsticky').removeClass("roomnavstick");
$SUL('#pageNavsticky ul').removeClass("container container-max");
}
});
}
}
function activeOnScroll(event) {
var scrollPosition = $SUL(document).scrollTop();
$SUL('#pageNavsticky li a').each(function () {
var currentLink = $SUL(this);
var refElement = $SUL(currentLink.attr("href"));
var bool1 = refElement.position().top <= scrollPosition;
var bool2 = refElement.position().top + refElement.height() > scrollPosition;
// console.log("doc top : " + scrollPosition + ", ref : " + $SUL(currentLink).parent().attr("id") + ", ref top :" + (refElement.position().top + 630) + ", ref bott: " + (refElement.position().top + 630) + refElement.height())
if (refElement.position().top + 630 <= scrollPosition && (refElement.position().top + 630) + refElement.height() > scrollPosition) {
$SUL('#pageNavsticky li a').removeClass("active");
currentLink.addClass("active");
}
else {
currentLink.removeClass("active");
}
});}
function fnNextPrevAdstcky() {
if ($SUL('div.roomdetail-topnav').length == 1) {
var hdr = $SUL('div.roomdetail-topnav').parent().parent();
var start = $SUL(hdr).next().offset();
$SUL.event.add(window, "scroll.nextprevNav", function () {
if ($SUL(window).scrollTop() >= start.top) {
$SUL('div.roomprev').removeClass("hide");
$SUL('div.roomnext').removeClass("hide");
}
else {
$SUL('div.roomprev').removeClass("hide").addClass('hide');
$SUL('div.roomnext').removeClass("hide").addClass('hide');
}
});
}
}
function getDisplayCount() {
var screen_width = $SUL(window).width();
var display_items = 2;
if (screen_width > 375 && screen_width <= 414) {
display_items = 3;
}
else if (screen_width > 414 && screen_width <= 768) {
display_items = 5;
}
else if (screen_width > 768 && screen_width <= 1280) {
display_items = 7;
}
else if (screen_width > 1280 && screen_width <= 1366) {
display_items = 8;
}
else if (screen_width > 1366) {
display_items = 12
}
return display_items;}
function prefillLandmarkSuggestion() {
if (!preloadlandmark) {
landmarkHolder = 'searchLandmark';
var lat = $SUL('#landmarkLat').val(), long = $SUL('#landmarkLong').val();
if (lat == undefined || lat == '' || lat == 'undefined') {
lat = $SUL('#hdLatNearCitiesCity').val();
long = $SUL('#hdLongNearCitiesCity').val();
}
Sulekha.Auth.JSONGetData(gProtocol + window.location.host + "/common/commonv4.aspx?type=landmarkSugg&nearby=1&lat=" + lat + "&long=" + long + "&callback=searchLndmrkSuccess");
preloadlandmark = true;
}
}
function insertcouponstrip() {
$SUL.ajax({
url: '/common/commonv4.aspx?type=paymentpendingstrip',
success: function (data) {
$SUL('body').prepend(data);
}
});}
function setstickyadslot() {
//var stickyfooterdiv = GetScrollPercent() >= 0 && GetScrollPercent() < 95;
try {
var stickyfooterdiv = $SUL(document).scrollTop() + $SUL('footer').height() < $SUL('footer').position().top;
var stickydisable = $SUL('#stickyadslot').attr('data-disablesticky');
if ($SUL('footer').length > 0) {
if (stickyfooterdiv && stickydisable != '1') {
if ($SUL('.footer_sticky').is(':visible')) {
$SUL('#stickyadslot').attr('style', 'position: fixed;width: 100%;z-index: 100;left: 0;bottom: 37px;text-align: center;');
}
else {
$SUL('#stickyadslot').attr('style', 'position: fixed;width: 100%;z-index: 100;left: 0;bottom: 1px;text-align: center;');
}
$SUL('#stickyadslot_close').removeClass('hide');
}
else {
$SUL('#stickyadslot').attr('style', 'width: 100%;z-index: 100;left: 0;text-align: center;');
$SUL('#stickyadslot_close').removeClass('hide').addClass('hide');
}
}
} catch (e) {
}
}
GetScrollPercent = function () {
try {
var bottom = $SUL(window).height() + $SUL(window).scrollTop();
var height = $SUL(document).height();
return Math.round(100 * bottom / height);
} catch (ex) {
var jErr = 'Error occured. GetScrollPercent msg : ' + ex.Line + ' type : ' + ex.Message + ' ' + ex.StackTrace;
console.log(jErr);
}
}
function closestickyad() {
$SUL('#stickyadslot').attr('style', 'width: 100%;z-index: 100;left: 0;text-align: center;');
$SUL('#stickyadslot').attr('data-disablesticky', '1');}
homepage = {
owlpremium: null, owlfeatured: null, owlagents: null, owlhousingcorner: null, premiumowlpage: 1, featuredowlpage: 1, postclickevent: undefined,
callOwlPostIcons: function () {
if ($SUL("#postowlicon").length > 0) {
$SUL.cachedScript("https://d3aew4oo17ml6.cloudfront.net/common/js/classifieds/owl.carousel-new.js?v=0.0.1").done(function () {
var posticonowl = $SUL('#postowlicon').find('.owl-carousel');
posticonowl.owlCarousel({
responsiveClass: false,
dots: false,
nav: true,
margin: 10,
responsive: {
0: { items: 1, stagePadding: 15, nav: true, },
400: { items: 1, stagePadding: 15, nav: true, },
600: { items: 1 },
700: { items: 3 },
1000: { items: 3 },
1200: { items: 3 },
1400: { items: 3, mouseDrag: false },
}
});
if ($SUL('.owl-dots').length > 0) {
$SUL('.owl-dots').addClass('hide');
}
});
}
},
callPremium_MT_Ads: function(page) {
var pathname = window.location.pathname;
pathname = pathname.substring(1);
if ($SUL("#MTpremiumAdsHomeDiv").length > 0) {
$SUL.cachedScript("https://d3aew4oo17ml6.cloudfront.net/common/js/classifieds/owl.carousel-new.js?v=0.0.1").done(function () {
homepage.owlpremium = $SUL('#MTpremiumAdsHomeDiv').find('.owl-carousel');
homepage.owlpremium.owlCarousel({
responsiveClass: false,
dots: true,
nav: true,
margin: 10,
responsive: {
0: { items: 1, nav: true, },
400: { items: 1, nav: true, },
600: { items: 2 },
700: { items: 2 },
1000: { items: 3 },
1200: { items: 3 },
1400: { items: 4, mouseDrag: false }
}
});
if ($SUL('.owl-dots').length > 0) {
$SUL('.owl-dots').addClass('hide');
}
homepage.owlpremium.on('translated.owl.carousel', function (event) {
homepage.afterPremiumSlideOver_MT(event);
});
});
}
},
callPremiumAds: function (page) {
var pathname = window.location.pathname;
pathname = pathname.substring(1);
if ($SUL("#premiumAdsHomeDiv").length > 0) {
$SUL.cachedScript("https://d3aew4oo17ml6.cloudfront.net/common/js/classifieds/owl.carousel-new.js?v=0.0.1").done(function () {
homepage.owlpremium = $SUL('#premiumAdsHomeDiv').find('.owl-carousel');
homepage.owlpremium.owlCarousel({
responsiveClass: false,
dots: true,
nav: true,
margin: 10,
responsive: {
0: { items: 1, nav: true, },
400: { items: 1, nav: true, },
600: { items: 2 },
700: { items: 2 },
1000: { items: 3 },
1200: { items: 3 },
1400: { items: 4, mouseDrag: false }
}
});
if ($SUL('.owl-dots').length > 0) {
$SUL('.owl-dots').addClass('hide');
}
homepage.owlpremium.on('translated.owl.carousel', function (event) {
homepage.afterPremiumSlideOver(event);
});
});
}
},
callNeighbourbaseAds: function (page) {
var pathname = window.location.pathname;
pathname = pathname.substring(1);
if ($SUL("#neighbourbaseAdsHomeDiv").length > 0) {
$SUL.cachedScript("https://d3aew4oo17ml6.cloudfront.net/common/js/classifieds/owl.carousel-new.js?v=0.0.1").done(function () {
homepage.owlpremium = $SUL('#neighbourbaseAdsHomeDiv').find('.owl-carousel');
homepage.owlpremium.owlCarousel({
responsiveClass: false,
dots: true,
nav: true,
margin: 10,
responsive: {
0: { items: 1, nav: true, },
400: { items: 1, nav: true, },
600: { items: 2 },
700: { items: 2 },
1000: { items: 3 },
1200: { items: 3 },
1400: { items: 4, mouseDrag: false }
}
});
if ($SUL('.owl-dots').length > 0) {
$SUL('.owl-dots').addClass('hide');
}
//homepage.owlpremium.on('translated.owl.carousel', function (event) {
// homepage.afterPremiumSlideOver(event);
//});
});
}
},
callmarkettrendsbannerAds: function (page) {
var pathname = window.location.pathname;
pathname = pathname.substring(1);
if ($SUL("#marketbannertrendsadsDiv").length > 0) {
$SUL.cachedScript("https://d3aew4oo17ml6.cloudfront.net/common/js/classifieds/owl.carousel-new.js?v=0.0.1").done(function () {
homepage.owlpremium = $SUL('#marketbannertrendsadsDiv').find('.owl-carousel');
homepage.owlpremium.owlCarousel({
responsiveClass: false,
dots: false,
nav: true,
animateIn: 'fadeIn',
animateOut: 'fadeOut',
items: 1,
loop: true,
autoplay: false,
autoplayTimeout: 3000,
autoHeight: true
});
if ($SUL('.owl-dots').length > 0) {
$SUL('.owl-dots').addClass('hide');
}
//homepage.owlpremium.on('translated.owl.carousel', function (event) {
// homepage.afterPremiumSlideOver(event);
//});
});
}
},
callApartmentbaseAds: function (page) {
var pathname = window.location.pathname;
pathname = pathname.substring(1);
if ($SUL("#apartmentbaseAdsHomeDiv").length > 0) {
$SUL.cachedScript("https://d3aew4oo17ml6.cloudfront.net/common/js/classifieds/owl.carousel-new.js?v=0.0.1").done(function () {
homepage.owlpremium = $SUL('#apartmentbaseAdsHomeDiv').find('.owl-carousel');
homepage.owlpremium.owlCarousel({
responsiveClass: false,
dots: true,
nav: true,
margin: 10,
responsive: {
0: { items: 1, nav: true, },
400: { items: 1, nav: true, },
600: { items: 2 },
700: { items: 2 },
1000: { items: 3 },
1200: { items: 3 },
1400: { items: 4, mouseDrag: false }
}
});
if ($SUL('.owl-dots').length > 0) {
$SUL('.owl-dots').addClass('hide');
}
//homepage.owlpremium.on('translated.owl.carousel', function (event) {
// homepage.afterPremiumSlideOver(event);
//});
});
}
},
afterPremiumSlideOver_MT: function(event) {
var totalpage = event.page.count, currentpage = event.page.index;
var mtservice = "rentals";
if (currentpage == totalpage - 1) {
var pathname = window.location.pathname;
pathname = pathname.substring(1);
homepage.premiumowlpage = homepage.premiumowlpage + 1;
$SUL.ajax({
url: "/common/commonv4.aspx?type=gethomepremiumads&userlat=" + userlat + "&userlong=" + userlong + "&pageno=" + homepage.premiumowlpage +
"&service=" + mtservice + "&metro=" + $SUL("#hdMetro").val() + "&city=" + $SUL("#hdCity"),
success: function (data) {
if (data != '') {
homepage.owlpremium.trigger('destroy.owl.carousel');
$SUL("#MTpremiumAdsHomeDiv div.owl-carousel").append(data);
homepage.owlpremium = $SUL('#MTpremiumAdsHomeDiv').find('.owl-carousel');
homepage.owlpremium.owlCarousel({
responsiveClass: false,
dots: true,
nav: true,
margin: 10,
responsive: {
0: { items: 1, nav: true, },
400: { items: 1, nav: true, },
600: { items: 2 },
700: { items: 2 },
1000: { items: 3 },
1200: { items: 3 },
1400: { items: 4, mouseDrag: false }
}
});
if ($SUL('.owl-dots').length > 0) {
$SUL('.owl-dots').addClass('hide');
}
homepage.owlpremium.trigger('to.owl.carousel', [currentpage, 0]);
assignImageInViewport();
}
}
});
}
},
afterPremiumSlideOver: function (event) {
var totalpage = event.page.count, currentpage = event.page.index;
if (currentpage == totalpage - 1) {
var pathname = window.location.pathname;
pathname = pathname.substring(1);
homepage.premiumowlpage = homepage.premiumowlpage + 1;
$SUL.ajax({
url: "/common/commonv4.aspx?type=gethomepremiumads&userlat=" + userlat + "&userlong=" + userlong + "&pageno=" + homepage.premiumowlpage +
"&service=" + pageFilterValues.service + "&metro=" + $SUL("#hdMetro").val() + "&city=" + $SUL("#hdCity"),
success: function (data) {
if (data != '') {
homepage.owlpremium.trigger('destroy.owl.carousel');
$SUL("#premiumAdsHomeDiv div.owl-carousel").append(data);
homepage.owlpremium = $SUL('#premiumAdsHomeDiv').find('.owl-carousel');
homepage.owlpremium.owlCarousel({
responsiveClass: false,
dots: true,
nav: true,
margin: 10,
responsive: {
0: { items: 1, nav: true, },
400: { items: 1, nav: true, },
600: { items: 2 },
700: { items: 2 },
1000: { items: 3 },
1200: { items: 3 },
1400: { items: 4, mouseDrag: false }
}
});
if ($SUL('.owl-dots').length > 0) {
$SUL('.owl-dots').addClass('hide');
}
homepage.owlpremium.trigger('to.owl.carousel', [currentpage, 0]);
assignImageInViewport();
}
}
});
}
},
callFeaturedAds: function (page) {
var pathname = window.location.pathname;
pathname = pathname.substring(1);
if ($SUL("#featuredAdsHomeDiv").length > 0) {
$SUL.cachedScript("https://d3aew4oo17ml6.cloudfront.net/common/js/classifieds/owl.carousel-new.js?v=0.0.1").done(function () {
homepage.owlfeatured = $SUL('#featuredAdsHomeDiv').find('.owl-carousel');
homepage.owlfeatured.owlCarousel({
responsiveClass: false,
dots: true,
nav: true,
margin: 10,
responsive: {
0: { items: 1, nav: true, },
400: { items: 1, nav: true, },
600: { items: 2 },
700: { items: 2 },
1000: { items: 3 },
1200: { items: 3 },
1400: { items: 4, mouseDrag: false }
}
});
if ($SUL('.owl-dots').length > 0) {
$SUL('.owl-dots').addClass('hide');
}
homepage.owlfeatured.on('translated.owl.carousel', function (event) {
homepage.afterFeaturedSlideOver(event);
});
});
}
},
afterFeaturedSlideOver: function (event) {
var totalpage = event.page.count, currentpage = event.page.index;
if (currentpage == totalpage - 1) {
var pathname = window.location.pathname;
pathname = pathname.substring(1);
homepage.featuredowlpage = homepage.featuredowlpage + 1;
$SUL.ajax({
url: "/common/commonv4.aspx?type=gethomefeaturedads&pageno=" + homepage.featuredowlpage + "&service=" + pageFilterValues.service +
"&metrourl=" + $SUL("#hdMetroUrl").val() + "&cityurl=" + $SUL("#hdCityurl").val(),
success: function (data) {
if (data != '') {
homepage.owlfeatured.trigger('destroy.owl.carousel');
$SUL("#featuredAdsHomeDiv div.owl-carousel").append(data);
homepage.owlfeatured = $SUL('#featuredAdsHomeDiv').find('.owl-carousel');
homepage.owlfeatured.owlCarousel({
responsiveClass: false,
dots: true,
nav: true,
margin: 10,
responsive: {
0: { items: 1, nav: true, },
400: { items: 1, nav: true, },
600: { items: 2 },
700: { items: 2 },
1000: { items: 3 },
1200: { items: 3 },
1400: { items: 4, mouseDrag: false }
}
});
if ($SUL('.owl-dots').length > 0) {
$SUL('.owl-dots').addClass('hide');
}
homepage.owlfeatured.trigger('to.owl.carousel', [currentpage, 0]);
assignImageInViewport();
}
}
});
}
},
callAgentsBlock: function (page) {
var pathname = window.location.pathname;
pathname = pathname.substring(1);
if ($SUL("#agentsHomeDiv").length > 0) {
$SUL.cachedScript("https://d3aew4oo17ml6.cloudfront.net/common/js/classifieds/owl.carousel-new.js?v=0.0.1").done(function () {
homepage.owlagents = $SUL('#agentsHomeDiv').find('.owl-carousel');
homepage.owlagents.owlCarousel({
responsiveClass: false,
dots: true,
nav: true,
margin: 10,
responsive: {
0: { items: 1, nav: true, },
400: { items: 1, nav: true, },
600: { items: 2 },
700: { items: 2 },
1000: { items: 3 },
1200: { items: 4 },
1400: { items: 6, mouseDrag: false },
}
});
if ($SUL('.owl-dots').length > 0) {
$SUL('.owl-dots').addClass('hide');
}
});
}
},
callHousingcornerBlock: function (page) {
var pathname = window.location.pathname;
pathname = pathname.substring(1);
if ($SUL("#housingcornerHomeDiv").length > 0) {
$SUL.cachedScript("https://d3aew4oo17ml6.cloudfront.net/common/js/classifieds/owl.carousel-new.js?v=0.0.1").done(function () {
homepage.owlhousingcorner = $SUL('#housingcornerHomeDiv').find('.owl-carousel');
homepage.owlhousingcorner.owlCarousel({
responsiveClass: false,
dots: true,
nav: true,
margin: 10,
responsive: {
0: { items: 1, nav: true, },
400: { items: 1, nav: true, },
600: { items: 2 },
700: { items: 2 },
1000: { items: 3 },
1200: { items: 4 },
1400: { items: 4, mouseDrag: false },
}
});
if ($SUL('.owl-dots').length > 0) {
$SUL('.owl-dots').addClass('hide');
}
});
}
},
preSetSelectedhome: function (service, cityurl) {
$SUL(document).on("click.filter", function (event) {
homepage.bind_Click_Filterpanel(event);
homepage.bind_Click_Postpanel(event);
});
if (service.toLowerCase() == "roommates") {
$SUL('#selectneed li[data-value="i-need-a-room"]').trigger('click');
$SUL('#selectroomtype > div').removeClass('hide').addClass('hide');
}
else if (service.toLowerCase() == "rentals") {
$SUL('#selectneed li[data-value="i-need-an-apartment"]').trigger('click');
$SUL('#selectroomtype > div').removeClass('hide').addClass('hide');
}
$SUL('
').val(cityurl).appendTo('body');
if (!homepage.isemptyfield(meturl)) {
if ($SUL('#metrodrpdwn ul a[data-value=' + meturl + ']').length == 1) {
$SUL('#selectlocationdrpdwn li[data-value=metro]').trigger('click');
$SUL('#metrodrpdwn ul a[data-value=' + meturl + ']').parent().trigger('click');
}
$SUL('#metrodrpdwn').removeClass('hide').addClass('hide');
}
var stype = $SUL("#selectneed > a").html();
if (stype.indexOf('<') != '-1') {
stype = stype.substr(0, stype.indexOf('<'));
if (stype.trim() == "Need a Property for Rent")
$SUL("#selectLocationCounty").removeClass('hide');
}
pageFilterValues.service = service;
homepage.sulCitySearchUSCan('searchCity');
homepage.sulUnivSearch('searchUniv');
homepage.sulLndmrkSearch('searchLandmark');
homepage.sulCountySearch('searchCounty');
homepage.sulApartmentSearch('searchApartment');
homepage.bind_metrosearch();
homepage.bind_statesearch();
$SUL.event.add(window, "scroll", function () {
setstickyadslot();
});
},
bind_Click_Filterpanel: function (event) {
//selectneed only for immediate parent
if ($SUL(event.target).parent("#selectneed").length != 1 && !$SUL(event.target).is('#selectneed')) {
$SUL('#selectneed div').removeClass('hide').addClass('hide');
}
else {
$SUL('#selectneed div').removeClass('hide');
}
if ($SUL(event.target).parents("#selectneed li").length == 1 || $SUL(event.target).is("#selectneed li")) {
var clicked_obj = undefined;
if ($SUL(event.target).is('li')) {
clicked_obj = $SUL(event.target);
}
else if ($SUL(event.target).is('a')) {
clicked_obj = $SUL(event.target).parent();
}
var userneed = $SUL(clicked_obj).attr('data-value');
var category_selected = $SUL(clicked_obj).attr('data-categorytype');
if (category_selected == 'roomtype') {
$SUL('#bedroomType').removeClass('hide').addClass('hide');
$SUL('#bathroomType').removeClass('hide').addClass('hide');
$SUL('#genderType').removeClass('hide');
}
else if (category_selected == 'renttype') {
$SUL('#bedroomType').removeClass('hide');
$SUL('#bathroomType').removeClass('hide');
$SUL('#genderType').removeClass('hide').addClass('hide');
}
else {
$SUL('#bedroomType').removeClass('hide').addClass('hide');
$SUL('#bathroomType').removeClass('hide').addClass('hide');
$SUL('#genderType').removeClass('hide').addClass('hide');
}
$SUL('#userneed').val(userneed);
$SUL('#selectroomtype input[name=services]').prop('checked', false);
$SUL('input[name=roomtype]').val(''); $SUL('input[name=renttype]').val(''); $SUL('input[name=commercialtype]').val('');
$SUL('#selectroomtype li[data-category="' + category_selected + '"] > input').each(function () {
$SUL(this).trigger('click');
});
$SUL("#selectneed li").each(function (i, obj) {
if ($SUL(obj).is(clicked_obj)) {
$SUL(obj).attr('data-active', 'true');
$SUL('#selectneed > a').html($SUL(obj).text() + '
');
}
else {
$SUL(obj).attr('data-active', 'false');
}
});
}
//category
if ($SUL(event.target).parents("#selectroomtype").length != 1 && !$SUL(event.target).is('#selectroomtype')) {
$SUL('#selectroomtype > div').removeClass('hide').addClass('hide');
}
else {
var data_category = $SUL('#selectneed li[data-active=true]').attr('data-category');
$SUL('#selectroomtype > div[id=' + data_category + ']').removeClass('hide');
}
if ($SUL(event.target).parents("#selectroomtype input.filled-in").length == 1 || $SUL(event.target).is("#selectroomtype input.filled-in")) {
var data_category = undefined;
if ($SUL(event.target).is('li')) {
data_category = $SUL(event.target).attr('data-category');
}
else if ($SUL(event.target).is('input')) {
data_category = $SUL(event.target).parent().attr('data-category');
}
homepage.assignroomtypes(data_category);
}
//gender only for immediate parent
if ($SUL(event.target).parent("#genderType").length != 1 && !$SUL(event.target).is('#genderType')) {
$SUL('#genderType div').removeClass('hide').addClass('hide');
}
else {
$SUL('#genderType div').removeClass('hide');
}
if ($SUL(event.target).parents("#genderType li").length == 1 || $SUL(event.target).is("#genderType li")) {
var genderurl = '', gender_text = '';
if ($SUL(event.target).is('li')) {
genderurl = $SUL(event.target).find('a').attr('data-value');
gender_text = $SUL(event.target).find('a').text();
}
else if ($SUL(event.target).parent().is('li')) {
genderurl = $SUL(event.target).attr('data-value');
gender_text = $SUL(event.target).text();
}
if (gender_text == 'Any' || gender_text == ' Any') {
}
else
$SUL('#genderSelect').val(genderurl);
if (homepage.isemptyfield(genderurl)) {
gender_text = 'Select Gender';
}
$SUL('#genderType > a').html(gender_text + '
');
}
//bedroom only for immediate parent
if ($SUL(event.target).parent("#bedroomType").length != 1 && !$SUL(event.target).is('#bedroomType')) {
$SUL('#bedroomType div').removeClass('hide').addClass('hide');
}
else {
$SUL('#bedroomType div').removeClass('hide');
}
if ($SUL(event.target).parents("#bedroomType li").length == 1 || $SUL(event.target).is("#bedroomType li")) {
var bedroomcount = '', bedroom_text = '';
if ($SUL(event.target).is('li')) {
bedroomcount = $SUL(event.target).find('a').attr('data-value');
bedroom_text = $SUL(event.target).find('a').text() + ' Bed';
}
else if ($SUL(event.target).parent().is('li')) {
bedroomcount = $SUL(event.target).attr('data-value');
bedroom_text = $SUL(event.target).text() + ' Bed';
}
$SUL('#bedroomSelect').val(bedroomcount);
if (homepage.isemptyfield(bedroomcount)) {
bedroom_text = 'Select Bed';
}
$SUL('#bedroomType > a').html(bedroom_text + '
');
}
//bathroom only for immediate parent
if ($SUL(event.target).parent("#bathroomType").length != 1 && !$SUL(event.target).is('#bathroomType')) {
$SUL('#bathroomType div').removeClass('hide').addClass('hide');
}
else {
$SUL('#bathroomType div').removeClass('hide');
}
if ($SUL(event.target).parents("#bathroomType li").length == 1 || $SUL(event.target).is("#bathroomType li")) {
var bathroomcount = '', bathroom_text = '';
if ($SUL(event.target).is('li')) {
bathroomcount = $SUL(event.target).find('a').attr('data-value');
bathroom_text = $SUL(event.target).find('a').text() + ' Bath';
}
else if ($SUL(event.target).parent().is('li')) {
bathroomcount = $SUL(event.target).attr('data-value');
bathroom_text = $SUL(event.target).text() + ' Bath';
}
$SUL('#bathroomSelect').val(bathroomcount);
if (homepage.isemptyfield(bathroomcount)) {
bathroom_text = 'Select Bath';
}
$SUL('#bathroomType > a').html(bathroom_text + '
');
}
//price only for immediate parent
if ($SUL(event.target).parent("#pricerangeType").length != 1 && !$SUL(event.target).is('#pricerangeType')) {
//$SUL('#pricerangeType div').removeClass('hide').addClass('hide');
}
else {
$SUL('#pricerangeType div').removeClass('hide');
$SUL('#ulpricemin').removeClass('hide');
$SUL('#ulpricemax').removeClass('hide').addClass('hide');
}
if (!$SUL(event.target).closest("li[id='pricerangeType']").length) {
$SUL('#pricerangeType div').removeClass('hide').addClass('hide');
}
if (!$SUL(event.target).closest("div[id='divsearchbyadid']").length) {
$SUL('#divsearchbyadidhome').removeClass('hide').addClass('hide');
}
//notification related js
if (!$SUL(event.target).closest("div[id='divnotificationlist']").length) {
$SUL('#divnotificationlist').removeClass('hide').addClass('hide');
//$SUL("#parenthtml").removeClass("blurbody");
$SUL("html:first").removeClass("blurbody");
}
if (!$SUL(event.target).closest("div[id='divactionslist']").length) {
$SUL("div[id^='action-']").attr('class', 'ctawrp hide');
}
//end notification related js
if ($SUL(event.target).closest("input[id='txtminprice']").length) {
$SUL('#ulpricemin').removeClass('hide');
$SUL('#ulpricemax').removeClass('hide').addClass('hide');
}
else if ($SUL(event.target).closest("input[id='txtmaxprice']").length) {
$SUL('#ulpricemax').removeClass('hide');
$SUL('#ulpricemin').removeClass('hide').addClass('hide');
}
//selectlocationtype
if (($SUL(event.target).parents("#selectlocation").length != 1 && !$SUL(event.target).is('#selectlocation')) ||
$SUL(event.target).parents("#selectlocationdrpdwn").length == 1 || $SUL(event.target).is('#selectlocationdrpdwn')) {
$SUL('#selectlocation div').removeClass('hide').addClass('hide');
}
else {
$SUL('#selectlocation div').removeClass('hide');
}
if ($SUL(event.target).parents("#selectlocation li").length == 1 || $SUL(event.target).is('#selectlocation li')) {
var locationtype = '', location_text = '';
if ($SUL(event.target).is('li')) {
locationtype = $SUL(event.target).attr('data-value');
}
else if ($SUL(event.target).parent().is('li')) {
locationtype = $SUL(event.target).parent().attr('data-value');
}
location_text = $SUL(event.target).text();
location_text = location_text.replace('By ', '');
if (!homepage.isemptyfield(locationtype)) {
$SUL('#hploctypesel').val(locationtype);
//john added apartment End Nov 17 2023
var locationtype_Arr = ['city', 'metro', 'state', 'university', 'landmark', 'county', 'apartment'];
//john added apartment End Nov 17 2023
$SUL(locationtype_Arr).each(function (i, locationtype_value) {
if (locationtype_value != locationtype) {
if ($SUL('#' + locationtype_value + 'HomeCont').length == 1) {
$SUL('#' + locationtype_value + 'HomeCont').removeClass('hide').addClass('hide');
}
}
else {
if ($SUL('#' + locationtype_value + 'HomeCont').length == 1) {
$SUL('#' + locationtype_value + 'HomeCont').removeClass('hide');
}
}
});
$SUL('#selectlocation > a > span').text(location_text);
}
}
//metroHomeCont
if ($SUL(event.target).parent("#metroHomeCont").length != 1 && !$SUL(event.target).is('#metroHomeCont')) {
$SUL('#metroHomeCont div').removeClass('hide').addClass('hide');
}
else {
$SUL('#metroHomeCont div').removeClass('hide');
}
//countyHomeCont
if ($SUL(event.target).parent("#countyHomeCont").length != 1 && !$SUL(event.target).is('#countyHomeCont')) {
$SUL('#countyHomeCont div').removeClass('hide').addClass('hide');
}
else {
$SUL('#countyHomeCont div').removeClass('hide');
}
//john added apartment Start Nov 17 2023
if ($SUL(event.target).parent("#apartmentHomeCont").length != 1 && !$SUL(event.target).is('#apartmentHomeCont')) {
$SUL('#apartmentHomeCont div').removeClass('hide').addClass('hide');
}
else {
$SUL('#apartmentHomeCont div').removeClass('hide');
}
//john added apartment END Nov 17 2023
//stateHomeCont
if ($SUL(event.target).parent("#stateHomeCont").length != 1 && !$SUL(event.target).is('#stateHomeCont')) {
$SUL('#stateHomeCont div').removeClass('hide').addClass('hide');
}
else {
$SUL('#stateHomeCont div').removeClass('hide');
}
//metro
if ($SUL(event.target).parents("#metrodrpdwn li").length == 1 || $SUL(event.target).is("#metrodrpdwn li")) {
var metrourl = '', metro_text = '';
if ($SUL(event.target).is('li')) {
metrourl = $SUL(event.target).find('a').attr('data-value');
metro_text = $SUL(event.target).find('a').text();
}
else if ($SUL(event.target).parent().is('li')) {
metrourl = $SUL(event.target).attr('data-value');
metro_text = $SUL(event.target).text();
}
$SUL('#hpsrchmetrolist').val(metrourl);
$SUL('#searchmetro').val(metro_text);
}
//state
if ($SUL(event.target).parents("#stateHomeCont li").length == 1 || $SUL(event.target).is("#stateHomeCont li")) {
var stateurl = '', state_text = '';
if ($SUL(event.target).is('li')) {
stateurl = $SUL(event.target).find('a').attr('data-value');
state_text = $SUL(event.target).text();
}
else if ($SUL(event.target).parent().is('li')) {
stateurl = $SUL(event.target).attr('data-value');
state_text = $SUL(event.target).parent().text();
}
$SUL('#hpsrchstatelist').val(stateurl);
$SUL('#searchstate').val(state_text);
}
if ($SUL(event.target).parents("#mobilefilterbtn").length == 1 || $SUL(event.target).is('#mobilefilterbtn')) {
$SUL('#filterpanel div.filtermain').removeClass('show').addClass('show');
$SUL('body').attr('style', 'overflow:hidden');
}
if ($SUL(event.target).parents("#mobilefilterclosebtn").length == 1 || $SUL(event.target).is('#mobilefilterclosebtn')) {
$SUL('#filterpanel div.filtermain').removeClass('show');
$SUL('body').removeAttr('style');
}
},
bind_Click_Postpanel: function (event) {
if ($SUL(event.target).parents("*[data-goto]").length == 1 || $SUL(event.target).is('*[data-goto]')) {
if (Sulekha.Auth.isLoggedin() == 1) {
homepage.postclickevent = event;
homepage.navigatetoPost();
}
else {
try {
ga('send', 'event', 'home', 'clicked post btn', 'without logging');
} catch (e) {
}
if (usnewloginurl != null && usnewloginurl != undefined && usnewloginurl != 'undefined' && usnewloginurl != '') {
$SUL("#frMyAccount").attr("src", usnewloginurl);
}
else {
$SUL('#frMyAccount').attr('src', "https://myaccount.sulekha.com/network/usnewsign.aspx");
}
homepage.postclickevent = event;
Sulekha.Auth.CallBack_Success = "homepage.navigatetoPost";
$SUL(document.body).attr("style", "overflow:hidden");
$SUL("#newsignin").css("display", "block")
$SUL("#newsignin").find('span.clsoeico').bind('click', function () { $SUL(document.body).css('overflow', ''); $SUL('#newsignin').css('display', 'none'); });
}
}
},
navigatetoPost: function () {
if (homepage.postclickevent != undefined) {
var event = homepage.postclickevent;
var finalobject = undefined;
if ($SUL(event.target).parents("*[data-goto]").length == 1) {
finalobject = $SUL(event.target).parents("*[data-goto]");
}
else if ($SUL(event.target).is('*[data-goto]')) {
finalobject = $SUL(event.target);
}
var category = $SUL(finalobject).attr('data-category');
var goto_step = $SUL(finalobject).attr('data-goto');
var superid = $SUL(finalobject).attr('data-superid');
var primaryid = $SUL(finalobject).attr('data-primaryid');
var secondaryid = $SUL(finalobject).attr('data-secondaryid');
var isback = $SUL(finalobject).attr('data-back');
var isfinal = $SUL(finalobject).attr('data-final');
if (isback != 'true') {
if (!homepage.isemptyfield(superid) && superid != '0') {
$SUL('form#postnewad input[type=hidden][name=supercatid]').remove();
$SUL('
').appendTo('form#postnewad');
}
if (!homepage.isemptyfield(primaryid) && primaryid != '0') {
$SUL('form#postnewad input[type=hidden][name=primarycatid]').remove();
$SUL('
').appendTo('form#postnewad');
}
if (!homepage.isemptyfield(secondaryid) && secondaryid != '0') {
$SUL('form#postnewad input[type=hidden][name=secondarycatid]').remove();
$SUL('
').appendTo('form#postnewad');
}
if (!homepage.isemptyfield(category)) {
$SUL('form#postnewad input[type=hidden][name=serviceurl]').remove();
$SUL('
').appendTo('form#postnewad');
}
}
try {
var trimmed_text = $SUL(finalobject).text();
trimmed_text = Sulekha.Common.trim(trimmed_text);
ga('send', 'event', 'home', 'clicked post btn', trimmed_text + '; Category=' + category + '; Step=' + goto_step + '; Superid=' + superid +
'; Primid=' + primaryid + '; Secid=' + secondaryid + '; Userid=' + Sulekha.CurrentUser.id);
} catch (e) {
}
if (isfinal == 'true') {
$SUL('div.preloader').remove();
$SUL.ajax({
url: '/html/preloader_new.html', success: function (data) {
$SUL('body').append(data);
$SUL('body').removeClass('blurbody').addClass('blurbody');
$SUL('div.blurbg').remove();
$SUL('body').append('
');
$SUL('form#postnewad').attr('action', 'https://mycity.sulekha.com/postanad_roommates_prefill');
$SUL('form#postnewad').attr('method', 'post');
$SUL('form#postnewad').submit();
}
});
}
else {
$SUL('*[data-step]').removeClass('hide').addClass('hide');
$SUL('*[data-step=' + goto_step + '][data-category=' + category + ']').removeClass('hide');
}
if ($SUL('#loglinks').length == 0) {
fnauthsuccess();
}
homepage.postclickevent = undefined;
}
},
assignroomtypes: function (data_category) {
var roomtypes = '';
var roomtype_Arr = [];
$SUL('li[data-category=' + data_category + ']').each(function () {
if ($SUL(this).children('input').is(':checked')) {
roomtype_Arr.push($SUL(this).children('input').val());
}
});
if (roomtype_Arr.length > 0) {
roomtypes = roomtype_Arr.join();
if (roomtype_Arr.length == 1) {
var selected_single_roomtype = $SUL('li[data-category=' + data_category + '] > input:checked').siblings('label').text();
$SUL('#selectroomtype > a').html(selected_single_roomtype + '
');
}
else {
$SUL('#selectroomtype > a').html(roomtype_Arr.length + ' Property Types
');
}
}
else {
$SUL('#selectroomtype > a').html('Select Type
');
}
$SUL('input[name=' + data_category + ']').val(roomtypes);
},
isemptyfield: function (value) {
if (value == '' || value == undefined || value == 'undefined') {
return true;
}
else {
return false;
}
},
sulCitySearchUSCan: function (holder) {
$SUL("#" + holder).bind('keyup', function (event) {
srchHolder = holder;
if (event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 27) {
var cityval = ""; cityval = $SUL("#" + holder).val();
if (cityval.length > 1) {
Sulekha.Auth.JSONGetData(gProtocol + window.location.host + "/common/citysearch_sync-call.aspx?callback=homepage.&term=" + cityval);
} else {
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").removeClass('show hide').addClass("hide");
}
}
});
$SUL("#" + holder).bind('keydown', function (event) {
if (event.keyCode == 27)
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").children('li').remove();
if (event.keyCode == 40 || event.keyCode == 38 || event.keyCode == 13) {
if ($SUL("#" + srchHolder + "-uscanadacity-list-wrap li").length > 0 && (event.keyCode == 40 || event.keyCode == 13)) {
var i = 0, j = 0, totlen = $SUL('#' + srchHolder + '-uscanadacity-list-wrap li').length;
for (i = 0; i < totlen; i++) {
if ($SUL('#autocomplist' + i).hasClass('active')) {
if (event.keyCode == 13) {
j = 1;
$SUL('#autocomplist' + i).removeClass('active');
$SUL('#autocomplist' + i).trigger('click');
$SUL("#" + holder + "-uscanadacity-list-wrap").html("");
break;
}
j = 1;
$SUL('#autocomplist' + i).removeClass('active');
if ($SUL('#autocomplist' + (parseInt(i) + parseInt(1))).length > 0) {
$SUL('#autocomplist' + (parseInt(i) + parseInt(1))).addClass('active').trigger('hover');
break;
} else {
$SUL('#autocomplist0').addClass('active').trigger('hover');
break;
}
}
}
if (j == 0) {
$SUL('#autocomplist0').addClass('active').trigger('hover');
}
}
if ($SUL("#" + srchHolder + "-uscanadacity-list-wrap li").length > 0 && event.keyCode == 38) {
var i = 0, j = 0, totlen = $SUL('#' + srchHolder + '-uscanadacity-list-wrap li').length;
for (i = 0; i < totlen; i++) {
if ($SUL('#autocomplist' + i).hasClass('active')) {
if (i > 0)
j = 1;
$SUL('#autocomplist' + i).removeClass('active');
if ($SUL('#autocomplist' + (parseInt(i) - parseInt(1))).length > 0) {
$SUL('#autocomplist' + (parseInt(i) - parseInt(1))).addClass('active');
break;
} else {
$SUL('#autocomplist' + (totlen - 1)).addClass('active');
break;
}
}
}
if (j == 0) {
$SUL('#autocomplist' + (totlen - 1)).addClass('active');
}
}
}
});
$SUL("#" + holder).bind('click', function () { this.focus(); this.select(); });
$SUL(document).bind('click.' + holder, function (event) {
if ($SUL("#" + holder + "-uscanadacity-list-wrap").length == 1 && $SUL(event.target).attr("id") != holder) {
$SUL("#" + holder + "-uscanadacity-list-wrap").html("");
}
});
$SUL("#" + holder).bind('focus', function (event) {
$SUL("#" + holder + "-uscanadacity-list-wrap").parent().parent().removeClass('hide show');
});
},
searchUSCanadaCity: function (a) {
if (a != undefined && a.length > 0) {
var b = "";
var isUsa = false, isCanada = false;
var uslist = "
USA
";
var canadalist = "
Canada
";
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").html(uslist);
}
if (isCanada) {
canadalist += "
";
if ($SUL('#us-city-list').length == 1) {
if ($SUL('#us-city-list').prev().text() == 'Canada') {
$SUL('#us-city-list').prev().remove();
$SUL('#us-city-list').remove();
}
}
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").append(canadalist);
}
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").parent().parent().removeClass('show hide').addClass("show");
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").removeClass('show hide').addClass("show");
}
},
selectUSCanadaCity: function (a) {
var place = $SUL('#hdSelCity').val();
$SUL('#hdSelCity').remove(); $SUL('#hdSelCityUrl').remove(); $SUL('#hdSelStatecode').remove();
$SUL('#hdSelMetro').remove(); $SUL('#hdSelMetroUrl').remove();
$SUL('
').val(a.city).appendTo('body');
$SUL('
').val('').appendTo('body');
$SUL('
').val('').appendTo('body');
$SUL('
').val(a.citystatecodeurl).appendTo('body');
$SUL('
').val(a.statecode).appendTo('body');
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").removeClass("hide show").addClass("hide");
$SUL("#" + srchHolder).val(a.city + ", " + a.statecode);
$SUL('#locationtxt').text(a.city + ", " + a.statecode);
},
sulUnivSearch: function (holder) {
$SUL("#" + holder).bind('keyup', function (event) {
univHolder = holder;
if (event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 27) {
var univVal = ""; univVal = $SUL("#" + holder).val();
if (univVal.length > 1) {
Sulekha.Auth.JSONGetData(gProtocol + window.location.host + "/common/commonv4.aspx?type=lndmrk&landmarktype=university&term=" + univVal + "&callback=homepage.searchUnivSuccess");
} else {
$SUL("#" + univHolder + "-list-wrap").html("");
}
}
});
$SUL("#" + holder).bind('keydown', function (event) {
if (event.keyCode == 27)
$SUL("#" + holder + "-list-wrap").children('li').remove();
if (event.keyCode == 40 || event.keyCode == 38 || event.keyCode == 13) {
if ($SUL("#" + holder + "-list-wrap li").length > 0 && (event.keyCode == 40 || event.keyCode == 13)) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistUniv' + i).hasClass('active')) {
if (event.keyCode == 13) {
j = 1;
$SUL('#autocomplistUniv' + i).removeClass('active');
$SUL('#autocomplistUniv' + i).trigger('click');
$SUL("#" + holder + "-list-wrap").html("");
break;
}
j = 1;
$SUL('#autocomplistUniv' + i).removeClass('active');
if ($SUL('#autocomplistUniv' + (parseInt(i) + parseInt(1))).length > 0) {
$SUL('#autocomplistUniv' + (parseInt(i) + parseInt(1))).addClass('active').trigger('hover');
break;
} else {
$SUL('#autocomplistUniv0').addClass('active').trigger('hover');
break;
}
}
}
if (j == 0) {
$SUL('#autocomplistUniv0').addClass('active').trigger('hover');
}
}
if ($SUL("#" + holder + "-list-wrap li").length > 0 && event.keyCode == 38) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistUniv' + i).hasClass('active')) {
if (i > 0)
j = 1;
$SUL('#autocomplistUniv' + i).removeClass('active');
if ($SUL('#autocomplistUniv' + (parseInt(i) - parseInt(1))).length > 0) {
$SUL('#autocomplistUniv' + (parseInt(i) - parseInt(1))).addClass('active');
break;
} else {
$SUL('#autocomplistUniv' + (totallen - 1)).addClass('active');
break;
}
}
} if (j == 0) { $SUL('#autocomplistUniv' + (totallen - 1)).addClass('active'); }
}
}
});
$SUL("#" + holder).bind('click', function () { this.focus(); this.select(); });
$SUL("#" + holder).bind('focus', function (event) {
$SUL("#universitydrpdwn").removeClass('hide show');
});
$SUL(document).bind('click.univ' + holder, function (event) {
if ($SUL("#" + holder + "-list-wrap").length == 1 && $SUL(event.target).attr("id") != holder) {
$SUL("#" + holder + "-list-wrap").html("");
}
});
},
searchUnivSuccess: function (a) {
if (a != undefined && a.length > 0) {
if (a[0].ROW_PRC_GET_NEARBY_LANDMARK_AJAX_CITYURL != undefined && a[0].ROW_PRC_GET_NEARBY_LANDMARK_AJAX_CITYURL.length > 0) {
var uslist = '';
var obj = a[0].ROW_PRC_GET_NEARBY_LANDMARK_AJAX_CITYURL
$SUL.each(obj, function (a, c) {
var abbr = "";
if (c.abbreviation != undefined && c.abbreviation != "undefined" && c.abbreviation != "") {
abbr = "(" + c.abbreviation + ")";
}
uslist += "
" + c.landmark + abbr + ", " + c.city + ", " + c.statecode + "";
});
$SUL("#" + univHolder + "-list-wrap").html(uslist);
$SUL("#" + univHolder + "-list-wrap").removeClass("show hide").addClass('show');
}
}
},
selectUniversity: function (a) {
var place = $SUL('#hdUnivUrl').val();
$SUL('#hdUnivUrl').remove(); $SUL('#hdUnivName').remove(); $SUL('#hdUnivCityurl').remove();
$SUL('
').val(a.landmarkurl).appendTo('body');
$SUL('
').val(a.landmark).appendTo('body');
$SUL('
').val(a.cityurl).appendTo('body');
$SUL("#" + univHolder + "-list-wrap").removeClass("hide").addClass('hide');
$SUL("#" + univHolder).val(a.landmark);
if (a.landmark.length > 16) {
$SUL('#locationtxt').text(a.landmark.substr(0, 16) + '...');
}
else
$SUL('#locationtxt').text(a.landmark);
},
sulLndmrkSearch: function (holder) {
$SUL("#" + holder).bind('keyup', function (event) {
landmarkHolder = holder;
if (event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 27) {
var univVal = ""; univVal = $SUL("#" + holder).val();
if (univVal.length > 1) {
Sulekha.Auth.JSONGetData(gProtocol + window.location.host + "/common/commonv4.aspx?type=lndmrk&landmarktype=landmark&term=" + univVal + "&callback=homepage.searchLndmrkSuccess");
} else {
$SUL("#" + landmarkHolder + "-list-wrap").html("");
}
}
});
$SUL("#" + holder).bind('keydown', function (event) {
if (event.keyCode == 27)
$SUL("#" + holder + "-list-wrap").children('li').remove();
if (event.keyCode == 40 || event.keyCode == 38 || event.keyCode == 13) {
if ($SUL("#" + holder + "-list-wrap li").length > 0 && (event.keyCode == 40 || event.keyCode == 13)) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistLandmark' + i).hasClass('active')) {
if (event.keyCode == 13) {
j = 1;
$SUL('#autocomplistLandmark' + i).removeClass('active');
$SUL('#autocomplistLandmark' + i).trigger('click');
$SUL("#" + holder + "-list-wrap").html("");
break;
}
j = 1;
$SUL('#autocomplistLandmark' + i).removeClass('active');
if ($SUL('#autocomplistLandmark' + (parseInt(i) + parseInt(1))).length > 0) {
$SUL('#autocomplistLandmark' + (parseInt(i) + parseInt(1))).addClass('active').trigger('hover');
break;
} else {
$SUL('#autocomplistLandmark0').addClass('active').trigger('hover');
break;
}
}
}
if (j == 0) {
$SUL('#autocomplistLandmark0').addClass('active').trigger('hover');
}
}
if ($SUL("#" + holder + "-list-wrap li").length > 0 && event.keyCode == 38) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistLandmark' + i).hasClass('active')) {
if (i > 0)
j = 1;
$SUL('#autocomplistLandmark' + i).removeClass('active');
if ($SUL('#autocomplistLandmark' + (parseInt(i) - parseInt(1))).length > 0) {
$SUL('#autocomplistLandmark' + (parseInt(i) - parseInt(1))).addClass('active');
break;
} else {
$SUL('#autocomplistLandmark' + (totallen - 1)).addClass('active');
break;
}
}
} if (j == 0) { $SUL('#autocomplistLandmark' + (totallen - 1)).addClass('active'); }
}
}
});
$SUL("#" + holder).bind('click', function () { this.focus(); this.select(); });
$SUL("#" + holder).bind('focus', function (event) {
$SUL("#landmarkdrpdwn").removeClass('hide show');
});
$SUL(document).bind('click.lndmrk' + holder, function (event) {
if ($SUL("#" + holder + "-list-wrap").length == 1 && $SUL(event.target).attr("id") != holder) {
$SUL("#" + holder + "-list-wrap").html("");
}
});
},
searchLndmrkSuccess: function (a) {
if (a != undefined && a.length > 0) {
if (a[0].ROW_PRC_GET_NEARBY_LANDMARK_AJAX_CITYURL != undefined && a[0].ROW_PRC_GET_NEARBY_LANDMARK_AJAX_CITYURL.length > 0) {
var uslist = '';
var obj = a[0].ROW_PRC_GET_NEARBY_LANDMARK_AJAX_CITYURL
$SUL.each(obj, function (a, c) {
var abbr = "";
if (c.abbreviation != undefined && c.abbreviation != "undefined" && c.abbreviation != "") {
abbr = "(" + c.abbreviation + ")";
}
uslist += "
" + c.landmark + abbr + ", " + c.city + ", " + c.statecode + "";
});
$SUL("#" + landmarkHolder + "-list-wrap").html(uslist);
$SUL("#" + landmarkHolder + "-list-wrap").removeClass("show hide").addClass('show');
}
}
},
selectLandmark: function (a) {
var place = $SUL('#hdLandmarkUrl').val();
$SUL('#hdLandmarkUrl').remove(); $SUL('#hdLandmarkName').remove(); $SUL('#hdLandmarkCityurl').remove();
$SUL('
').val(a.landmarkurl).appendTo('body');
$SUL('
').val(a.landmark).appendTo('body');
$SUL('
').val(a.cityurl).appendTo('body');
$SUL("#" + landmarkHolder + "-list-wrap").removeClass("hide").addClass('hide');
$SUL("#" + landmarkHolder).val(a.landmark);
if (a.landmark.length > 16)
$SUL('#locationtxt').text(a.landmark.substr(0, 16) + '...');
else
$SUL('#locationtxt').text(a.landmark);
},
sulCountySearch: function (holder) {
$SUL("#" + holder).bind('keyup', function (event) {
countyHolder = holder;
if (event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 27) {
var countyVal = ""; countyVal = $SUL("#" + holder).val();
if (countyVal.length > 1) {
Sulekha.Auth.JSONGetData(gProtocol + window.location.host + "/common/commonv4.aspx?type=countyajax&term=" + countyVal + "&callback=searchCountySuccess");
} else {
$SUL("#" + countyHolder + "-list-wrap").html("");
}
}
});
$SUL("#" + holder).bind('keydown', function (event) {
if (event.keyCode == 27)
$SUL("#" + holder + "-list-wrap").children('li').remove();
if (event.keyCode == 40 || event.keyCode == 38 || event.keyCode == 13) {
if ($SUL("#" + holder + "-list-wrap li").length > 0 && (event.keyCode == 40 || event.keyCode == 13)) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistCounty' + i).hasClass('active')) {
if (event.keyCode == 13) {
j = 1;
$SUL('#autocomplistCounty' + i).removeClass('active');
$SUL('#autocomplistCounty' + i).trigger('click');
$SUL("#" + holder + "-list-wrap").html("");
break;
}
j = 1;
$SUL('#autocomplistCounty' + i).removeClass('active');
if ($SUL('#autocomplistCounty' + (parseInt(i) + parseInt(1))).length > 0) {
$SUL('#autocomplistCounty' + (parseInt(i) + parseInt(1))).addClass('active').trigger('hover');
break;
} else {
$SUL('#autocomplistCounty0').addClass('active').trigger('hover');
break;
}
}
}
if (j == 0) {
$SUL('#autocomplistCounty0').addClass('active').trigger('hover');
}
}
if ($SUL("#" + holder + "-list-wrap li").length > 0 && event.keyCode == 38) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistCounty' + i).hasClass('active')) {
if (i > 0)
j = 1;
$SUL('#autocomplistCounty' + i).removeClass('active');
if ($SUL('#autocomplistCounty' + (parseInt(i) - parseInt(1))).length > 0) {
$SUL('#autocomplistCounty' + (parseInt(i) - parseInt(1))).addClass('active');
break;
} else {
$SUL('#autocomplistCounty' + (totallen - 1)).addClass('active');
break;
}
}
} if (j == 0) { $SUL('#autocomplistCounty' + (totallen - 1)).addClass('active'); }
}
}
});
$SUL("#" + holder).bind('click', function () { this.focus(); this.select(); });
$SUL(document).bind('click.lndmrk' + holder, function (event) {
if ($SUL("#" + holder + "-list-wrap").length == 1 && $SUL(event.target).attr("id") != holder) {
$SUL("#" + holder + "-list-wrap").html("");
}
});
},
//john added apartment Start Nov 17 2023
sulApartmentSearch: function (holder) {
$SUL("#" + holder).bind('keyup', function (event) {
apartmentHolder = holder;
if (event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 27) {
var countyVal = ""; countyVal = $SUL("#" + holder).val();
if (countyVal.length > 1) {
Sulekha.Auth.JSONGetData(gProtocol + window.location.host + "/common/commonv4.aspx?type=apmtajax&term=" + countyVal + "&callback=searchApartmentSuccess");
} else {
$SUL("#" + apartmentHolder + "-list-wrap").html("");
}
}
});
$SUL("#" + holder).bind('keydown', function (event) {
if (event.keyCode == 27)
$SUL("#" + holder + "-list-wrap").children('li').remove();
if (event.keyCode == 40 || event.keyCode == 38 || event.keyCode == 13) {
if ($SUL("#" + holder + "-list-wrap li").length > 0 && (event.keyCode == 40 || event.keyCode == 13)) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistApartment' + i).hasClass('active')) {
if (event.keyCode == 13) {
j = 1;
$SUL('#autocomplistApartment' + i).removeClass('active');
$SUL('#autocomplistApartment' + i).trigger('click');
$SUL("#" + holder + "-list-wrap").html("");
break;
}
j = 1;
$SUL('#autocomplistApartment' + i).removeClass('active');
if ($SUL('#autocomplistApartment' + (parseInt(i) + parseInt(1))).length > 0) {
$SUL('#autocomplistApartment' + (parseInt(i) + parseInt(1))).addClass('active').trigger('hover');
break;
} else {
$SUL('#autocomplistApartment0').addClass('active').trigger('hover');
break;
}
}
}
if (j == 0) {
$SUL('#autocomplistApartment0').addClass('active').trigger('hover');
}
}
if ($SUL("#" + holder + "-list-wrap li").length > 0 && event.keyCode == 38) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistApartment' + i).hasClass('active')) {
if (i > 0)
j = 1;
$SUL('#autocomplistApartment' + i).removeClass('active');
if ($SUL('#autocomplistApartment' + (parseInt(i) - parseInt(1))).length > 0) {
$SUL('#autocomplistApartment' + (parseInt(i) - parseInt(1))).addClass('active');
break;
} else {
$SUL('#autocomplistApartment' + (totallen - 1)).addClass('active');
break;
}
}
} if (j == 0) { $SUL('#autocomplistApartment' + (totallen - 1)).addClass('active'); }
}
}
});
$SUL("#" + holder).bind('click', function () { this.focus(); this.select(); });
$SUL(document).bind('click.lndmrk' + holder, function (event) {
if ($SUL("#" + holder + "-list-wrap").length == 1 && $SUL(event.target).attr("id") != holder) {
$SUL("#" + holder + "-list-wrap").html("");
}
});
},
//john added apartment END Nov 17 2023
searchCountySuccess: function (a) {
if (a != undefined && a.length > 0) {
if (a[0].ROW_PRC_GET_AJAX_LOCATION_COUNTY != undefined && a[0].ROW_PRC_GET_AJAX_LOCATION_COUNTY.length > 0) {
var uslist = '';
var obj = a[0].ROW_PRC_GET_AJAX_LOCATION_COUNTY
$SUL.each(obj, function (a, c) {
var abbr = "";
if (c.abbreviation != undefined && c.abbreviation != "undefined" && c.abbreviation != "") {
abbr = "(" + c.abbreviation + ")";
}
uslist += "
" + c.county + abbr + ", " + c.statecode + "";
});
$SUL("#" + countyHolder + "-list-wrap").html(uslist);
$SUL("#" + countyHolder + "-list-wrap").removeClass("show hide").addClass('show');
}
}
},
selectCounty: function (a) {
if (countyHolder == "txtlandmarkss") {
$SUL("#hdCountyUrl").val(a.countystatecodeurl);
$SUL("#hdCountyName").val(a.county);
$SUL("#" + countyHolder + "-list-wrap").removeClass("hide").addClass('hide');
$SUL("#" + countyHolder).val(a.county);
}
else {
var place = $SUL('#hdLandmarkUrl').val();
$SUL('#hdCountyUrl').remove(); $SUL('#hdCountyName').remove();
$SUL('
').val(a.countystatecodeurl).appendTo('body');
$SUL('
').val(a.county).appendTo('body');
$SUL("#" + countyHolder + "-list-wrap").removeClass("hide").addClass('hide');
$SUL("#" + countyHolder).val(a.county);
if (a.county.length > 16) {
$SUL('#locationtxt').text(a.county.substr(0, 16) + '...');
}
else
$SUL('#locationtxt').text(a.county);
// setTimeout(function () { $SUL('#location').addClass('hide'); }, 10);
}
},
//john added apartment START Nov 17 2023
searchApartmentSuccess: function (a) {
if (a != undefined && a.length > 0) {
if (a[0].ROW_PRC_GET_AJAX_APARTMENT != undefined && a[0].ROW_PRC_GET_AJAX_APARTMENT.length > 0) {
var uslist = '';
var obj = a[0].ROW_PRC_GET_AJAX_APARTMENT
$SUL.each(obj, function (a, c) {
var abbr = "";
//if (c.abbreviation != undefined && c.abbreviation != "undefined" && c.abbreviation != "") {
// abbr = "(" + c.abbreviation + ")";
//}
uslist += "
" + c.businessname + ", " + c.city + "";
});
$SUL("#" + apartmentHolder + "-list-wrap").html(uslist);
$SUL("#" + apartmentHolder + "-list-wrap").removeClass("show hide").addClass('show');
}
}
},
selectApartment: function (a) {
if (apartmentHolder == "txtlandmarkss") {
$SUL("#hdApartmentUrl").val(a.businessurl);
$SUL("#hdApartmentName").val(a.businessname);
$SUL("#" + apartmentHolder + "-list-wrap").removeClass("hide").addClass('hide');
$SUL("#" + apartmentHolder).val(a.county);
}
else {
var place = $SUL('#hdApartmentClickUrl').val(a.apartclickurl);
$SUL('#hdApartmentUrl').remove(); $SUL('#hdApartmentName').remove();
$SUL('
').val(a.businessurl).appendTo('body');
$SUL('
').val(a.businessname).appendTo('body');
$SUL('
').val(a.apartclickurl).appendTo('body');
$SUL("#" + apartmentHolder + "-list-wrap").removeClass("hide").addClass('hide');
$SUL("#" + apartmentHolder).val(a.businessname);
if (a.businessname.length > 16) {
$SUL('#locationtxt').text(a.businessname.substr(0, 16) + '...');
}
else
$SUL('#locationtxt').text(a.businessname);
// setTimeout(function () { $SUL('#location').addClass('hide'); }, 10);
}
},
//john added apartment END Nov 17 2023
SearchAdsHomeV3: function () {
showplaceprocessing('homesearch');
var userneed = $SUL('#userneed').val();
var loctype = $SUL('#hploctypesel').val();
var univUrlForm = homepage.checkunivUrl();
var lndmrkUrlForm = homepage.checkLandmarkUrl();
if (loctype == 'state' && !$SUL('#stateHomeCont').hasClass('hide')) {
homepage.searchadsbyStateHome();
}
//john added apartment START Nov 17 2023
else if (loctype == "apartment") {
var redirecturl = $SUL('#hdApartmentClickUrl').val();
if (redirecturl != "" && redirecturl != undefined && redirecturl != null) {
window.location.replace(redirecturl);
}
else {
hideplaceprocessing('homesearch');
Sulekha.Common.alert("Please select a Apartment");
}
}
//john added apartment END Nov 17 2023
else if (univUrlForm == "1" || lndmrkUrlForm == "1") {
var univService = "";
if (userneed.toLowerCase() == 'i-need-an-apartment' || $SUL("li [data-category=renttype] > input[name='services']:checked").length > 0) {
univService = "rentals-offered";
count = $SUL("li [data-category=renttype] > input[name='services']:checked").length;
}
else if (userneed.toLowerCase() == 'i-have-an-apartment-to-rent' || $SUL("li [data-category=renttype] > input[name='services']:checked").length > 0) {
univService = "rentals-wanted";
count = $SUL("li [data-category=renttype] > input[name='services']:checked").length;
}
else if (userneed.toLowerCase() == 'i-need-a-room' || $SUL("li [data-category=roomtype] > input[name='services']:checked").length > 0) {
univService = "roommates-offered";
count = $SUL("li [data-category=roomtype] > input[name='services']:checked").length;
}
else if (userneed.toLowerCase() == 'i-have-a-room-to-rent' || $SUL("li [data-category=roomtype] > input[name='services']:checked").length > 0) {
univService = "roommates-wanted";
count = $SUL("li [data-category=roomtype] > input[name='services']:checked").length;
}
else if (userneed.toLowerCase() == 'i-need-a-commercial-space' || $SUL("li [data-category=commercialtype] > input[name='services']:checked").length > 0) {
univService = "rentals-commercial";
count = $SUL("li [data-category=commercialtype] > input[name='services']:checked").length;
}
else {
hideplaceprocessing('homesearch');
Sulekha.Common.alert("Please select any one Need");
}
if (count == 0) {
hideplaceprocessing('homesearch');
Sulekha.Common.alert("Please select any one Need");
}
else if (univUrlForm == "1") {
homepage.universityUrlForm(univService, '', '', userneed, count, '1');
}
else if (lndmrkUrlForm == "1") {
homepage.landmarkUrlForm(univService, '', '', userneed, count, '1');
}
}
else if (univUrlForm == "0" && lndmrkUrlForm == "0") {
if (userneed.toLowerCase() == 'i-need-an-apartment') {
homepage.SearchAdsRentalsHome('rentals', "offered", "");
}
else if (userneed.toLowerCase() == 'i-have-an-apartment-to-rent') {
homepage.SearchAdsRentalsHome("rentals", "wanted", "");
}
else if (userneed.toLowerCase() == 'i-need-a-room') {
homepage.SearchAdsRoommatesHome("roommates", "offered");
}
else if (userneed.toLowerCase() == 'i-have-a-room-to-rent') {
homepage.SearchAdsRoommatesHome("roommates", "wanted");
}
else if (userneed.toLowerCase() == 'i-need-a-commercial-space') {
homepage.SearchAdsRentalsHome("rentals", "offered", "1");
}
}
else {
hideplaceprocessing('homesearch');
}
},
checkunivUrl: function (aCityurl, sorting) {
var univUrl = "0";
if (!$SUL("#universityHomeCont").hasClass("hide") && homepage.isemptyfield(aCityurl)) {
if ($SUL("#searchUniv").val().length > 0 || (sorting == 1)) {
if ((Sulekha.Common.trim($SUL("#searchUniv").val()) == $SUL("#hdUnivName").val() && $SUL('#hdUnivUrl').val() != "") || (sorting == 1 && $SUL('#hdUnivUrl').val() != "")) {
univUrl = "1";
}
else {
$SUL('#divError_Dialog').dialog("option", "buttons", { "Ok": function () { $SUL("#searchUniv").focus(); $SUL(this).dialog('close'); } });
Sulekha.Common.alert("Please select a University"); univUrl = "2";
hideplaceprocessing('homesearch');
}
}
else {
$SUL('#divError_Dialog').dialog("option", "buttons", { "Ok": function () { $SUL("#searchUniv").focus(); $SUL(this).dialog('close'); } });
Sulekha.Common.alert("Please select a University"); univUrl = "2";
hideplaceprocessing('homesearch');
}
}
return univUrl;
},
checkLandmarkUrl: function (aCityurl, sorting) {
var univUrl = "0";
if (!$SUL("#landmarkHomeCont").hasClass("hide") && homepage.isemptyfield(aCityurl)) {
if ($SUL("#searchLandmark").val().length > 0 || (sorting == 1)) {
if ((Sulekha.Common.trim($SUL("#searchLandmark").val()) == $SUL("#hdLandmarkName").val() && $SUL('#hdLandmarkUrl').val() != "") || (sorting == 1 && $SUL('#hdLandmarkUrl').val() != "")) {
univUrl = "1";
}
else {
$SUL('#divError_Dialog').dialog("option", "buttons", { "Ok": function () { $SUL("#searchUniv").focus(); $SUL(this).dialog('close'); } });
Sulekha.Common.alert("Please select a Landmark"); univUrl = "2";
hideplaceprocessing('homesearch');
}
}
else {
$SUL('#divError_Dialog').dialog("option", "buttons", { "Ok": function () { $SUL("#searchUniv").focus(); $SUL(this).dialog('close'); } });
Sulekha.Common.alert("Please select a Landmark"); univUrl = "2";
hideplaceprocessing('homesearch');
}
}
return univUrl;
},
searchadsbyStateHome: function () {
var stateurl = $SUL('#hpsrchstatelist').val();
var userneed = $SUL('#userneed').val();
var searchurl = '';
var countzero = false;
if (userneed.toLowerCase() == 'i-need-an-apartment') {
var count = $SUL("li [data-category=renttype] > input[name='services']:checked").length;
var beds = $SUL('#bedroomSelect').val();
var price = $SUL('#priceRange').val();
if (count > 1 || (beds != '' || price != '')) {
var roomtype = $SUL('input[name=renttype]').val();
searchurl = 'osearchv2.aspx?service=rentals&titleurl=rentals&roomtype=' + roomtype + '&reqtype=offered&tagtype=apartments-and-flats&noofrooms=' + beds + '&price=' + price + '&locationtype=state&cityurl=' + stateurl + '&pagetype=state-listing';
}
else if (count == 1) {
var roomtype = $SUL('input[name=renttype]').val();
searchurl = 'rentals-' + roomtype + '-for-rent-in-' + stateurl;
}
else if (count == 0) {
countzero = true;
}
}
else if (userneed.toLowerCase() == 'i-have-an-apartment-to-rent') {
var count = $SUL("li [data-category=renttype] > input[name='services']:checked").length;
var beds = $SUL('#bedroomSelect').val();
//var price = $SUL('#pricerangeSelect').val();
var price = $SUL('#priceRange').val();
if (count > 1 || (beds != '' || price != '')) {
var roomtype = $SUL('input[name=renttype]').val();
searchurl = 'wsearchv2.aspx?service=rentals&titleurl=rentals&roomtype=' + roomtype + '&reqtype=wanted&tagtype=apartments-and-flats&noofrooms=' + beds + '&price=' + price + '&locationtype=state&cityurl=' + stateurl + '&pagetype=state-listing';
}
else if (count == 1) {
var roomtype = $SUL('input[name=renttype]').val();
searchurl = 'wanted-rentals-' + roomtype + '-for-rent-in-' + stateurl;
}
else if (count == 0) {
countzero = true;
}
}
else if (userneed.toLowerCase() == 'i-need-a-room') {
var count = $SUL("li [data-category=roomtype] > input[name='services']:checked").length;
var gender = $SUL('#genderSelect').val();
//var price = $SUL('#pricerangeSelect').val();
var price = $SUL('#priceRange').val();
if (count > 1 || (gender != '' || price != '')) {
var roomtype = $SUL('input[name=roomtype]').val();
searchurl = 'osearchv2.aspx?service=roommates&titleurl=roommates&roomtype=' + roomtype + '&gender=' + gender + '&price=' + price + '&reqtype=offered&locationtype=state&cityurl=' + stateurl + '&pagetype=state-offered';
}
else if (count == 1) {
var roomtype = $SUL('input[name=roomtype]').val();
searchurl = roomtype + '-roommates-in-' + stateurl;
}
else if (count == 0) {
countzero = true;
}
}
else if (userneed.toLowerCase() == 'i-have-a-room-to-rent') {
var count = $SUL("li [data-category=roomtype] > input[name='services']:checked").length;
var gender = $SUL('#genderSelect').val();
//var price = $SUL('#pricerangeSelect').val();
var price = $SUL('#priceRange').val();
if (count > 1 || gender != '') {
var roomtype = $SUL('input[name=roomtype]').val();
searchurl = 'wsearchv2.aspx?service=roommates&titleurl=roommates&roomtype=' + roomtype + '&gender=' + gender + '&price=' + price + '&reqtype=wanted&locationtype=state&cityurl=' + stateurl + '&pagetype=state-wanted';
}
else if (count == 1) {
var roomtype = $SUL('input[name=roomtype]').val();
searchurl = 'wanted-' + roomtype + '-roommates-in-' + stateurl;
}
else if (count == 0) {
countzero = true;
}
}
else if (userneed.toLowerCase() == 'i-need-a-commercial-space') {
var count = $SUL("li [data-category=commercialtype] > input[name='services']:checked").length;
//var price = $SUL('#pricerangeSelect').val();
var price = $SUL('#priceRange').val();
var roomtype = $SUL('input[name=commercialtype]').val();
if (count > 0 || price != '') {
searchurl = 'osearchv2.aspx?service=rentals&titleurl=rentals&tagtype=commercial-space&roomtype=' + roomtype + '&price=' + price + '&reqtype=offered&locationtype=state&cityurl=' + stateurl + '&pagetype=state-listing';
}
else if (count == 0) {
countzero = true;
}
}
if (countzero) {
Sulekha.Common.alert('Please select any one need');
hideplaceprocessing('homesearch');
}
else if (searchurl != '' && stateurl != '') {
window.location.href = '/' + searchurl;
}
else {
Sulekha.Common.alert('Please select state');
hideplaceprocessing('homesearch');
}
},
universityUrlForm: function (service, pageno, sortby, parentVal, childCount, homepageparam) {
var universityurl = $SUL("#hdUnivUrl").val(), universityCityurl = $SUL("#hdUnivCityurl").val();
var searchurl = "", pageNourl = "";
if (parseInt(pageno, 10) > 1) {
pageNourl = "_" + pageno
}
if (service == "roommates-offered" || service == "roommates-wanted") {
searchurl = "/offered_student-";
if (service == "roommates-wanted") {
searchurl = "/wanted_student-";
}
if (childCount == 1) {
var checkedRoomtype = $SUL("input[name=roomtype]").val();
if (checkedRoomtype == "single" || checkedRoomtype == "shared") {
checkedRoomtype += "-rooms";
}
searchurl += checkedRoomtype + "-in-and-near_" + universityurl + "_" + universityCityurl + pageNourl;
searchurl = homepage.getadditionalParams(searchurl, service, parentVal, childCount, sortby, '', homepageparam);
}
else {
searchurl += "accommodation-in-and-near_" + universityurl + "_" + universityCityurl + pageNourl;
searchurl = homepage.getadditionalParams(searchurl, service, parentVal, childCount, sortby, '', homepageparam);
}
}
else if (service == "rentals-offered" || service == "rentals-wanted") {
searchurl = "/offered_rentals_student-";
if (service == "rentals-wanted") {
searchurl = "/wanted_rentals_student-";
}
if (childCount == 1) {
var checkedRoomtype = $SUL("input[name=renttype]").val();
searchurl += checkedRoomtype + "-in-and-near_" + universityurl + "_" + universityCityurl + pageNourl;
searchurl = homepage.getadditionalParams(searchurl, service, parentVal, childCount, sortby, '', homepageparam);
}
else {
searchurl += "accommodation-in-and-near_" + universityurl + "_" + universityCityurl + pageNourl;
searchurl = homepage.getadditionalParams(searchurl, service, parentVal, childCount, sortby, '', homepageparam);
}
}
else if (service == "rentals-offered-parking-garage" || service == "rentals-wanted-parking-garage") {
searchurl = "/offered_rentals_student-";
if (service == "rentals-wanted-parking-garage") {
searchurl = "/wanted_rentals_student-";
}
searchurl += "parking-garage-in-and-near_" + universityurl + "_" + universityCityurl + pageNourl;
searchurl = homepage.getadditionalParams(searchurl, service, parentVal, childCount, sortby, '', homepageparam);
}
else if (service == "rentals-commercial") {
searchurl = "/offered_rentals_student-";
if (childCount == 1) {
var checkedRoomtype = $SUL("input[name=commercialtype]").val();
searchurl += checkedRoomtype + "-in-and-near_" + universityurl + "_" + universityCityurl + pageNourl;
searchurl = homepage.getadditionalParams(searchurl, service, parentVal, childCount, sortby, '', homepageparam);
}
else {
searchurl += "accommodation-in-and-near_" + universityurl + "_" + universityCityurl + pageNourl;
searchurl = homepage.getadditionalParams(searchurl, service, parentVal, childCount, sortby, '', homepageparam);
}
}
if (searchurl != "") {
window.location.href = searchurl;
}
else {
Sulekha.Common.alert("Oops !! Something went wrong. Please try again later.");
}
},
landmarkUrlForm: function (service, pageno, sortby, parentVal, childCount, homepageparam) {
var universityurl = $SUL("#hdLandmarkUrl").val(), universityCityurl = $SUL("#hdLandmarkCityurl").val();
var searchurl = "", pageNourl = "";
if (parseInt(pageno, 10) > 1) {
pageNourl = "_" + pageno
}
if (service == "roommates-offered" || service == "roommates-wanted") {
searchurl = "/offered-";
if (service == "roommates-wanted") {
searchurl = "/wanted-";
}
if (childCount == 1) {
var checkedRoomtype = $SUL("input[name=roomtype]").val();
searchurl += checkedRoomtype + "-roommates-near-" + universityurl + "_" + universityCityurl + pageNourl;
searchurl = homepage.getadditionalParams(searchurl, service, parentVal, childCount, sortby, '', homepageparam);
}
else {
searchurl += "roommates-near-" + universityurl + "_" + universityCityurl + pageNourl;
searchurl = homepage.getadditionalParams(searchurl, service, parentVal, childCount, sortby, '', homepageparam);
}
}
else if (service == "rentals-offered" || service == "rentals-wanted") {
searchurl = "/offered-";
if (service == "rentals-wanted") {
searchurl = "/wanted-";
}
if (childCount == 1) {
var checkedRoomtype = $SUL("input[name=renttype]").val();
searchurl += 'rentals/' + checkedRoomtype + "-for-rent-near-" + universityurl + "_" + universityCityurl + pageNourl;
searchurl = homepage.getadditionalParams(searchurl, service, parentVal, childCount, sortby, '', homepageparam);
}
else {
searchurl += "rooms-for-rent-near-" + universityurl + "_" + universityCityurl + pageNourl;
searchurl = homepage.getadditionalParams(searchurl, service, parentVal, childCount, sortby, '', homepageparam);
}
}
else if (service == "rentals-offered-parking-garage" || service == "rentals-wanted-parking-garage") {
searchurl = "/offered-";
if (service == "rentals-wanted-parking-garage") {
searchurl = "/wanted-";
}
searchurl += "rooms-for-rent-near-" + universityurl + "_" + universityCityurl + pageNourl;
searchurl = homepage.getadditionalParams(searchurl, service, '', 2, sortby, '', homepageparam);
}
else if (service == "rentals-commercial") {
searchurl = "/offered-";
searchurl += "rooms-for-rent-near-" + universityurl + "_" + universityCityurl + pageNourl;
searchurl = homepage.getadditionalParams(searchurl, service, '', 2, sortby, '', homepageparam);
}
if (!homepage.isemptyfield(searchurl)) {
window.location.href = searchurl;
}
else {
Sulekha.Common.alert("Oops !! Something went wrong. Please try again later.");
}
},
getadditionalParams: function (searchurl, service, parentVal, childCount, sortby, shortstay, homepageparam) {
var searchurlQueryStr = "?"
if (service.indexOf('rentals') > -1) {
var priceRange = $SUL("#priceRange").val(), usertype = $SUL("#rentalsSeller").val(), leasetype = $SUL("#leaseType").val();
var bedcount = $SUL("#bedCount").val();
var availability = $SUL("#availablefrom").val();
var noofbaths = $SUL("#bathroomSelect").val();
var occupation = $SUL("#occupationvalue").val();
var woccupation = $SUL("#woccupationvalue").val();
var ageval = $SUL("#agevalue").val();
if (homepageparam == "1") {
bedcount = $SUL("#bedroomSelect").val();
}
if (service.indexOf('wanted') > -1) {
usertype = $SUL("#rentalsTenant").val()
}
var radius = $SUL("#anchorRadius").val();
var pets = $SUL("#petsvalue").val();
if (bedcount != "" && bedcount != 0 && bedcount != undefined && bedcount != "undefined") {
searchurlQueryStr += "noofrooms=" + bedcount + "&";
}
if (noofbaths != "" && noofbaths != 0 && noofbaths != undefined && noofbaths != "undefined") {
searchurlQueryStr += "noofbaths=" + noofbaths + "&";
}
if (priceRange != "" && priceRange != undefined && priceRange != "undefined") {
searchurlQueryStr += "price=" + priceRange + "&";
}
if (usertype != "" && usertype != undefined && usertype != "undefined") {
searchurlQueryStr += "usertype=" + usertype + "&";
}
if (leasetype != "" && leasetype != undefined && leasetype != "undefined") {
searchurlQueryStr += "leaseType=" + leasetype + "&";
}
else if (shortstay == "1") {
searchurlQueryStr += "leaseType=short-term&";
}
if (availability != "" && availability != undefined && availability != "undefined") {
searchurlQueryStr += "availability=" + availability + "&";
}
if (radius != "" && radius != undefined && radius != "undefined" && radius != '0') {
searchurlQueryStr += "radius=" + radius + "&";
}
if (pets != "" && pets != undefined && pets != "undefined") {
searchurlQueryStr += "pets=" + pets + "&";
}
if (ageval != undefined && ageval != "")
searchurlQueryStr += "age=" + ageval + "&";
if (pageFilterValues.reqType == "offered") {
if (occupation != undefined && occupation != "")
searchurlQueryStr += "occupation=" + occupation + "&";
}
else {
if (woccupation != undefined && woccupation != "")
searchurlQueryStr += "occupation=" + woccupation + "&";
}
if (sortby != "" && sortby != undefined && sortby != "undefined") {
searchurlQueryStr += "sorttype=" + sortby + "&";
}
if (childCount > 1 && homepage.isemptyfield(parentVal) && service != "rentals-commercial") {
var roomtypes = "", checkboxtype = "";
if (service == "rentals-offered") {
roomtypes = $SUL("input[name='roomtype']").val();
searchurlQueryStr += "roomtype=" + roomtypes;
}
else if (service == "rentals-wanted") {
roomtypes = $SUL("input[name='renttype']").val();
searchurlQueryStr += "roomtype=" + roomtypes;
}
else if (service == "rentals-offered-parking-garage" || service == "rentals-wanted-parking-garage") {
searchurlQueryStr += "roomtype=parking-garage";
}
}
if (service == "rentals-commercial") {
var roomtypes = $SUL("input[name='commercialtype']").val();
searchurlQueryStr += "tagtype=commercial-space&";
if (childCount > 1) {
searchurlQueryStr += "roomtype=" + roomtypes;
}
}
}
else {
var priceRange = $SUL("#priceRange").val(), usertype = $SUL("#roommatesSeller").val(), leasetype = $SUL("#leaseType").val();
var gender = $SUL("input[name='roommatesGender']").val(), attachedBath = $SUL("#attachedBath").attr("checked");
var availability = $SUL("#availablefrom").val();
var noofbaths = $SUL("#bathroomSelect").val();
var occupation = $SUL("#occupationvalue").val();
var woccupation = $SUL("#woccupationvalue").val();
var ageval = $SUL("#agevalue").val();
if (homepageparam == "1") {
gender = $SUL("#genderSelect").val();
}
if (service.indexOf('wanted') > -1) {
usertype = $SUL("#roommatesTenant").val()
}
var radius = $SUL("#anchorRadius").val();
var pets = $SUL("#petsvalue").val();
if (priceRange != "" && priceRange != undefined && priceRange != "undefined") {
searchurlQueryStr += "price=" + priceRange + "&";
}
if (noofbaths != "" && noofbaths != undefined && noofbaths != "undefined") {
searchurlQueryStr += "noofbaths=" + noofbaths + "&";
}
if (usertype != "" && usertype != undefined && usertype != "undefined") {
searchurlQueryStr += "usertype=" + usertype + "&";
}
if (leasetype != "" && leasetype != undefined && leasetype != "undefined") {
searchurlQueryStr += "leaseType=" + leasetype + "&";
}
if (gender != "" && gender != undefined && gender != "undefined") {
searchurlQueryStr += "gender=" + gender + "&";
}
if (attachedBath == "checked") {
searchurlQueryStr += "attachedBath=yes&";
}
if (availability != "" && availability != undefined && availability != "undefined") {
searchurlQueryStr += "availability=" + availability + "&";
}
if (radius != "" && radius != undefined && radius != "undefined" && radius != '0') {
searchurlQueryStr += "radius=" + radius + "&";
}
if (pets != "" && pets != undefined && pets != "undefined") {
searchurlQueryStr += "pets=" + pets + "&";
}
if (sortby != "" && sortby != undefined && sortby != "undefined") {
searchurlQueryStr += "sorttype=" + sortby + "&";
}
if (ageval != undefined && ageval != "")
searchurlQueryStr += "age=" + ageval + "&";
if (pageFilterValues.reqType == "offered") {
if (occupation != undefined && occupation != "")
searchurlQueryStr += "occupation=" + occupation + "&";
}
else {
if (woccupation != undefined && woccupation != "")
searchurlQueryStr += "occupation=" + woccupation + "&";
}
if (childCount > 1 && homepage.isemptyfield(parentVal)) {
var roomtypes = "";
roomtypes = $SUL("input[name='roomtype']").val();
searchurlQueryStr += "roomtype=" + roomtypes;
}
}
if (searchurlQueryStr != "?") {
searchurlQueryStr = searchurl + searchurlQueryStr;
if (searchurlQueryStr.substr(searchurlQueryStr.length - 1) == "&") {
searchurlQueryStr = searchurlQueryStr.substring(0, searchurlQueryStr.length - 1);
}
}
else {
searchurlQueryStr = searchurl;
}
return searchurlQueryStr;
},
SearchAdsRentalsHome: function (services, AdType, iscommercial) {
var searchUrl = "/" + AdType + "_rentals_", cityurl = $SUL('#hdSelCityUrl').val(), metrourl = $SUL("#hpsrchmetrolist").val(), countyurl = $SUL('#hdCountyUrl').val();
var bedroom = $SUL("#bedroomSelect").val(), istag = $SUL("li [data-category=renttype] > input[name='services']:checked").length,
iscommercialtag = $SUL("li [data-category=commercialtype] > input[name='services']:checked").length;
var taglength = $SUL("li [data-category=renttype] > input[name='services']").length, commercialtaglength = $SUL("li [data-category=commercialtype] > input[name='services']").length;
var tags = "", isValid = true, newisValid = false;
var priceRange = $SUL("#priceRange").val();
var noofbaths = $SUL("#bathroomSelect").val();
if (istag == 1 && iscommercial != "1") {
if (bedroom != undefined && bedroom != "") {
searchUrl += bedroom + "-bedrooms_";
}
if (istag > 0) {
tags = $SUL("input[name='renttype']").val();
searchUrl += tags + "_";
}
if (bedroom != undefined && bedroom != "" && istag > 0) {
if (AdType == "wanted") {
searchUrl += "for-rent_"
}
else {
searchUrl += "to-rent_"
}
}
if (priceRange != undefined && priceRange != "")
searchUrl += priceRange + "_";
newisValid = true;
}
else if (((istag > 1 && istag != taglength) || ((istag == 0 || istag == taglength) && ((bedroom != undefined && bedroom != "") || (noofbaths != undefined && noofbaths != ""))))
&& iscommercial != "1") {
tags = $SUL("input[name='renttype']").val();
if (AdType == "offered") {
searchUrl = "/osearchv2.aspx?service=rentals&titleurl=rentals&tagtype=apartments-and-flats&reqtype=offered";
}
else {
searchUrl = "/wsearchv2.aspx?service=rentals&titleurl=rentals&tagtype=apartments-and-flats&reqtype=wanted";
}
if (tags != "" && tags != undefined) {
tags = tags.substring(0, tags.length - 1);
searchUrl += "&roomtype=" + tags;
}
if (bedroom != undefined && bedroom != "") {
searchUrl += "&noofrooms=" + bedroom;
}
if (noofbaths != undefined && noofbaths != "") {
searchUrl += "&noofbaths=" + noofbaths;
}
if (priceRange != undefined && priceRange != "") {
searchUrl += "&price=" + priceRange;
}
newisValid = true;
}
else if (iscommercial == 1 && (iscommercialtag < 2 || iscommercialtag == commercialtaglength)) {
tags = $SUL("input[name='commercialtype']").val();
if (iscommercialtag == 1) {
searchUrl += tags + "_"
}
searchUrl += "commercial-space_";
if (iscommercialtag == 1) {
searchUrl += "to-rent_";
}
if (priceRange != undefined && priceRange != "")
searchUrl += priceRange + "_";
newisValid = true;
}
else if (iscommercial == 1 && iscommercialtag > 1 && iscommercial != commercialtaglength) {
tags = $SUL("input[name='commercialtype']").val();
tags = tags.substring(0, tags.length - 1);
searchUrl = "/osearchv2.aspx?service=rentals&titleurl=rentals&roomtype=" + tags + "&tagtype=commercial-space&reqtype=offered";
if (priceRange != undefined && priceRange != "")
searchUrl += "&price=" + priceRange;
if (noofbaths != undefined && noofbaths != "") {
searchUrl += "&noofbaths=" + noofbaths;
}
newisValid = true;
}
if ((!$SUL("#metroHomeCont").hasClass("hide") && $SUL("#hpsrchmetrolist").val() != '' && $SUL("#countyHomeCont").hasClass("hide")) ||
(!$SUL("#cityHomeCont").hasClass("hide") && $SUL("#hdSelCityUrl").length > 0
&& Sulekha.Common.trim($SUL('#searchCity').val()) != '' && homepage.checkcity()) && $SUL("#countyHomeCont").hasClass("hide")) {
if (cityurl != undefined && cityurl != "" && cityurl != null && cityurl.length > 0 && !$SUL("#cityHomeCont").hasClass("hide")) {
if (searchUrl.length > 0 && (((istag == 0 || istag == taglength) && bedroom == 0 && (noofbaths == "" || noofbaths == undefined) && iscommercial != 1) || istag == 1 || ((iscommercialtag < 2 || iscommercialtag == commercialtaglength) && iscommercial == 1))) {
if (priceRange != undefined && priceRange != "" && !newisValid)
searchUrl += priceRange + "_";
searchUrl += "in_" + cityurl;
}
else if ((istag > 1 && istag != taglength) || ((istag == 0 || istag == taglength) && bedroom > 0) || (iscommercialtag > 1 && iscommercial == 1 && iscommercialtag != commercialtaglength)) {
searchUrl += "&locationtype=city&cityurl=" + cityurl + "&pagetype=city-listing";
}
}
else if (!$SUL("#metroHomeCont").hasClass("hide") && $SUL("#hpsrchmetrolist").val() != '') {
if (searchUrl.length > 0 && (((istag == 0 || istag == taglength) && bedroom == 0 && (noofbaths == "" || noofbaths == undefined) && iscommercial != 1) || istag == 1 || ((iscommercialtag < 2 || iscommercialtag == commercialtaglength) && iscommercial == 1))) {
if (priceRange != undefined && priceRange != "" && !newisValid)
searchUrl += priceRange + "_";
searchUrl += "in_" + metrourl;
}
else if ((istag > 1 && istag != taglength) || ((istag == 0 || istag == taglength) && (bedroom > 0 || noofbaths > 0)) || (iscommercialtag > 1 && iscommercial == 1 && iscommercialtag != commercialtaglength)) {
searchUrl += "&locationtype=metro&cityurl=" + metrourl + "&pagetype=metro-listing";
}
}
else {
isValid = false;
Sulekha.Common.alert("Please select a city or address from the list.");
}
}
else if (!$SUL("#countyHomeCont").hasClass("hide")) { // && $SUL("#hdCountyUrl").length > 0 && Sulekha.Common.trim($SUL('#searchCounty').val()) != ''
if (countyurl != undefined && countyurl != "" && countyurl != null && countyurl.length > 0 && !$SUL("#countyHomeCont").hasClass("hide")) {
if (searchUrl.length > 0 && (((istag == 0 || istag == taglength) && bedroom == 0 && (noofbaths == "" || noofbaths == undefined) && iscommercial != 1) || istag == 1 || ((iscommercialtag < 2 || iscommercialtag == commercialtaglength) && iscommercial == 1))) {
if (priceRange != undefined && priceRange != "" && !newisValid)
searchUrl += priceRange + "_";
searchUrl += "in_" + countyurl;
}
else if ((istag > 1 && istag != taglength) || ((istag == 0 || istag == taglength) && bedroom > 0) || (iscommercialtag > 1 && iscommercial == 1 && iscommercialtag != commercialtaglength)) {
searchUrl += "&locationtype=county&cityurl=" + countyurl + "&pagetype=county-listing";
}
}
else {
isValid = false;
Sulekha.Common.alert("Please select a County");
}
}
else {
isValid = false;
Sulekha.Common.alert("Please select metro or city.");
}
if (iscommercialtag == 0 && istag == 0) {
isValid = false;
Sulekha.Common.alert("Please select any one Need.");
}
if (isValid) {
window.location.href = searchUrl;
}
else
hideplaceprocessing('homesearch');
},
SearchAdsRoommatesHome: function (services, AdType, iscommercial) {
var isRoommatesKeyWordAdded = false, isValid = true; SortBylatest = false, issearchpage = false, urlSearchpage = "";
SearchUrl = AdType + "_";
var cityurl = "", metrourl = "", stateurl = '', gender = $SUL("#genderSelect").val(), roomtype = "", countyurl = "";
var roomtypecount = $SUL("li [data-category=roomtype] > input[name='services']:checked").length;
var roomtypecounttot = $SUL("li [data-category=roomtype] > input[name='services']").length;
var priceRange = $SUL("#priceRange").val();
cityurl = $SUL('#hdSelCityUrl').val();
metrourl = $SUL("#hpsrchmetrolist").val();
stateurl = $SUL("#hpsrchstatelist").val();
countyurl = $SUL('#hdCountyUrl').val();
if ((!$SUL("#metroHomeCont").hasClass("hide") && $SUL("#hpsrchmetrolist").val() != '') ||
(!$SUL("#stateHomeCont").hasClass("hide") && $SUL("#hpsrchstatelist").val() != '') ||
(!$SUL("#countyHomeCont").hasClass("hide") && $SUL("#hdCountyUrl").length > 0) ||
(!$SUL("#cityHomeCont").hasClass("hide") && $SUL("#hdSelCityUrl").length > 0
&& Sulekha.Common.trim($SUL('#searchCity').val()) != '' && homepage.checkcity())) {
if (cityurl != undefined && cityurl != "" && cityurl != null && cityurl.length > 0 && !$SUL("#cityHomeCont").hasClass("hide")) {
if (SearchUrl.length > 0) {
if (gender != '' && gender != undefined) {
SearchUrl += gender + '_';
}
if ($SUL("li [data-category=roomtype] > input[name='services']:checked").length == 1) {
roomtype = $SUL("input[name='roomtype']").val();
SearchUrl += roomtype + '_';
}
else if ($SUL("li [data-category=roomtype] > input[name='services']:checked").length > 1 &&
$SUL("li [data-category=roomtype] > input[name='services']:checked").length != $SUL("li [data-category=roomtype] > input[name='services']").length) {
roomtype += $SUL("input[name='roomtype']").val();
urlSearchpage = "/osearchv2.aspx?";
if (AdType.toLowerCase() == "wanted") {
urlSearchpage = "/wsearchv2.aspx?";
}
urlSearchpage += "service=roommates&titleurl=roommates&roomtype=" + roomtype;
if (gender != undefined && gender.length > 0) {
urlSearchpage += "&gender=" + gender;
}
if (priceRange != undefined && priceRange.length > 0) {
urlSearchpage += "&price=" + priceRange;
}
urlSearchpage += "&reqtype=" + AdType + "&locationtype=city&cityurl=" + cityurl + "&pagetype=city-" + AdType;
issearchpage = true;
}
if (!isRoommatesKeyWordAdded)
SearchUrl += "roommates_";
if (!issearchpage && priceRange != undefined && priceRange != "")
SearchUrl += "rent-" + priceRange + "_";
SearchUrl += "in-and-near_" + cityurl;
isRoommatesKeyWordAdded = true;
}
else
SearchUrl = cityurl;
}
else if (countyurl != undefined && countyurl != "" && countyurl != null && countyurl.length > 0 && !$SUL("#countyHomeCont").hasClass("hide")) {
if (SearchUrl.length > 0) {
var isgenderprice = false;
if ((gender != '' && gender != undefined) || (priceRange != '' && priceRange != undefined)) {
isgenderprice = true;
}
if ($SUL("li [data-category=roomtype] > input[name='services']:checked").length == 1) {
roomtype = $SUL("input[name='roomtype']").val();
SearchUrl += roomtype + '-';
}
else if ((roomtypecount > 1 && roomtypecount != roomtypecounttot) || isgenderprice) {
roomtype += $SUL("input[name='roomtype']").val();
urlSearchpage = "/osearchv2.aspx?";
if (AdType.toLowerCase() == "wanted") {
urlSearchpage = "/wsearchv2.aspx?";
}
urlSearchpage += "service=roommates&titleurl=roommates&roomtype=" + roomtype;
if (gender != undefined && gender.length > 0) {
urlSearchpage += "&gender=" + gender;
}
if (priceRange != undefined && priceRange.length > 0) {
urlSearchpage += "&price=" + priceRange;
}
urlSearchpage += "&reqtype=" + AdType + "&locationtype=county&cityurl=" + countyurl + "&pagetype=county-" + AdType;
issearchpage = true;
}
if (!issearchpage && !isgenderprice) {
SearchUrl += "rooms-";
if (AdType == "offered")
SearchUrl += "for-rent-" + countyurl;
else if (AdType == "wanted")
SearchUrl += "to-rent-" + countyurl;
SearchUrl = SearchUrl.replace('offered_', '');
if (roomtypecount == 1)
SearchUrl = SearchUrl.replace('_rooms-', '-rooms-').replace('wanted_', 'wanted-');
}
isRoommatesKeyWordAdded = true;
}
}
else if (!$SUL("#metroHomeCont").hasClass("hide") && $SUL("#hpsrchmetrolist").val() != '') {
if (SearchUrl.length > 0) {
if (gender != '' && gender != undefined) {
SearchUrl += gender + '_';
}
if ($SUL("li [data-category=roomtype] > input[name='services']:checked").length == 1) {
roomtype = $SUL("input[name='roomtype']").val();
SearchUrl += roomtype + '_';
}
else if ($SUL("li [data-category=roomtype] > input[name='services']:checked").length > 1 &&
$SUL("li [data-category=roomtype] > input[name='services']:checked").length != $SUL("li [data-category=roomtype] > input[name='services']").length) {
roomtype += $SUL("input[name='roomtype']").val();
urlSearchpage = "/osearchv2.aspx?";
if (AdType.toLowerCase() == "wanted") {
urlSearchpage = "/wsearchv2.aspx?";
}
urlSearchpage += "service=roommates&titleurl=roommates&roomtype=" + roomtype;
if (gender != undefined && gender.length > 0) {
urlSearchpage += "&gender=" + gender;
}
if (priceRange != undefined && priceRange.length > 0) {
urlSearchpage += "&price=" + priceRange;
}
urlSearchpage += "&reqtype=" + AdType + "&locationtype=metro&cityurl=" + metrourl + "&pagetype=metro-" + AdType;
issearchpage = true;
}
if (!isRoommatesKeyWordAdded)
SearchUrl += "roommates_";
if (!issearchpage && priceRange != undefined && priceRange != "")
SearchUrl += "rent-" + priceRange + "_";
SearchUrl += "in_" + metrourl;
isRoommatesKeyWordAdded = true;
}
else
SearchUrl = metrourl;
}
else {
isValid = false;
Sulekha.Common.alert("Please select a city or address from the list.");
}
}
else if (isValid) {
isValid = false;
Sulekha.Common.alert("Please select metro or city or county.");
}
if (roomtypecount == 0) {
isValid = false;
Sulekha.Common.alert("Please select any one Need.");
}
if (isValid) {
if (issearchpage) {
window.location.href = urlSearchpage;
}
else {
window.location.href = "/" + SearchUrl;
}
}
else
hideplaceprocessing('homesearch');
},
bind_metrosearch: function () {
$SUL('#searchmetro').off('keyup');
$SUL('#searchmetro').on('keyup', function (event) {
$SUL('#metrosearchnoresult').remove();
if ($SUL('#metrodrpdwn ul').children().length > 0) {
if (event.keyCode != 13 && event.keyCode != 38 && event.keyCode != 40) {
var typedtxt = $SUL('#searchmetro').val().toLowerCase();
$SUL('#metrodrpdwn ul li').each(function (i, li) {
var litxt = $SUL(li).children('a').text().toLowerCase();
if (litxt.indexOf(typedtxt) == -1)
$SUL(li).addClass('hide').removeClass('active');
else
$SUL(li).removeClass('hide active');
});
if ($SUL('#metrodrpdwn ul li.hide').length == $SUL('#metrodrpdwn ul li').length) {
$SUL('#metrodrpdwn ul').append('
No Results found');
}
}
}
});
$SUL('#searchmetro').on('keydown', function (event) {
if ($SUL('#metrodrpdwn ul').children().length > 0 && !$SUL('#metrodrpdwn').hasClass('hide')) {
if (event.keyCode == 40 || event.keyCode == 13) {
var i = 0, j = 0, totallen = $SUL("#metrodrpdwn ul li:not(.hide)").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#metrodrpdwn ul li:not(.hide):eq(' + i + ')').hasClass('active')) {
if (event.keyCode == 13) {
j = 1;
$SUL('#metrodrpdwn ul li:not(.hide):eq(' + i + ')').removeClass('active');
$SUL('#metrodrpdwn ul li:not(.hide):eq(' + i + ')').trigger('click');
break;
}
j = 1;
$SUL('#metrodrpdwn ul li:not(.hide):eq(' + i + ')').removeClass('active');
if ($SUL('#metrodrpdwn ul li:not(.hide):eq(' + (parseInt(i) + parseInt(1)) + ')').length > 0) {
$SUL('#metrodrpdwn ul li:not(.hide):eq(' + (parseInt(i) + parseInt(1)) + ')').addClass('active').trigger('hover');
break;
} else {
$SUL('#metrodrpdwn ul li:not(.hide):eq(0)').addClass('active').trigger('hover');
break;
}
}
}
if (j == 0) {
$SUL('#metrodrpdwn ul li:not(.hide):eq(0)').addClass('active').trigger('hover');
}
}
if (event.keyCode == 38) {
var i = 0, j = 0, totallen = $SUL("#metrodrpdwn ul li:not(.hide)").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#metrodrpdwn ul li:not(.hide):eq(' + i + ')').hasClass('active')) {
if (i > 0)
j = 1;
$SUL('#metrodrpdwn ul li:not(.hide):eq(' + i + ')').removeClass('active');
if ($SUL('#metrodrpdwn ul li:not(.hide):eq(' + (parseInt(i) - parseInt(1)) + ')').length > 0) {
$SUL('#metrodrpdwn ul li:not(.hide):eq(' + (parseInt(i) - parseInt(1)) + ')').addClass('active');
break;
} else {
$SUL('#metrodrpdwn ul li:not(.hide):eq(' + (totallen - 1) + ')').addClass('active');
break;
}
}
} if (j == 0) { $SUL('#metrodrpdwn ul li:not(.hide):eq(' + (totallen - 1) + ')').addClass('active'); }
}
}
});
},
bind_statesearch: function () {
$SUL('#searchstate').off('keyup');
$SUL('#searchstate').on('keyup', function (event) {
$SUL('#searchstatenoresult').remove();
if ($SUL('#statedrpdwn ul').children().length > 0) {
if (event.keyCode != 13 && event.keyCode != 38 && event.keyCode != 40) {
var typedtxt = $SUL('#searchstate').val().toLowerCase();
$SUL('#statedrpdwn ul li').each(function (i, li) {
var litxt = $SUL(li).children('a').text().toLowerCase();
if (litxt.indexOf(typedtxt) == -1)
$SUL(li).addClass('hide').removeClass('active');
else
$SUL(li).removeClass('hide active');
});
if ($SUL('#statedrpdwn ul li.hide').length == $SUL('#statedrpdwn ul li').length) {
$SUL('#statedrpdwn ul').append('
No Results found');
}
}
}
});
$SUL('#searchstate').on('keydown', function (event) {
if ($SUL('#statedrpdwn ul').children().length > 0 && !$SUL('#statedrpdwn').hasClass('hide')) {
if (event.keyCode == 40 || event.keyCode == 13) {
var i = 0, j = 0, totallen = $SUL("#statedrpdwn ul li:not(.hide)").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#statedrpdwn ul li:not(.hide):eq(' + i + ')').hasClass('active')) {
if (event.keyCode == 13) {
j = 1;
$SUL('#statedrpdwn ul li:not(.hide):eq(' + i + ')').removeClass('active');
$SUL('#statedrpdwn ul li:not(.hide):eq(' + i + ')').trigger('click');
break;
}
j = 1;
$SUL('#statedrpdwn ul li:not(.hide):eq(' + i + ')').removeClass('active');
if ($SUL('#statedrpdwn ul li:not(.hide):eq(' + (parseInt(i) + parseInt(1)) + ')').length > 0) {
$SUL('#statedrpdwn ul li:not(.hide):eq(' + (parseInt(i) + parseInt(1)) + ')').addClass('active').trigger('hover');
break;
} else {
$SUL('#statedrpdwn ul li:not(.hide):eq(0)').addClass('active').trigger('hover');
break;
}
}
}
if (j == 0) {
$SUL('#statedrpdwn ul li:not(.hide):eq(0)').addClass('active').trigger('hover');
}
}
if (event.keyCode == 38) {
var i = 0, j = 0, totallen = $SUL("#statedrpdwn ul li:not(.hide)").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#statedrpdwn ul li:not(.hide):eq(' + i + ')').hasClass('active')) {
if (i > 0)
j = 1;
$SUL('#statedrpdwn ul li:not(.hide):eq(' + i + ')').removeClass('active');
if ($SUL('#statedrpdwn ul li:not(.hide):eq(' + (parseInt(i) - parseInt(1)) + ')').length > 0) {
$SUL('#statedrpdwn ul li:not(.hide):eq(' + (parseInt(i) - parseInt(1)) + ')').addClass('active');
break;
} else {
$SUL('#statedrpdwn ul li:not(.hide):eq(' + (totallen - 1) + ')').addClass('active');
break;
}
}
} if (j == 0) { $SUL('#statedrpdwn ul li:not(.hide):eq(' + (totallen - 1) + ')').addClass('active'); }
}
}
});
},
displayMetroTabs: function (serviceL) {
if (serviceL == "roommates") {
$SUL("#othersMetroTab").removeClass("active");
$SUL("#roommatesMetroTab").removeClass("active").addClass("active");
$SUL("#rentalsMetroTab").removeClass("active");
$SUL("#universityTab").removeClass("active");
$SUL("#nearcityTab").removeClass("active");
$SUL("#othersMetroDiv").removeClass("hide").addClass('hide');
$SUL("#roommatesMetroDiv").removeClass("hide");
$SUL("#universityDiv").removeClass("hide").addClass('hide');
$SUL("#rentalsMetroDiv").removeClass("hide").addClass('hide');
$SUL("#nearcityDiv").removeClass("hide").addClass('hide');
//john added START
$SUL("#NearbyTab").removeClass("active");
$SUL("#rentalnearbyDiv").removeClass("hide").addClass('hide');
//john added END
}
else if (serviceL == "rentals") {
$SUL("#othersMetroTab").removeClass("active");
$SUL("#roommatesMetroTab").removeClass("active");
$SUL("#rentalsMetroTab").removeClass("active").addClass("active");
$SUL("#universityTab").removeClass("active");
$SUL("#nearcityTab").removeClass("active");
$SUL("#othersMetroDiv").removeClass("hide").addClass('hide');
$SUL("#roommatesMetroDiv").removeClass("hide").addClass('hide');
$SUL("#universityDiv").removeClass("hide").addClass('hide');
$SUL("#rentalsMetroDiv").removeClass("hide");
$SUL("#nearcityDiv").removeClass("hide").addClass('hide');
//john added START
$SUL("#NearbyTab").removeClass("active");
$SUL("#rentalnearbyDiv").removeClass("hide").addClass('hide');
//john added END
}
else if (serviceL == "others") {
$SUL("#othersMetroTab").removeClass("active").addClass("active");
$SUL("#roommatesMetroTab").removeClass("active");
$SUL("#rentalsMetroTab").removeClass("active");
$SUL("#universityTab").removeClass("active");
$SUL("#nearcityTab").removeClass("active");
$SUL("#othersMetroDiv").removeClass("hide");
$SUL("#roommatesMetroDiv").removeClass("hide").addClass('hide');
$SUL("#universityDiv").removeClass("hide").addClass('hide');
$SUL("#rentalsMetroDiv").removeClass("hide").addClass('hide');
$SUL("#nearcityDiv").removeClass("hide").addClass('hide');
//john added START
$SUL("#NearbyTab").removeClass("active");
$SUL("#rentalnearbyDiv").removeClass("hide").addClass('hide');
//john added END
}
else if (serviceL == "university") {
$SUL("#othersMetroTab").removeClass("active");
$SUL("#roommatesMetroTab").removeClass("active");
$SUL("#rentalsMetroTab").removeClass("active");
$SUL("#universityTab").removeClass("active").addClass("active");
$SUL("#nearcityTab").removeClass("active");
$SUL("#othersMetroDiv").removeClass("hide").addClass('hide');
$SUL("#roommatesMetroDiv").removeClass("hide").addClass('hide');
$SUL("#universityDiv").removeClass("hide");
$SUL("#rentalsMetroDiv").removeClass("hide").addClass('hide');
$SUL("#nearcityDiv").removeClass("hide").addClass('hide');
//john added START
$SUL("#NearbyTab").removeClass("active");
$SUL("#rentalnearbyDiv").removeClass("hide").addClass('hide');
//john added END
}
else if (serviceL == "nearcity") {
$SUL("#othersMetroTab").removeClass("active");
$SUL("#roommatesMetroTab").removeClass("active");
$SUL("#rentalsMetroTab").removeClass("active");
$SUL("#universityTab").removeClass("active");
$SUL("#nearcityTab").removeClass("active").addClass("active");
$SUL("#othersMetroDiv").removeClass("hide").addClass('hide');
$SUL("#roommatesMetroDiv").removeClass("hide").addClass('hide');
$SUL("#universityDiv").removeClass("hide").addClass('hide');
$SUL("#rentalsMetroDiv").removeClass("hide").addClass('hide');
$SUL("#nearcityDiv").removeClass("hide");
//john added START
$SUL("#NearbyTab").removeClass("active");
$SUL("#rentalnearbyDiv").removeClass("hide").addClass('hide');
//john added END
}
else if (serviceL == "nearbyrental") {
$SUL("#othersMetroTab").removeClass("active");
$SUL("#roommatesMetroTab").removeClass("active");
$SUL("#rentalsMetroTab").removeClass("active");
$SUL("#universityTab").removeClass("active");
$SUL("#nearcityTab").removeClass("active");
$SUL("#NearbyTab").removeClass("active").addClass("active");
$SUL("#rentalnearbyDiv").removeClass("hide");
$SUL("#roomnearbyDiv").removeClass("hide").addClass('hide');
$SUL("#othersMetroDiv").removeClass("hide").addClass('hide');
$SUL("#roommatesMetroDiv").removeClass("hide").addClass('hide');
$SUL("#universityDiv").removeClass("hide").addClass('hide');
$SUL("#rentalsMetroDiv").removeClass("hide").addClass('hide');
$SUL("#nearcityDiv").removeClass("hide").addClass('hide');
}
else if (serviceL == "nearbyroom") {
$SUL("#othersMetroTab").removeClass("active");
$SUL("#roommatesMetroTab").removeClass("active");
$SUL("#rentalsMetroTab").removeClass("active");
$SUL("#universityTab").removeClass("active");
$SUL("#nearcityTab").removeClass("active");
$SUL("#NearbyTab").removeClass("active").addClass("active");
$SUL("#roomnearbyDiv").removeClass("hide");
$SUL("#rentalnearbyDiv").removeClass("hide").addClass('hide');
$SUL("#othersMetroDiv").removeClass("hide").addClass('hide');
$SUL("#roommatesMetroDiv").removeClass("hide").addClass('hide');
$SUL("#universityDiv").removeClass("hide").addClass('hide');
$SUL("#rentalsMetroDiv").removeClass("hide").addClass('hide');
$SUL("#nearcityDiv").removeClass("hide").addClass('hide');
}
},
checkcity: function () {
var finalresult = false;
try {
var city = '', statecode = '', cityinput = '', combinehiddenfield = '';
city = $SUL('#hdSelCity').val();
statecode = $SUL('#hdSelStatecode').val();
combinehiddenfield = city + ',' + statecode;
cityinput = $SUL('#searchCity').val();
cityinput = cityinput.replace(/\s+/g, '');
combinehiddenfield = combinehiddenfield.replace(/\s+/g, '');
if (cityinput == combinehiddenfield) {
finalresult = true;
}
} catch (e) {
}
return finalresult;
}
}
function OnHomePrice(price, type) {
if (price != undefined && type != undefined && type != "") {
if (type == "min") {
var maxprice = $SUL("#txtmaxprice").val().trim();
if (price != "" && price != "0" && (parseInt(price) <= parseInt(maxprice) || (maxprice == "0" || maxprice == ""))) {
$SUL("#txtminprice").val(price);
$SUL('#ulpricemin').removeClass('hide').addClass('hide');
$SUL('#ulpricemax').removeClass('hide');
if (maxprice != "0" && maxprice != "") {
$SUL("#anchorprice").html(price + "-" + maxprice + "
");
$SUL("#priceRange").val(price + "-" + maxprice);
}
}
else {
if (maxprice != "" && maxprice != "0" && parseInt(price) > parseInt(maxprice)) {
}
else {
$SUL("#anchorprice").html("Price
");
$SUL("#priceRange").val("");
}
}
}
else {
var minprice = $SUL("#txtminprice").val().trim();
if (minprice != "" && minprice != "0" && price != "" && price != "0" && parseInt(minprice) <= parseInt(price)) {
$SUL('#ulpricemax').removeClass('hide').addClass('hide');
$SUL('#ulpricemin').removeClass('hide');
$SUL('#pricerangeType div').removeClass('hide').addClass('hide');
$SUL("#txtmaxprice").val(price);
$SUL("#anchorprice").html(minprice + "-" + price + "
");
$SUL("#priceRange").val(minprice + "-" + price);
}
else {
$SUL("#anchorprice").html("Price
");
$SUL("#priceRange").val("");
}
}
}
}
function SearchByAdIdHome() {
if ($SUL("#divsearchbyadidhome").attr('class') == 'roomidsearchblock') {
$SUL('#divsearchbyadidhome').removeClass('hide').addClass('hide');
}
else {
$SUL('#divsearchbyadidhome').removeClass('hide');
$SUL("#divadidsearcherror").html("");
$SUL("#searchbyAdidInp").val("");
$SUL('#divsearchbyadidhome').removeClass('alert');
}
}
function OnSqFtMap(sqft, type) {
if (sqft != undefined && type != undefined && type != "") {
if (type == "min") {
$SUL('#ulsqftmin').removeClass('hide').addClass('hide');
$SUL('#ulsqftmax').removeClass('hide');
$SUL("#txtmapminsqft").val(sqft);
var maxsqft = $SUL("#txtmapmaxsqft").val().trim();
if (maxsqft != "" && maxsqft != "0" && sqft != "" && sqft != "0" && parseInt(sqft) <= parseInt(maxsqft)) {
$SUL("#anchorsqftmap").html(sqft + "-" + maxsqft + "
");
$SUL("#sqftminmax").val(sqft + "-" + maxsqft);
}
else {
$SUL("#anchorsqftmap").html("Any
");
$SUL("#sqftminmax").val("");
}
}
else {
$SUL('#ulsqftmax').removeClass('hide').addClass('hide');
$SUL('#ulsqftmin').removeClass('hide');
$SUL("#txtmapmaxsqft").val(sqft);
var minsqft = $SUL("#txtmapminsqft").val().trim();
if (minsqft != "" && minsqft != "0" && sqft != "" && sqft != "0" && parseInt(minsqft) <= parseInt(sqft)) {
$SUL("#anchorsqftmap").html(minsqft + "-" + sqft + "
");
$SUL("#sqftminmax").val(minsqft + "-" + sqft);
}
else {
$SUL("#anchorsqftmap").html("Any
");
$SUL("#sqftminmax").val("");
}
}
}
}
function SqftMapValidation() {
var min = $SUL("#txtmapminsqft").val().trim();
var max = $SUL("#txtmapmaxsqft").val().trim();
if (min == "" || min == undefined || parseInt(min) == 0 || (parseInt(min) > 0) == false) {
min = "";
$SUL("#txtmapminsqft").val("");
}
if (max == "" || max == undefined || parseInt(max) == 0 || (parseInt(max) > 0) == false) {
max = "";
$SUL("#txtmapmaxsqft").val("");
}
if (min != "" || max != "")
$SUL("#sqftminmax").val(min + "-" + max);
else
$SUL("#sqftminmax").val("");
if (min != "" && min != undefined && max != "" && max != undefined && parseInt(min) > 0 && parseInt(max) > 0 && parseInt(min) <= parseInt(max))
$SUL("#anchorsqftmap").html(min + "-" + max + "
");
else {
$SUL("#anchorsqftmap").html("Any
");
$SUL("#sqftminmax").val("");
}
}
function OnRadiusMap(radius) {
if (radius != undefined && radius != "" && radius != "0") {
$SUL("#radiusmap").val(radius);
$SUL("#anchorradiusmap").html("" + radius + " miles
");
}
else {
$SUL("#radiusmap").val("");
$SUL("#anchorradiusmap").html("Any
");
}
}
function HomePriceChange() {
$SUL("#txtminprice,#txtmaxprice").on("propertychange change keyup paste input", function () {
this.value = this.value.replace(/\D/g, '');
var min = $SUL("#txtminprice").val().trim();
var max = $SUL("#txtmaxprice").val().trim();
if (min == "" || min == undefined || parseInt(min) == 0 || (parseInt(min) > 0) == false) {
min = "";
$SUL("#txtminprice").val("");
}
if (max == "" || max == undefined || parseInt(max) == 0 || (parseInt(max) > 0) == false) {
max = "";
$SUL("#txtmaxprice").val("");
}
if (min != "" || max != "")
$SUL("#priceRange").val(min + "-" + max);
else
$SUL("#priceRange").val("");
if (min != "" && min != undefined && max != "" && max != undefined && parseInt(min) > 0 && parseInt(max) > 0 && parseInt(min) <= parseInt(max))
$SUL("#anchorprice").html(min + "-" + max + "
");
else {
$SUL("#anchorprice").html("Price
");
$SUL("#priceRange").val("");
}
});
$SUL("#searchbyAdidInp").on("propertychange change keyup paste input", function (e) {
if ($SUL("#searchbyAdidInp").val().length >= 9) {
$SUL(this).val($SUL(this).val().slice(0, 9));
return false;
}
});}
function fngetnotification() {
var userpid = $SUL("#hdnloggedpid").val();
if (userpid != undefined && userpid != "" && parseInt(userpid) > parseInt(0)) {
$SUL.ajax({
url: "/common/commonv4.aspx?type=notification&userpid=" + userpid,
cache: false,
success: function (data) {
if (data != '')
$SUL("#divtopnotfiy").html(data);
else
$SUL("#divtopnotfiy").html("");
}
});
}
else
$SUL("#divtopnotfiy").html("");}
function GetNotificationList() {
var userpid = $SUL("#hdnloggedpid").val();
var username = $SUL("#hdLoggedInContributor").val();
if (userpid != undefined && userpid != "" && parseInt(userpid) > parseInt(0)) {
$SUL.ajax({
url: "/common/commonv4.aspx?type=notificationlist&userpid=" + userpid + "&username=" + username,
cache: false,
success: function (data) {
if (data != '') {
$SUL("#divnotificationlist").html(data);
$SUL("#divnotificationlist").removeClass('hide').addClass('show');
// $SUL("#parenthtml").removeClass("blurbody").addClass('blurbody');
$SUL("html:first").removeClass("blurbody").addClass('blurbody');
}
else {
$SUL("#divnotificationlist").html("");
$SUL("#divnotificationlist").removeClass('show').addClass('hide');
//$SUL("#parenthtml").removeClass("blurbody");
$SUL("html:first").removeClass("blurbody");
}
}
});
}
}
function CloseNotification() {
//$SUL("#parenthtml").removeClass('blurbody');
$SUL("html:first").removeClass("blurbody");
$SUL("#divnotificationlist").html("");
$SUL("#divnotificationlist").removeClass('show').addClass('hide');}
function OnActionsView(actionid, adid, siteid) {
if ($SUL("#" + actionid).attr("class") == "ctawrp hide") {
$SUL("div[id^='action-']").attr('class', 'ctawrp hide');
$SUL("#" + actionid).removeClass("hide");
}
else
$SUL("div[id^='action-']").attr('class', 'ctawrp hide');}
function OnPerformAction(adid, siteid, actionid, type, adtype) {
if (adid != undefined && (parseInt(adid) > parseInt(0) || adtype == "responses") && siteid != undefined && (siteid == "1" || siteid == "2") && actionid != undefined && actionid != "") {
$SUL.ajax({
url: "/common/commonv4.aspx?type=notificationaction&adid=" + adid + "&siteid=" + siteid + "&actionid=" + actionid + "&adtype=" + adtype,
cache: false,
success: function (data) {
if (data != '' && data.result == "inserted successfully") {
$SUL("div[id^='action-']").attr('class', 'ctawrp hide');
if (actionid == "276")
$SUL("#" + type + "-" + adid).html("
");
else if (actionid == "277")
$SUL("#" + type + "-" + adid).html("
");
else if (actionid == "278")
$SUL("#" + type + "-" + adid).html("
");
//$SUL("#" + type + "-" + adid).remove();
var notocnt = $SUL("#divnotifcationcount").html();
if (notocnt != undefined && notocnt != "" && parseInt(notocnt) > parseInt(1)) {
//$SUL("#divnotifcationcount").html(parseInt(notocnt) - parseInt(1));
}
else
$SUL("#divnotificationcnt").html("");
}
else {
}
}
});
}
}
function UndoAction(adid, adtype) {
if (adtype != undefined && adtype != "" && (adtype == "responses" || (adid != "" && adid != "0"))) {
$SUL.ajax({
url: "/common/commonv4.aspx?type=notificationundo&adid=" + adid + "&adtype=" + adtype,
cache: false,
success: function (data) {
if (data != '' && data.result == "deleted sucessfully") {
GetNotificationList();
}
}
});
}
}
function OpenSaveSearch() {
var loggedinuseremail = $SUL("#hdLoggedInEmailID").val();
if (loggedinuseremail == undefined)
loggedinuseremail = "";
var loggedinuser = $SUL("#hdLoggedInContributor").val();
if (loggedinuser == undefined)
loggedinuser = "";
if (loggedinuser == "" || loggedinuseremail == "") {
showloginbox();
return false;
}
var service = $SUL("#hdService").val();
$SUL.ajax({
url: "/common/commonv4.aspx?type=savesearchpopup" + "&service=" + service,
cache: false,
success: function (data) {
if (data != '') {
$SUL("#savedsearchpopup").html(data);
$SUL("#savedsearchpopup").removeClass('hide').addClass('show');
$SUL("html:first").removeClass("blurbody").addClass('blurbody');
//savedsearchavailabledate();
}
else {
$SUL("#savedsearchpopup").html("");
$SUL("#savedsearchpopup").removeClass('show').addClass('hide');
$SUL("html:first").removeClass("blurbody");
}
}
});}
function OnCloseSavedSearch() {
$SUL("#savedsearchpopup").html("");
$SUL("#savedsearchpopup").removeClass('show').addClass('hide');
$SUL("html:first").removeClass("blurbody");}
function OnGenderClick(type) {
$SUL("#hdssgender").val(type);
$SUL("li[id^='ligender-']").attr('class', '');
$SUL("#ligender-" + type).attr('class', 'active');}
function OnPetsClick(type) {
$SUL("#hdsspets").val(type);
$SUL("li[id^='lipets-']").attr('class', '');
$SUL("#lipets-" + type).attr('class', 'active');}
function savedsearchavailabledatev2() {
try {
if (typeof (datepicker) == undefined || typeof (datepicker) == 'undefined' || typeof (datepicker) == null) {
$SUL.cachedScript("https://code.jquery.com/ui/1.11.1/jquery-ui.js").done(function () {
$SUL("#txtavailability").datepicker({
onSelect: function (dateText, inst) {
}, minDate: new Date()
});
});
}
}
catch (ex) {
}
}
function SaveSearchPriceChange() {
$SUL("#txtminpricess,#txtmaxpricess,#txtminsqftss,#txtmaxsqftss").on("propertychange change keyup paste input", function () {
this.value = this.value.replace(/\D/g, '');
});}
function OnSaveSearch() {
var loggedinuseremail = $SUL("#hdLoggedInEmailID").val();
if (loggedinuseremail == undefined)
loggedinuseremail = "";
var loggedinuser = $SUL("#hdLoggedInContributor").val();
if (loggedinuser == undefined)
loggedinuser = "";
$SUL('input[name=emailfrequency]').closest(".form-group").removeClass("alert");
$SUL('input[id=txtavailability]').closest(".form-group").removeClass("alert");
$SUL('#ddlmetrolistss').closest(".form-group").removeClass("alert");
$SUL('#txtcitynamess').closest(".form-group").removeClass("alert");
$SUL('#txtminpricess').closest(".form-group").removeClass("alert");
$SUL('#txtminsqftss').closest(".form-group").removeClass("alert");
var ltype = $SUL("#ddllocationtype option:selected").val();
var location = "", locationurl = "", locationcity = "", statecode = "";
if (ltype == 1) {
location = $SUL("#ddlmetrolistss option:selected").text();
locationurl = $SUL("#ddlmetrolistss option:selected").val();
if (location == "" || location == undefined || locationurl == "" || locationurl == undefined) {
$SUL('#ddlmetrolistss').closest(".form-group").addClass("alert");
return false;
}
}
else if (ltype == 3) {
location = $SUL("#ddlstatelistss option:selected").text();
locationurl = $SUL("#ddlstatelistss option:selected").val();
if (location == "" || location == undefined || locationurl == "" || locationurl == undefined) {
$SUL('#ddlmetrolistss').closest(".form-group").addClass("alert");
return false;
}
}
else if (ltype == 2) {
location = $SUL("#hdSelCityss").val();
locationurl = $SUL("#hdSelCityUrlss").val();
statecode = $SUL("#hdSelCityStateCodess").val();
if (location == "" || location == undefined || locationurl == "" || locationurl == undefined) {
$SUL('#txtcitynamess').closest(".form-group").addClass("alert");
return false;
}
}
else if (ltype == 4) {
location = $SUL("#hdUnivNamess").val();
locationurl = $SUL("#hdUnivUrlss").val();
locationcity = $SUL("#hdUnivCityurlss").val
if (location == "" || location == undefined || locationurl == "" || locationurl == undefined) {
$SUL('#txtuniversityss').closest(".form-group").addClass("alert");
return false;
}
}
else if (ltype == 5) {
location = $SUL("#hdLandmarkNamess").val();
locationurl = $SUL("#hdLandmarkUrlss").val();
locationcity = $SUL("#hdLandmarkCityurlss").val();
if (location == "" || location == undefined || locationurl == "" || locationurl == undefined) {
$SUL('#txtlandmarkss').closest(".form-group").addClass("alert");
return false;
}
}
var gender = $SUL("#hdssgender").val();
var pets = $SUL("#hdsspets").val();
var minprice = $SUL("#txtminpricess").val();
var maxprice = $SUL("#txtmaxpricess").val();
if (minprice != "" && minprice != undefined && minprice != "0" && maxprice != "" && maxprice != undefined && maxprice != "0") {
if (parseInt(minprice) > parseInt(maxprice)) {
$SUL('#txtminpricess').closest(".form-group").addClass("alert");
return false;
}
}
var availability = $SUL("#txtavailability").val();
var leasetype = $SUL("#ddlleasetype option:selected").val();
var sellertype = $SUL("#ddlsellertype option:selected").val();
var noofbeds = $SUL("#ddlnoofbeds option:selected").val();
var noofbaths = $SUL("#ddlnoofbaths option:selected").val();
var minsqft = $SUL("#txtminsqftss").val();
if (minsqft == undefined)
minsqft = "";
var maxsqft = $SUL("#txtmaxsqftss").val();
if (maxsqft == undefined)
maxsqft = "";
if (minsqft != "" && minsqft != "0" && maxsqft != "" && maxsqft != "0") {
if (parseInt(minsqft) > parseInt(maxsqft)) {
$SUL('#txtminsqftss').closest(".form-group").addClass("alert");
return false;
}
}
var emailfreqency = $SUL("input[name='emailfrequency']:checked").val();
var service = $SUL("#hdService").val();
if (noofbeds == undefined)
noofbeds = "";
if (noofbaths == undefined)
noofbaths = "";
if (emailfreqency == undefined || emailfreqency == "") {
$SUL('input[name=emailfrequency]').closest(".form-group").addClass("alert");
return false;
}
if (availability == undefined || availability == "") {
$SUL('input[id=txtavailability]').closest(".form-group").addClass("alert");
return false;
}
var contentid = $SUL("#hdsscontentid").val();
if (contentid == undefined)
contentid = "";
var servid = $SUL("#hdssserviceid").val();
if (servid == undefined)
servid = "";
var categoryid = $SUL("#ddlrrcategory option:selected").val();
$SUL("#btnsavesearch").addClass("hide");
$SUL("#savedsearch_openLoading").removeClass("hide");
$SUL.ajax({
url: "/common/commonv4.aspx?type=savesearch<ype=" + ltype + "&location=" + location + "&locationurl=" + locationurl + "&gender=" + gender + "&categoryid=" + categoryid
+ "&pets=" + pets + "&minprice=" + minprice + "&maxprice=" + maxprice + "&availability=" + availability + "&leasetype=" + leasetype + "&servid=" + servid
+ "&sellertype=" + sellertype + "&minsqft=" + minsqft + "&maxsqft=" + maxsqft + "&emailfreqency=" + emailfreqency + "&service=" + service + "&contentid=" + contentid
+ "&noofbeds=" + noofbeds + "&noofbaths=" + noofbaths + "&locationcity=" + locationcity + "&loggedinuser=" + loggedinuser + "&loggedinuseremail=" + loggedinuseremail
+ "&statecode=" + statecode,
cache: false,
success: function (data) {
$SUL("#btnsavesearch").removeClass("hide");
$SUL("#savedsearch_openLoading").addClass("hide");
$SUL("#divssmainfields").addClass("hide");
$SUL("#divsssactions").addClass("hide");
if (data != "" && data.result != "" && data.result == "inserted successfully") {
$SUL("#divsavedstatus").removeClass("hide");
try { ga('send', 'event', 'Save Search completed', 'Save Search', 'Save Search'); } catch (ex) { }
}
else if (data != "" && data.result != "" && data.result == "updated successfully") {
$SUL("#divsavedstatus").removeClass("hide");
$SUL("#bstatusmsg").html("Your Search has been updated");
try { ga('send', 'event', 'Save Search completed', 'Save Search', 'Save Search'); } catch (ex) { }
}
else {
$SUL("#divsavedstatus").removeClass("hide");
$SUL("#bstatusmsg").html("Please try again later!");
}
}
});}
function OnLocationTypeChange() {
var type = $SUL("#ddllocationtype option:selected").val();
$SUL("#txtcitynamess").val("");
$SUL("#txtcitynamess-uscanadacity-list-wrap").html("");
$SUL("#txtcitynamess-uscanadacity-list-wrap").addClass("hide");
$SUL("#txtuniversityss-list-wrap").html("");
$SUL("#txtuniversityss-list-wrap").addClass("hide");
$SUL("#txtlandmarkss-list-wrap").html("");
$SUL("#txtlandmarkss-list-wrap").addClass("hide");
$SUL("#drpdwnmetroListDSS").addClass("hide");
$SUL("#drpdwnstateListDSS").addClass("hide");
$SUL("#metroListss").val("");
$SUL("#stateListss").val("");
$SUL("#hdSelCityss").val("");
$SUL("#hdSelCityUrlss").val("");
$SUL("#hdSelCityStateCodess").val("");
$SUL("#hdUnivUrlss").val("");
$SUL("#hdUnivNamess").val("");
$SUL("#hdUnivCityurlss").val("");
$SUL("#hdLandmarkUrlss").val("");
$SUL("#hdLandmarkNamess").val("");
$SUL("#hdLandmarkCityurlss").val("");
$SUL("#txtcitynamess").addClass("hide");
$SUL("#txtuniversityss").addClass("hide");
$SUL("#txtlandmarkss").addClass("hide");
$SUL("#ddlstatelistss").addClass("hide");
$SUL("#ddlmetrolistss").addClass("hide");
$SUL("#ddlstatelistss").val("");
$SUL("#ddlmetrolistss").val("");
$SUL('#ddlmetrolistss').closest(".form-group").removeClass("alert");
$SUL('#txtcitynamess').closest(".form-group").removeClass("alert");
if (type == "1") {
$SUL("#ddlmetrolistss").removeClass("hide");
$SUL("#lbllocationtype").html("Select Metros
*");
}
else if (type == "3") {
$SUL("#ddlstatelistss").removeClass("hide");
$SUL("#lbllocationtype").html("Select State
*");
}
else if (type == "2") {
$SUL("#txtcitynamess").removeClass("hide");
sulCitySearchUSCan("txtcitynamess");
$SUL("#lbllocationtype").html("Select City
*");
}
else if (type == "4") {
$SUL("#txtuniversityss").removeClass("hide");
sulUnivSearch('txtuniversityss');
$SUL("#txtuniversityss-list-wrap").removeClass("hide");
$SUL("#lbllocationtype").html("Select University
*");
}
else if (type == "5") {
$SUL("#txtlandmarkss").removeClass("hide");
sulLndmrkSearch('txtlandmarkss');
$SUL("#txtlandmarkss-list-wrap").removeClass("hide");
$SUL("#lbllocationtype").html("Select Landmark
*");
}
}
function OnRemoveSavedSearch(id) {
if (id != undefined && id != "" && parseInt(id) > parseInt(0)) {
$SUL("#btnssremove-" + id).addClass("hide");
$SUL("#updatesearch_openLoading-" + id).removeClass("hide");
$SUL.ajax({
url: "/common/commonv4.aspx?type=updatess&id=" + id,
cache: false,
success: function (data) {
if (data != "" && data.result != "" && data.result == "updated successfully") {
$SUL("#section-" + id).html("
Saved Search removed successfully
");
}
else {
$SUL("#btnssremove-" + id).removeClass("hide");
$SUL("#updatesearch_openLoading-" + id).addClass("hide");
}
}
});
}
}
function OnEditSavedSearch(id) {
if (id != undefined && id != "" && parseInt(id) > parseInt(0)) {
$SUL.ajax({
url: "/common/commonv4.aspx?type=editsavedsearch&id=" + id,
cache: false,
success: function (data) {
if (data != '') {
$SUL("#savedsearchpopup").html(data);
$SUL("#savedsearchpopup").removeClass('hide').addClass('show');
$SUL("html:first").removeClass("blurbody").addClass('blurbody');
}
else {
$SUL("#savedsearchpopup").html("");
$SUL("#savedsearchpopup").removeClass('show').addClass('hide');
$SUL("html:first").removeClass("blurbody");
}
}
});
}
}
function fnSubmitFeedback() {
var id = $SUL("input[name^='questiontype']:checked").val();
var adid = $SUL("#hduserfeedbackadid").val();
var category = $SUL("#hduserfeedbackategory").val();
var email = $SUL("#hdufemail").val();
var mobile = $SUL("#hdufmobile").val();
var username = $SUL("#hdufusername").val();
var category = $SUL("#hdufcategory").val();
var adidint = $SUL("#hduserfeedbackadidint").val();
if (id != undefined && id != "" && parseInt(id) > parseInt(0) && adid != undefined && adid != "" && parseInt(adidint) > parseInt(0)) {
var cmts = $SUL("#txtfeedbackcmts-" + id).val();
if ((cmts == undefined || cmts.trim() == "") && (id != "4" && id != "5")) {
return false;
}
if (cmts == undefined)
cmts = "";
$SUL.ajax({
url: "/common/commonv4.aspx?type=userfeedback&id=" + id + "&cmts=" + cmts + "&adid=" + adid + "&email=" + email + "&mobile=" + mobile + "&username=" + username + "&category=" + category,
cache: false,
success: function (data) {
if (data != '') {
$SUL("#divfeedback").html(data);
if (id == 4 || id == 5)
if (category != undefined && category.toLowerCase() == "rentals")
window.location.href = "https://mycity.sulekha.com/postanad_rentals_ad-details?mode=edit&cid=" + adidint + "";
else
window.location.href = "https://mycity.sulekha.com/postanad_roommates_ad-details?mode=edit&cid=" + adidint + "";
}
else {
}
}
});
}
}
function OnFeedbackTypeChange() {
var id = $SUL("input[name^='questiontype']:checked").val();
$SUL("div[id^='divcmts-']").attr('class', 'commontbox hide');
$SUL("#divcmts-" + id).attr('class', 'commontbox');
$SUL("textarea[id^='txtfeedbackcmts-']").val('');}
function MarkasReadNotification(adid, type, siteid, divid) {
$SUL.ajax({
url: "/common/commonv4.aspx?type=markasread&adid=" + adid + "&adtype=" + type + "&siteid=" + siteid,
cache: false,
success: function (data) {
if (data != '' && data.result == "inserted successfully") {
$SUL("#" + divid + "-" + adid).removeClass('unread');
var cnt = $SUL("#divnotifcationcount").html();
if (cnt != "" && cnt == "1")
$SUL("#divnotifcationcount").remove();
else
$SUL("#divnotifcationcount").html(parseInt(cnt) - parseInt(1));
}
}
});}
function MTBedsFilter(beds, adtype) {
var cityurl = $SUL('#hdnuscanadanewcityurl').val();
var type = $SUL('#searchlocation').val();
if (type == "metro")
cityurl = $SUL('#hdnuscanadametrourl').val();
else if (type == "university")
cityurl = $SUL('#hdUnivCityurl').val();
else if (type == "landmark")
cityurl = $SUL('#hdLandmarkCityurl').val();
else if (type == "neighbour")
cityurl = $SUL('#hdLandmarkCityurl').val();
else if (type == "state")
cityurl = $SUL('#hdStateCode').val();
var roomtype = $SUL('#hdmtroomtype').val();
if (beds == "" || beds == undefined)
$SUL("#divmtbeds").removeClass('hide');
if (adtype == undefined)
adtype = "";
else if (beds != undefined && beds != "" && cityurl != undefined && cityurl != "") {
if (beds == "0") {
$SUL("#aMTBeds").html(" Beds
");
$SUL("#aMTBeds").attr('title', "Any");
beds = "";
}
else {
$SUL("#aMTBeds").html(" " + beds + '
');
$SUL("#aMTBeds").attr('title', beds);
}
$SUL("#divmtbeds").removeClass('hide').addClass('hide');
var locationtype = pageFilterValues.locationtype;
if (locationtype == "county") cityurl = pageFilterValues.cityurl;
$SUL.ajax({
url: "/common/commonv4.aspx?type=mtsummary&beds=" + beds + "&cityurl=" + cityurl + "&roomtype=" + roomtype + "&cityormetro=" + type + "&adtype=" + adtype,
cache: false,
success: function (data) {
$SUL("#divmtfilters").html(data);
$SUL("#divsummarypiebarchart").remove();
// GetBarChart(roomtype, adtype, cityurl, "Rental", type, beds);
// GetGooglePieChart(type, adtype, cityurl, cityurl, roomtype, beds);
var status = $SUL("#hdmtsummaryfilter").val();
if (status == undefined || status == "" || status != "1")
ShowBarPieChart(roomtype, adtype, cityurl, type, beds);
GetLineChart(roomtype, adtype, cityurl, "", beds, type, '');
//var percentage = $SUL("#hdmtyoychangespercent").val();
//var rent = $SUL("#hdmtcurrmedianrent").val();
//$SUL("#divmtyoycurrmedianrenttxt").html("
$" + Math.round(rent) + "");
//$SUL("#divmtyoychangespercenttxt").html("
" + Math.round(percentage) + "%");
//if (percentage != "" && (parseInt(percentage) > 0 || parseInt(percentage) == 0))
// $SUL("#divincreasetxt").html(" increase");
//else if (percentage != "" && parseInt(percentage) < 0)
// $SUL("#divincreasetxt").html(" decrease");
//else
// $SUL("#divincreasetxt").html("");
//if (beds == "0" || beds == "")
// $SUL("#divbedroomstxt").html("");
//else if (beds == "1 beds")
// $SUL("#divbedroomstxt").html(" for
1 bedroom");
//else if (beds == "2 beds")
// $SUL("#divbedroomstxt").html(" for
2 bedroom");
//else if (beds == "3 beds")
// $SUL("#divbedroomstxt").html(" for
3 bedroom");
//else if (beds == "4 beds")
// $SUL("#divbedroomstxt").html(" for
4 bedroom");
}
});
}
}
function ShowBarPieChart(roomtype, adtype, cityurl, cityormetro, beds) {
var locationname = $SUL("#hdmtlocationname").val();
$SUL.ajax({
url: "/common/commonv4.aspx?type=mtsummary&beds=" + beds + "&cityurl=" + cityurl + "&roomtype=" + roomtype + "&cityormetro=" + cityormetro + "&adtype=" + adtype + "&cityname=" + locationname + "&rendertype=fullblock",
cache: false,
success: function (data) {
$SUL("#divsummaryblock").after(data);
}
});}
function GetBarChart(roomtype, adtype, cityurl, titletxt, cityormetro, beds, service) {
if (titletxt == "rentals")
titletxt = "Rental";
if (beds == "1" || beds == "2" || beds == "3" || beds == "4")
beds = beds + " beds";
var locationtype = pageFilterValues.locationtype;
if (locationtype == "county") cityurl = pageFilterValues.cityurl;
$SUL.cachedScript("https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js").done(function () {
$SUL.ajax({
url: "/common/commonv4.aspx?type=mtbarchart&adtype=" + adtype + "&cityurl=" + cityurl + "&roomtype=" + roomtype + "&cityormetro=" + cityormetro + "&beds=" + beds + "&service=" + service,
cache: false,
dataType: 'json',
success: function (result) {
$SUL("#divbarchart").html('
');
var barColors = ["red", "green", "blue", "orange", "brown"];
var myChart = new Chart("myChart", {
type: "bar",
data: {
labels: [],
datasets: [{
backgroundColor: barColors,
data: [],
label: 'Percentage',
}]
},
options: {
responsive: true,
legend: { display: false },
title: {
display: true,
text: titletxt + " Average Rent Price Range"
},
legend: {
display: false
},
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
},
scaleLabel: {
display: true,
labelString: 'Percentage(%)'
}
}],
xAxes: [{
barThickness: 50, // number (pixels) or 'flex'
maxBarThickness: 50, // number (pixels)
//scaleLabel: {
// display: true,
// labelString: 'Rent Ranges'
//}
}]
}
}
});
var status = false;
$SUL.each(result.ROW_MARKET_TRENDS_BARCHART, function (index, item) {
if (item.percentage == "0" && (item.rentrangemax == "7000" || item.rentrangemax == "8000" || item.rentrangemax == "9000" || item.rentrangemax == "10000")) {
}
else {
if (parseInt(item.percentage) > 0 && status != true)
status = true;
myChart.data.labels.push(item.rentrangetxt);
myChart.data.datasets[0].data.push(item.percentage);
myChart.update();
}
})
if (status == false)
$SUL("#divbarchart").html("");
}
});
});}
function GetLineChart(roomtype, adtype, cityurl, titletxt, beds, cityormetro, service) {
$SUL("li[id^='lilinegrp-']").attr('class', '');
if (beds == undefined || beds == "" || beds == "0") {
beds = "";
$SUL("#lilinegrp-0").addClass("active");
}
else if (beds == "1 beds" || beds == "2 beds" || beds == "3 beds" || beds == "4 beds") {
$SUL("#lilinegrp-" + beds.replace(" beds", "")).addClass("active");
}
else {
$SUL("#lilinegrp-" + beds).addClass("active");
beds = beds + " beds";
}
var locationtype = pageFilterValues.locationtype;
if (locationtype == "county") cityurl = pageFilterValues.cityurl;
$SUL.cachedScript("https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js").done(function () {
$SUL.ajax({
url: "/common/commonv4.aspx?type=mtlinechart&adtype=" + adtype + "&cityurl=" + cityurl + "&roomtype=" + roomtype + "&beds=" + beds + "&cityormetro=" + cityormetro + "&service=" + service,
cache: false,
dataType: 'json',
success: function (result) {
$SUL("#divlinechart").html("");
$SUL("#divlinechart").html('
');
$SUL("#tbodylinechart").html("");
var xValues = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
var myLineChart = new Chart("lineChart", {
type: "line",
data: {
labels: xValues,
datasets: [{
data: [],
borderColor: "green",
label: 'Year : 2024, Avg Price ',
fill: false
}, {
data: [],
borderColor: "blue",
label: 'Year : 2025, Avg Price ',
fill: false
}]
},
options: {
legend: { display: false },
scales: {
yAxes: [{
scaleLabel: {
display: true,
labelString: 'Price($)'
}
}],
}
},
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
},
}]
}
});
var month = new Array();
month[0] = "Jan";
month[1] = "Feb";
month[2] = "Mar";
month[3] = "Apr";
month[4] = "May";
month[5] = "Jun";
month[6] = "Jul";
month[7] = "Aug";
month[8] = "Sep";
month[9] = "Oct";
month[10] = "Nov";
month[11] = "Dec";
var monthnum = new Array();
monthnum['Jan'] = "1";
monthnum['Feb'] = "2";
monthnum['Mar'] = "3";
monthnum['Apr'] = "4";
monthnum['May'] = "5";
monthnum['Jun'] = "6";
monthnum['Jul'] = "7";
monthnum['Aug'] = "8";
monthnum['Sep'] = "9";
monthnum['Oct'] = "10";
monthnum['Nov'] = "11";
monthnum['Dec'] = "12";
var d = new Date();
var currentmonth = month[d.getMonth()];
var currentmonthnum = monthnum[month[d.getMonth()]];
var currentyear = d.getFullYear();
$SUL.each(result.ROW_MARKET_TRENDS_LINECHART, function (index, item) {
if (item.avgprice != "0")
$SUL("#tbodylinechart").append("
" + item.monthtext + " " + item.year + " | $" + item.avgprice + " |
");
var dyncurrentmonth = monthnum[item.monthtext];
if (item.year == currentyear && parseInt(currentmonthnum) < parseInt(dyncurrentmonth)) { }
else {
if (item.year == "2021")
myLineChart.data.datasets[0].data.push(item.avgprice);
else if (item.year == "2022")
myLineChart.data.datasets[1].data.push(item.avgprice);
else if (item.year == "2023")
myLineChart.data.datasets[0].data.push(item.avgprice);
else if (item.year == "2024")
myLineChart.data.datasets[1].data.push(item.avgprice);
//john added market trends current year
else if (item.year == "2025")
myLineChart.data.datasets[0].data.push(item.avgprice);
//john added market trends current year
myLineChart.update();
}
})
$SUL("#divlinecharttblalert").remove();
if ($SUL("#tbodylinechart tr").length == 0 || $SUL("#tbodylinechart tr").length == undefined) {
$SUL("#tbllinechart").addClass('hide');
if (beds == "0")
$SUL("#divlinecharttbl").after("
Whoops! looks like there's no data
");
else
$SUL("#divlinecharttbl").after("
Whoops! looks like there's no data for " + beds + ",Try selecting different bed type
");
}
else
$SUL("#tbllinechart").removeClass('hide');
if ($SUL("#lilinegraph").attr('class') == "active")
OnLineGraphView('grp');
else if ($SUL("#lilinetbl").attr('class') == "active")
OnLineGraphView('tbl');
}
});
});}
function OnLineGraphView(type) {
if (type == "grp") {
$SUL("#lineChart").removeClass('hide');
$SUL("#lilinegraph").addClass('active');
$SUL("#lilinetbl").removeClass('active');
$SUL("#tbllinechart").addClass('hide');
$SUL("#divlinecharttblalert").addClass('hide');
}
else if (type == "tbl") {
$SUL("#lineChart").addClass('hide');
$SUL("#lilinegraph").removeClass('active');
$SUL("#lilinetbl").addClass('active');
$SUL("#divlinecharttblalert").removeClass('hide');
if ($SUL("#tbodylinechart tr").length == 0)
$SUL("#tbllinechart").addClass('hide');
else
$SUL("#tbllinechart").removeClass('hide');
}
}
function GetGooglePieChart(cityormetro, adtype, cityurl1, metrourl, roomtype, beds, service) {
$SUL.cachedScript("https://www.gstatic.com/charts/loader.js?v=0.0.1").done(function () {
setTimeout(function () {
try {
const addslicescolors = [];
google.charts.load('current', { 'packages': ['corechart'] });
var cityurl = cityurl1;
if (cityormetro == "metro")
cityurl = metrourl;
else if (cityormetro == "state")
cityurl = metrourl;
else if (cityormetro == "county")
cityurl = pageFilterValues.cityurl;
if (beds == "1" || beds == "2" || beds == "3" || beds == "4")
beds = beds + " beds";
$SUL.ajax({
url: "/common/commonv4.aspx?type=mtpiechart&cityurl=" + cityurl + "&cityormetro=" + cityormetro + "&adtype=" + adtype + "&roomtype=" + roomtype + "&beds=" + beds + "&service=" + service,
cache: false,
dataType: 'json',
success: function (result) {
$SUL("#ulpiechartrenters").html("");
var arrValues = [['House Rent', 'Rent Types']];
var iCnt = 0;
$SUL.each(result.ROW_MARKET_TRENDS_PIECHART, function (index, item) {
if (item.percentage != "0") {
if (item.usertypetext == "Agent") {
arrValues.push(["Agents", item.usertypechk]);
$SUL("#ulpiechartrenters").append("
Agents - " + item.percentage + "%");
addslicescolors.push('#dc3912');
}
else if (item.usertypetext == "Sub-leasing") {
arrValues.push(["Renters", item.usertypechk]);
$SUL("#ulpiechartrenters").append("
Renters - " + item.percentage + "%");
addslicescolors.push('#ff9900');
}
else if (item.usertypetext == "Other") {
arrValues.push(["Other", item.usertypechk]);
$SUL("#ulpiechartrenters").append("
Other - " + item.percentage + "%");
addslicescolors.push('#00801e');
}
else if (item.usertypetext == "Owner") {
arrValues.push(["Owners", item.usertypechk]);
$SUL("#ulpiechartrenters").append("
Owners - " + item.percentage + "%");
addslicescolors.push('#36c');
}
else if (item.usertypetext == "Individual") {
arrValues.push(["Individual", item.usertypechk]);
$SUL("#ulpiechartrenters").append("
Individual - " + item.percentage + "%");
addslicescolors.push('#36c');
}
else if (item.usertypetext == "Couple-family") {
arrValues.push(["Couple/Family", item.usertypechk]);
$SUL("#ulpiechartrenters").append("
Couple/Family - " + item.percentage + "%");
addslicescolors.push('#ff9900');
}
else if (item.usertypetext == "Group") {
arrValues.push(["Group", item.usertypechk]);
$SUL("#ulpiechartrenters").append("
Group - " + item.percentage + "%");
addslicescolors.push('#00801e');
}
else if (item.usertypetext == "Tenant") {
arrValues.push(["Tenant", item.usertypechk]);
$SUL("#ulpiechartrenters").append("
Tenant - " + item.percentage + "%");
addslicescolors.push('#00801e');
}
else if (item.usertypetext == "Family") {
arrValues.push(["Family", item.usertypechk]);
$SUL("#ulpiechartrenters").append("
Family - " + item.percentage + "%");
addslicescolors.push('#00801e');
}
iCnt += 1;
}
})
var data = google.visualization.arrayToDataTable(arrValues);
// Optional; add a title and set the width and height of the chart
// var options = { legend: 'none' };
var options = {
legend: 'none',
colors: addslicescolors
};
// Display the chart inside the
element with id="piechart"
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
});
}
catch (ex) {
console.log(ex);
}
}, 3500);
});}
function GetGooglePieChartGender(cityormetro, adtype, cityurl1, metrourl, roomtype, beds, service) {
$SUL.cachedScript("https://www.gstatic.com/charts/loader.js?v=0.0.5").done(function () {
setTimeout(function () {
try {
const addslicescolors = [];
google.charts.load('current', { 'packages': ['corechart'] });
var cityurl = cityurl1;
if (cityormetro == "metro")
cityurl = metrourl;
else if (cityormetro == "state")
cityurl = metrourl;
$SUL.ajax({
url: "/common/commonv4.aspx?type=mtpiechartgender&cityurl=" + cityurl + "&cityormetro=" + cityormetro + "&adtype=" + adtype + "&roomtype=" + roomtype + "&beds=" + beds + "&service=" + service,
cache: false,
dataType: 'json',
success: function (result) {
$SUL("#ulpiechartrentersgender").html("");
var arrValues = [['Gender', 'Gender Types']];
var iCnt = 0;
$SUL.each(result.ROW_MARKET_TRENDS_PIECHART_GENDER, function (index, item) {
if (item.percentage != "0") {
if (item.gendertext == "Male") {
arrValues.push(["Male", item.genderchk]);
$SUL("#ulpiechartrentersgender").append("
Male - " + item.percentage + "%");
addslicescolors.push('#dc3912');
}
else if (item.gendertext == "Female") {
arrValues.push(["Female", item.genderchk]);
$SUL("#ulpiechartrentersgender").append("
Female - " + item.percentage + "%");
addslicescolors.push('#ff9900');
}
else if (item.gendertext == "Both") {
arrValues.push(["Both", item.genderchk]);
$SUL("#ulpiechartrentersgender").append("
Both - " + item.percentage + "%");
addslicescolors.push('#00801e');
}
iCnt += 1;
}
})
var data = google.visualization.arrayToDataTable(arrValues);
// Optional; add a title and set the width and height of the chart
//var options = { legend: 'none' };
var options = {
legend: 'none',
colors: addslicescolors
};
// Display the chart inside the
element with id="piechart"
var chart = new google.visualization.PieChart(document.getElementById('piechartgender'));
chart.draw(data, options);
}
});
}
catch (ex) {
console.log(ex);
}
}, 3500);
});}
function onmarketsummarybeds(beds) {
if (beds != undefined && beds != "") {
if (beds == "1")
filterfieldsnew('bedCount', '1', '1 Bed');
else if (beds == "2")
filterfieldsnew('bedCount', '2', '2 Beds');
else if (beds == "3")
filterfieldsnew('bedCount', '3', '3 Beds');
else if (beds == "4")
filterfieldsnew('bedCount', '4', '4+ Beds');
SearchAds();
}
}
function loadbannersCarousel() {
if ($SUL("#itpromopanner").length > 0 || $SUL("#itpromopanner1").length > 0) {
$SUL.cachedScript("https://d3aew4oo17ml6.cloudfront.net/common/js/classifieds/owl.carousel-new.js?v=0.0.1").done(function () {
var owl = $SUL('#itpromopanner,#itpromopanner1').find('.owl-carousel');
owl.owlCarousel({
dots: false,
nav: true,
animateIn: 'fadeIn',
animateOut: 'fadeOut',
items: 1,
loop: true,
autoplay: true,
autoplayTimeout: 5000,
autoPlay: true,
});
});
$SUL.ajax({
url: "/common/commonv4.aspx?type=getdevicename",
cache: false,
dataType: 'json',
success: function (data) {
if (data != "" && data != null && data != undefined && data != "error") {
if (data == "android")
$SUL("#aMobileAppBanner").attr("href", "https://play.google.com/store/apps/details?id=com.sulekha.nri&hl=en_IN&gl=US");
}
}
});
}
}
function MarketTrendsScroll() {
$SUL('html, body').animate({
scrollTop: $SUL("#divsummaryblock").offset().top
}, 2000);}
function LoadAccommodationTypes(loadtype) {
var roomtype = "";
try {
if (loadtype != undefined && loadtype == "map") {
$SUL("input[name=propertyOffered]").each(function () {
if ($SUL(this).prop("checked") == true && $SUL(this).val() == "apartment") {
roomtype += $SUL(this).val();
}
});
$SUL("input[name=propertyWanted]").each(function () {
if ($SUL(this).prop("checked") == true && $SUL(this).val() == "apartment") {
roomtype += $SUL(this).val();
}
});
}
else {
$SUL("input[name=rentWanted]").each(function () {
if ($SUL(this).prop("checked") == true && $SUL(this).val() == "apartment") {
roomtype += $SUL(this).val();
}
});
$SUL("input[name=rentOffered]").each(function () {
if ($SUL(this).prop("checked") == true && $SUL(this).val() == "apartment") {
roomtype += $SUL(this).val();
}
});
}
if (roomtype != "" && roomtype != undefined && roomtype == "apartment") {
$SUL("#divaccommodationtype").attr("class", "form-group");
$SUL.ajax({
url: "/common/commonv4.aspx?type=loadaccommodation&roomtype=" + roomtype + "&loadtype=" + loadtype,
cache: false,
success: function (data) {
if (data != "" && data != null && data != undefined && data != "error") {
if (loadtype != undefined && loadtype == "map")
$SUL("#divaccommodationM").html(data);
else
$SUL("#loadaccommodations").html(data);
var accomtype = $SUL("#accommodationvalue").val();
if (accomtype != undefined && accomtype != "") {
var accomtype_split = accomtype.split(",");
$SUL.each(accomtype_split, function (index, value) {
$SUL('#' + value).prop("checked", true);
});
FreeFillAccommodation(loadtype);
}
}
}
});
}
else {
$SUL("#divaccommodationtype").attr("class", "form-group");
if (loadtype != undefined && loadtype == "map")
$SUL("#divaccommodationM").html("");
else {
//$SUL("#loadaccommodations").html("");
}
$SUL("#accommodationvalue").val("");
$SUL("#accommodationvaluemap").val("");
}
}
catch (ex) {
console.log(ex);
}
}
function FreeFillAccommodation(loadtype) {
var accommodation = "", accommodation_url = "";
$SUL('input:checkbox[name="accommodationtypes"]').each(function () {
if ($SUL(this).prop("checked") == true) {
accommodation += $SUL(this).val() + ",";
accommodation_url += $SUL(this).attr("id") + ",";
}
})
if (accommodation != "" && accommodation != undefined)
accommodation = accommodation.substring(0, accommodation.length - 1);
if (accommodation_url != "" && accommodation_url != undefined)
accommodation_url = accommodation_url.substring(0, accommodation_url.length - 1);
if (loadtype != undefined && loadtype == "map") {
if (accommodation == "") {
$SUL("#accommodationvaluemapD").html("None");
$SUL("#accommodationvaluemap").val("");
}
else {
$SUL("#accommodationvaluemapD").html(accommodation);
$SUL("#accommodationvaluemap").val(accommodation_url);
}
}
else {
$SUL("#accommodationvalueD").val(accommodation);
$SUL("#accommodationvalue").val(accommodation_url);
}
mapviewfilters.accommodation = accommodation_url;
pageFilterValues.accommodation = accommodation_url;}
function fnPostAd() {
if (Sulekha.Auth.isLoggedin() == 1) {
window.location.href = "https://mycity.sulekha.com/postanad_roommates";
} else {
$SUL('#ussignin').trigger('click');
Sulekha.Auth.CallBack_Success = "fngotopostpage();";
}
}
function fngotopostpage() {
window.location.href = "https://mycity.sulekha.com/postanad_roommates";}
function sulCountySearch(holder) {
$SUL("#" + holder).bind('keyup', function (event) {
countyHolder = holder;
if (event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 27) {
var countyVal = ""; countyVal = $SUL("#" + holder).val();
if (countyVal.length > 1) {
Sulekha.Auth.JSONGetData(gProtocol + window.location.host + "/common/commonv4.aspx?type=countyajax&term=" + countyVal + "&callback=searchCountySuccess");
} else {
$SUL("#" + countyHolder + "-list-wrap").html("");
}
}
});
$SUL("#" + holder).bind('keydown', function (event) {
if (event.keyCode == 27)
$SUL("#" + holder + "-list-wrap").children('li').remove();
if (event.keyCode == 40 || event.keyCode == 38 || event.keyCode == 13) {
if ($SUL("#" + holder + "-list-wrap li").length > 0 && (event.keyCode == 40 || event.keyCode == 13)) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistCounty' + i).hasClass('active')) {
if (event.keyCode == 13) {
j = 1;
$SUL('#autocomplistCounty' + i).removeClass('active');
$SUL('#autocomplistCounty' + i).trigger('click');
$SUL("#" + holder + "-list-wrap").html("");
break;
}
j = 1;
$SUL('#autocomplistCounty' + i).removeClass('active');
if ($SUL('#autocomplistCounty' + (parseInt(i) + parseInt(1))).length > 0) {
$SUL('#autocomplistCounty' + (parseInt(i) + parseInt(1))).addClass('active').trigger('hover');
break;
} else {
$SUL('#autocomplistCounty0').addClass('active').trigger('hover');
break;
}
}
}
if (j == 0) {
$SUL('#autocomplistCounty0').addClass('active').trigger('hover');
}
}
if ($SUL("#" + holder + "-list-wrap li").length > 0 && event.keyCode == 38) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistCounty' + i).hasClass('active')) {
if (i > 0)
j = 1;
$SUL('#autocomplistCounty' + i).removeClass('active');
if ($SUL('#autocomplistCounty' + (parseInt(i) - parseInt(1))).length > 0) {
$SUL('#autocomplistCounty' + (parseInt(i) - parseInt(1))).addClass('active');
break;
} else {
$SUL('#autocomplistCounty' + (totallen - 1)).addClass('active');
break;
}
}
} if (j == 0) { $SUL('#autocomplistCounty' + (totallen - 1)).addClass('active'); }
}
}
});
$SUL("#" + holder).bind('click', function () { this.focus(); this.select(); });
$SUL(document).bind('click.lndmrk' + holder, function (event) {
if ($SUL("#" + holder + "-list-wrap").length == 1 && $SUL(event.target).attr("id") != holder) {
$SUL("#" + holder + "-list-wrap").html("");
}
});}
function searchCountySuccess(a) {
if (a != undefined && a.length > 0) {
if (a[0].ROW_PRC_GET_AJAX_LOCATION_COUNTY != undefined && a[0].ROW_PRC_GET_AJAX_LOCATION_COUNTY.length > 0) {
var uslist = '';
var obj = a[0].ROW_PRC_GET_AJAX_LOCATION_COUNTY
$SUL.each(obj, function (a, c) {
var abbr = "";
if (c.abbreviation != undefined && c.abbreviation != "undefined" && c.abbreviation != "") {
abbr = "(" + c.abbreviation + ")";
}
uslist += "
" + c.county + abbr + ", " + c.statecode + "";
});
$SUL("#" + countyHolder + "-list-wrap").html(uslist);
$SUL("#" + countyHolder + "-list-wrap").removeClass("show hide").addClass('show');
}
}
}
function selectCounty(a) {
if (countyHolder == "txtlandmarkss") {
$SUL("#hdCountyUrl").val(a.countystatecodeurl);
$SUL("#hdCountyName").val(a.county);
$SUL("#" + countyHolder + "-list-wrap").removeClass("hide").addClass('hide');
$SUL("#" + countyHolder).val(a.county);
}
else {
var place = $SUL('#hdLandmarkUrl').val();
$SUL('#hdCountyUrl').remove(); $SUL('#hdCountyName').remove();
$SUL('
').val(a.countystatecodeurl).appendTo('body');
$SUL('
').val(a.county).appendTo('body');
$SUL("#" + countyHolder + "-list-wrap").removeClass("hide").addClass('hide');
$SUL("#" + countyHolder).val(a.county);
//for mapviewfilter setting
// mapviewfilters.universityid = a.contentid;
//for mapviewfilter setting
if (a.county.length > 16) {
$SUL('#locationtxt').text(a.county.substr(0, 16) + '...');
}
else
$SUL('#locationtxt').text(a.county);
setTimeout(function () { $SUL('#location').addClass('hide'); }, 10);
}
}
//john added apartmet START NOV 20 23
function sulApartmentSearch(holder) {
$SUL("#" + holder).bind('keyup', function (event) {
apartmentHolder = holder;
if (event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 27) {
var countyVal = ""; countyVal = $SUL("#" + holder).val();
if (countyVal.length > 1) {
Sulekha.Auth.JSONGetData(gProtocol + window.location.host + "/common/commonv4.aspx?type=apmtajax&term=" + countyVal + "&callback=searchApartmentSuccess");
} else {
$SUL("#" + countyHolder + "-list-wrap").html("");
}
}
});
$SUL("#" + holder).bind('keydown', function (event) {
if (event.keyCode == 27)
$SUL("#" + holder + "-list-wrap").children('li').remove();
if (event.keyCode == 40 || event.keyCode == 38 || event.keyCode == 13) {
if ($SUL("#" + holder + "-list-wrap li").length > 0 && (event.keyCode == 40 || event.keyCode == 13)) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistApartment' + i).hasClass('active')) {
if (event.keyCode == 13) {
j = 1;
$SUL('#autocomplistApartment' + i).removeClass('active');
$SUL('#autocomplistApartment' + i).trigger('click');
$SUL("#" + holder + "-list-wrap").html("");
break;
}
j = 1;
$SUL('#autocomplistApartment' + i).removeClass('active');
if ($SUL('#autocomplistApartment' + (parseInt(i) + parseInt(1))).length > 0) {
$SUL('#autocomplistApartment' + (parseInt(i) + parseInt(1))).addClass('active').trigger('hover');
break;
} else {
$SUL('#autocomplistApartment0').addClass('active').trigger('hover');
break;
}
}
}
if (j == 0) {
$SUL('#autocomplistApartment0').addClass('active').trigger('hover');
}
}
if ($SUL("#" + holder + "-list-wrap li").length > 0 && event.keyCode == 38) {
var i = 0, j = 0, totallen = $SUL("#" + holder + "-list-wrap li").length;
for (i = 0; i < totallen; i++) {
if ($SUL('#autocomplistApartment' + i).hasClass('active')) {
if (i > 0)
j = 1;
$SUL('#autocomplistApartment' + i).removeClass('active');
if ($SUL('#autocomplistApartment' + (parseInt(i) - parseInt(1))).length > 0) {
$SUL('#autocomplistApartment' + (parseInt(i) - parseInt(1))).addClass('active');
break;
} else {
$SUL('#autocomplistApartment' + (totallen - 1)).addClass('active');
break;
}
}
} if (j == 0) { $SUL('#autocomplistApartment' + (totallen - 1)).addClass('active'); }
}
}
});
$SUL("#" + holder).bind('click', function () { this.focus(); this.select(); });
$SUL(document).bind('click.lndmrk' + holder, function (event) {
if ($SUL("#" + holder + "-list-wrap").length == 1 && $SUL(event.target).attr("id") != holder) {
$SUL("#" + holder + "-list-wrap").html("");
}
});}
function searchApartmentSuccess(a) {
if (a != undefined && a.length > 0) {
if (a[0].ROW_PRC_GET_AJAX_APARTMENT != undefined && a[0].ROW_PRC_GET_AJAX_APARTMENT.length > 0) {
var uslist = '';
var obj = a[0].ROW_PRC_GET_AJAX_APARTMENT
$SUL.each(obj, function (a, c) {
//var abbr = "";
//if (c.abbreviation != undefined && c.abbreviation != "undefined" && c.abbreviation != "") {
// abbr = "(" + c.abbreviation + ")";
//}
uslist += "
" + c.businessname + ", " + c.city + "";
});
$SUL("#" + apartmentHolder + "-list-wrap").html(uslist);
$SUL("#" + apartmentHolder + "-list-wrap").removeClass("show hide").addClass('show');
}
}
}
function selectaptmnt(a) {
if (apartmentHolder == "txtlandmarkss") {
$SUL("#hdApartmentUrl").val(a.businessurl);
$SUL("#hdApartmentName").val(a.businessname);
$SUL("#" + apartmentHolder + "-list-wrap").removeClass("hide").addClass('hide');
$SUL("#" + apartmentHolder).val(a.county);
}
else {
var place = $SUL('#hdApartmentClickUrl').val(a.apartclickurl);
$SUL('#hdApartmentUrl').remove(); $SUL('#hdApartmentName').remove();
$SUL('
').val(a.businessurl).appendTo('body');
$SUL('
').val(a.businessname).appendTo('body');
$SUL('
').val(a.apartclickurl).appendTo('body');
$SUL("#" + apartmentHolder + "-list-wrap").removeClass("hide").addClass('hide');
$SUL("#" + apartmentHolder).val(a.businessname);
//for mapviewfilter setting
// mapviewfilters.universityid = a.contentid;
//for mapviewfilter setting
if (a.businessname.length > 16) {
$SUL('#locationtxt').text(a.businessname.substr(0, 16) + '...');
}
else
$SUL('#locationtxt').text(a.businessname);
setTimeout(function () { $SUL('#location').addClass('hide'); }, 10);
}
}
// John added apartmet END
function checkcountyUrl() {
var countyurl = "0";
if ($SUL("#searchlocationD").text() == "By County") {
if ($SUL("#searchCounty").val().length > 0) {
if ((Sulekha.Common.trim($SUL("#searchCounty").val()) == $SUL("#hdCountyName").val() && $SUL('#hdCountyUrl').val() != "")) {
countyurl = "1";
}
else {
$SUL('#divError_Dialog').dialog("option", "buttons", { "Ok": function () { $SUL("#searchCounty").focus(); $SUL(this).dialog('close'); } });
Sulekha.Common.alert("Please select a County"); countyurl = "2";
hideplaceprocessing('listingsearch');
}
}
else {
$SUL('#divError_Dialog').dialog("option", "buttons", { "Ok": function () { $SUL("#searchCounty").focus(); $SUL(this).dialog('close'); } });
Sulekha.Common.alert("Please select a County"); countyurl = "2";
hideplaceprocessing('listingsearch');
}
}
return countyurl;}
function showmorecountycity() {
$SUL(".action-morecount").addClass('hide');
$SUL(".action-morecountrec").removeClass('hide');}
//---Places nearby start
function openNearbyplaces() {
if ($SUL("#sec_nearby").length > 0 && $SUL('#sec_nearby').hasClass('hide')) {
$SUL('#sec_nearby').removeClass('hide').addClass('show');
} else if ($SUL("#sec_nearby").length > 0 && $SUL('#sec_nearby').hasClass('show')) {
$SUL('#sec_nearby').removeClass('show').addClass('hide');
}
else if ($SUL("#sec_nearby").length > 0 && $SUL('#sec_nearby').hasClass('mobilehide')) {
$SUL('#sec_nearby').removeClass('mobilehide').addClass('show');
}
}
function getNearby(adid, landmarktype, servicename, id) {
$SUL(".action-linearby").removeClass('active'); $SUL(".li-nearby" + id).addClass('active');
$SUL.ajax({
url: "/common/commonv4.aspx?type=detailpageloadnearby&adid=" + adid + "&landmarktype=" + landmarktype + "&servicename=" + servicename + "&pageno=1&rowstofetch=12",
cache: false,
success: function (data) {
if (data != null && data != undefined && data != "Error") {
$SUL('#div_nearbyplaces').html(data);
}
}
});}
function nearbychangePage(pageno, rowstofetch, adid, landmarktype, servicename) {
$SUL.ajax({
url: "/common/commonv4.aspx?type=detailpageloadnearby&adid=" + adid + "&landmarktype=" + landmarktype + "&servicename=" + servicename + "&pageno=" + pageno + "&rowstofetch=" + rowstofetch,
cache: false,
success: function (data) {
if (data != null && data != undefined && data != "Error") {
$SUL('#div_nearbyplaces').html(data);
}
}
});}
//---Places nearby end
function dyloadgclientjs(fileurl) {
let scrptelement = document.createElement("script");
scrptelement.setAttribute("src", fileurl);
scrptelement.setAttribute("type", "text/javascript");
scrptelement.setAttribute("async", "async");
scrptelement.setAttribute("defer", "defer");
document.body.appendChild(scrptelement);
scrptelement.addEventListener("load", () => {
console.log("File loaded")
});
scrptelement.addEventListener("error", (ev) => {
console.log("Error on loading file", ev);
});}
function dyloadgtaphtml() {
var googleonetaphtml = '';
googleonetaphtml += "
";
$SUL('body').append(googleonetaphtml);}
function fndetectnloadgonetapsign() {
if (!Sulekha.Auth.isLoggedin() && !(jQuery.browser = jQuery.browser || {}).mobile) {
dyloadgtaphtml();
dyloadgclientjs("https://accounts.google.com/gsi/client");
if (!(jQuery.browser = jQuery.browser || {}).mobile) {
setTimeout(function () {
$SUL('#credential_picker_container').attr("style", "position: fixed;z-index: 9999999;height: 204px;top: 120px;");
}, 5000);
}
}
}
function googleonetapcallbackpoint(googletokenval) {
console.log(googletokenval)
Sulekha.Auth.JSONGetData("https://us.sulekha.com/gtap/googleonetapsign.aspx?QuStr=gonetap&callback=fngtapSuccess&gjwt=" + googletokenval.credential);}
function fngtapSuccess(sjson) {
if (sjson != null && sjson != "" && sjson != undefined && sjson != 'undefined') {
var decidetoreload = sjson[0].value;
if (decidetoreload == "1")
window.location.reload(true);
}
}
var zedoroadblockhtmlpromo = "";var zedoroadblockcookval = "";/*function for zedo roadblock*/
function fnzedoroadblock() {
try {
zedoroadblockcookval = getCookieV2('zedooverlay');
//zedoroadblockhtmlpromo += "
";
zedoroadblockhtmlpromo += "
";
try {
if (zedoroadblockcookval == null || zedoroadblockcookval == undefined || zedoroadblockcookval == 'undefined') {
zedoroadblockcookval = "1";
Sulekha.Common.setCookie('zedooverlay', zedoroadblockcookval, 1, '');
}
else {
//zedoroadblockcookval = parseInt(zedoroadblockcookval) + parseInt("1");
//Sulekha.Common.setCookie('zedooverlay', zedoroadblockcookval, 1, '');
//if (zedoroadblockcookval > 2) {
// zedoroadblockhtmlpromo = "";
//}
zedoroadblockhtmlpromo = "";
}
}
catch (e) {
}
}
catch (exsblk) {
console.log(exsblk);
}
}
function eliteblockload() {
var metrocityurl = $SUL('#hdMetroUrl').val();
var gender = $SUL('#hdnelitblockgender').val();
var roomtype = $SUL('#hdnelitblockroomtype').val();
var minprice = $SUL('#hdnelitblockfromprice').val();
var maxprice = $SUL('#hdnelitblocktoprice').val();
var orderby = $SUL('#hdnelitblockorderby').val();
var usertype = $SUL('#hdnelitblockusertype').val();
var userlat = $SUL('#hdnelitblockuserlat').val();
var userlong = $SUL('#hdnelitblockuserlong').val();
$SUL.ajax({
type: "GET",
dataType: "json",
url: "/common/commonv4.aspx?type=loadeliteblock&metrocityurl=" + metrocityurl + "&gender=" + gender + "&roomtype=" + roomtype + "&minprice=" + minprice + "&maxprice=" + maxprice + "&orderby=" + orderby + "&usertype=" + usertype + "&userlong=" + userlong + "&userlat=" + userlat,
success: function (jsondata) {
if (jsondata[0].value == "success") {
$SUL('#diveliteblockload').html(jsondata[2].value);
}
else {
}
}
});}
$SUL(window).on('scroll.megamenu', function () {
var scrollPercent = fnscpertagdata();
console.log("scrollPercent:" + scrollPercent);
if (scrollPercent > 10) {
if ($SUL('#premiumAdsDiv').length > 0) {
if ($SUL('#premiumAdsDiv').html() == "") {
callPremiumAdsv2('1');
}
}
}
if (scrollPercent > 15) {
if ($SUL('#latestAdsDiv').length > 0) {
if ($SUL('#latestAdsDiv').html() == "") {
callLatestAds('1');
}
}
}
});
//john start Apartment oct 24 2023
$SUL(window).scroll(function () {
var scroll = $SUL(window).scrollTop();
if (scroll >= 100) {
$SUL(".botnav").addClass("sticky");
} else {
$SUL('.botnav').removeClass('sticky');
}
if($SUL('#sulmenu').length > 0){
if (scroll >= 10) {
$SUL("#sulmenu").addClass("sticky");
} else {
$SUL('#sulmenu').removeClass('sticky');
}
}
if($SUL('#sulmenus').length > 0){
if (scroll >= 10) {
$SUL("#sulmenus").addClass("sticky");
} else {
$SUL('#sulmenus').removeClass('sticky');
}
}
if (scroll >= 450) {
$SUL("#aprtnav").addClass("sticky");
} else {
$SUL('#aprtnav').removeClass('sticky');
}
});
function aptactiveOnScroll(event) {
var scrollPosition = $SUL(document).scrollTop();
$SUL('#aprtnav li a').each(function () {
var currentLink = $SUL(this);
var refElement = $SUL(currentLink.attr("href"));
var bool1 = refElement.position().top <= scrollPosition;
var bool2 = refElement.position().top + refElement.height() > scrollPosition;
// console.log("doc top : " + scrollPosition + ", ref : " + $SUL(currentLink).parent().attr("id") + ", ref top :" + (refElement.position().top + 630) + ", ref bott: " + (refElement.position().top + 630) + refElement.height())
if (refElement.position().top + 630 <= scrollPosition && (refElement.position().top + 630) + refElement.height() > scrollPosition) {
$SUL('#aprtnav li a').removeClass("active");
currentLink.addClass("active");
}
else {
currentLink.removeClass("active");
}
});}
function fnappendaptid(aptid) {
setTimeout(function () {
if (aptid != null) {
$SUL('
').val(aptid).appendTo('#lcfroommateform1');
$SUL('#lcfholder1heading').find('div.close').on('click', function () {
$SUL('#showPromoContainerDiv1').html("");
$SUL('#lcfBack').remove();
$SUL(document.body).attr("style", "");
});
}
}, 2000);
}
function fnviewmore() {
$SUL(".actionaptlist").removeClass('hide');
$SUL("#aptviewmore").addClass('hide');
$SUL("#aptviewless").removeClass('hide');}
function fnviewless() {
$SUL('html,body').animate({ scrollTop: $SUL("#scrollup").offset().top - 50 }, 0);
$SUL(".actionaptlist").addClass('hide');
$SUL("#aptviewless").addClass('hide');
$SUL("#aptviewmore").removeClass('hide');}
//john END Apartment oct 24 2023
function fnpromoteuserlcf() {
$SUL('#LclOpen').trigger('click');}
function gaclicktrack(eventSend, eventCategory, eventAction, eventLabel, eventValue) {
try {
gtag('event', eventAction, {
'event_category': eventCategory,
'event_label': eventLabel,
'event_value': eventValue
});
}
catch (e) {
console.log(e);
}
}
//market Trends Start
function displayFirst_rentals(type) {
if (type == "city") {
$SUL('#One').removeClass('hide').addClass('show');
$SUL('#Two_rentals').addClass('hide').removeClass('show');
$SUL('#OneActive').removeClass('hide').addClass('show');
$SUL('#TwoActive_rentals').addClass('show');
}
else {
$SUL('#Oneneighbour').removeClass('hide').addClass('show');
$SUL('#Twoneighbour_rentals').addClass('hide').removeClass('show');
$SUL('#OneActiveneighbour').removeClass('hide').addClass('show');
$SUL('#TwoActiveneighbour_rentals').addClass('show');
}
}
function displayFirst(type) {
if (type == "city") {
$SUL('#One').removeClass('hide').addClass('show');
$SUL('#Two').addClass('hide').removeClass('show');
$SUL('#OneActive').removeClass('hide').addClass('show');
$SUL('#TwoActive').addClass('show');
}
else {
$SUL('#Oneneighbour').removeClass('hide').addClass('show');
$SUL('#Twoneighbour').addClass('hide').removeClass('show');
$SUL('#OneActiveneighbour').removeClass('hide').addClass('show');
$SUL('#TwoActiveneighbour').addClass('show');
}
}
function displaySecond(type) {
if (type == "city") {
$SUL('#Two').removeClass('hide').addClass('show');
$SUL('#One').addClass('hide').removeClass('show');
$SUL('#TwoActive').removeClass('hide').addClass('show');
$SUL('#OneActive').addClass('show');
}
else {
$SUL('#Twoneighbour').removeClass('hide').addClass('show');
$SUL('#Oneneighbour').addClass('hide').removeClass('show');
$SUL('#TwoActiveneighbour').removeClass('hide').addClass('show');
$SUL('#OneActiveneighbour').addClass('show');
}
}
function displaySecond_rentals(type) {
if (type == "city") {
$SUL('#Two_rentals').removeClass('hide').addClass('show');
$SUL('#One').addClass('hide').removeClass('show');
$SUL('#TwoActive_rentals').removeClass('hide').addClass('show');
$SUL('#OneActive').addClass('show');
}
else {
$SUL('#Twoneighbour_rentals').removeClass('hide').addClass('show');
$SUL('#Oneneighbour').addClass('hide').removeClass('show');
$SUL('#TwoActiveneighbour_rentals').removeClass('hide').addClass('show');
$SUL('#OneActiveneighbour').addClass('show');
}
}
function fnfiltersearch_neighbour_rentals(category) {
var value = category;
$SUL("#ifilter2_neighbour_rentals").text(category);
var userselservice = $SUL('#hdnuserservicetype').val();
//if (category == "Single Room" || category == "Shared Room" || category == "Paying Guest") {
// $SUL('#OneActiveneighbour').addClass('hide');
//}
//else {
// $SUL('#OneActiveneighbour').removeClass('hide');
//}
var Sbedsttype = $SUL("#ifilter1_neighbour_rentals").text();
var locationurl = $SUL('#hdCityurl').val();
var Adtype = $SUL('#hdnadtypemarkettrends').val();
var selectcategory = value;
$SUL('#Twoneighbour_rentals').addClass('hide').removeClass('show');
$SUL('#divloadermaincontent_rentals').removeClass('hide');
$SUL.ajax({
type: "POST",
url: "/common/commonv4.aspx?type=filteronchange_neighbour&Adtype=" + Adtype + "&locationurl=" + locationurl + "&selectcategory=" + selectcategory + "&bedtype=" + Sbedsttype + "&userselservice=" + userselservice,
cache: false,
dataType: "json",
success: function (jsondata) {
$SUL('#divloadermaincontent_rentals').addClass('hide');
$SUL('#divmatchingtopneighbour_rentals').html(jsondata[2].value);
},
});
}
function fnfiltersearch_neighbour(category) {
var value = category;
$SUL("#ifilter2_neighbour").text(category);
var userselservice = $SUL('#hdnuserservicetype').val();
//if (category == "Single Room" || category == "Shared Room" || category == "Paying Guest") {
// $SUL('#OneActiveneighbour').addClass('hide');
//}
//else {
// $SUL('#OneActiveneighbour').removeClass('hide');
//}
var Sbedsttype = $SUL("#ifilter1_neighbour").text();
var locationurl = $SUL('#hdCityurl').val();
var Adtype = $SUL('#hdnadtypemarkettrends').val();
var selectcategory = value;
$SUL('#Twoneighbour').addClass('hide').removeClass('show');
$SUL('#divloadermaincontent').removeClass('hide');
$SUL.ajax({
type: "POST",
url: "/common/commonv4.aspx?type=filteronchange_neighbour&Adtype=" + Adtype + "&locationurl=" + locationurl + "&selectcategory=" + selectcategory + "&bedtype=" + Sbedsttype + "&userselservice=" + userselservice,
cache: false,
dataType: "json",
success: function (jsondata) {
$SUL('#divloadermaincontent').addClass('hide');
$SUL('#divmatchingtopneighbour').html(jsondata[2].value);
},
});
}
function fnfiltersearch_rentals(category) {
var value = category;
$SUL("#ifilter2_rentals").text(category);
//if (category == "Single Room" || category == "Shared Room" || category == "Paying Guest") {
// $SUL('#OneActive').addClass('hide');
//}
//else {
// $SUL('#OneActive').removeClass('hide');
//}
var Sbedsttype = $SUL("#ifilter1_rentals").text();
var locationurl = $SUL('#hdCityurl').val();
var Adtype = $SUL('#hdnadtypemarkettrends').val();
var selectcategory = value;
$SUL('#Two_rentals').addClass('hide').removeClass('show');
$SUL('#divloadermaincontent_rentals').removeClass('hide');
$SUL.ajax({
type: "POST",
url: "/common/commonv4.aspx?type=filteronchange&Adtype=" + Adtype + "&locationurl=" + locationurl + "&selectcategory=" + selectcategory + "&bedtype=" + Sbedsttype,
cache: false,
dataType: "json",
success: function (jsondata) {
$SUL('#divloadermaincontent_rentals').addClass('hide');
$SUL('#divmatchingtopcities_rentals').html(jsondata[2].value);
},
});
//fnfiltersearch();
}
function fnfiltersearch(category) {
var value = category;
$SUL("#ifilter2").text(category);
var userselservice = $SUL('#hdnuserservicetype').val();
//if (category == "Single Room" || category == "Shared Room" || category == "Paying Guest") {
// $SUL('#OneActive').addClass('hide');
//}
//else {
// $SUL('#OneActive').removeClass('hide');
//}
var Sbedsttype = $SUL("#ifilter1").text();
var locationurl = $SUL('#hdCityurl').val();
var Adtype = $SUL('#hdnadtypemarkettrends').val();
var selectcategory = value;
$SUL('#Two').addClass('hide').removeClass('show');
$SUL('#divloadermaincontent').removeClass('hide');
$SUL.ajax({
type: "POST",
url: "/common/commonv4.aspx?type=filteronchange&Adtype=" + Adtype + "&locationurl=" + locationurl + "&selectcategory=" + selectcategory + "&bedtype=" + Sbedsttype + "&userselservice=" + userselservice,
cache: false,
dataType: "json",
success: function (jsondata) {
$SUL('#divloadermaincontent').addClass('hide');
$SUL('#divmatchingtopcities').html(jsondata[2].value);
},
});
//fnfiltersearch();
}
function fnfiltersearchmarkettrends() {
}
function fnfilterbed_neighbour_search(bedtype) {
$SUL("#ifilter1_neighbour_rentals").text(bedtype);
var value = $SUL("#ifilter2_neighbour_rentals").text();
var userselservice = $SUL('#hdnuserservicetype').val();
//if (bedtype == "1 beds" || bedtype == "2 beds" || bedtype == "3 beds" || bedtype == "4 beds" || bedtype == "All beds") {
// $SUL('#TwoActiveneighbour').addClass('hide');
//}
//else {
// $SUL('#TwoActiveneighbour').removeClass('hide');
//}
var locationurl = $SUL('#hdCityurl').val();
var Adtype = $SUL('#hdnadtypemarkettrends').val();
var selectcategory = value;
$SUL('#Oneneighbour').addClass('hide').removeClass('show');
$SUL('#divloadermaincontent_rentals').removeClass('hide');
$SUL.ajax({
type: "POST",
url: "/common/commonv4.aspx?type=filteronchange_neighbour&Adtype=" + Adtype + "&locationurl=" + locationurl + "&selectcategory=" + selectcategory + "&bedtype=" + bedtype + "&userselservice=" + userselservice,
cache: false,
dataType: "json",
success: function (jsondata) {
$SUL('#divloadermaincontent_rentals').addClass('hide');
$SUL('#divmatchingtopneighbour_rentals').html(jsondata[2].value);
},
});
//fnfiltersearch();
}
function fnfilterbed_search(bedtype) {
$SUL("#ifilter1_rentals").text(bedtype);
var value = $SUL("#ifilter2_rentals").text();
//if (bedtype == "1 beds" || bedtype == "2 beds" || bedtype == "3 beds" || bedtype == "4 beds" || bedtype == "All beds") {
// $SUL('#TwoActive').addClass('hide');
//}
//else {
// $SUL('#TwoActive').removeClass('hide');
//}
var locationurl = $SUL('#hdCityurl').val();
var Adtype = $SUL('#hdnadtypemarkettrends').val();
var selectcategory = value;
$SUL('#One').addClass('hide').removeClass('show');
$SUL('#divloadermaincontent_rentals').removeClass('hide');
$SUL.ajax({
type: "POST",
url: "/common/commonv4.aspx?type=filteronchange&Adtype=" + Adtype + "&locationurl=" + locationurl + "&selectcategory=" + selectcategory + "&bedtype=" + bedtype,
cache: false,
dataType: "json",
success: function (jsondata) {
$SUL('#divloadermaincontent_rentals').addClass('hide');
$SUL('#divmatchingtopcities_rentals').html(jsondata[2].value);
},
});
//fnfiltersearch();
}
function searchUSCanadaCity_neighbour(a) {
if (a != undefined && a.length > 0) {
var b = "";
var isUsa = false, isCanada = false;
var uslist = "
USA
";
var canadalist = "Canada
";
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").html(uslist);
}
if (isCanada) {
canadalist += "
";
if ($SUL('#us-city-list').length == 1) {
if ($SUL('#us-city-list').prev().text() == 'Canada') {
$SUL('#us-city-list').prev().remove();
$SUL('#us-city-list').remove();
}
}
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").append(canadalist);
}
if (srchHolder == 'searchCity2')
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").children('div').children('div').attr('style', 'width:300px;max-height:240px;overflow-y:auto');
else
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").children('div').children('div').css('width', $SUL('#' + srchHolder).width());
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").removeClass('show hide').addClass("show");
}
}
$SUL(document).ready(function () {
$SUL('body').bind('click', function (e) {
if (!$SUL(e.target).closest("#OneActive").length) {
$SUL('#One').addClass('hide');
}
if (!$SUL(e.target).closest("#TwoActive").length) {
$SUL('#Two').addClass('hide');
}
if (!$SUL(e.target).closest("#OneActiveneighbour").length) {
$SUL('#Oneneighbour').addClass('hide');
}
if (!$SUL(e.target).closest("#TwoActiveneighbour").length) {
$SUL('#Twoneighbour').addClass('hide');
}
if (!$SUL(e.target).closest("#TwoActive_rentals").length) {
$SUL('#Two_rentals').addClass('hide');
}
if (!$SUL(e.target).closest("#TwoActiveneighbour_rentals").length) {
$SUL('#Twoneighbour_rentals').addClass('hide');
}
});
//start samarish prefil
fncategoryposthrefdisable();
if ($SUL('#hdnuserservicetype').val() == "roommates") {
$SUL('#optbedtype').addClass('hide');
}
if ($SUL('#hdncategoreytremurl').length > 0 && $SUL('#hdncategoreytremurl').val() != "") {
$SUL('#divformfilter').removeClass('hide');
if ($SUL('#hdncategoreytremurl').val() == "paying-guest") {
$SUL('#optproptype').val('paying');
}
else {
$SUL('#optproptype').val($SUL('#hdncategoreytremurl').val());
}
}
//End samarish prefil
});
function fnsearchtrendshome() {
var cityurl = $SUL('#hdSelCityUrl').val();
var Sservice = $SUL('#hdnuserservicetype').val();
if (Sservice == "roommates") {
window.location.href = "https://indianroommates.sulekha.com/room-market-trends/" + cityurl;
}
else {
window.location.href = "https://indianroommates.sulekha.com/rent-market-trends/" + cityurl;
}
}
function fnproptypechange() {
var proptype = $SUL('#optproptype :selected').val();
var bedtype = $SUL('#optbedtype :selected').val();
var service = $SUL('#hdnuserservicetype').val()
if (service == "roommates") {
if (proptype == "single" || proptype == "shared" || proptype == "paying" || proptype == "All types") {
$SUL('#optbedtype').addClass('hide');
}
else {
$SUL('#optbedtype').removeClass('hide');
}
} else {
if (proptype == "single" || proptype == "shared" || proptype == "paying") {
$SUL('#optbedtype').addClass('hide');
}
else {
$SUL('#optbedtype').removeClass('hide');
}
}
//if (proptype == "single" || proptype == "shared" || proptype == "paying") {
// $SUL('#optbedtype').addClass('hide');
//}
//else {
// $SUL('#optbedtype').removeClass('hide');
//}
}
function fncallcomparecitytrends() {
var proptype = $SUL('#optproptype :selected').val();
var bedtype = $SUL('#optbedtype :selected').val();
var locationurl = $SUL('#hdSelCityUrl').val();
var cityurl = $SUL('#hdCityurl').val();
var roomtypeid = "";
var roomtypedisplaytext = "";
if (proptype == "single") {
roomtypeid = 2;
roomtypedisplaytext == "Single Room";
}
else if (proptype == "All types") {
roomtypeid == "";
roomtypedisplaytext == "All types";
}
else if (proptype == "shared") {
roomtypeid = 1;
roomtypedisplaytext == "Shared Room";
}
else if (proptype == "paying-guest") {
roomtypeid = 4;
roomtypedisplaytext == "Paying Guest";
}
else if (proptype == "single-family-home") {
roomtypeid = 1;
roomtypedisplaytext == "Paying Guest";
}
else if (proptype == "apartment") {
roomtypeid = 2;
}
else if (proptype == "condo") {
roomtypeid = 3;
}
else if (proptype == "office-space") {
roomtypeid == "6";
}
else if (proptype == "homes") {
roomtypeid = 8;
}
else if (proptype == "houses") {
roomtypeid = 9;
}
else if (proptype == "hostels") {
roomtypeid = 10;
}
else if (proptype == "hotels") {
roomtypeid = 11;
}
else if (proptype == "basement-apartment") {
roomtypeid = 12;
}
else if (locationurl == "") {
locationurl = cityurl;
}
var Adtype = $SUL('#hdnadtypemarkettrends').val();
var ObjType = $SUL('#hdObjType').val();
$SUL.ajax({
type: "POST",
url: "/common/commonv4.aspx?type=filteronchange_citypagehome&Adtype=" + Adtype + "&locationurl=" + locationurl + "&selectcategory=" + proptype + "&bedtype=" + bedtype,
cache: false,
dataType: "json",
success: function (jsondata) {
$SUL('#divloadermaincontent').addClass('hide');
var chkcurrentmedianrent = jsondata[2].value;
const domparser = new DOMParser()
const doc = domparser.parseFromString(chkcurrentmedianrent, 'text/html')
const elem = doc.getElementById('emtopcurrmedianrent');
$SUL('#emcomparecitymedian').html(elem.innerHTML);
// $SUL('#divcityneighbourmarketsummary').html(jsondata[2].value);
},
});
}
function fnsearchcitymarketdata() {
$SUL('#divloadermaincontentsearch').removeClass('hide');
var proptype = $SUL('#optproptype :selected').val();
var bedtype = $SUL('#optbedtype :selected').val();
var locationurl = $SUL('#hdSelCityUrl').val();
var cityurl = $SUL('#hdCityurl').val();
var roomtypeid = "";
var roomtypedisplaytext = "";
var bedtypedisplaytext = "";
var servicetitle = "rentals";
var userselservice = $SUL('#hdnuserservicetype').val();
var roomtypedisplaytextnew = "";
if (bedtype == "1 beds") {
bedtypedisplaytext = "1 bedroom";
}
else if (bedtype == "2 beds") {
bedtypedisplaytext = "2 bedroom";
}
else if (bedtype == "3 beds") {
bedtypedisplaytext = "3 bedroom";
}
else if (bedtype == "4 beds") {
bedtypedisplaytext = "4 bedroom";
}
if (proptype == "single") {
roomtypeid = 2;
roomtypedisplaytext = "Single Rooms";
roomtypedisplaytextnew = roomtypedisplaytext;
servicetitle = "roommates";
bedtype = "";
}
else if (proptype == "All types") {
roomtypeid == "";
roomtypedisplaytext = "all property types";
if (userselservice == "roommates") {
roomtypedisplaytextnew = "RoomMates";
servicetitle = "roommates";
}
else {
roomtypedisplaytextnew = "Rentals";
servicetitle = "rentals";
}
}
else if (proptype == "shared") {
roomtypeid = 1;
roomtypedisplaytext = "Shared Rooms";
roomtypedisplaytextnew = roomtypedisplaytext;
servicetitle = "roommates";
bedtype = "";
}
else if (proptype == "paying") {
roomtypeid = 4;
roomtypedisplaytext = "Paying Guest";
roomtypedisplaytextnew = roomtypedisplaytext;
servicetitle = "roommates";
bedtype = "";
}
else if (proptype == "single-family-home") {
roomtypeid = 1;
roomtypedisplaytext = "Single Family home";
roomtypedisplaytextnew = roomtypedisplaytext;
}
else if (proptype == "apartment") {
roomtypeid = 2;
roomtypedisplaytext = "Apartment/Flats";
roomtypedisplaytextnew = roomtypedisplaytext;
}
else if (proptype == "condo") {
roomtypeid = 3;
roomtypedisplaytext = "Condo";
roomtypedisplaytextnew = roomtypedisplaytext;
}
else if (proptype == "office-space") {
roomtypeid = "6";
}
else if (proptype == "homes") {
roomtypeid = 8;
roomtypedisplaytext = "Homes";
roomtypedisplaytextnew = roomtypedisplaytext;
}
else if (proptype == "houses") {
roomtypeid = 9;
roomtypedisplaytext = "Houses";
roomtypedisplaytextnew = roomtypedisplaytext;
}
else if (proptype == "hostels") {
roomtypeid = 10;
roomtypedisplaytext = "Hostels";
roomtypedisplaytextnew = roomtypedisplaytext;
}
else if (proptype == "hotels") {
roomtypeid = 11;
roomtypedisplaytext = "Hotels";
roomtypedisplaytextnew = roomtypedisplaytext;
}
else if (proptype == "basement-apartment") {
roomtypeid = 12;
roomtypedisplaytext = "Basement Apartment";
roomtypedisplaytextnew = roomtypedisplaytext;
}
//if (locationurl != "" && proptype == "All types" && bedtype == "") {
// var cityurlnew = $SUL('#hdSelCityUrl').val();
// if (proptype == "shared" || proptype == "paying" || proptype == "single") {
// $SUL('#divloadermaincontentsearch').addClass('hide');
// window.location.href = "https://indianroommates.sulekha.com/room-market-trends/" + cityurlnew;
// }
// else {
// $SUL('#divloadermaincontentsearch').addClass('hide');
// window.location.href = "https://indianroommates.sulekha.com/rent-market-trends/" + cityurlnew;
// }
//}
if (cityurl != locationurl && locationurl != "") {
var cityurlnew = $SUL('#hdSelCityUrl').val();
if (proptype == "shared" || proptype == "paying" || proptype == "single") {
window.location.href = "https://indianroommates.sulekha.com/room-market-trends/" + cityurlnew;
$SUL('#divloadermaincontentsearch').addClass('hide');
}
else {
window.location.href = "https://indianroommates.sulekha.com/rent-market-trends/" + cityurlnew;
$SUL('#divloadermaincontentsearch').addClass('hide');
}
}
else if (locationurl == "") {
locationurl = cityurl;
}
//new change//
if (userselservice == "roommates") {
if (proptype != "shared" && proptype != "paying" && proptype != "single" && proptype != "All types") {
$SUL('#divloadermaincontentsearch').addClass('hide');
fnposttomarkettrendsv2("https://indianroommates.sulekha.com/rent-market-trends/" + locationurl, proptype);
return false;
}
} else {
if (proptype == "shared" || proptype == "paying" || proptype == "single") {
$SUL('#divloadermaincontentsearch').addClass('hide');
fnposttomarkettrendsv2("https://indianroommates.sulekha.com/room-market-trends/" + locationurl, proptype);
return false;
}
}
var Adtype = $SUL('#hdnadtypemarkettrends').val();
var ObjType = $SUL('#hdObjType').val();
$SUL.ajax({
type: "POST",
url: "/common/commonv4.aspx?type=filteronchange_citypagehome&Adtype=" + Adtype + "&locationurl=" + locationurl + "&selectcategory=" + proptype + "&bedtype=" + bedtype + "&userselservice=" + userselservice,
cache: false,
dataType: "json",
success: function (jsondata) {
$SUL('#divloadermaincontentsearch').addClass('hide');
$SUL('#divcityneighbourmarketsummary').html(jsondata[2].value);
//GetBarChart(roomtypeid, Adtype, locationurl, roomtypedisplaytext, ObjType, bedtype, servicetitle);
//GetLineChart(roomtypeid, Adtype, locationurl, roomtypedisplaytext, bedtype, ObjType, servicetitle);
//GetGooglePieChart(ObjType, Adtype, locationurl, locationurl, roomtypeid, bedtype, servicetitle);
var chkcurrentmedianrent = jsondata[2].value;
$SUL('.dynrntval').html($SUL('#dynmicliveadscount').html());
$SUL('.dynyoychgeperval').html($SUL('#dynmicyoychgrpercentage').html().replace('
', '').replace('
', ''));
//alert($SUL('#dynmicyoychgrpercentage').html());
const domparser = new DOMParser()
const doc = domparser.parseFromString(chkcurrentmedianrent, 'text/html')
const elem = doc.getElementById('emtopcurrmedianrent');
$SUL('#emtopcurrmedianrent').html(elem.innerHTML);
$SUL('#btagcomparetextvalue').html(elem.innerHTML);
const jsononevalue = jsondata[1].value;
const jsononedata = JSON.parse(jsononevalue);
if (elem.innerHTML.trim() != "$0") {
GetBarChart(roomtypeid, Adtype, locationurl, roomtypedisplaytextnew, ObjType, bedtype, servicetitle);
GetLineChart(roomtypeid, Adtype, locationurl, roomtypedisplaytext, bedtype, ObjType, servicetitle);
GetGooglePieChart(ObjType, Adtype, locationurl, locationurl, roomtypeid, bedtype, servicetitle);
$SUL("#secbargraphchart").removeClass("hide").addClass("show");
$SUL("#secbiecomparechart").removeClass("hide").addClass("show");
$SUL("#sec_neighblock").removeClass("hide").addClass("show");
$SUL("#sec_faqblock").removeClass("hide").addClass("show");
$SUL("#divcityneighbourmarketsummary").removeClass("hide").addClass("show");
}
else {
$SUL("#secbargraphchart").addClass("hide").removeClass("show");
$SUL("#secbiecomparechart").addClass("hide").removeClass("show");
$SUL("#sec_neighblock").addClass("hide").removeClass("show");
$SUL("#sec_faqblock").addClass("hide").removeClass("show");
$SUL("#divcityneighbourmarketsummary").addClass("hide").removeClass("show");
}
if (elem.innerHTML.trim() == "$0") {
$SUL('#divbindbedsvalue').html('The average rent in
' + $SUL('#hdCity').val() + ',
' + $SUL('#hdStateCode').val() + ' , varies depending on the type of property neighborhood, amenities, and market demand. While exact figures may not be available at this moment, expect higher rents for newer properties and those close to schools, parks, or transport. Whether seeking affordability or luxury, these factors guide your rental decisions');
}
else {
$SUL('#divbindbedsvalue').html('The average rent in
' + $SUL('#hdCity').val() + ',
' + $SUL('#hdStateCode').val() + ' , as of ' + $SUL('#hdnMTmonthname').val() + ' ' + $SUL('#hdnMTyrs').val() + ', is approximately
' + elem.innerHTML + ' per month for
' + roomtypedisplaytext + '. Rent prices can vary depending on the neighborhood and the type of rental property. Rent prices are influenced by factors like neighborhood popularity, proximity to amenities, and the overall housing market trends in the city');
}
//if (proptype == "single" || proptype == "shared" || proptype == "paying-guest") {
// $SUL('#divbindroomcontent').removeClass('hide');
// $SUL('#divbindbedsvalue').addClass('hide');
// $SUL('#divbindroomcontent').html('
The average rent in ' + $SUL('#hdCity').val() + ',' + $SUL('#hdStateCode').val()+', as of November 2024, is approximately ' + elem.innerHTML + ' per month for Single room. Rent prices can vary depending on the neighborhood within Frisco and the type of rental property.
')
//}
//else {
// $SUL('#divbindroomcontent').addClass('hide');
// $SUL('#divbindbedsvalue').removeClass('hide');
// $SUL('#divbindbedsvalue').html('The average rent in ' + jsononedata.city + ', ' + jsononedata.statecode + ', as of November 2024, is approximately $' + jsononedata.onebeds + ' per month for a one-bedroom apartment, $' + jsononedata.twobeds + ' per month for a two-bedroom, $' + jsononedata.threebeds + ' per month for a three-bedroom and $' + jsononedata.fourbeds+' per month for a four-bedroom unit. Rent prices can vary depending on the neighborhood and the type of rental property.');
//}
if (proptype != "All types" && bedtype != "") {
$SUL('#divlinecharcontent').html('
The average rent for' + bedtypedisplaytext + ' ' + roomtypedisplaytext + ' is $' + jsononedata.currmedianrent + ', ' + jsononedata.yoychangespercent + '% ' + jsononedata.per + ' compared to the last year.
')
}
else if (proptype != "All types" && bedtype == "All beds") {
$SUL('#divlinecharcontent').html('
The average rent for ' + roomtypedisplaytext + ' is $' + jsononedata.currmedianrent + ', ' + jsononedata.yoychangespercent + '% ' + jsononedata.per + ' compared to the last year.
')
}
else if (proptype != "All types" && bedtype == "") {
$SUL('#divlinecharcontent').html('
The average rent for ' + roomtypedisplaytext + ' is $' + jsononedata.currmedianrent + ', ' + jsononedata.yoychangespercent + '% ' + jsononedata.per + ' compared to the last year.
')
}
else if (proptype == "All types" && bedtype != "") {
//$SUL('#divlinecharcontent').html('
The average rent for ' + roomtypedisplaytext + ' is $' + jsononedata.currmedianrent + ', ' + jsononedata.yoychangespercent + '% ' + jsononedata.per + ' compared to the last year.
')
$SUL('#divlinecharcontent').html('
The average rent for ' + bedtypedisplaytext + ' for all property types is $' + jsononedata.currmedianrent + ', ' + jsononedata.yoychangespercent + '% ' + jsononedata.per + ' compared to the last year.
')
}
else if (proptype == "All types" && bedtype == "") {
//$SUL('#divlinecharcontent').html('
The average rent for ' + roomtypedisplaytext + ' is $' + jsononedata.currmedianrent + ', ' + jsononedata.yoychangespercent + '% ' + jsononedata.per + ' compared to the last year.
')
$SUL('#divlinecharcontent').html('
The average rent for ' + roomtypedisplaytext + ' is $' + jsononedata.currmedianrent + ', ' + jsononedata.yoychangespercent + '% ' + jsononedata.per + ' compared to the last year.
')
}
},
});
}
function onAllowAlphaNumericOnly(objectid) {
$SUL("#" + objectid).keydown(function (event) {
// Prevent shift key since its not needed
if (event.shiftKey == true) {
event.preventDefault();
}
// Allow Only: keyboard 0-9, numpad 0-9, backspace, tab, left arrow, right arrow, delete
if ((event.keyCode >= 65 && event.keyCode <= 90) || (event.keyCode >= 48 && event.keyCode <= 57) || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 46 || event.keyCode == 188 || event.keyCode == 32 || (event.keyCode >= 96 && event.keyCode <= 105)) {
// Allow normal operation
} else {
// Prevent the rest
event.preventDefault();
}
});}
$SUL(document).ready(function () {
if ($SUL('#txtsearchcityneighbour1').length > 0)
onAllowAlphaNumericOnly("txtsearchcityneighbour1");
if ($SUL('#txtsearchcityneighbour').length > 0)
onAllowAlphaNumericOnly("txtsearchcityneighbour");
if ($SUL('#txtsearchcitycomparemedian').length > 0)
onAllowAlphaNumericOnly("txtsearchcitycomparemedian");
//alert("1");
const headers = document.querySelectorAll(".citiarea > b > a");
headers.forEach(header => {
header.addEventListener("click", (event) => {
event.preventDefault(); // Prevent default link behavior
// Find the parent article and the
element within it
const parentArticle = header.closest(".citiarea");
const content = parentArticle.querySelector("ul");
// Check if this section is already active
const isActive = parentArticle.classList.contains("active");
// Close all open sections
document.querySelectorAll(".citiarea").forEach(article => {
article.classList.remove("active");
article.querySelector("ul").style.display = "none";
});
//parentArticle.querySelector("ul").style.display = "none";
// Toggle the clicked section
if (!isActive) {
parentArticle.classList.add("active");
//content.style.display = "block";
content.removeAttribute("style");
}
});
});
});
//Market comparison city based start
var srchHolder = '';function searchcityneighbourmarket_compare_Trends(holder) {
$SUL("#" + holder).bind('keyup', function (event) {
srchHolder = holder;
if (event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 27) {
var cityval = ""; cityval = $SUL("#" + holder).val();
if (cityval.length > 1) {
Sulekha.Auth.JSONGetData(gProtocol + window.location.host + "/common/city_neighbour_search_sync-call.aspx?term=" + cityval);
} else {
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").removeClass('show hide').addClass("hide");
}
}
});
$SUL("#" + holder).bind('keydown', function (event) {
if (event.keyCode == 27)
$SUL("#" + srchHolder + "-uscanadacity-list-wrap").children('li').remove();
if (event.keyCode == 40 || event.keyCode == 38 || event.keyCode == 13) {
if ($SUL("#" + srchHolder + "-uscanadacity-list-wrap li").length > 0 && (event.keyCode == 40 || event.keyCode == 13)) {
var i = 0, j = 0, totlen = $SUL('#' + srchHolder + '-uscanadacity-list-wrap li').length;
for (i = 0; i < totlen; i++) {
if ($SUL('#autocomplist' + i).hasClass('active')) {
if (event.keyCode == 13) {
j = 1;
$SUL('#autocomplist' + i).removeClass('active');
$SUL('#autocomplist' + i).trigger('click');
$SUL("#" + holder + "-uscanadacity-list-wrap").html("");
break;
}
j = 1;
$SUL('#autocomplist' + i).removeClass('active');
if ($SUL('#autocomplist' + (parseInt(i) + parseInt(1))).length > 0) {
$SUL('#autocomplist' + (parseInt(i) + parseInt(1))).addClass('active').trigger('hover');
break;
} else {
$SUL('#autocomplist0').addClass('active').trigger('hover');
break;
}
}
}
if (j == 0) {
$SUL('#autocomplist0').addClass('active').trigger('hover');
}
}
if ($SUL("#" + srchHolder + "-uscanadacity-list-wrap li").length > 0 && event.keyCode == 38) {
var i = 0, j = 0, totlen = $SUL('#' + srchHolder + '-uscanadacity-list-wrap li').length;
for (i = 0; i < totlen; i++) {
if ($SUL('#autocomplist' + i).hasClass('active')) {
if (i > 0)
j = 1;
$SUL('#autocomplist' + i).removeClass('active');
if ($SUL('#autocomplist' + (parseInt(i) - parseInt(1))).length > 0) {
$SUL('#autocomplist' + (parseInt(i) - parseInt(1))).addClass('active');
break;
} else {
$SUL('#autocomplist' + (totlen - 1)).addClass('active');
break;
}
}
}
if (j == 0) {
$SUL('#autocomplist' + (totlen - 1)).addClass('active');
}
}
}
});
$SUL("#" + holder).bind('click', function () { this.focus(); this.select(); });
$SUL(document).bind('click.' + holder, function (event) {
if ($SUL("#" + holder + "-uscanadacity-list-wrap").length == 1 && $SUL(event.target).attr("id") != holder) {
$SUL("#" + holder + "-uscanadacity-list-wrap").html("");
$SUL("#uscanadacity-list-wrap").attr("class", "hide");
}
});
$SUL("#" + holder).bind('focus', function (event) {
//$SUL("#" + holder + "-uscanadacity-list-wrap").attr('class', 'show');
});}
//Market comparison city based End
function displayForm()
{
$SUL('#divformfilter').removeClass('hide');}
function displayForm_zerorent() {
$SUL('#divformfilter_zerorent').removeClass('hide');}
//market trend samrish home start
function showroomorrentmtrends(service) {
if (service == "rentals") {
$SUL('#hdnuserservicetype').val(service);
$SUL('#roommatemarketstats').addClass('hide');
$SUL('#roommateshomemarkettrendsbtn').removeClass('active');
$SUL('#rentalshomemarkettrendsbtn').addClass('active');
$SUL('#rentalmarketstats').removeClass('hide');
$SUL("#hostService").val(service);
}
else {
$SUL('#hdnuserservicetype').val(service);
$SUL('#roommatemarketstats').removeClass('hide');
$SUL('#roommateshomemarkettrendsbtn').addClass('active');
$SUL('#rentalshomemarkettrendsbtn').removeClass('active');
$SUL('#rentalmarketstats').addClass('hide');
$SUL("#hostService").val(service);
}
}
//market trend samrish home start
function fnsaveadopen_mt(service) {
var processing = "/common/commonv4.aspx";
$SUL('#divsavead > div.room-modal').show();
if (service != undefined) {
if (service.toLowerCase() == "rentals") {
$SUL("#savedRoommatesTab_MT").attr("class", "");
$SUL("#savedRentalsTab_MT").attr("class", "active");
}
else if (service.toLowerCase() == "roommates") {
$SUL("#savedRoommatesTab_MT").attr("class", "active");
$SUL("#savedRentalsTab_MT").attr("class", "");
}
}
$SUL('#ulsaved_mt').html('');
$SUL.ajax({
url: processing + "?type=mysavedadsv2&newlisting=1&service=" + service,
cache: false,
success: function (data) {
if (data != null && data != undefined && data != "Error") {
if (data.html != undefined && data.html != 'undefined' && data.html != '' && data.html != null) {
$SUL('#ulsaved_mt').html(data.html);
//$SUL('div.blurbg').remove();
//$SUL('body').append('');
//$SUL('body').removeClass('blurbody').addClass('blurbody');
$SUL('body').attr('style', 'overflow:hidden');
}
else {
$SUL('#ulsaved_mt').html('');
}
var cnt = data.cnt;
if (cnt == '' || cnt == undefined || cnt == 'undefined' || cnt == null) {
cnt = 0;
}
if (service.toLowerCase() == "rentals") {
if ($SUL('#SaveCntrentals').length > 0) {
$SUL('#SaveCntrentals').text(cnt);
}
else {
$SUL('#savedRentalsTab > a').append('');
$SUL('#SaveCntrentals').text(cnt);
}
}
else if (service.toLowerCase() == "roommates") {
if ($SUL('#SaveCntroommates').length > 0) {
$SUL('#SaveCntroommates').text(cnt);
}
else {
$SUL('#savedRoommatesTab > a').append('');
$SUL('#SaveCntroommates').text(cnt);
}
}
$SUL(document).off('keyup.escsavefrm');
$SUL(document).on('keyup.escsavefrm', function (event) {
if (event.keyCode == 27) {
fncloseSavedads();
}
});
}
}
});}
function switchChangedListTab_MT(service) {
if (service != undefined) {
if (service == "roommates") {
$SUL('#savedRoommatesTab').attr('class', 'active');
$SUL('#savedRentalsTab').attr('class', '');
fnsaveadopen_mt('roommates');
}
else {
$SUL('#savedRentalsTab').attr('class', 'active');
$SUL('#savedRoommatesTab').attr('class', '');
fnsaveadopen_mt('rentals');
}
}
}
function fnsavead_MT(pagetype, adidL) {
var processing = "/common/commonv4.aspx";
var service = $SUL("#hostService").val();
if (service == undefined || service == "") {
service = $SUL("#hostPService").val();
}
if ($SUL('#loglinks').length == 0) {
fnauthsuccess();
}
//$SUL('#divsavead').attr('class', 'show');
var adid = $SUL('#adid2').val();
if (pagetype == "listing") {
adid = adidL;
}
if (pagetype == "listing") {
$SUL("#saveAd" + adid).html(" ");
if ($SUL("#grdSaveAd" + adid).length == 1) {
$SUL("#grdSaveAd" + adid).html("
Saving...
").removeClass("hovered").addClass("hovered");
$SUL("#tblSaveAd" + adid).html("").removeClass("hovered").addClass("hovered");
$SUL("#tblsmrySaveAd" + adid).html("
Saving...
").removeClass("hovered").addClass("hovered");
}
if ($SUL("li[data-id=saveAd" + adid + "]").length == 1) {
$SUL("li[data-id=saveAd" + adid + "]").html(" ");
}
}
else {
$SUL("#saveAd").html("");
}
$SUL.ajax({
url: processing + "?type=savead&adid=" + adid + "&service=" + service,
cache: false,
success: function (data) {
data = Sulekha.Common.trim(data);
if (data != null && data != undefined && data != "Error") {
fncountsavead_MT(pagetype, adid);
}
else {
$SUL("#saveAd" + adid).html("");
if ($SUL("li[data-id=saveAd" + adid + "]").length == 1) {
$SUL("li[data-id=saveAd" + adid + "]").html("Save");
}
}
}
});}
function fncountsavead_MT(pagetype, adidL) {
var processing = "/common/commonv4.aspx";
var service = $SUL("#hostService").val();
if (service == undefined || service == "") {
service = $SUL("#hostPService").val();
}
var adid = $SUL('#adid2').val();
if (pagetype == "listing") {
adid = adidL;
}
if (adid != "" && adid != undefined) {
$SUL.ajax({
url: processing + "?type=savecount&adid=" + adid + "&service=" + service,
cache: false,
success: function (o) {
if (o != null && o != undefined && o != "Error") {
var text = '';
var totalcnt = o[0].value;
var myadcnt = o[1].value;
var isadsaved = o[2].value;
if (isadsaved == 0) {
$SUL("#saveAd" + adid).html(" ");
if ($SUL("#grdSaveAd" + adid).length == 1) {
$SUL("#grdSaveAd" + adid).html("
Save this ad
").removeClass("hovered").attr("onclick", "fnloginsave('listing','" + adid + "')");
$SUL("#tblsmrySaveAd" + adid).html("
Save this ad
").removeClass("hovered").attr("onclick", "fnloginsave('listing','" + adid + "')");
$SUL("#tblSaveAd" + adid).html("").removeClass("hovered active").attr("onclick", "fnloginsave('listing','" + adid + "')");
}
if ($SUL("li[data-id=saveAd" + adid + "]").length == 1) {
$SUL("li[data-id=saveAd" + adid + "]").html(" Save");
}
}
else {
$SUL("#saveAd" + adid).html("");
if ($SUL("#grdSaveAd" + adid).length == 1) {
$SUL("#grdSaveAd" + adid).html("
Saved ad
").removeClass("hovered").attr("onclick", "fnsaveadopen_mt('" + service + "', 'listing')");
$SUL("#tblsmrySaveAd" + adid).html("
Saved
").removeClass("hovered").attr("onclick", "fnsaveadopen_mt('" + service + "', 'listing')");
$SUL("#tblSaveAd" + adid).html("").removeClass("hovered active").addClass("active").attr("onclick", "fnsaveadopen_mt('" + service + "', 'listing')");
try { ga('send', 'event', 'mapview', 'clicked on savead', ''); } catch (ex) { }
}
if ($SUL("li[data-id=saveAd" + adid + "]").length == 1) {
$SUL("li[data-id=saveAd" + adid + "]").html("Saved");
}
}
}
}
});
}
}
//Start samarish prefil
function fncategoryposthrefdisable() {
$SUL("a.categorypost").each(function () {
console.log(1);
$SUL(this).attr("data-oldhref", $SUL(this).attr("href"));
$SUL(this).removeAttr("href");
$SUL(this).attr("href", "javascript:void(0);");
});}
function fnposttomarkettrends(SearchUrl) {
var gethdnobjcategorytype = "";
if ($SUL('#hdnobjcategorytype').length > 0) {
gethdnobjcategorytype = $SUL('#hdnobjcategorytype').val();
}
$SUL('