(function(a){PaginationCalculator=function(b,c){this.maxentries=b;this.opts=c};a.extend(PaginationCalculator.prototype,{numPages:function(){return Math.ceil(this.maxentries/this.opts.items_per_page)},getInterval:function(f){var d=Math.floor(this.opts.num_display_entries/2);var e=this.numPages();var c=e-this.opts.num_display_entries;var g=f>d?Math.max(Math.min(f-d,c),0):0;var b=f>d?Math.min(f+d+(this.opts.num_display_entries%2),e):Math.min(this.opts.num_display_entries,e);return{start:g,end:b}}});PaginationRenderers={};PaginationRenderers.defaultRenderer=function(b,c){this.maxentries=b;this.opts=c;this.pc=new PaginationCalculator(b,c)};a.extend(PaginationRenderers.defaultRenderer.prototype,{createLink:function(b,e,d){var f,c=this.pc.numPages();b=b<0?0:(b<c?b:c-1);d=a.extend({text:b+1,classes:""},d||{});if(b==e){f=a("<span class='current'>"+d.text+"</span>")}else{f=a("<a>"+d.text+"</a>").attr("href",this.opts.link_to.replace(/__id__/,(b+1)))}if(d.classes){f.addClass(d.classes)}f.data("page_id",b);return f},appendRange:function(c,f,g,b,e){var d;for(d=g;d<b;d++){this.createLink(d,f,e).appendTo(c)}},getLinks:function(h,e){var f,b,c=this.pc.getInterval(h),g=this.pc.numPages(),d=a("<div class='pagination'></div>");if(this.opts.prev_text&&(h>0||this.opts.prev_show_always)){d.append(this.createLink(h-1,h,{text:this.opts.prev_text,classes:"prev"}))}if(c.start>0&&this.opts.num_edge_entries>0){b=Math.min(this.opts.num_edge_entries,c.start);this.appendRange(d,h,0,b,{classes:"sp"});if(this.opts.num_edge_entries<c.start&&this.opts.ellipse_text){jQuery("<span>"+this.opts.ellipse_text+"</span>").appendTo(d)}}this.appendRange(d,h,c.start,c.end);if(c.end<g&&this.opts.num_edge_entries>0){if(g-this.opts.num_edge_entries>c.end&&this.opts.ellipse_text){jQuery("<span>"+this.opts.ellipse_text+"</span>").appendTo(d)}f=Math.max(g-this.opts.num_edge_entries,c.end);this.appendRange(d,h,f,g,{classes:"ep"})}if(this.opts.next_text&&(h<g-1||this.opts.next_show_always)){d.append(this.createLink(h+1,h,{text:this.opts.next_text,classes:"next"}))}a("a",d).click(e);return d}});a.fn.pagination=function(i,b){b=jQuery.extend({items_per_page:10,num_display_entries:11,current_page:0,num_edge_entries:0,link_to:"#",prev_text:"Prev",next_text:"Next",ellipse_text:"...",prev_show_always:true,next_show_always:true,renderer:"defaultRenderer",callback:function(){return false}},b||{});var c=this,f,k,e;function d(m){var n,l=a(m.target).data("page_id"),o=g(l);if(!o){m.stopPropagation()}return o}function g(l){c.data("current_page",l);k=f.getLinks(l,d);c.empty();k.appendTo(c);var m=b.callback(l,c);return m}e=b.current_page;c.data("current_page",e);i=(!i||i<0)?1:i;b.items_per_page=(!b.items_per_page||b.items_per_page<0)?1:b.items_per_page;if(!PaginationRenderers[b.renderer]){throw new ReferenceError("Pagination renderer '"+b.renderer+"' was not found in jQuery.PaginationRenderers object.")}f=new PaginationRenderers[b.renderer](i,b);var h=new PaginationCalculator(i,b);var j=h.numPages();c.bind("setPage",{numPages:j},function(m,l){if(l>=0&&l<m.data.numPages){g(l);return false}});c.bind("prevPage",function(l){var m=a(this).data("current_page");if(m>0){g(m-1)}return false});c.bind("nextPage",{numPages:j},function(l){var m=a(this).data("current_page");if(m<l.data.numPages-1){g(m+1)}return false});k=f.getLinks(e,d);c.empty();k.appendTo(c)}})(jQuery);(function(a){a.fn.csListingDetails=function(b,o){var h=null;var k=null;var g=null;var i=null;var j=new Array();var l=null;var f={ajaxTarget:"listings",listingNumber:"",listingDetailsLink:"",modletId:"0",plugin:false,statsData:null,listingUrl:"",infoBox:false};var e={init:function(p){var m=this;return this.each(function(){var r=a(this);var q={};if(p){a.extend(q,f,p)}q.modletId=r.attr("id").substring(r.attr("id").lastIndexOf("_")+1);q.totalPhotos=a(".cs-listing-details-slideshow-thumbnails li",this).size();r.data("settings",q);e.validateStreetView.call(m);a("div.cs-tabs-container li:not(.cs-tabs-tab-left, .cs-tabs-tab-right)",this).click(function(){if(a("a",this).html()!="VR Tour"&&a("a",this).html()!="Statistics"){a(this).parents("ul.cs-tabs-list").find("li.cs-tabs-tab-active").removeClass("cs-tabs-tab-active").addClass("cs-tabs-tab");a(this).removeClass("cs-tabs-tab").addClass("cs-tabs-tab-active")}});c.printViewUrl.call(m);if(q.listingDetailsLink.indexOf("/")==0){r.find("#listingURL").html("http://"+document.location.host+q.listingDetailsLink)}else{r.find("#listingURL").html("http://"+document.location.host+"/"+q.listingDetailsLink)}r.find("#listingURL").click(function(t){if(document.selection){document.selection.empty()}else{if(window.getSelection){window.getSelection().removeAllRanges()}}if(document.selection){var s=document.body.createTextRange();s.moveToElementText(t.currentTarget);s.select()}else{if(window.getSelection){var s=document.createRange();s.selectNode(t.currentTarget);window.getSelection().addRange(s)}}return false})})},initSlideshow:function(){var m=this;return this.each(function(){var q=a(this);var p=q.data("settings");var r=new Image();r.src=a("img.cs-listing-details-photo-main",this).attr("src");a("img.cs-listing-details-photo-main",this).attr("height",r.height);if(p.totalPhotos>1){a(".cs-listing-details-photo-container",q).mouseover(function(){a(".cs-photo-nav-right, .cs-photo-nav-left",this).show()}).mouseout(function(){a(".cs-photo-nav-right, .cs-photo-nav-left",this).hide()});a(".cs-photo-nav-right",this).click(function(){if(a(this).parent().siblings("ul.cs-listing-details-slideshow-thumbnails").find(".cs-listing-details-slideshow-thumbnail-selected").parent().next().size()==1){var s=a(this).siblings("img.mainPhoto");var t=a(this).parent().siblings("ul.cs-listing-details-slideshow-thumbnails").find(".cs-listing-details-slideshow-thumbnail-selected").parent().next().find("img");c.updateMainPhoto.call(m,s,t);a(this).parent().siblings("ul.cs-listing-details-slideshow-thumbnails").find(".cs-listing-details-slideshow-thumbnail-selected").removeClass("cs-listing-details-slideshow-thumbnail-selected").parent().next().find("a").addClass("cs-listing-details-slideshow-thumbnail-selected")}else{var s=a(this).siblings("img.mainPhoto");var t=a(this).parent().siblings("ul.cs-listing-details-slideshow-thumbnails").find(".cs-listing-details-slideshow-thumbnail-selected").parent().prevAll().last().find("img");c.updateMainPhoto.call(m,s,t);a(this).parent().siblings("ul.cs-listing-details-slideshow-thumbnails").find(".cs-listing-details-slideshow-thumbnail-selected").removeClass("cs-listing-details-slideshow-thumbnail-selected").parent().prevAll().last().find("a").addClass("cs-listing-details-slideshow-thumbnail-selected")}});a(".cs-photo-nav-left",this).click(function(){if(a(this).parent().siblings("ul.cs-listing-details-slideshow-thumbnails").find(".cs-listing-details-slideshow-thumbnail-selected").parent().prev().size()==1){var s=a(this).siblings("img.mainPhoto");var t=a(this).parent().siblings("ul.cs-listing-details-slideshow-thumbnails").find(".cs-listing-details-slideshow-thumbnail-selected").parent().prev().find("img");c.updateMainPhoto.call(m,s,t);a(this).parent().siblings("ul.cs-listing-details-slideshow-thumbnails").find(".cs-listing-details-slideshow-thumbnail-selected").removeClass("cs-listing-details-slideshow-thumbnail-selected").parent().prev().find("a").addClass("cs-listing-details-slideshow-thumbnail-selected")}else{var s=a(this).siblings("img.mainPhoto");var t=a(this).parent().siblings("ul.cs-listing-details-slideshow-thumbnails").find(".cs-listing-details-slideshow-thumbnail-selected").parent().nextAll().last().find("img");c.updateMainPhoto.call(m,s,t);a(this).parent().siblings("ul.cs-listing-details-slideshow-thumbnails").find(".cs-listing-details-slideshow-thumbnail-selected").removeClass("cs-listing-details-slideshow-thumbnail-selected").parent().nextAll().last().find("a").addClass("cs-listing-details-slideshow-thumbnail-selected")}if(p.infoBox){a.clickSoldUtils("infoBoxResize")}})}if(p.othStatus!=null){if(p.othStatus=="1"){q.find(".mainPhoto").before('<div class="listingStatus_overlayIncrease"></div>')}else{if(p.othStatus=="2"){q.find(".mainPhoto").before('<div class="listingStatus_overlayDecrease"></div>')}else{if(p.othStatus=="3"){q.find(".mainPhoto").before('<div class="listingStatus_overlayNew"></div>')}}}}q.find("ul.cs-listing-details-slideshow-thumbnails li a").each(function(){a(this).unbind("click").bind("click",function(){var s=a(this).parents("ul.cs-listing-details-slideshow-thumbnails").siblings("div.cs-listing-details-photo-container").find("img.mainPhoto");var t=a(this).find("img");c.updateMainPhoto.call(m,s,t);a(this).closest("ul").find(".cs-listing-details-slideshow-thumbnail-selected").removeClass("cs-listing-details-slideshow-thumbnail-selected");a(this).addClass("cs-listing-details-slideshow-thumbnail-selected")})})})},displaySlideshow:function(){return this.each(function(){var p=a(this);var m=a(this).data("settings");p.find("#listingTabsOverlay").block({message:"<b>Loading Slideshow...</b>"});if(p.listingDetailsAjaxRequest){p.listingDetailsAjaxRequest.abort()}p.listingDetailsAjaxRequest=a.ajax({type:"GET",url:m.ajaxTarget,data:"pathway=6&listingNumber="+m.listingNumber+"&slideshow=true&modletId="+m.modletId,dataType:"html",error:function(r,q){alert("Error: displayListingDetailsSlideshow(): "+q+" "+r)},success:function(q){p.find("#listingTabsModule").html(q)},complete:function(q,r){setTimeout(function(){p.find("#listingTabsOverlay").unblock()},500)}})})},displayMap:function(p,m){return this.each(function(){var t=a(this);var r=t.data("settings");t.find("#listingTabsOverlay").block({message:"<b>Loading Map...</b>"});if(t.listingDetailsAjaxRequest){t.listingDetailsAjaxRequest.abort()}t.find("#listingTabsModule").empty();t.find("#listingTabsModule").html('<div class="cs-listing-details-gmap-container"><div id="listingDetailsMap" style="height: 485px;"></div></div>');var s=new google.maps.Map(t.find("#listingDetailsMap").get(0),{center:new google.maps.LatLng(p,m),mapTypeId:google.maps.MapTypeId.ROADMAP,zoom:15,mapTypeControl:true,zoomControl:true});var q=new google.maps.Marker({clickable:false,map:s,position:new google.maps.LatLng(p,m)});setTimeout(function(){t.find("#listingTabsOverlay").unblock()},500)})},displayMedia:function(p,m){return this.each(function(){var r=a(this);var q=a(this).data("settings");r.find("#listingTabsOverlay").block({message:"<b>Loading Media...</b>"});if(r.listingDetailsAjaxRequest){r.listingDetailsAjaxRequest.abort()}r.listingDetailsAjaxRequest=a.ajax({type:"GET",url:q.ajaxTarget,data:"pathway=6&listingNumber="+q.listingNumber+"&media=true&modletId="+q.modletId,dataType:"html",error:function(t,s){alert("Error: displayListingDetailsSlideshow(): "+s+" "+t)},success:function(s){r.find("#listingTabsModule").html(s)},complete:function(s,t){setTimeout(function(){r.find("#listingTabsOverlay").unblock()},500)}})})},displayWalkscore:function(p,m){return this.each(function(){var s=a(this);var r=a(this).data("settings");s.find("#listingTabsOverlay").block({message:"<b>Loading WalkScore<sup>&reg;</sup>...</b>"});if(s.listingDetailsAjaxRequest){s.listingDetailsAjaxRequest.abort()}s.find("#listingTabsModule").html('<div class="cs-listing-details-walkscore-container"></div>');var t=s.find(".cs-listing-details-walkscore-container").width();var q=s.find(".cs-listing-details-walkscore-container").height();s.listingDetailsAjaxRequest=a.ajax({type:"GET",url:r.ajaxTarget,data:"pathway=6&walkscore=true&latitude="+p+"&longitude="+m+"&width="+t+"&height="+q+"&modletId="+r.modletId,dataType:"html",error:function(v,u){alert("Error: displayWalkscore(): "+u+" "+v)},success:function(u){s.find(".cs-listing-details-walkscore-container").html(u)},complete:function(u,v){setTimeout(function(){s.find("#listingTabsOverlay").unblock()},500)}})})},validateStreetView:function(){var m=this;return this.each(function(){var s=a(this);var q=s.data("settings");if(q.latitude!=""&&q.longitude!=""){var r=new google.maps.LatLng(q.latitude,q.longitude);var p=new google.maps.StreetViewService();p.getPanoramaByLocation(r,30,function(u,t){if(t==google.maps.StreetViewStatus.OK){s.find("#streetView").parent().show();q.dataLocationPano=u.location.pano;s.data("settings",q)}})}})},displayStreetView:function(){return this.each(function(){var p=a(this);var m=p.data("settings");if(m.dataLocationPano!=null){p.find("#listingTabsOverlay").block({message:"<b>Loading Street View...</b>"});if(p.listingDetailsAjaxRequest){p.listingDetailsAjaxRequest.abort()}p.find("#listingTabsModule").empty();p.find("#listingTabsModule").html('<div class="cs-listing-details-gmap-container"><div id="listingDetailsStView" style="height: 485px"></div></div>');this.pano=new google.maps.StreetViewPanorama(p.find("#listingDetailsStView").get(0));this.pano.setPano(m.dataLocationPano);this.pano.setPov({heading:270,pitch:0,zoom:1});this.pano.setVisible(true);setTimeout(function(){p.find("#listingTabsOverlay").unblock()},500)}})},hideStreetView:function(){return this.each(function(){var p=a(this);var m=p.data("settings");if(a("#listingDetailsStView").length>0){if(this.pano!=null){this.pano.setVisible(false);this.pano=null}}})},displayStats:function(){return this.each(function(){var q=a(this);var m=q.data("settings");if(q.listingDetailsAjaxRequest){q.listingDetailsAjaxRequest.abort()}var p="pathway=6&statistics=true";if(m.statsData!=null){p=m.statsData}a.csVOWPanel("csVOWAjax",{type:"GET",url:m.ajaxTarget,data:p+"&listingNumber="+m.listingNumber+"&modletId="+m.modletId,dataType:"html",error:function(s,r){alert("Error: displayListingStatistics(): "+r+" "+s)},success:function(r){a.clickSoldUtils("infoBoxCreate",{html:r,top:"30px",fastIframe:false,overlayClose:true,returnFocus:false,onComplete:function(){if(daysOnMarket){a("#daysOnMarket").clickSoldUtils("renderDOMGraph",daysOnMarket.MLSStatsDOMs)}if(listingPrices){a("#prices").clickSoldUtils("renderPricesGraph",listingPrices.MLSStatsPrices)}if(listedVersusSold){a("#listedVersusSold").clickSoldUtils("renderListedVersusSoldGraph",listedVersusSold.MLSStatsListedVersusSold)}a.clickSoldUtils("infoBoxResize")}})}},function(){},function(){},true)})},displayMortCalc:function(p,s,m,q,r){return this.each(function(){var u=a(this);var t=u.data("settings");if(u.listingInfoAjaxRequest){u.listingInfoAjaxRequest.abort()}if(a("#rpmCalcDialog").length==0){a("body").append('<div id="rpmCalcDialog" title="Mortgage Center" style="display:none;"></div>')}a.clickSoldUtils("infoBoxCreate",{href:t.ajaxTarget,data:"pathway=6&calculator=true&selectedTabId="+r+"&listPrice="+p+"&propTax="+s+"&conFees="+m+"&listingNumber="+t.listingNumber+"&modletId="+t.modletId,opacity:0.25,innerWidth:"750px",innerHeight:"600px",returnFocus:false,onComplete:function(){a("#QualifierOutFormContainer").RPMQualifier({outputContainerId:"QualifierOutFormContainer",containerTabId:"widgetRpmqualiferTabs",calcuVars:calcuVars,qualifierVars:qualifierVars,selectedTab:selectedTab,ajaxTarget:t.ajaxTarget});a.clickSoldUtils("infoBoxResize");a(".ui-widget-overlay").bind("click",function(){a(".ui-widget-overlay").unbind("click");a("#rpmCalcDialog").dialog("close")})},onClosed:function(){a(".mortDialog").remove()}}).parents(".ui-dialog:eq(0)").wrap('<div class="mortDialog"></div>');return false})},displayEmailForm:function(m){var q=a(this);var p=q.data("settings");alert("here1");q.find("#listingEmailForm").clickSoldUtils("csBindToForm",{updateDivId:"listingEmailModule",loadingDivId:"listingEmailLoadingOverlay",message:"Sending Message...",context:q});alert("here2");a.clickSoldUtils("infoBoxCreate",{href:p.ajaxTarget,data:"pathway=6&listingNumber="+m+"&loadListingEmail=true",opacity:0.25,overlayClose:false,onComplete:function(){a("#listingEmailForm").clickSoldUtils("csBindToForm",{updateDivId:"listingEmailModule",loadingDivId:"listingEmailLoadingOverlay",message:"Please wait...",plugin:p.plugin})}})},toggleEnlargePhoto:function(m){return this.each(function(){var q=a(this);var p=new Image();p.src=m;if(p.width>640||p.height>480){a(".photoOptionsEnlarge").css("display","inline");a("#mainPhoto_buttons").css("width","132px")}else{a(".photoOptionsEnlarge").css("display","none");a("#mainPhoto_buttons").css("width","100px")}p=null})}};var c={updateMainPhoto:function(m,p){return a(this).each(function(){var s=a(this);var q=s.data("settings");var t=m.height();m.attr("src",p.attr("src"));m.attr("alt",p.attr("alt"));m.attr("title",p.attr("title"));m.parents("div.cs-listing-details-photo-container").find("div.cs-listing-details-photo-desc").html(p.attr("title"));var r=new Image();r.src=p.attr("src");m.attr("height",r.height);m.css("height",r.height);if(q.infoBox&&t!=r.height){a.clickSoldUtils("infoBoxResize")}})},printViewUrl:function(){return a(this).each(function(){var p=a(this);var m=p.data("settings");p.find("#printView").attr("href",m.ajaxTarget+"?pathway=6&listingNumber="+m.listingNumber+"&printView=true")})},displayTour:function(m){return this.each(function(){var q=a(this);var p=q.data("settings");a(".tourFrame").attr("src",p.ajaxTarget+"?pathway=6&type=results&tourNum="+m+"&vrTour=true&modletId="+p.modletId);a.clickSoldUtils("infoBoxResize")})}};if(e[b]){if(typeof this.data("settings")=="undefined"){var j=new Array();if(typeof this.data("methodQueue")!="undefined"){j=this.data("methodQueue")}j.push([b,Array.prototype.slice.call(arguments,0)]);this.data("methodQueue",j);return false}else{return e[b].apply(this,Array.prototype.slice.call(arguments,1))}}else{if(typeof b==="object"){if(typeof this.data("settings")!="undefined"){a.clickSoldUtils("csConsole","Removing Stuff");this.data("settings",null);this.unbind()}var n=e.init.apply(this,arguments);if(typeof this.data("methodQueue")!="undefined"){var j=this.data("methodQueue");while(j.length>0){var d=j.shift();e[d[0]].apply(this,d[1])}}return n}else{a.error("Method "+b+" does not exist on jQuery.listingDetails")}}}})(jQuery);(function(a){a.fn.csIDXSearchEngine=function(j,l){var y=null;var p=null;var g=null;var A='<div style="padding:5px;">Loading Statistics, please wait (takes up to 15 seconds)...</div>';var q=0;var e=1;var w=2;var m=2;var i=0;var f=730;var r=100;function x(B,D,E,C){this.position_=B;this.content_=D;this.align_=x.SouthWest;if(E==x.NorthWest||E==x.NorthEast||E==x.SouthWest||E==x.SouthEast||E==x.Center){this.align_=E}this.opacity_=C;this.showOnDraw_=false;this.div_=null}x.NorthWest="NW";x.NorthEast="NE";x.SouthWest="SW";x.SouthEast="SE";x.Center="C";x.prototype=new google.maps.OverlayView();x.prototype.onAdd=function(){try{var D=document.createElement("div");D.style.position="absolute";D.style.filter="alpha(opacity="+(this.opacity_*100)+")";D.style.opacity=this.opacity_;D.innerHTML=this.content_;D.style.visibility="hidden";var B=this.getPanes();B.overlayImage.appendChild(D);this.div_=D}catch(C){alert(C.name+" - "+C.message)}};x.prototype.draw=function(){try{var C=this.getProjection();var E=C.fromLatLngToDivPixel(this.position_);var D,F=0,B=0;if(typeof window.getComputedStyle!="undefined"){D=window.getComputedStyle(this.div_,null);F=new Number(D.getPropertyValue("width").substring(0,D.getPropertyValue("width").indexOf("px")));B=new Number(D.getPropertyValue("height").substring(0,D.getPropertyValue("height").indexOf("px")))}else{F=this.div_.clientWidth;B=this.div_.clientHeight}switch(this.align_){case x.NorthWest:E.x-=F;E.y-=B;break;case x.SouthWest:E.x-=F;E.y+=B;break;case x.NorthEast:E.y-=B;break;case x.Center:E.x-=(F/2);E.y-=(B/2);break;default:break}this.div_.style.top=E.y+"px";this.div_.style.left=E.x+"px";if(this.showOnDraw_==true){this.div_.style.visibility="visible";this.showOnDraw_==false}}catch(G){alert(G.name+" - "+G.message)}};x.prototype.onRemove=function(){try{if(this.div){this.div_.style.visibility="hidden"}this.div_.parentNode.removeChild(this.div_);this.div_=null}catch(B){alert(B.name+" - "+B.message)}};x.prototype.show=function(){try{if(this.div_){this.div_.style.visibility="visible"}else{this.showOnDraw_=true}}catch(B){alert(B.name+" - "+B.message)}};x.prototype.hide=function(){try{if(this.div_){this.div_.style.visibility="hidden"}}catch(B){alert(B.name+" - "+B.message)}};function o(B){this.position_=B;this.showOnDraw_=false;this.debug=false;this.img_=null;this.div_=null}o.prototype=new google.maps.OverlayView();o.prototype.onAdd=function(){try{var B=document.createElement("img");B.setAttribute("src",y.resLink+"/t/resources/rpm3.0/images/icons/searchEngine/hl.png");var D=document.createElement("div");D.style.position="absolute";D.style.width="26px";D.style.height="36px";D.style.visibility="hidden";D.style.zIndex="2000";D.appendChild(B);this.div_=D;this.getPanes().overlayShadow.appendChild(this.div_)}catch(C){alert(C.name+" - "+C.message)}};o.prototype.draw=function(){try{var B=this.getProjection();var C=B.fromLatLngToDivPixel(this.position_);C.x-=13;C.y-=18.5;this.div_.style.top=C.y+"px";this.div_.style.left=C.x+"px";if(this.showOnDraw_){this.div_.style.visibility="visible";this.showOnDraw_=false}}catch(D){alert(D.name+" - "+D.message)}};o.prototype.onRemove=function(){try{this.div_.style.visibility="hidden";this.div_.parentNode.removeChild(this.div_);this.div_=null;this.img_=null}catch(B){alert(B.name+" - "+B.message)}};o.prototype.show=function(){if(this.div_){this.div_.style.visibility="visible"}else{this.showOnDraw_=true}};o.prototype.hide=function(){if(this.div_){this.div_.style.visibility="hidden"}};function b(B,I,J,K,H,E,C,F,G,D){this.listnum=B;this.lat=I;this.lng=J;this.mCol=K;this.onMap=false;this.highlight=null;this.polygon=null;this.mlsNumber=H;this.price=E;this.labelValuePairs=D;this.mainPhoto=C;this.picCount=F;if(this.picCount>0){this.numberOfAdditionalPhotos=F-1}else{this.numberOfAdditionalPhotos=0}this.listingAgentsString=G}b.prototype.getMarkerImage=function(){var B=y.resLink+"/t/resources/rpm3.0/images/icons/searchEngine/";switch(this.mCol){case"Blue":B+="new_"+y.searchTypes[y.mlsSearchType].icon+".png";break;case"Green":B+="active_"+y.searchTypes[y.mlsSearchType].icon+".png";break;case"Yellow":B+="pending_"+y.searchTypes[y.mlsSearchType].icon+".png";break;default:B+="sold_"+y.searchTypes[y.mlsSearchType].icon+".png";break}return new google.maps.MarkerImage(B,new google.maps.Size(18,29),new google.maps.Point(0,0),new google.maps.Point(9,29))};b.prototype.getMarkerImageShadow=function(){return new google.maps.MarkerImage(y.resLink+"/t/resources/rpm3.0/images/icons/searchEngine/shadow.png",new google.maps.Size(28,38),new google.maps.Point(0,0),new google.maps.Point(9,29))};b.prototype.getMarkerImageHighlight=function(){return new google.maps.MarkerImage(y.resLink+"/t/resources/rpm3.0/images/icons/searchEngine/glow.png",new google.maps.Size(50,50),new google.maps.Point(0,0),new google.maps.Point(30,48))};b.prototype.getMarkerShape=function(){return{coord:[0,0,18,0,18,15,11,20,10,26,8,26,7,21,0,15],type:"poly"}};b.prototype.setShape=function(){if(this.marker!=null){this.marker.setShape(this.getMarkerShape)}};b.prototype.addToMap=function(){var B=this;if(this.marker==null){var C={map:y.map.getMap(),position:new google.maps.LatLng(this.lat,this.lng),icon:this.getMarkerImage(),visible:true,zIndex:2,shadow:this.getMarkerImageShadow(),shape:this.getMarkerShape()};this.marker=new google.maps.Marker(C)}this.onMap=true;google.maps.event.addListener(this.marker,"dblclick",function(){});google.maps.event.addListener(this.marker,"click",function(){});this.setMOClasses();google.maps.event.addListener(this.marker,"mouseover",function(){B.openHTMLWindow()});google.maps.event.addListener(this.marker,"mouseout",function(){})};b.prototype.removeFromMap=function(){if(this.polygon!=null){this.polygon.setMap(null)}if(this.marker!=null){google.maps.event.clearInstanceListeners(this.marker);this.marker.setMap(null)}this.polygon=null;this.marker=null;this.onMap=false};b.prototype.setMOClasses=function(){var B=this.getBounds();if(this.highlight!=null){this.highlight.setMap(null);this.highlight=null}this.highlight=new o(B.getCenter());this.highlight.setMap(y.map.getMap())};b.prototype.getMarker=function(){return this.marker};b.prototype.getBounds=function(){var C=Math.pow(2,y.map.getMap().getZoom());var E=y.map.getMap().getProjection().fromLatLngToPoint(new google.maps.LatLng(this.lat,this.lng));var B=new google.maps.Point((E.x*C),(E.y*C));var D=y.map.getMap().getProjection().fromPointToLatLng(new google.maps.Point(((B.x+9)/C),((B.y-29)/C)));var F=y.map.getMap().getProjection().fromPointToLatLng(new google.maps.Point(((B.x-9)/C),E.y));return new google.maps.LatLngBounds(F,D)};b.prototype.showBounds=function(){if(this.polygon!=null){this.polygon.setMap(null)}var B={strokeColor:"#FF0000",strokeOpacity:0.8,strokeWeight:2,fillColor:"#FF0000",fillOpacity:0.35,map:y.map.getMap(),bounds:this.getBounds()};this.polygon=new google.maps.Rectangle();this.polygon.setOptions(B)};b.prototype.openHTMLWindow=function(){var B=this;var C="";C+='  <div class="cs-idx-search-info-window-container">';C+='    <div class="cs-idx-search-info-window-result-single" id="ln_'+this.listnum+'">';C+=this.generateHTML();C+="    </div>";C+="  </div>";a("#cs-idx-search-results-info-window",y.self).html("").hide();var D=y.map.getMarkerPosition(this.marker);var F=D.x;var E=D.y-15;if(F+a("#cs-idx-search-result-info-window",y.self).width()>a(".cs-idx-search-container",y.self).width()){a("#cs-idx-search-result-info-window",y.self).css("left",F-a("#cs-idx-search-result-info-window",y.self).width())}else{a("#cs-idx-search-result-info-window",y.self).css("left",F)}var G=E+r;if(a("#cs-idx-search-result-info-window",y.self).height()>G){a("#cs-idx-search-result-info-window",y.self).css("top",-r)}else{a("#cs-idx-search-result-info-window",y.self).css("top",G-r-a("#cs-idx-search-result-info-window",y.self).height())}a("#cs-idx-search-result-info-window",y.self).html("").show();a("#cs-idx-search-result-info-window",y.self).html(C);a(".cs-idx-search-info-window-container",y.self).show("fast",function(){a("#cs-idx-search-result-info-window",y.self).animate({height:a(".cs-idx-search-info-window-container",y.self).height()},100,function(){})});a("#cs-map-search-canvas",y.self).bind("mouseover",function(){a("#cs-idx-search-result-info-window",y.self).hide();a("#cs-map-search-canvas",y.self).unbind("mouseover")})};b.prototype.generateHTML=function(){function B(D){if(D==null||D==""){return true}else{return false}}var C="";C+='      <div class="cs-idx-search-info-window-result-id">';if(!B(this.mlsNumber)){C+="        <a onclick=\"$('#modletWrapper_"+y.modletId+"').csIDXSearchEngine('listingDetails', "+this.listnum+'); return false;" href="#">';C+="          MLS<sup>&reg;</sup>: "+this.mlsNumber;C+="        </a>"}C+='      </div><div class="cs-idx-search-info-window-result-price">';C+="        "+this.price;C+="      </div>";C+='      <div class="cs-idx-search-info-window-result-left">';C+='        <dl class="cs-idx-search-info-window-result-tabular-info">';a.each(this.labelValuePairs,function(D,E){C+="          <dt>"+D+":</dt><dd>"+E+"</dd>"});C+="        </dl>";C+='      </div><div class="cs-idx-search-info-window-result-right">';C+="        <a onclick=\"$('#modletWrapper_"+y.modletId+"').csIDXSearchEngine('listingDetails', "+this.listnum+'); return false;" href="#" class="cs-photo-container">';if(this.picCount>0){C+='            <img src="'+this.mainPhoto+'" class="cs-photo-container-wrap"/>';if(this.numberOfAdditionalPhotos>1){C+="            "+this.numberOfAdditionalPhotos+" more photos"}else{C+="          1 more photo"}}else{C+='            <img src="'+y.resLink+'/t/resources/rpm3.0/images/search_engine/no_photo.jpg" class="cs-photo-container-wrap"/>'}C+="        </a>";C+="      </div>";if(!B(this.listingAgentsString)){C+='      <div class="cs-idx-search-info-window-result-agent">Listed By '+this.listingAgentsString+"</div>"}return C};function u(B){this.marker=null;this.listings=B;this.padding=0;this.onMap=false;this.lat=null;this.lng=null;this.highlight=null;this.polygon=null}u.prototype.getMarkerImage=function(){this.listings.moveFirst();var B=y.resLink+"/t/resources/rpm3.0/images/icons/searchEngine/";while(this.listings.next()){if(this.listings.getValue()!=null){switch(this.listings.getValue().mCol){case"Blue":B+="new_"+y.searchTypes[y.mlsSearchType].icon+"_m.png";break;case"Green":B+="active_"+y.searchTypes[y.mlsSearchType].icon+"_m.png";break;case"Yellow":B+="pending_"+y.searchTypes[y.mlsSearchType].icon+"_m.png";break;default:B+="sold_"+y.searchTypes[y.mlsSearchType].icon+"_m.png";break}break}}return new google.maps.MarkerImage(B,new google.maps.Size(18,29),new google.maps.Point(0,0),new google.maps.Point(9,29))};u.prototype.getMarkerImageShadow=function(){return new google.maps.MarkerImage(y.resLink+"/t/resources/rpm3.0/images/icons/searchEngine/shadow.png",new google.maps.Size(28,38),new google.maps.Point(0,0),new google.maps.Point(9,29))};u.prototype.getMarkerImageHighlight=function(){return new google.maps.MarkerImage(y.resLink+"/t/resources/rpm3.0/images/icons/searchEngine/glow.png",new google.maps.Size(50,50),new google.maps.Point(0,0),new google.maps.Point(30,48))};u.prototype.getMarkerShape=function(){return{coord:[0,0,18,0,18,26,8,26,5,21,5,18,0,17,0,11],type:"poly"}};u.prototype.markerBounds=function(){try{var C=Math.pow(2,y.map.getMap().getZoom());var E=y.map.getMap().getProjection().fromLatLngToPoint(this.markerCenter());var B=new google.maps.Point((E.x*C),(E.y*C));var D=y.map.getMap().getProjection().fromPointToLatLng(new google.maps.Point(((B.x+9)/C),((B.y-29)/C)));var G=y.map.getMap().getProjection().fromPointToLatLng(new google.maps.Point(((B.x-9)/C),E.y));return new google.maps.LatLngBounds(G,D)}catch(F){alert(F.name+" - "+F.message);return null}};u.prototype.showBounds=function(){if(this.polygon!=null){this.polygon.setMap(null)}var B={strokeColor:"#FF0000",strokeOpacity:0.8,strokeWeight:2,fillColor:"#FF0000",fillOpacity:0.35,map:y.map.getMap(),bounds:this.markerBounds()};this.polygon=new google.maps.Rectangle();this.polygon.setOptions(B)};u.prototype.markerCenter=function(){var C=new Number(0),B=new Number(0);this.listings.moveFirst();while(this.listings.next()){C=C+new Number(this.listings.getValue().lat);B=B+new Number(this.listings.getValue().lng)}C=C/new Number(this.listings.size());B=B/new Number(this.listings.size());return new google.maps.LatLng(C,B)};u.prototype.getMarkerBounds=function(){if(this.marker!=null){this.marker.setPosition(this.markerCenter())}return this.markerBounds()};u.prototype.resetMarkerPosition=function(){this.removeMarker();this.marker.setPosition(this.markerCenter());this.marker.setMap(y.map.getMap());this.marker.setShape(this.getMarkerShape());this.initMarkerEvents()};u.prototype.initializeMarker=function(){try{if(this.listings.size()>1){if(this.marker==null){this.marker=new google.maps.Marker({map:y.map.getMap(),position:this.markerCenter(),visible:true,zIndex:2,icon:this.getMarkerImage(),shadow:this.getMarkerImageShadow(),shape:this.getMarkerShape()});this.lat=this.marker.getPosition().lat();this.lng=this.marker.getPosition().lng()}this.marker.setMap(y.map.getMap());this.onMap=true;this.initMarkerEvents()}}catch(B){alert("ListingCluster.initializeMarker: "+B.name+" - "+B.message)}};u.prototype.removeMarker=function(){if(this.marker!=null){google.maps.event.clearInstanceListeners(this.marker);this.marker.setMap(null)}if(this.highlight!=null){this.highlight.setMap(null)}this.highlight=null};u.prototype.destroyMarker=function(){this.removeMarker();this.marker=null;this.listings=null;this.onMap=false};u.prototype.initMarkerEvents=function(){var B=this;if(this.marker!=null){google.maps.event.addListener(this.marker,"dblclick",function(){});google.maps.event.addListener(this.marker,"click",function(){});if(this.highlight!=null){this.highlight.setMap(null);this.highlight=null}this.highlight=new o(this.markerBounds().getCenter());this.highlight.setMap(y.map.getMap());google.maps.event.addListener(this.marker,"mouseover",function(){B.openHTMLWindow()});google.maps.event.addListener(this.marker,"mouseout",function(){})}};u.prototype.openHTMLWindow=function(B){var J=this;var E=0;var C="";this.listings.moveFirst();while(this.listings.next()){if(this.listings.getValue()!=null){var I=this.listings.getValue();C+='  <div class="cs-idx-search-info-window-container">';C+='    <div class="cs-idx-search-info-window-result" id="ln_'+I.listingNumber+'">';C+=I.generateHTML();C+="    </div>";C+="  </div>";E++}}if(E==0){return}a("#cs-idx-search-result-info-window",y.self).html("").hide();var D=y.map.getMarkerPosition(this.marker);var G=D.x;var F=D.y-15;if(G+a("#cs-idx-search-results-info-window",y.self).width()>a(".cs-idx-search-container",y.self).width()){a("#cs-idx-search-results-info-window",y.self).css("left",G-a("#cs-idx-search-results-info-window",y.self).width())}else{a("#cs-idx-search-results-info-window",y.self).css("left",G)}var H=F+r;if(a("#cs-idx-search-results-info-window",y.self).height()>H){a("#cs-idx-search-results-info-window",y.self).css("top",-r)}else{a("#cs-idx-search-results-info-window",y.self).css("top",H-r-a("#cs-idx-search-results-info-window",y.self).height())}a("#cs-idx-search-results-info-window",y.self).html("").show();a("#cs-idx-search-results-info-window",y.self).html(C).each(function(){a(".cs-idx-search-info-window-container",this).fadeIn()});a("#cs-map-search-canvas",y.self).bind("mouseover",function(){a("#cs-idx-search-results-info-window",y.self).hide();a("#cs-map-search-canvas",y.self).unbind("mouseover")})};u.prototype.listingExists=function(B){this.listings.moveFirst();while(this.listings.next()){if(this.listings.getKey()==B){return true}}return false};u.prototype.removeListing=function(C){if(this.listings.size()==0){return false}var B=this.listings.size();this.listings.remove(C);if(this.listings.size()!=B){return true}else{return false}};u.prototype.addListing=function(C,B){if(!this.listingExists(C)){this.listings.put(C,B)}};u.prototype.isEmpty=function(){if(this.listings==null){return true}else{if(this.listings.size()==0){return true}else{return false}}};u.prototype.size=function(){return this.listings.size()};u.prototype.listingsArray=function(){var B=[];this.listings.moveFirst();while(this.listings.next()){B.push(this.listings.getValue())}return B};function d(C){this.displaying=false;this.self=C;var B=this;a(".cs-idx-view-market-analyzer",this.self).click(function(D){if(y.searchTypes[a("#searchTypes",B.self).val()].showStats.toLowerCase()=="true"&&y.currentSearchView!=y.searchViews.stats&&y.mapLoaded){B.load()}return false});this.lastLoadedTab;this.loadTab=function(){if(B.displaying){a("#statisticsPanelLoadingOverlay",B.self).block({message:"<div style='font-size:2em;font-weight:bold;'>Loading...</div><img src='t/resources/rpm3.0/images/search_engine/map-ajax-loader.gif' />"})}else{B.lastLoadedTab=a(".cs-tabs-tab-active",B.self).get();a(".cs-tabs-tab-active",B.self).addClass("cs-tabs-tab").removeClass("cs-tabs-tab-active");a(".cs-tabs-tab-left",B.self).addClass("cs-tabs-tab-first-loading");a("#cs-idx-view-market-analyzer",B.self).parent().addClass("cs-tabs-tab-active").removeClass("cs-tabs-tab")}};this.rollbackLoadTab=function(){if(B.displaying){}else{a(".cs-tabs-tab-active",B.self).addClass("cs-tabs-tab").removeClass("cs-tabs-tab-active");a(".cs-tabs-tab-left",B.self).removeClass("cs-tabs-tab-first-loading");a(B.lastLoadedTab).addClass("cs-tabs-tab-active").removeClass("cs-tabs-tab")}}}d.prototype.load=function(){var B=this;try{a.csVOWPanel("csVOWAjax",{type:"POST",url:y.absUrl,beforeSend:function(){B.loadTab()},data:"pathway=48&mkt=true&envPropType="+y.mlsSearchType+s.getSearchUrlString.call(this.self)+s.getSearchCoords.call(this.self),dataType:"html",async:true,error:function(E,D){},success:function(D){y.currentSearchView=y.searchViews.stats;a("#cs-idx-search-results-market-analyzer-panel",B.self).html(D);B.displaying=true},complete:function(D,E){y.mapViewPanel.hide();y.listViewPanel.unload();a("#cs-idx-search-results-market-analyzer:hidden",B.self).show();y.searchStatisticsPanel.hide();y.pagination.hide();a(".cs-tabs-tab-right",B.self).hide();a("#cs-idx-search-options",B.self).hide();if(B.displaying){a("#statisticsPanelLoadingOverlay",B.self).unblock()}y.mapLoaded=true;a("#listedVersusSold",B.self).clickSoldUtils("renderListedVersusSoldGraph",listedVersusSold.MLSStatsListedVersusSold);a("#daysOnMarket",B.self).clickSoldUtils("renderDOMGraph",daysOnMarket.MLSStatsDOMs);g=null;B.displaying=true;a(".cs-tabs-tab-left",this.self).removeClass("cs-tabs-tab-first-loading");a(".cs-idx-view-map",this.self).parent("li").attr("class","cs-tabs-tab");a(".cs-idx-view-list",this.self).parent("li").attr("class","cs-tabs-tab");a(".cs-idx-view-market-analyzer",this.self).parent("li").attr("class","cs-tabs-tab-active");return false},failComplete:function(D,E){}},function(){},function(){B.rollbackLoadTab()},true)}catch(C){alert("marketStats error\n"+C.name+" - "+C.message)}};d.prototype.unload=function(B){this.displaying=false;a("#cs-idx-search-results-market-analyzer-panel",this.self).html("")};function c(C){this.displaying=true;this.self=C;var B=this;a(".cs-idx-view-map",this.self).click(function(){if(y.currentSearchView!=y.searchViews.map){if(y.currentSearchView==y.searchViews.list){y.currentListingsSort=a("#cs-idx-search-sort:eq(0)",this.self).val();y.pagination.insertHiddenCount()}y.currentSearchView=y.searchViews.map;if(a(".cs-tabs-tab-right",this.self).css("display")=="none"){a(".cs-tabs-tab-right",this.self).show();if(a("#cs-id-search-options-tab",this.self).hasClass("cs-idx-search-options-tab-active")){a("#cs-idx-search-options",this.self).show()}}a(".cs-tabs-tab-active",this.self).addClass("cs-tabs-tab").removeClass("cs-tabs-tab-active");a(this).parent().addClass("cs-tabs-tab-active").removeClass("cs-tabs-tab");a("#cs-map-search-canvas",this.self).show();y.searchStatisticsPanel.show();y.pagination.show(0);y.pagination.hide(1);y.map.checkResize();if(y.refactorMap==true){y.refactorMap=false;s.runSearch.call(this.self,y.currentPage,false)}if(y.listViewPanel!=null){y.listViewPanel.unload()}if(y.marketAnalyzerPanel!=null){y.marketAnalyzerPanel.unload()}}return false});y.map=new n(this.self,y.centerCoords,y.maxResults,y.zoomLevel,y.absUrl,y.mapDiv);a(window).load(function(){google.maps.event.addListener(y.map.getMap(),"dragend",function(){if(!y.map.savedPosition){y.map.removeAreaLabel=false;s.runSearch.call(B.self)}});google.maps.event.addListener(y.map.getMap(),"zoom_changed",function(){s.runSearch.call(B.self)})});this.runSearchCall=function(H,G,F){var D=this;try{a.csVOWPanel("csVOWAjax",{type:"POST",url:y.absUrl,data:"pathway=5&search=1&envPropType="+y.mlsSearchType+s.getSearchUrlString.call(this)+"&startNumber="+H+s.getSearchCoords.call(this)+"&zoomLevel="+y.map.getZoom()+"&listingsSort="+F+"&searchViewType="+y.currentSearchView,dataType:"json",async:true,error:function(J,I){},success:function(I){y.map.addListings(I);y.map.hideLoadingMessage();y.mapLoaded=true;p=null;if(y.searchTypes[y.mlsSearchType].showStats.toLowerCase()=="true"&&!G){y.searchStatisticsPanel.load()}},complete:function(I,J){}},function(I){},function(I){},true)}catch(E){a.clickSoldUtils("csConsole","MapViewPanel.runSearchCall error\n"+E.name+" - "+E.message);p=null}}}c.prototype.load=function(F,D,E){var B=this;y.mapLoaded=false;a("#cs-map-search-canvas:hidden",this.self).show().each(function(){this.displaying=true});if(D==null){D=false}if(y.searchTypes[y.mlsSearchType].showStats.toLowerCase()=="true"&&!D){y.searchStatisticsPanel.showLoadingIcons()}a("#savedSearchMessage:not(:hidden)",this.self).hide();a("#saveSearchButton:hidden",this.self).show();var C;if(a(".cs-pagination-bar-select:eq(0)",this.self).length>0){C=a(".cs-pagination-bar-select:eq(0)",this.self).val()}if(F==null){F=0}y.currentNEBounds=y.map.getNortheastBounds();y.currentSWBounds=y.map.getSouthwestBounds();y.currentPage=F;y.map.showLoadingMessage();clearTimeout(i);if(p!=null){p.abort();q=q+e;if(q>m){q=m}i=setTimeout(function(){B.runSearchCall.call(B.self,F,D,C)},q*1000)}else{q=q-w;if(q<0){q=0}i=setTimeout(function(){B.runSearchCall.call(B.self,F,D,C)},q*1000)}};c.prototype.hide=function(){a("#cs-map-search-canvas:visible",this.self).hide().each(function(){this.displaying=false});a("#cs-idx-search-results-info-window",y.self).hide();a("#cs-idx-search-result-info-window",y.self).hide()};function h(C){this.displaying=false;this.self=C;var B=this;a(".cs-idx-view-list",C).click(function(){if(y.currentSearchView!=y.searchViews.list&&y.mapLoaded){y.currentListingsSort=a(".cs-pagination-bar-select:eq(0)",C).val();y.currentSearchView=y.searchViews.list;y.currentNEBounds=y.map.getNortheastBounds();y.currentSWBounds=y.map.getSouthwestBounds();y.listViewPanel.load(y.currentPage,true)}return false});this.runSearchCall=function(F,E){try{a.csVOWPanel("csVOWAjax",{type:"POST",url:y.absUrl,data:"pathway=5&list=1&modletId="+y.modletId+"&envPropType="+y.mlsSearchType+s.getSearchUrlString.call(B.self)+"&startNumber="+F+s.getSearchCoords.call(B.self)+"&listingsSort="+y.currentListingsSort+"&searchViewType="+y.currentSearchView+"&zoomLevel="+y.map.getZoom(),dataType:"html",cache:false,async:true,error:function(H,G){a.clickSoldUtils("csConsole","ListViewPanel.load error:"+G+" - "+G.message)},success:function(G){a("#cs-idx-search-results-listings-panel").html(G);if(y.marketAnalyzerPanel!=null){y.marketAnalyzerPanel.unload()}y.mapViewPanel.hide();y.searchStatisticsPanel.show();y.pagination.show();a("#cs-idx-search-results-listings",B.self).css("display","inline");if(B.displaying){a("#listingsPanelLoadingOverlay",B.self).unblock()}p=null;B.displaying=true;y.mapLoaded=true;a(".cs-tabs-tab-left",B.self).removeClass("cs-tabs-tab-first-loading");if(!E){y.searchStatisticsPanel.load()}}},function(G){},function(G){},true)}catch(D){alert("marketStats error\n"+D.name+" - "+D.message)}}}h.prototype.load=function(E,C,D){var B=this;if(a(".cs-tabs-tab-right",this.self).css("display")=="none"){a(".cs-tabs-tab-right",this.self).show();if(a("#cs-id-search-options-tab",this.self).hasClass("cs-idx-search-options-tab-active")){a("#cs-idx-search-options",this.self).show()}}if(C==null){C=false}if(y.searchTypes[y.mlsSearchType].showStats.toLowerCase()=="true"&&!C){y.searchStatisticsPanel.showLoadingIcons()}if(this.displaying){a("#listingsPanelLoadingOverlay",this.self).block({message:'<div style="font-size:2em;font-weight:bold;">Loading...</div><img src="t/resources/rpm3.0/images/search_engine/map-ajax-loader.gif" />',centerY:false,css:{top:"10px"}})}else{a(".cs-tabs-tab-active",this.self).addClass("cs-tabs-tab").removeClass("cs-tabs-tab-active");a(".cs-tabs-tab-left",this.self).addClass("cs-tabs-tab-first-loading");a(".cs-idx-view-list",this.self).parent().addClass("cs-tabs-tab-active").removeClass("cs-tabs-tab")}clearTimeout(i);if(p!=null){p.abort();q=q+e;if(q>m){q=m}i=setTimeout(function(){B.runSearchCall.call(B.self,E,C)},q*1000)}else{q=q-w;if(q<0){q=0}i=setTimeout(function(){B.runSearchCall.call(B.self,E,C)},q*1000)}};h.prototype.unload=function(B){this.displaying=false;a("#cs-idx-search-results-listings-panel",this.self).html("")};function z(B){this.displaying=true;this.self=B;this.$mapStats_mostExp=a("#mapStats_mostExp",this.self);this.$mapStats_leastExp=a("#mapStats_leastExp",this.self);this.$mapStats_avg=a("#mapStats_avg",this.self);this.$mapStats_new=a("#mapStats_new",this.self)}z.prototype.load=function(D){var B=this;try{if(g!=null){g.abort()}B.show();g=a.ajax({type:"POST",url:y.absUrl,data:"pathway=48&map=true&envPropType="+y.mlsSearchType+s.getSearchUrlString.call(this.self)+s.getSearchCoords.call(this.self),dataType:"json",async:true,error:function(F,E){B.$mapStats_mostExp.html("N/A");B.$mapStats_leastExp.html("N/A");B.$mapStats_avg.html("N/A");B.$mapStats_new.html("N/A")},success:function(E){B.$mapStats_mostExp.html(E.maxPrice);B.$mapStats_leastExp.html(E.minPrice);B.$mapStats_avg.html(E.averagePrice);B.$mapStats_new.html(E.listedToday)},complete:function(E,F){g=null}})}catch(C){alert("SearchStatisticsPanel.load error\n"+C.name+" - "+C.message)}};z.prototype.show=function(){if(y.searchTypes[a("#searchTypes",this.self).val()].showStats.toLowerCase()=="true"){a("#cs-idx-quickstats:hidden",this.self).show()}};z.prototype.hide=function(){a("#cs-idx-quickstats:visible",this.self).hide()};z.prototype.showLoadingIcons=function(){this.$mapStats_mostExp.html('<img src="'+y.resLink+'/t/resources/rpm3.0/images/activity/se_indicator_small.gif"  />');this.$mapStats_leastExp.html('<img src="'+y.resLink+'/t/resources/rpm3.0/images/activity/se_indicator_small.gif"  />');this.$mapStats_avg.html('<img src="'+y.resLink+'/t/resources/rpm3.0/images/activity/se_indicator_small.gif"  />');this.$mapStats_new.html('<img src="'+y.resLink+'/t/resources/rpm3.0/images/activity/se_indicator_small.gif"  />')};function k(B){this.self=B;this.$cs_idx_pagination=a(".cs-pagination-bar-paging-mls-search",this.self);this.$cs_idx_displaying=a(".cs-pagination-bar-displaying-mls-search",B);this.maxResults;this.lastMapHiddenCount=null;this.getHiddenCountText=function(C){if(C>0){if(C==1){return C+" listing unmapped, "}else{return C+" listings unmapped, "}}else{return""}}}k.prototype.insertHiddenCount=function(){var B=this;if(this.lastMapHiddenCount!=null){var C=this.$cs_idx_displaying.html();this.$cs_idx_displaying.filter(":visible").each(function(){a(this).html(C.substring(0,C.indexOf("(")+1)+B.getHiddenCountText(B.lastMapHiddenCount)+C.substring(C.indexOf("(")+1,C.length))})}};k.prototype.load=function(M,D,J,G){this.maxResults=D;var L=this;var P=this.self;var H;var I;var O;var B="";if(M==0){H="No Listings Found";a(".pagination",P).css("display","none")}else{var F=Math.round(M/D+0.4);if(F==0){F=1}else{if(M%D!=0){F+=1}}var N;var C;for(var E=0;E<F;E++){N=E*D;C=(E+1)*D;if(C>M){C=M}if(J==N){if(M<=D){I=1;O="1 page"}else{if(M%D==0){I=(M/D);O=I+" pages"}else{I=parseInt((M/D)+1,10);O=I+" pages"}}if(G>0){this.lastMapHiddenCount=G}H="Showing "+(N+1)+" to "+C+" of "+M+" properties ("+this.getHiddenCountText(G)+O+")";if(J==0){currentPage=1}else{currentPage=(J/D)+1}a(".pagination",P).css("display","block");var K={callback:function(Q,R){s.runSearch.call(P,(Q*L.maxResults),true);return false},next_text:"&nbsp;&gt;&nbsp;",prev_text:"&nbsp;&lt;&nbsp;",num_display_entries:"3",num_edge_entries:"1",current_page:(currentPage-1),items_per_page:1};this.$cs_idx_pagination.each(function(){a(this).pagination(I,K)});break}}}this.$cs_idx_displaying.html(H)};k.prototype.hide=function(B){if(typeof B=="undefined"){a(".cs-pagination-bar-idx-search",this.self).filter(":visible").hide()}else{a(".cs-pagination-bar-idx-search:eq("+B+")",this.self).hide()}};k.prototype.show=function(B){if(typeof B=="undefined"){a(".cs-pagination-bar-idx-search",this.self).filter(":hidden").show()}else{a(".cs-pagination-bar-idx-search:eq("+B+")",this.self).show()}};function n(D,H,C,G,E,B){this.self=D;var F=this;this.maxResults=C;this.zoomLevel=G;this.absoluteUrl=E;this.northEastBounds=null;this.southWestBounds=null;this.mapDiv=B;this.loadingMessage=null;this.newListings=null;this.currentListings=null;this.allListings=null;this.currentClusters=null;this.savedPosition=false;this.openInfoWindowAgain=false;this.markerArray=null;this.clusterSensitivity=0;this.areaLabel=null;this.removeAreaLabel=true;this.infoWindow=null;this.infoWindowClose=null;this.cachedNortheastBounds=null;this.cachedSouthwestBounds=null;this.map=new google.maps.Map(document.getElementById(this.mapDiv),{center:H,zoom:this.zoomLevel,mapTypeId:google.maps.MapTypeId.ROADMAP});a('<div class="cs-idx-search-loading-message-container"><span class="cs-idx-search-loading-message">Searching Listings...</span></div>').appendTo(".cs-idx-search-container",this.self);this.loadingMessage=a(".cs-idx-search-loading-message",this.self)}n.prototype.getMarkerPosition=function(C){var G=Math.pow(2,this.map.getZoom());var B=new google.maps.LatLng(this.map.getBounds().getNorthEast().lat(),this.map.getBounds().getSouthWest().lng());var F=this.map.getProjection().fromLatLngToPoint(B);var E=this.map.getProjection().fromLatLngToPoint(C.getPosition());var D=new google.maps.Point(Math.floor((E.x-F.x)*G),Math.floor((E.y-F.y)*G));return D};n.prototype.disableMapMoveEvent=function(B){y.disableMapMoveEvent=B};n.prototype.setMapType=function(B){return this.map.setMapType(B)};n.prototype.getContainer=function(){return this.map.getContainer()};n.prototype.setSavedPosition=function(){if(!this.savedPosition){this.sCenter=this.map.getCenter();this.savedPosition=true}else{this.openInfoWindowAgain=true}};n.prototype.returnToSavedPosition=function(){if(!this.openInfoWindowAgain){this.map.panTo(this.sCenter);this.savedPosition=false}};n.prototype.addControl=function(B){this.map.addControl(B)};n.prototype.getZoom=function(){return this.map.getZoom()};n.prototype.setZoom=function(B){this.map.setZoom(B)};n.prototype.setCenter=function(C,B){this.map.setCenter(C);this.map.setZoom(B)};n.prototype.getCenter=function(){return this.map.getCenter()};n.prototype.getNortheastBounds=function(){if(y.currentSearchView==y.searchViews.map||this.cachedNortheastBounds==null){var C=Math.pow(2,this.map.getZoom());var B=this.map.getProjection().fromLatLngToPoint(this.map.getBounds().getNorthEast());var D=new google.maps.Point(B.x*C,B.y*C);D.x-=9;D.y+=29;B=new google.maps.Point(D.x/C,D.y/C);this.cachedNortheastBounds=this.map.getProjection().fromPointToLatLng(B)}return this.cachedNortheastBounds};n.prototype.getSouthwestBounds=function(){if(y.currentSearchView==y.searchViews.map||this.cachedSouthwestBounds==null){var B=Math.pow(2,this.map.getZoom());var C=this.map.getProjection().fromLatLngToPoint(this.map.getBounds().getSouthWest());var D=new google.maps.Point(C.x*B,C.y*B);D.x+=9;D.y-=14;C=new google.maps.Point(D.x/B,D.y/B);this.cachedSouthwestBounds=this.map.getProjection().fromPointToLatLng(C)}return this.cachedSouthwestBounds};n.prototype.getMap=function(){return this.map};n.prototype.addOverlay=function(B){this.map.addOverlay(B)};n.prototype.showLoadingMessage=function(){this.loadingMessage.show()};n.prototype.hideLoadingMessage=function(){this.loadingMessage.hide()};n.prototype.addListings=function(C){if(C.totalResults==0){this.clearOverlays();y.pagination.load(C.totalResults,C.maxResults,C.startNumber,0);return}this.tempListings=new Hashtable();this.newListings=new Hashtable();this.newClusters=[];this.existingListings=new Hashtable();var D=0;if(this.allListings==null){this.allListings=new Hashtable()}if(this.currentClusters==null){this.currentClusters=[]}for(var B=0;B<C.listings.length;B++){if(C.listings[B].latitude==""&&C.listings[B].longitude==""){D++}else{if(this.allListings.get(C.listings[B].listingNumber)==null){this.newListings.put(C.listings[B].listingNumber,new b(C.listings[B].listingNumber,C.listings[B].latitude,C.listings[B].longitude,C.listings[B].markerColor,C.listings[B].mlsNumber,C.listings[B].formattedPrice,C.listings[B].mainPhoto,C.listings[B].picCount,C.listings[B].listingAgentsString,C.listings[B].labelValuePairs));this.tempListings.put(C.listings[B].listingNumber,new b(C.listings[B].listingNumber,C.listings[B].latitude,C.listings[B].longitude,C.listings[B].markerColor,C.listings[B].mlsNumber,C.listings[B].formattedPrice,C.listings[B].mainPhoto,C.listings[B].picCount,C.listings[B].listingAgentsString,C.listings[B].labelValuePairs))}else{this.existingListings.put(C.listings[B].listingNumber,this.allListings.get(C.listings[B].listingNumber));this.tempListings.put(C.listings[B].listingNumber,this.allListings.get(C.listings[B].listingNumber))}}}this.removeInvalidListings();this.refactorExistingClusters();this.addListingsToExistingClusters();this.createNewClusters();this.allListings=this.tempListings;this.newListings.moveFirst();while(this.newListings.next()){this.allListings.get(this.newListings.getKey()).addToMap()}for(var B=0;B<this.newClusters.length;B++){this.newClusters[B].initializeMarker()}for(var B=0;B<this.currentClusters.length;B++){this.currentClusters[B].resetMarkerPosition()}this.existingListings.moveFirst();while(this.existingListings.next()){this.allListings.get(this.existingListings.getKey()).setMOClasses(true)}this.currentClusters=this.currentClusters.concat(this.newClusters);y.pagination.load(C.totalResults,C.maxResults,C.startNumber,D)};n.prototype.createNewClusters=function(){var C=false;var I=null;var J=new Hashtable();var D=new Hashtable();var H=new Hashtable();var F=[];this.newListings.moveFirst();while(this.newListings.next()){F.push(this.newListings.getValue())}for(var G=0;G<this.currentClusters.length;G++){D=D.add(this.currentClusters[G].listings)}this.existingListings.moveFirst();while(this.existingListings.next()){if(D.get(this.existingListings.getKey())==null){F.push(this.existingListings.getValue())}}if(C){alert("this.newListings: "+this.newListings.size()+"\nlistings: "+F.length)}for(var G=0;G<F.length-1;G++){if(H.get(F[G])==null){J=null;for(var E=G+1;E<F.length;E++){if(H.get(F[E].listnum)==null&&F[G].listnum!=F[E].listnum){if(F[G].getBounds().intersects(F[E].getBounds())){if(J==null){J=new Hashtable();J.put(F[G].listnum,F[G]);if(C){alert("init - adding "+F[G].listnum)}}if(C){alert("after init - adding "+F[E].listnum)}J.put(F[E].listnum,F[E]);F.splice(E,1);E--}}}if(J!=null){J.moveFirst();while(J.next()){if(this.newListings.get(J.getKey())!=null){this.newListings.remove(J.getKey())}else{if(this.existingListings.get(J.getKey())!=null){this.existingListings.get(J.getKey()).removeFromMap();this.existingListings.remove(J.getKey())}else{if(C){alert("createNewClusters - clustered listing not found in list!!!")}}}}I=new u(J);this.newClusters.push(I);if(C){var B="";J.moveFirst();while(J.next()){B+="\n"+J.getKey()}alert("Number of listings in new cluster: "+J.size()+B)}H=H.add(J);F.splice(G,1);G--}}}if(C){alert("Size of this.newClusters: "+this.newClusters.length)}for(var G=0;G<this.newClusters.length;G++){for(var E=0;E<F.length;E++){if(this.newClusters[G].getMarkerBounds().intersects(F[E].getBounds())){this.newClusters[G].addListing(F[E].listnum,F[E]);if(this.newListings.get(F[E].listnum)!=null){this.newListings.remove(F[E].listnum)}else{if(this.existingListings.get(F[E].listnum)!=null){if(this.existingListings.get(F[E].listnum).onMap){this.existingListings.get(F[E].listnum).removeFromMap()}this.existingListings.remove(F[E].listnum)}}}}}for(var G=0;G<this.newClusters.length-1;G++){for(var E=G+1;E<this.newClusters.length;E++){if(this.newClusters[E].getMarkerBounds().intersects(this.newClusters[G].getMarkerBounds())){this.newClusters[G].listings.add(this.newClusters[E].listings);this.newClusters.splice(E,1);E--}}}for(var G=0;G<this.currentClusters.length;G++){for(var E=0;E<this.newClusters.length;E++){if(this.newClusters[E].getMarkerBounds().intersects(this.currentClusters[G].getMarkerBounds())){this.currentClusters[G].listings.add(this.newClusters[E].listings);this.newClusters.splice(E,1);E--}}}};n.prototype.addListingsToExistingClusters=function(){var D=null;for(var C=0;C<this.currentClusters.length;C++){D=[];this.newListings.moveFirst();while(this.newListings.next()){if(this.newListings.getValue().getBounds().intersects(this.currentClusters[C].getMarkerBounds())){this.currentClusters[C].addListing(this.newListings.getValue().listnum,this.newListings.getValue());D.push(this.newListings.getValue().listnum)}}for(var B=0;B<D.length;B++){this.newListings.remove(D[B])}D=[];this.existingListings.moveFirst();while(this.existingListings.next()){if(this.existingListings.getValue().onMap&&this.existingListings.getValue().getBounds().intersects(this.currentClusters[C].getMarkerBounds())){this.currentClusters[C].addListing(this.existingListings.getValue().listnum,this.existingListings.getValue());D.push(this.existingListings.getValue().listnum)}}for(var B=0;B<D.length;B++){this.existingListings.get(D[B]).removeFromMap();this.existingListings.remove(D[B])}}};n.prototype.refactorExistingClusters=function(){var C=false;for(var E=0;E<this.currentClusters.length;E++){var H=this.currentClusters[E].listingsArray();var I=[];if(C){this.currentClusters[E].showBounds()}for(var D=0;D<H.length-1;D++){if(C){H[D].showBounds()}for(var B=D+1;B<H.length;B++){if(!H[D].getBounds().intersects(H[B].getBounds())){I.push(H[B]);H.splice(B,1);B--}}}if(C&&I.length>0){var G="";for(var F=0;F<I.length;F++){G+="\n"+I[F].listnum}alert("Cluster "+E+":"+G)}if(I.length>0){for(var D=0;D<I.length;D++){if(!this.currentClusters[E].removeListing(I[D].listnum)){if(C){this.currentClusters[E].listings.moveFirst();var G="\n---";while(this.currentClusters[E].listings.next()){G+="\n"+this.currentClusters[E].listings.getValue().listnum}G+="\n---";alert("refactorExistingClusters - remove listing "+I[D].listnum+" failed on cluster "+E+G)}}this.newListings.put(I[D].listnum,I[D]);this.existingListings.remove(I[D].listnum)}if(this.currentClusters[E].size()<2){if(this.currentClusters[E].size()==1){this.newListings.add(this.currentClusters[E].listings)}this.currentClusters[E].destroyMarker();this.currentClusters.splice(E,1);E--}}}for(var E=0;E<this.currentClusters.length-1;E++){for(var D=E+1;D<this.currentClusters.length;D++){if(this.currentClusters[E].getMarkerBounds().intersects(this.currentClusters[D].getMarkerBounds())){this.currentClusters[E].listings=this.currentClusters[E].listings.add(this.currentClusters[D].listings);this.currentClusters[D].destroyMarker();this.currentClusters.splice(D,1);D--}}}};n.prototype.removeInvalidListings=function(){var B=false;this.allListings.moveFirst();while(this.allListings.next()){if(this.tempListings.get(this.allListings.getKey())==null){if(!this.allListings.getValue().onMap){for(var C=0;C<this.currentClusters.length;C++){if(this.currentClusters[C].listingExists(this.allListings.getKey())){if(!B){this.currentClusters[C].removeListing(this.allListings.getKey())}else{if(!this.currentClusters[C].removeListing(this.allListings.getKey())){alert("removeInvalidListings - remove from cluster failed!")}}break}}}this.allListings.getValue().removeFromMap();this.allListings.remove(this.allListings.getKey());this.allListings.moveFirst()}}for(var C=0;C<this.currentClusters.length;C++){if(this.currentClusters[C].size()<2){if(this.currentClusters[C].size()==1){this.newListings.add(this.currentClusters[C].listings)}this.currentClusters[C].destroyMarker();this.currentClusters.splice(C,1);C--}}};n.prototype.clearOverlays=function(){if(this.allListings!=null&&typeof this.allListings!="undefined"){this.allListings.moveFirst();while(this.allListings.next()){this.allListings.getValue().removeFromMap()}this.allListings=null}if(this.currentClusters!=null&&this.currentClusters!="undefined"){for(var B=0;B<this.currentClusters.length;B++){this.currentClusters[B].destroyMarker()}this.currentClusters=null}};n.prototype.checkResize=function(){google.maps.event.trigger(this.map,"resize")};var s={runQuickSearch:function(C){var B=this;var D=a(this);B.searchAjaxActivity=a.ajax({type:"GET",url:y.absUrl,data:"pathway=5&textSearch=true&queryText="+encodeURIComponent(C),dataType:"json",error:function(F,E){setTimeout(function(){a("#searchEngineSearchOptionsLoadingOverlay",B).unblock()},1000)},success:function(E){if(E.searchResultType=="Listing"){v.listingDetails.call(D,E.listingNumber)}else{if(E.searchResultType=="Map"){y.map.setCenter(new google.maps.LatLng(E.lat,E.lng),parseInt(E.zoom,10));y.currentNEBounds=y.map.getNortheastBounds();y.currentSWBounds=y.map.getSouthwestBounds();a(function(){google.maps.event.addListenerOnce(y.map.getMap(),"tilesloaded",function(){y.map.areaLabel=new x(new google.maps.LatLng(E.lat,E.lng),'<div class="cs-idx-areaid-marker">'+E.queryText+"</div>",x.Center,0.8,E.queryText);y.map.areaLabel.setMap(y.map.getMap());y.map.areaLabel.show()})})}else{alert("No Records Found")}}}})},getSearchCoords:function(){var B="";if(y.plugin){B="[]"}return"&latitude"+B+"="+y.map.getSouthwestBounds().lat()+"&latitude"+B+"="+y.map.getNortheastBounds().lat()+"&longitude"+B+"="+y.map.getSouthwestBounds().lng()+"&longitude"+B+"="+y.map.getNortheastBounds().lng()},getSearchUrlString:function(D){var B=this;var E=a(this);var F="";if(y.plugin){F="[]"}var C="";a(".cs-slider",B).each(function(){var G=a(this).attr("id");C+="&"+G+F+"="+encodeURIComponent(a(".cs-slider-inner-label-value-left",this).html())+"&"+G+F+"="+encodeURIComponent(a(".cs-slider-inner-label-value-right",this).html())});a(".cs-dd-range",B).each(function(){var G=a(this).attr("id");C+="&"+G+F+"="+encodeURIComponent(a(".cs-dd-range-left",this).val())+"&"+G+F+"="+encodeURIComponent(a(".cs-dd-range-right",this).val())});a(".cs-treeview",B).each(function(){var G=a(this).attr("id");a(this).find("input:checked").each(function(){C+="&"+G+F+"="+a(this).attr("id")})});a(".datetime_range",B).each(function(){var G=a(this).attr("id");C+="&"+G+F+"="+encodeURIComponent(a("#"+G+"Start",this).val())+"&"+G+F+"="+encodeURIComponent(a("#"+G+"End",this).val())});a("#hiddenSearchOptions",B).find("input").each(function(){if(a(this).parent().attr("class")=="datetime_range"){return}var G=a(this).attr("id");C+="&"+G+F+"="+encodeURIComponent(a("#"+G+"").val())});a(".cs-idx-search-vip-options",B).find("input:checked").each(function(){var G=a(this).attr("id");C+="&"+G+F+"=true"});if(C==""){C="&"}return C},loadConfig:function(C){var B=this;var E=a(this);if(y==null){y=E.data("config");if(y==null){if(C!=null){y={};if(!C){return false}a.extend(y,C)}else{var D={name:"loadConfig",message:"No config available"};throw D}}}},runSearch:function(E,D){var B=this;var C=a(this);if(typeof E=="undefined"){E=0}if(typeof D=="incremental"){D=false}if(!y.disableMapMoveEvent){if(y.map.removeAreaLabel&&y.map.areaLabel!=null){y.map.areaLabel.hide();y.map.areaLabel.setMap(null);y.map.areaLabel=null;a("#cs-idx-quicksearch",this).val("")}else{if(!y.map.removeAreaLabel){y.map.removeAreaLabel=true}}if(y.currentNEBounds==null||y.currentSWBounds==null){y.currentNEBounds=y.map.getNortheastBounds();y.currentSWBounds=y.map.getSouthwestBounds()}if(y.currentSearchView==y.searchViews.list){y.refactorMap=true;y.currentListingsSort=parseInt(a(".cs-pagination-bar-select:eq(0)",this).val(),10);y.listViewPanel.load(E,D)}else{if(y.currentSearchView==y.searchViews.stats){y.refactorMap=true;y.marketAnalyzerPanel.load(false)}else{y.mapViewPanel.load(E,D)}}}},loadSearchOptions:function(G,B,E){try{var C=this;var F=a(this);y.mlsSearchType=G;if(y.currentSearchView==y.searchViews.stats&&y.searchTypes[y.mlsSearchType].showStats.toLowerCase()=="true"){a("#mapView",this).click()}if(!B){if(p!=null){p.abort()}p=a.ajax({type:"GET",url:y.absUrl,data:"pathway=5&options=true&envPropType="+G,dataType:"html",beforeSend:function(){},error:function(I,H){setTimeout(function(){a("#searchEngineSearchOptionsLoadingOverlay",C).unblock()},1000)},success:function(H){a("#cs-idx-search-options",C).html(H)},complete:function(H,I){s.initSearchOptions.call(C);if(E){s.runSearch.call(C)}}})}else{s.initSearchOptions.call(C);if(y.searchTypes[y.mlsSearchType].showStats.toLowerCase()=="false"){y.searchStatisticsPanel.hide()}if(y.map.getMap().getProjection()==null){google.maps.event.addListenerOnce(y.map.getMap(),"idle",function(){s.runSearch.call(C)})}else{s.runSearch.call(C)}}}catch(D){alert("helpers.loadSearchOptions error\n"+D.name+" - "+D.message)}},initSearchOptions:function(){try{var B=this;var D=a(this);a("#cs-id-save-search-tab",B).unbind("click").bind("click",function(){var E=0;a.csVOWPanel("csVOWAjax",{type:"POST",url:y.absUrl,beforeSend:function(){},data:"pathway=5&startNumber="+E+"&saveSearch=true&envPropType="+y.mlsSearchType+s.getSearchUrlString.call(B)+s.getSearchCoords.call(B)+"&zoomLevel="+y.map.getZoom()+"&listingsSort="+D.find(".cs-pagination-bar-select:eq(0)").val(),dataType:"html",success:function(F){a(B).block({message:"Saving..."});a("#saveSearchButton",B).hide();a("#savedSearchMessage",B).show()},complete:function(){setTimeout(function(){a(B).unblock()},500)},failComplete:function(){setTimeout(function(){a(B).unblock()},500)}},function(){setTimeout(function(){a(B).unblock()},500)},function(){},true);return false});a("#saveSendOptions",B).mouseover(function(){a("#saveSendOptions",B).toggleClass("saveSendOptions_on")});a("#saveSendOptions",B).mouseout(function(){a("#saveSendOptions",B).toggleClass("saveSendOptions_on")});a(".cs-treeview",B).find(".cs-treeview-check-all, .cs-treeview-check-none").each(function(){var E=this;a(this).click(function(){a(this).siblings(".cs-treeview-boxtree-container").find("li").each(function(){if(a(E).attr("class")=="cs-treeview-check-all"){a(this).find("input:checkbox").attr("checked",true)}else{a(this).find("input:checkbox").attr("checked",false)}});s.runSearch.call(B);return false})});a("#foreclosure, #estateSale",B).click(function(){var E=this;a.csVOWPanel("csVOWAjax",{type:"GET",dataType:"html",url:y.absUrl,data:"pathway=5&vipAccessCheck=true",error:function(G,F){},success:function(F){if(E.id=="estateSale"){a("#foreclosure:checked",B).each(function(){this.checked=false})}else{a("#estateSale:checked",B).each(function(){this.checked=false})}s.runSearch.call(E)},failComplete:function(){}},function(){},function(){a("#estateSale:checked, #foreclosure:checked",B).each(function(){this.checked=false})},true)});if(a("#listDateRangeStart",B).val()!=""||a("#listDateRangeEnd",B).val()!=""){v.lockByListDate.call(B,true)}}catch(C){alert("initSearchOptions error\n"+C.name+" - "+C.message)}}};var v={init:function(B){return this.each(function(){try{var D=this;var F=a(this);s.loadConfig.call(this,B);a(document.body).mousemove(function(G){});if(typeof y.zoomLevel=="undefined"||typeof y.absUrl=="undefined"||typeof y.firstSearch=="undefined"||typeof y.mapDiv=="undefined"||typeof y.mlsSearchType=="undefined"||typeof y.listingsSort=="undefined"||typeof y.startSearchViewType=="undefined"){alert("Required fields missing, exiting...");return false}y.modletId=F.attr("id").substring(F.attr("id").lastIndexOf("_")+1);y.searchViews={map:0,list:1,stats:2};y.currentSearchView=y.startSearchViewType;y.rangeTypes={slide:0,drop:1};y.currentRangeType=null;y.currentNEBounds=null;y.currentSWBounds=null;y.currentPage=0;y.refactorMap=false;y.disableMapMoveEvent=false;if(y.resLink==null){y.resLink=""}y.self=D;var C=parseInt(y.listingsSort);if(!isNaN(C)){y.currentListingsSort=C;a(".cs-pagination-bar-select:eq(0)",D).val(C)}else{y.currentListingsSort=0}y.pagination=new k(this);y.mapViewPanel=new c(this);y.listViewPanel=new h(this);y.marketAnalyzerPanel=new d(this);y.searchStatisticsPanel=new z(this);a("#searchTypes",this).change(function(){if(y.searchTypes[a(this).val()].showStats.toLowerCase()=="true"){a("#cs-idx-view-market-analyzer",D).parent(":hidden").show("slide",{direction:"left"});a("#cs-idx-quickstats:hidden",D).show("slide",{direction:"left"})}else{a("#cs-idx-view-market-analyzer",D).parent(":visible").hide("slide",{direction:"left"});a("#cs-idx-quickstats:visible",D).hide("slide",{direction:"left"})}s.loadSearchOptions.call(D,y.searchTypes[a(this).val()].searchTypeId,false,true)});a("#cs-id-search-options-tab",this).click(function(){if(a("#cs-idx-search-options",D).css("display")=="none"){a("#cs-idx-search-options",D).slideDown();a(this).addClass("cs-idx-search-options-tab-active")}else{a("#cs-idx-search-options",D).slideUp();a(this).removeClass("cs-idx-search-options-tab-active")}return false});if(y.currentSearchView==y.searchViews.list){a("#cs-idx-search-options",D).hide();a("#cs-id-search-options-tab",D).removeClass("cs-idx-search-options-tab-active")}a(this).delegate(".cs-pagination-bar-select","change",function(){if(a(this).val()&&a(this).val()!=""){if(a(".cs-pagination-bar-select",D).length>1){var G=a(this).val();a(".cs-pagination-bar-select",D).each(function(){if(a(this).val()!=G){a(this).val(G)}})}s.runSearch.call(D,0,true)}});y.quickSearchLoading=null;a("#term",this).bind("click",function(){a(this).val("")}).autocomplete({autoFocus:true,disabled:false,appendTo:"#"+F.attr("id"),source:y.absUrl+"?pathway=5&autoComp=true",minLength:2,delay:400,search:function(){var G=this;a(this).addClass("cs-idx-quick-search-loading");clearTimeout(y.quickSearchLoading);y.quickSearchLoading=setTimeout(function(){a(G).removeClass("cs-idx-quick-search-loading")},3000)},open:function(){var G=this;clearTimeout(y.quickSearchLoading);y.quickSearchLoading=setTimeout(function(){a(G).removeClass("cs-idx-quick-search-loading")},1000)},select:function(G,H){if(H.item.value=="no results"){return false}else{s.runQuickSearch.call(D,H.item.value)}},close:function(){}}).css("color",a(".cs-form-simple",this).css("color"));a(window).load(function(){if(a("#term",D).val()==null||a("#term",D).val()==""||a("#term",D).val()=="City, Neighborhood, Address, MLS, etc."){s.loadSearchOptions.call(D,y.mlsSearchType,true,true)}else{s.loadSearchOptions.call(D,y.mlsSearchType,true,false);s.runQuickSearch.call(D,a("#term",D).val())}});F.data("config",y)}catch(E){alert("init error\n"+E.name+" - "+E.message)}})},updateResults:function(C,B){return this.each(function(){try{s.loadConfig.call(this,l);s.runSearch.call(this,C,B)}catch(D){alert("updateResults error\n"+D.name+" - "+D.message)}})},updatePagination:function(B,C,E,D){return this.each(function(){try{s.loadConfig.call(this,l);y.pagination.load(B,C,E,D)}catch(F){alert("updatePagination error\n"+F.name+" - "+F.message)}})},busyOverlay:function(D,B){try{var C=this;var F=a(this);if(B){if(D=="listingDetails"){a("#searchEngineLeftColumnBusyOverlay, #searchEngineLeftColumnBusyCloseListingDetails",C).fadeIn()}else{a("#searchEngineLeftColumnBusyOverlay, #searchEngineLeftColumnBusyLoadingMessage",C).fadeIn()}}else{if(D=="listingDetails"){a("#searchEngineLeftColumnBusyOverlay, #searchEngineLeftColumnBusyCloseListingDetails",C).fadeOut()}else{a("#searchEngineLeftColumnBusyOverlay, #searchEngineLeftColumnBusyLoadingMessage",C).fadeOut()}}return false}catch(E){alert("busyOverlay error\n"+E.name+" - "+E.message)}},listingDetails:function(B){return this.each(function(){try{var C=this;var F=a(this);s.loadConfig.call(this,D);if(B!=null){var D={href:y.absUrl,cb_his_control:"log",top:"30px",scrolling:false,data:"pathway=6&type=mls&envPropType="+y.mlsSearchType+"&listingNumber="+B+"&viewType=mls&modletId="+a.clickSoldUtils("getNextAvailableModuleId"),innerWidth:f,initialWidth:100,initialHeight:100,opacity:0.5,onComplete:function(){a.clickSoldUtils("infoBoxResize")}};a.clickSoldUtils("infoBoxCreate",D)}}catch(E){alert("listingDetails error\n"+E.name+" - "+E.message)}})},lockByListDate:function(B){try{var C=this;if(B==true){a("#cs-idx-search-list-date-restriction-msg",C).slideDown();a("#cs-id-save-search-tab").fadeOut();a("#cs-id-quick-search-tab").fadeOut();a("#cs-idx-search-list-date-restriction-msg",C).click(function(){a(this).unbind("click");return v.lockByListDate.call(C,false)})}else{a("#cs-idx-search-list-date-restriction-msg",C).slideUp();a("#cs-id-save-search-tab").fadeIn();a("#cs-id-quick-search-tab").fadeIn();a("#listDateRangeStart",C).val("");a("#listDateRangeEnd",C).val("");s.runSearch.call(C)}}catch(D){alert("lockByListDate error\n"+D.name+" - "+D.message)}finally{return false}}};try{if(v[j]){return v[j].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof j==="object"){return v.init.apply(this,arguments)}else{alert("Error! Method does not exist: "+j);a.error("Method "+j+" doesn't exist on jQuery.csIDXSearchEngine")}}}catch(t){alert("$.fn.csIDXSearchEngine - error\n"+t.name+" - "+t.message)}}})(jQuery);function searchType(b,c,a){this.searchTypeId=b;this.icon=c;this.showStats=a}(function(){$.fn.RPMSlideShow=function(a){return this.each(function(){var b=this;this.ajaxLoading=null;this.config=jQuery.extend({virtualTour:false},a||{});if(b.config.virtualTour){$(this).find("ul").find("a").each(function(){var c=this;c.hyperlink=$(this).attr("href");$(this).attr("href","#");$(this).click(function(){$(b).find(".tourFrame").attr("src",c.hyperlink);return false})})}else{$(this).find("ul").find("a").click(function(){if(b.ajaxLoading){b.ajaxLoading.abort()}$(b).find("#tour").clearApplet();$(b).find("ul").find("img").removeClass("selected");$(this).find("img").addClass("selected");$(b).find(".photo").find("img").attr("src",$(this).find("img").attr("src"));$(b).find(".description").html($(this).find("img").attr("alt"));return false})}$(this).find(".photoNavPrev, .photoNavNext").click(function(){b.prevNextType=$(this).attr("class");b.count=0;$(b).find("li").each(function(){if($(this).find("img").attr("src")==$(b).find(".photo").children("img").attr("src")&&b.count>=0){if(b.prevNextType=="photoNavPrev"){if(b.count==0){b.count=$(b).find("li").size()-1}else{b.count--}}else{if(b.count==($(b).find("ul").children().size()-1)){b.count=0}else{b.count++}}$(b).find("li").eq(b.count).find("a").click();$(b).find(".thumbnailColumnWrap").get(0).scrollTop=b.count*68-68;b.count=-1}if(b.count>=0){b.count++}});return false});$(this).find(".photoOptionsDescription").click(function(){$(b).find(".description").slideToggle();return false});$(this).find(".photoOptionsEnlarge").click(function(){tb_show($(b).find(".description").html(),$(b).find(".photo").find("img").attr("src"),false);return false})})}})(jQuery);Hashtable.prototype.hash=null;Hashtable.prototype.keys=null;Hashtable.prototype.location=null;function Hashtable(){this.hash=new Array();this.keys=new Array();this.location=0}Hashtable.prototype.put=function(a,b){if(b==null){return}if(this.hash[a]==null){this.keys[this.keys.length]=a}this.hash[a]=b};Hashtable.prototype.get=function(a){return this.hash[a]};Hashtable.prototype.remove=function(b){for(var a=0;a<this.keys.length;a++){if(b==this.keys[a]){this.hash[this.keys[a]]=null;this.keys.splice(a,1);return}}};Hashtable.prototype.size=function(){return this.keys.length};Hashtable.prototype.populateItems=function(){};Hashtable.prototype.next=function(){if(++this.location<this.keys.length){return true}else{return false}};Hashtable.prototype.moveFirst=function(){try{this.location=-1}catch(a){}};Hashtable.prototype.moveLast=function(){try{this.location=this.keys.length-1}catch(a){}};Hashtable.prototype.getKey=function(){try{return this.keys[this.location]}catch(a){return null}};Hashtable.prototype.getValue=function(){try{return this.hash[this.keys[this.location]]}catch(a){return null}};Hashtable.prototype.getKeyOfValue=function(b){for(var a=0;a<this.keys.length;a++){if(this.hash[this.keys[a]]==b){return this.keys[a]}}return null};Hashtable.prototype.toString=function(){try{var c=new Array(this.keys.length);c[c.length]="{";for(var b=0;b<this.keys.length;b++){c[c.length]=this.keys[b];c[c.length]="=";var a=this.hash[this.keys[b]];if(a){c[c.length]=a.toString()}else{c[c.length]="null"}if(b!=this.keys.length-1){c[c.length]=", "}}}catch(d){}finally{c[c.length]="}"}return c.join("")};Hashtable.prototype.add=function(a){try{a.moveFirst();while(a.next()){var b=a.getKey();this.hash[b]=a.getValue();if(this.get(b)!=null){this.keys[this.keys.length]=b}}}catch(c){}finally{return this}};
