var SavePropertyUtility=new function(){function n(n,i){if(typeof i=="undefined"&&(i=""),typeof redsso!="undefined"&&typeof window.redsso.settings!="undefined"&&window.redsso.settings.mozaic)return getAppRoot()+"/account/savepropertymozaic.html?listingId="+n+"&listingNumber="+i+"&onresize=WidgetLoginUtility.resizeoverlay";var r=t.refreshParent?"1":"0";return getAppRoot()+"/account/saveproperty.aspx?overlay=1&listingId="+n+"&onresize=WidgetLoginUtility.resizeoverlay&refreshParent="+r}var t=this;this.refreshParent=!0;this.launchOverlay=function(t,i){if($("#hiddenLink").length===0&&($("body").append("<a id='hiddenLink' class='iframe'><\/a>"),console.log($("#hiddenLink").length)),rbw.ui.ListingSearchVersion!=3&&$("#hiddenLink").colorbox({width:570,height:320,opacity:.7,close:"<span><\/span>",iframe:!0,scrollbars:!1,speed:0,transition:"none"}),typeof i=="undefined"&&(i=""),rbw.context.isLoggedIn()||rbw.utils.isAdminSite())typeof rbw.ui!="undefined"&&typeof rbw.ui.ListingSearchVersion!="undefined"&&rbw.ui.ListingSearchVersion==3?($("#hiddenLink.cboxElement").first().attr("href",n(t,i)),$("#hiddenLink.cboxElement").first().click()):($("#hiddenLink").attr("href",n(t,i)),$("#hiddenLink").click());else{if(typeof snaCreate!="undefined")return snaCreate("SavePropertyUtility.launchOverlay("+t+",'"+i+"');");WidgetLoginUtility.setSavePropertyKeys(t,i);typeof rbw.ui!="undefined"&&typeof rbw.ui.LoginSupport!="undefined"&&typeof rbw.ui.LoginSupport.loginForSaveProperty=="function"?rbw.ui.LoginSupport.loginForSaveProperty():($("#hiddenLink").attr("href",WidgetLoginUtility.getHref("login")),$("#hiddenLink").click())}};this.showSavePropertyBSModal=function(n){$("#saveproperty-modal-content").html('<iframe src="'+n+'" />');$("#modal-save-property-id").modal("show")};this.launchBootStrapOverlay=function(t,i){var u,r;if(WidgetLoginUtility._useBootstrapModal=!0,typeof i=="undefined"&&(i=""),rbw.context.isLoggedIn()||rbw.utils.isAdminSite())u=n(t,i),this.showSavePropertyBSModal(u);else{if(typeof snaCreate!="undefined")return snaCreate("SavePropertyUtility.launchBootstrapOverlay("+t+",'"+i+"');");WidgetLoginUtility.setSavePropertyKeys(t,i);typeof rbw.ui!="undefined"&&typeof rbw.ui.LoginSupport!="undefined"&&typeof rbw.ui.LoginSupport.loginForSaveProperty=="function"?rbw.ui.LoginSupport.loginForSaveProperty():(r=WidgetLoginUtility.getHref("login"),rbw.ui.ListingSearchVersion==3&&rbw.Utils.SecureHostHeader==""?($("#hiddenLink.cboxElement").first().attr("href",r),$("#hiddenLink.cboxElement").first().click()):window.location.href=r)}};this.saveOrUnsaveproperty=function(n,t,i,r){if(r.hasClass("active")){if(typeof i=="undefined")return;$.ajax({type:"GET",url:Utils.AppPath+"/include/ajax/api.aspx",data:"op=RemoveSavedProperty&customerListingId="+i,dataType:"json",contentType:"application/json; charset=utf-8"}).done(function(n){n!=undefined&&n.IsSuccess&&(r.removeClass("active"),r.find("span").text("Save"),$("#account-savedlistinglist").length&&location.reload())})}else this.launchBootStrapOverlay(n,t)}},SaveSearchUtility=new function(){function t(t,i,r){return getAppRoot()+"/account/savesearch.aspx?overlay=1&expandcb="+(t?1:0)+"&listing="+(i?i:"")+"&displayMode="+(r?r:"")+(n.contains("ListingSearch")?"&ListingSearchID="+n.get("ListingSearch"):"")+(n.contains("ListingSearchID")?"&ListingSearchID="+n.get("ListingSearchID"):"")+"&onresize=CustomerLogin.resizeoverlay"+(n.contains("perid")==!0&&isAdminApp()==!0?"&perid="+n.get("perid"):"")}var i=this,n;this.refreshParent=!0;n=new Querystring;this.launchOverlay=function(n,i){if($("#hiddenLink").length===0&&$("body").append("<a id='hiddenLink' class='iframe'><\/a>"),$("#hiddenLink").colorbox({width:570,height:320,opacity:.7,close:"<span><\/span>",iframe:!0,scrollbars:!1,speed:0,transition:"none"}),rbw.context.isLoggedIn()||rbw.utils.isAdminSite())$("#hiddenLink").attr("href",t(!1,n,i)),$("#hiddenLink").click();else{if(typeof snaCreate!="undefined")return snaCreate("SaveSearchUtility.launchOverlay("+n+',"'+i+'")');WidgetLoginUtility.setSaveSearchKeys(n,i);$("#hiddenLink").attr("href",WidgetLoginUtility.getHref("login"));$("#hiddenLink").click()}}},WidgetLoginUtility=new function(){function l(){return window.location.href.toString().toLowerCase().indexOf("brokeroffice.admin")>=0}var f=this,e,r,n,u,o,s,h,c,t,i=null;this.getLoginAction=function(){return i};this.setRatingKeys=function(i,f,e,o){t="rating";r=i;n=f;u=e;s=o};this.setNotesKeys=function(i,f,s,c,l,a){t="notes";e=i;r=f;n=s;o=c;h=l;u=a};this.setInrixKeys=function(){t="inrix"};this.setInrixKeys=function(n){t="inrix";i=n};this.setSavePropertyKeys=function(r,u){t="saveproperty";n=r;i="saveproperty-"+r;this._useBootstrapModal&&(i="saveproperty-bmodal-"+r);typeof u!="undefined"&&u.length&&(i+="-"+u)};this.setSaveSearchKeys=function(r,u){t="savesearch";n=r;c=u;i="savesearch"};this.loginRedirect=function(i){var f=!0,l;switch(t){case"rating":$(document.body).trigger("SetRatingAfterRedirect",[{listingNumber:r,listingId:n,customerListingId:u,ratingValue:s}]);break;case"notes":f=!1;l=new rbw.ui.HistoryNotes;l.saveNote(e,n,o,0,r,h).done(function(){parent.window.location.href=window.location.href});break;case"inrix":$(document.body).trigger("SetInrixAfterRedirect",[]);break;case"saveproperty":f=!1;SavePropertyUtility.launchOverlay(n);break;case"savesearch":f=!1;SaveSearchUtility.launchOverlay(n,c)}typeof Search!="undefined"?($(document).trigger("loginupdate",[{isLoggedIn:!0,loginName:i,canReloadView:!0}]),$(".iframe").colorbox.close()):typeof redirectToOnSuccessPage!="undefined"&&typeof redirectToOnSuccessPage=="function"?redirectToOnSuccessPage():f&&(parent.window.location.href=window.location.href)};this.register=function(){$("#hiddenLink").attr("href",WidgetLoginUtility.getHref("signup"));$("#hiddenLink").click()};this.signin=function(){$("#hiddenLink").attr("href",WidgetLoginUtility.getHref("login"));$("#hiddenLink").click()};this.getAppRoot=function(){return l()?"/brokeroffice.admin/agent/public":rbw.context.siteUrl};this.getHref=function(n){return this.getAppRoot()+"/account/"+n+".aspx?formtype="+n+"&onregister=WidgetLoginUtility.register&onsignin=WidgetLoginUtility.signin&onresize=WidgetLoginUtility.resizeoverlay&onloginsuccess=WidgetLoginUtility.loginRedirect&onsuccess="+this.getOnSuccess(!0)};this.resizeoverlay=function(n,t){$("#cboxIframe").css("width",n+"px");$("#cboxIframe").css("height",t+"px");$("#cboxLoadedContent").css("width",n+"px");$("#cboxLoadedContent").css("height",t+"px");$("#hiddenLink").colorbox.resize({innerWidth:n,innerHeight:t});f.overlayTopPosition&&setTimeout(function(){$("#colorbox").css("top",parseInt(f.overlayTopPosition)+"px")},10)};this.getOnSuccess=function(n){var t=CurrentUrl.getRedirectParams(i);return n?encodeURIComponent(encodeURIComponent(window.location.href)+t):window.location.href+decodeURIComponent(decodeURIComponent(t))}},CustomerLogin=new function(){function p(){return h===null&&(h=window.location.href.toLowerCase().indexOf("savesearch.aspx")>=0),h}function u(n,i){var r="CustomerLogin.showlogininfo";return i&&(r="CustomerLogin.closeOverlay"),getAppRoot()+"/account/"+n+".aspx?formtype="+n+"&onregister=CustomerLogin.register&onsignin=CustomerLogin.signin&onresize=CustomerLogin.resizeoverlay&onloginsuccess="+r+(t.contains("embed")?"&embed="+t.get("embed"):"")+"&onsuccess="+a(!0)}function a(t){var i=CurrentUrl.getRedirectParams(n);return t?encodeURIComponent(encodeURIComponent(window.location.href)+i):window.location.href+decodeURIComponent(decodeURIComponent(i))}function f(){return typeof r!="undefined"&&typeof r.firstName!="undefined"&&r.firstName!=""?!0:!1}function o(){return isAdminApp()&&readCookie("rBW-ListingSearch")!=""?!0:!1}function s(n){return getAppRoot()+"/account/savesearch.aspx?overlay=1&expandcb="+(n?1:0)+(t.contains("ListingSearch")?"&ListingSearchID="+t.get("ListingSearch"):"")+(t.contains("ListingSearchID")?"&ListingSearchID="+t.get("ListingSearchID"):"")+"&onresize=CustomerLogin.resizeoverlay"+(t.contains("perid")==!0&&isAdminApp()==!0?"&perid="+t.get("perid"):"")+(t.contains("savedSearchTypeId")?"&savedSearchTypeId="+t.get("savedSearchTypeId"):"")}function l(n,i){return(typeof i=="undefined"&&(i=""),typeof redsso!="undefined"&&typeof window.redsso.settings!="undefined"&&window.redsso.settings.mozaic)?getAppRoot()+"/account/savepropertymozaic.html?listingId="+n+"&listingNumber="+i+"&onresize=CustomerLogin.resizeoverlay":getAppRoot()+"/account/saveproperty.aspx?overlay=1&listingId="+n+"&listingNumber="+i+"&onresize=CustomerLogin.resizeoverlay"+(t.contains("perid")==!0&&isAdminApp()==!0?"&perid="+t.get("perid"):"")+"&refreshParent=1"}function v(){var i,f;if(n!=null){if(i=function(){var n=function(){$("#hiddenLink").click()};if(c){$(document).one("cbox_closed",n);$("#cboxContent #cboxClose").length>0&&$("#cboxContent #cboxClose").click()}else n()},n.toLowerCase()==="savesearchv3")$(document).on("init-search-options-modal",function(){CustomerLogin.saveSearch()});if(n.toLowerCase()==="launchsearchcriteriabox")$(document).one("maploaded",InrixDriveTimeUtility.launchSearchcriteriaBox);if(n.toLowerCase()=="savesearch"&&($("#hiddenLink").attr("href",s(!1)),i()),n.toLowerCase()=="getalerts"&&($("#hiddenLink").attr("href",s(!0)),i()),n.toLowerCase().indexOf("saveproperty-bmodal")!==-1){var t=n.split("-"),u=t[2],r="";t.length>3&&(r=t[3]);f=l(u,r);SavePropertyUtility.showSavePropertyBSModal(f)}else if(n.toLowerCase().indexOf("saveproperty")!==-1){var t=n.split("-"),u=t[1],r="";t.length>2&&(r=t[2]);$("#hiddenLink").attr("href",l(u,r));i()}n=null}}function w(n,t,i){$(".modal:visible").modal("hide");t||(n=!0);n?window.location.reload():t&&(window.location.href=i)}function b(){return}function y(){}function k(n){var f=$(window).height()-50,i=$(n),e=$(i.find("html")),r=$(i.find("body")),o=$(i.find("#Master_Viewport")),s=$("> .popupContainer",r),t=Math.max(e.outerHeight(),r.outerHeight(),o.outerHeight(),s.outerHeight())+18,u=Math.max(e.outerWidth(),r.outerWidth(),o.outerWidth(),s.outerWidth())+18;t>f&&(t=f);$("#colorbox").height(t+153);$("#cboxWrapper").height(t+100);$("#cboxContent, #cboxMiddleLeft, #cboxMiddleRight").height(t+50);$(".cboxiframe, #cboxLoadedContent").height(t);$("#colorbox, #cboxWrapper").css({minWidth:u+50});$(".cboxIframe, #cboxContent, #cboxTopCenter, #cboxBottomCenter, #cboxLoadedContent").css({minWidth:u});$(".cboxIframe").colorbox.resize({innerWidth:u,innerHeight:t})}function d(s){var l,a;$(window).resize(y);$(document).bind("cbox_complete",function(){document.location.href.contains("recolorado")||y()});var h=$('[data-loginoverlaytype="fixed"]'),w=h.length>0,k=h.length>0?h.attr("data-loginoverlaytop"):!1;r=s;l=!0;$("#customer-login").length===0&&(l=!1,$("body").append("<div id='customer-login' style='display:none'><\/div>"));$("#hidden-link").length===0&&$("#customer-login").append('<a id="hiddenLink" class="iframe"><\/a>');$("#customer-login-register").length===0&&$("#customer-login").append('<a id="customer-login-register" href="#" class="iframe"><\/a>');$("#customer-login-sigin").length===0&&$("#customer-login").append('<a id="customer-login-signin" href="#" class="iframe"><\/a>');$(document).bind("cbox_open",function(){c=!0;$("body").css("overflow","hidden")});$(document).bind("cbox_closed",function(){c=!1;$("body").css("overflow","auto")});$(document).bind("loginupdate",function(t,i){if(!i.reloadPage||typeof customLoggedinAction=="function"||window.location.reload(),i.isLoggedIn){if(r.firstName=i.loginName,$("#customer-login .welcome h2 span").html(i.loginName),e.TargetAreaSearch&&(e.TargetAreaSearch.isTargetArea||e.TargetAreaSearch.enrolledInMarketWatch)?($(".customerLoggedIn").hide(),$(".customerLoggedOff").hide(),$(".customerTargetAreaSearch").show()):($(".customerLoggedIn").show(),$(".customerLoggedOff").hide(),$(".customerTargetAreaSearch").hide()),$("a[href*='/Account/CustomerLogout.aspx']").show(),$("div[role='navigation']").attr("class")!=undefined){var u=$("div[role='navigation']").attr("class").split(" ")[0];$("div[role='navigation']").load(location.href+" ."+u)}typeof customLoggedinAction=="function"&&customLoggedinAction(i.loginName);n?v():$(".iframe").colorbox.close()}else r.firstName="",$("#customer-login .welcome h2 span").html(""),$(".customerLoggedIn").hide(),$(".customerLoggedOff").show(),$(".customerTargetAreaSearch").hide(),$("a[href*='/Account/CustomerLogout.aspx']").hide()});$(window).resize(function(){b()});$("#mapsearch-left-customer").css("height","auto");$("#customerLoginSpinner").fadeOut();$(".customer-login-spinner").fadeOut();f()?i.showlogininfo(r.firstName):o()?(i.hideLoginInfo(),$("#customer-login-welcome").hide(),$(".secondary-nav").hide()):i.hideLoginInfo();l&&$("#customer-login").show();$("#customer-login-register").attr("href",u("signup"));$("#customer-login-signin").attr("href",u("login"));$(".iframe").colorbox({width:"400",height:"200",iframe:!0,close:"",fixed:w,top:k});$().bind("cbox_load",function(){$("#cboxIframe").attr("scrolling","yes");setTimeout(function(){$("#cboxClose span").css("display","block")},1e3)});$().bind("cbox_complete",function(){});a=!1;$(document).bind("criteriachange",function(n,i){a||(e.load(i.activeTab),t.contains("ListingSearch")&&$("#search-summary h2").after("<p class='saved-search-info'>You are viewing a saved search<\/p>").hide().show("fast"),a=!0)});p()&&($("#customer-login-signout").hide(),$("#save-search-link").hide(),$("#email-alert-link").hide());f()&&t.contains("nextaction")&&(n=t.get("nextaction"),v())}var i=this,r,n=null,h=null,c=!1,t=new Querystring,e=new SearchSummary;this.SearchSummary=e;this.savedSearchWindowName=null;this.overlayTopPosition=null;this.test=function(){alert("inside")};this.getHref=u;this.isLoggedIn=f;this.isProxyLoggedIn=o;this.getLoginAction=function(){return n};this.redirectToSucessPage=w;this.showlogininfo=function(n,t){$(document).trigger("loginupdate",[{isLoggedIn:!0,loginName:n,canReloadView:!0,reloadPage:t}])};this.closeOverlay=function(){this.showlogininfo();$("#search-options-modal .close").click()};this.hideLoginInfo=function(){var n=typeof vowStatusId!="undefined"&&(window.vowStatusId===1||window.vowStatusId===4);$(document).trigger("loginupdate",[{isLoggedIn:!1,canReloadView:!0,reloadPage:n}])};this.saveSearch=function(){function t(){var n=$(".search-numresults-number:first").text()||$(".mapsearch-count-total:first").text()||$(".mapsearch-results-paging-properties:first").text();return n!==""?parseInt(n.replace(/,/g,"")):0}var i=t();if(i>1e5){alert("Your search returned too many properties and can not be saved. Please filter your search to narrow your results.");return}if(f()||o())$("#hiddenLink").attr("href",s(!1)),$("#hiddenLink").click();else{if(typeof snaCreate!="undefined")return snaCreate("CustomerLogin.saveSearch();");n="SaveSearch";typeof rbw.ui!="undefined"&&typeof rbw.ui.LoginSupport!="undefined"&&typeof rbw.ui.LoginSupport.loginForSaveSearch=="function"?rbw.ui.LoginSupport.loginForSaveSearch({onSuccess:a(!1)}):($("#hiddenLink").attr("href",u("login")),$("#hiddenLink").click())}};this.saveProperty=function(t,i){if(typeof i=="undefined"&&(i=""),f()||o())$("#hiddenLink").attr("href",l(t,i)),$("#hiddenLink").click();else{if(typeof snaCreate!="undefined")return snaCreate("CustomerLogin.saveProperty("+t+",'"+i+"');");n="SaveProperty-"+t+(i.length>0?"-"+i:"");$("#hiddenLink").attr("href",u("login"));$("#hiddenLink").click()}};this.getEmailAlerts=function(){f()||o()?($("#hiddenLink").attr("href",s(!0)),$("#hiddenLink").click()):(n="GetAlerts",$("#hiddenLink").attr("href",u("login")),$("#hiddenLink").click())};this.myDashboard=function(){window.location.href="/account/customerhome.aspx"};this.mySavedSearches=function(){var n=getAppRoot()+"/account/savedsearchlist.aspx";typeof i.savedSearchWindowName!="undefined"&&i.savedSearchWindowName?window.open(n,i.savedSearchWindowName):window.location.href=n};this.mySavedProperties=function(){window.location.href=getAppRoot()+"/account/savedlistinglist.aspx"};this.register=function(){rbw.ui.ListingSearchVersion!=3&&$("#customer-login-register").click()};this.signin=function(t,i,r){if(t&&t.gotoBrokerSignInPage&&rbw.context.siteUrl&&rbw.context.siteUrl.indexOf("http")>-1){var f=t.referer?t.referer:"";location.href=rbw.context.siteUrl+"/account/customerlogin.aspx?referer="+encodeURIComponent(f)}else rbw.ui.ListingSearchVersion==3?($("#hiddenLink").attr("href",u("login",r)),$("#hiddenLink").click()):(typeof i!="undefined"&&(n=i),$("#customer-login-signin").click())};this.load=function(n){d(n)};this.signOut=function(){$("#customer-login iframe").length==0&&$("#customer-login").append("<iframe name='customerLogoffFrame' style='display:none' onload='CustomerLogin.hideLoginInfo();' />");window.open(getAppRoot()+"/account/customerlogout.aspx","customerLogoffFrame")};this.resizeoverlay=function(){return};this.repositionOverlay=function(){i.overlayTopPosition&&setTimeout(function(){$("#colorbox").css("top",parseInt(i.overlayTopPosition)+"px")},10)};this.resizeModal=function(n){typeof sm3!="undefined"&&$(".modal-body iframe[src*='login'], .modal-body iframe[src*='signup']").length?sm3.resizeModalByIframe(n):k(n)}},lnfapi=lnfapi||{},orgIdMappings;lnfapi.call=function(n,t,i){$.ajax({url:"/include/ajax/api.aspx?op=LNFAPI&useLT=false&type="+n+"&parameters="+encodeURIComponent(t),dataType:"json",success:i})};lnfapi.getListingData=function(n,t,i){var r;if(n===null||typeof n=="undefined")return console.error("Required parameter 'mlsNumber' is missing."),null;if(t===null||typeof t!="string")return console.error("Required parameter 'orgId' is missing."),null;if(i===null||typeof i!="function")return console.error("Required parameter 'callback' is missing."),null;if(r=lnfapi.orgIdToLnfMlsCompanyId(t),r===null)return console.error("Required parameter 'orgId' does not have an MlsCompanyId mapping. You may need to update the mapping."),null;var u="selectStr=PropertyWebsite,RentalApplicationURL,MlsCompanyId&query="+encodeURIComponent('MlsNumber="'+n+'"')+" AND "+encodeURIComponent("MlsCompanyId="+r),f=encodeURIComponent(u);lnfapi.call("ListingData",u,i)};lnfapi.orgIdToLnfMlsCompanyId=function(n){if(n===null||typeof n=="undefined")return console.error("Required parameter 'orgId' is missing."),null;n=n.toString().toLowerCase();var t=orgIdMappings[n];return t===undefined&&(t=null),t};lnfapi.lnfMlsCompanyIdToOrgId=function(n){if(n===null||typeof n=="undefined")return console.error("Required parameter 'mlsCompanyId' is missing."),null;n=n.toString().toLowerCase();for(var t in orgIdMappings)if(orgIdMappings[t].toLowerCase()==n)return t;return null};orgIdMappings={varar:"1",mdmris:"2",varein:"4",mdbmls:"100","patrend-v":"16",vacbrar:"32","mdcar-v":"64",descar:"128","vawaar-v":"256","palvmls-v":"512",ncaaaor:"1024","paksml-v":"2048","varvar-v":"4096",njgsmls:"8192",vanrv:"16384",vaesar:"32768","njmcmls-r":"65536","njmomls-v":"262144",njcmbor:"1048576","nctrian-v":"2097152",vascaor:"4194304",valmls:"8388608",ncrvlg:"16777216","njsjs-v":"67108864",vaspbor:"134217728",vacaar:"268435456","gagaar-v":"536870912"};lnfapi.getOfficeData=function(n,t){var i="selectStr=OfficeWebsite,ManagerSet,CountyServedSet,LanguageSet,MarketSpecialtySet&query="+encodeURIComponent('OfficeNumber="'+n+'"');lnfapi.call("OfficeData",i,t)};lnfapi.getAgentData=function(n,t){var i="selectStr=DisplayTestimonialTreeRating,DisplayZillowRating,PhotoURL,Email,CompanyBrand,MobileServiceCarrierExtension,PhoneSet,CountyServedSet,CityServedSet,AgentWebsitesLogoURL,Biography&query="+encodeURIComponent('AgentNumber="'+n+'"');lnfapi.call("AgentData",i,t)};lnfapi.getTeamData=function(n,t){var i="selectStr=TeamWebsiteBiography&query="+encodeURIComponent('TeamLeadAgentNumber="'+n+'"');lnfapi.call("AgentTeamData",i,t)};lnfapi.getMarketMinuteData=function(n,t,i,r,u){function h(){f="selectStr=MarketMinuteURL&query="+encodeURIComponent('ReportType="City" AND State="'+r+'" AND ReportName.Contains("'+n+'")');lnfapi.call(e,f,function(n){if(n.Results[0]&&n.Results[0].MarketMinuteURL){u(n);return}o()})}function o(){f="selectStr=MarketMinuteURL&query="+encodeURIComponent('ReportType="ZipCode" AND State="'+r+'" AND ReportName="'+t+'"');lnfapi.call(e,f,function(n){if(n.Results[0]&&n.Results[0].MarketMinuteURL){u(n);return}s()})}function s(){f="selectStr=MarketMinuteURL&query="+encodeURIComponent('ReportType="County" AND State="'+r+'" AND ReportName="'+i+'"');lnfapi.call(e,f,u)}var e="MarketMinuteData",f;n?h():t?o():s()},function(n){n.fn.jumpSearchSlider=function(t){function e(n){var t=n.city,r="",f=n.totalareahigh?n.totalareahigh:n.totalarealow,c=i.showPrice?'<p class="lf_listing__information__price">'+n.price+"<\/p>":"",e,l,u;n.city!=""&&n.state!=""&&(t=t+", ");t=t+n.state;n.zip&&(t+=" "+n.zip);n.beds&&(r+=n.beds,n.baths&&(r+=", "));n.baths&&(r+=n.baths,f&&(r+=", "));f&&(r+=Utils.Format.addCommas(f)+" sq ft");e="";n.isIDXListing&&typeof n.courtesyOf=="string"&&n.courtesyOf.length>0&&(e='<div class="lf-results-courtesy-text '+n.courtesyCssClass+'">'+n.courtesyOf+"<\/div>");var s=i.agentExtension+n.listingurl,h="",a=i.largeImage?n.largeimagefilepath:n.imagefilepath;return n.listingtypeid==5&&i.redirectRentals&&(s="http://rental.longandfoster.com/sso/longandfoster/consumer?id_of_mls="+n.orgid+"&mls_id="+n.listingNumber,h=' target="_blank"'),l=o(n)||"",u='<div class="lf_block" tabindex="0" data-carlistingid="'+n.listingid+'"><a href="'+s+'" class="lf_block" tabindex="0" data-carlistingid="'+n.listingid+'"'+h+'><figure class="lf_listing__photo lf_photo"><img '+(i.lazyLoad==="ondemand"||i.lazyLoad==="progressive"?"data-lazy":"src")+'="'+a+'" class="img-responsive">'+l+"<\/figure><\/a>"+e+'<div class="lf_listing__information"><a href="'+s+'" class="lf_block" tabindex="0" data-carlistingid="'+n.listingid+'"'+h+">",u+=i.showPriceAboveAddress?c:"",u+='<p class="lf_listing__information__address">'+n.address+'<\/p><address><div class="lf_listing_citystatezip">'+t+"<\/div>",u+=i.showPriceAboveAddress?"":c,u+('<div class="lf_listing_bedsbathssqft">'+r+'<\/div><\/address><span class="lf_call-to-action">Learn More<\/span><\/a><\/div><\/div>')}function o(n){var t,r;if(!n)return null;if(t=null,i.openHouse&&n.openhouse)return t="OPEN HOUSE {0}".format(n.openhouse),'<figcaption class="lf_photo__tag">{0}<\/figcaption>'.format(t);var u=(new Date).midnight(),f=n.MLSStatusID!=1,e=n.listingtypeid==2&&n.PricePerSQFT&&n.PricePerSQFT!="0.0",o=n.openhouse&&new Date(n.openhouse).midnight()<=u.clone().addDays(4),s=n.PriceChangeDays&&n.PriceChangeDays<=7,h=n.ListDateDtm&&new Date(n.ListDateDtm).midnight()>=u.clone().addDays(-7);return f?n.MLSStatusID==="2"?(r=new Date(n.SoldDate),t="SOLD {0}: {1}".format(r.getMonth()+1+"/"+r.getDate()+"/"+r.getFullYear(),n.SoldPrice)):t=n.MLSStatusName:e?t="${0}/SQ FT".format(rbw.Utils.Format.addCommas(Math.round(n.PricePerSQFT))):o?t="OPEN HOUSE {0}".format(n.openhouse):s?t="PRICE CHANGE ${0}".format(rbw.Utils.Format.addCommas(n.PriceChange)):h&&(t="NEW LISTING"),t?'<figcaption class="lf_photo__tag">{0}<\/figcaption>'.format(t):null}function s(n,t){for(var f,r='<div class="slider photo-carousel-responsive">',u=0;u<n.length;u++)r+="<div>"+e(n[u])+"<\/div>";r+="<\/div>";t.html(r);f=i.slidesToShow>1?2:1;t.find(".photo-carousel-responsive").slick({dots:!1,autoplay:i.autoplay,autoplaySpeed:i.autoplaySpeed,infinite:!0,speed:300,lazyLoad:i.lazyLoad,slidesToShow:i.slidesToShow,slidesToScroll:i.slidesToScroll,prevArrow:'<button type="button" data-role="none" class="slick-prev" aria-label="Previous" tabindex="0" role="button"><\/button>',nextArrow:'<button type="button" data-role="none" class="slick-next" aria-label="Next" tabindex="0" role="button"><\/button>',responsive:[{breakpoint:767,settings:{slidesToShow:f,slidesToScroll:f}},{breakpoint:480,settings:{slidesToShow:1,slidesToScroll:1}}]})}function h(t){var u=[],f,e,r,s,o;for(n.each(t,function(n,t){i.largeImage?t.largeimagecount&&t.largeimagecount>0&&u.push(t):t.imagecount&&t.imagecount>0&&u.push(t)}),f={},e=[],r=0,s=u.length;r<s;++r)o=u[r].address,f[o]||(f[o]=r,e.push(u[r]));return e}function c(t,i){n.ajax({url:t,type:"GET",async:!0,dataType:"json",success:function(t){try{var u=0,e=function(){if(typeof n.fn.slick!="function"){u<100&&setTimeout(e,Math.min(50*++u,1e3));return}r=h(t.listing);i>0&&(r=r.sort(function(n,t){return n.isAgentListing<t.isAgentListing?1:n.isAgentListing>t.isAgentListing?-1:0}));r.length&&s(r,f);f.trigger("create",[r.length])};e()}catch(o){typeof console!="undefined"&&console.error("Error: %s",o.message)}}})}var i=n.extend({slidesToShow:3,slidesToScroll:3,autoplay:!0,autoplaySpeed:5e3,minResults:10,progressiveLocationSearch:!1,showPrice:!1,showPriceAboveAddress:!0,cacheMinutes:15,lazyLoad:"ondemand",moreCriteria:"",redirectRentals:!1,agentExtension:"",openHouse:!1,largeImage:!1,sortPersonID:0},t),f=this,r,u=i.agentExtension+"/listing/jumpsearchlistings.aspx?MaxResults="+i.maxResults+"&JumpSearch="+i.jumpSearchId+"&CacheMinutes="+i.cacheMinutes+(i.moreCriteria?"&"+i.moreCriteria:"");return i.progressiveLocationSearch&&(u+="&pls="+i.minResults),i.sortPersonID>0&&(u+="&SortPersonID="+i.sortPersonID),c(u,i.sortPersonID),Date.prototype.addDays=Date.prototype.addDays||function(n){return new Date(this.setTime(864e5*n+this.valueOf()))&&this},Date.prototype.midnight=Date.prototype.midnight||function(){return new Date(this.setHours(0,0,0,0,0))},Date.prototype.clone=Date.prototype.midnight||function(){return new Date(this.valueOf())},this}}(jQuery)