if(!window.Beast)window.Beast={};
Global={TrackCookieKey:"_ds_tcm_"+AccountVars.aid+"_"+AccountVars.sid,Source:"",OnLoad:function(){AccountVars.allowVisitorRegistration&&typeof LoginStatus!="undefined"&&LoginStatus.init(this.OnVisitorCallback.bind(this));Global.ForceChromeFrame&&this.launchOldBrowserUpgrade();Global.FullScreenEnabled?this.resizeTabsForFullScreen():this.restoreTabs()},OnVisitorCallback:function(){LoginStatus.showStatus()},FormatPrice:function(a){a=a+"";for(var b="",c=0;c<a.length;c++){if((a.length-c)%3==0&&c>0)b+=
",";b+=a.charAt(c)}return b},ValidateEmailAddress:function(a){return a.indexOf(".")>0&&a.indexOf("@")>0&&a!=""},GetScrollY:function(){return(window.scrollY?window.scrollY:document.documentElement.scrollTop)+Beast.FrameCommunicator.GetParentScroll()},FixXmlDoc:function(a){var b=navigator.userAgent.toLowerCase();return/mozilla/.test(b)&&!/(compatible|webkit)/.test(b)?(new DOMParser).parseFromString(a.responseText,"text/xml"):a.responseXML},FormatBaths:function(a,b){a=parseFloat(String(a));if(isFinite(a)){var c=
Math.round((a-Math.floor(a))*100),d=Math.round(Math.floor(a)-c);return d+(c==0?"":" full "+c+" part")+(typeof b=="undefined"||b?d+c>1?" baths":" bath":"")}else return"0"+(typeof b=="undefined"||b?" baths":"")},showAgentChat:function(){var a="";if(Session.CurrentVisitor&&Session.CurrentVisitor.Email)a="&Name="+Session.CurrentVisitor.FirstName+" "+Session.CurrentVisitor.LastName+"&Email="+Session.CurrentVisitor.Email;window.open("http://chat.dsagentchat.com/?PublicId="+AccountVars.agentChatTargetPublicId+
a,"","width=444,height=444")},createCookie:function(a,b,c){if(c){var d=new Date;d.setTime(d.getTime()+c*24*60*60*1E3);c="; expires="+d.toGMTString()}else c="";document.cookie=a+"="+b+c+"; path=/"},readCookie:function(a){a=a+"=";for(var b=document.cookie.split(";"),c=0;c<b.length;c++){for(var d=b[c];d.charAt(0)==" ";)d=d.substring(1,d.length);if(d.indexOf(a)==0)return d.substring(a.length,d.length)}return null},eraseCookie:function(a){Global.createCookie(a,"",-1)},thirdPartyFrame:function(a){if($("ThirdPartyFrame"))a();
else{$("ThirdPartyFrameContainer").update("<iframe id='ThirdPartyFrame' name='ThirdPartyFrame' src='/ThirdPartyFrame.aspx?MasterAccountID="+AccountVars.aid+"&SearchSetupID="+AccountVars.sid+"' style='width:0px;height:0px;'></iframe>");Event.observe($("ThirdPartyFrame").contentWindow,"load",a)}},redrawCss3Pie:function(a,b){try{for(var c=$(a).select(b),d=0,e=c.length;d<e;d++){var f=c[d];f.addClassName("no-pie");f.removeClassName("no-pie")}}catch(h){}},fireEvent:function(a,b){if(document.createEventObject){var c=
document.createEventObject();return a.fireEvent("on"+b,c)}else{c=document.createEvent("HTMLEvents");c.initEvent(b,true,true);return!a.dispatchEvent(c)}},toggleFullScreen:function(){if(Global.FullScreenEnabled){opener.location.href=location.href.replace("/full","");opener.location.reload(true);window.close()}else{var a=screen.availHeight,b=screen.availWidth;if(Prototype.Browser.WebKit)a-=60;Global.fullScreenZoomLevel=Mapper.getZoom();Global.fullScreenCenter=Mapper.getCenter();this.FullWindow=window.open((location.pathname==
"/"?AccountVars.rootPath:location.pathname)+"/full"+location.search+location.hash,"_blank","resizable=1,scrollbars=1,menubar=0,toolbar=0,location=0,personalbar=0,status=0,top=0,left=0,width="+b+",height="+a);this.FullWindow.fullScreenZoomLevel=Global.fullScreenZoomLevel;this.FullWindow.fullScreenCenter=Global.fullScreenCenter;this.FullWindow.focus&&this.FullWindow.focus();if(!Prototype.Browser.WebKit){this.FullWindow.moveTo(0,0);this.FullWindow.resizeTo(b,a)}}},checkToggleFullScreen:function(){if((document.fullscreen||
document.webkitIsFullScreen||document.mozFullScreen)!=Global.FullScreenEnabled)Global.toggleFullScreen()},resizeTabsForFullScreen:function(){var a=screen.availHeight-$("RightPanelWrapper").cumulativeOffset().top-59-31-10;$("ResultData").setStyle({height:a+"px"});$("ResultData_Track").setStyle({height:a-32+"px"});$("ResultData_Down").setStyle({top:a-16+"px"});$("map").setStyle({height:a+"px"});$("MainPanelWrapper").style.maxWidth="inherit"},restoreTabs:function(){$("MainPanelWrapper").style.maxWidth=
"1130px"},launchOldBrowserUpgrade:function(){Beast.Analytics.trackEvent("Miscellaneous","/LaunchOldBrowserUpgrade");document.documentElement.style.overflow="hidden";document.body.scroll="no";this.repositionOldBrowserUpgrade();if(!this.repositionOldBrowserUpgradeProxy)this.repositionOldBrowserUpgradeProxy=this.repositionOldBrowserUpgrade.bind(this);Event.observe(window,"resize",this.repositionOldBrowserUpgradeProxy)},repositionOldBrowserUpgrade:function(){var a=$("ChromeFrameInstaller_Bg"),b=$("ChromeFrameInstaller");
b.hasClassName("active")||b.addClassName("active");a.setStyle({height:document.viewport.getHeight()+"px",width:document.viewport.getWidth()+"px",top:document.viewport.getScrollOffsets()[1]+"px"});a.show();b.show();b.setStyle({left:document.viewport.getWidth()/2-b.getWidth()/2+"px",top:document.viewport.getScrollOffsets()[1]+document.viewport.getHeight()/2-b.getHeight()/2+"px"})},launchInternetExplorerUpgrade:function(){Beast.Analytics.trackEvent("Miscellaneous","/LaunchInternetExplorerUpgrade");window.open("http://windows.microsoft.com/en-US/internet-explorer/downloads/ie")},
launchChromeFrameInstaller:function(){Beast.Analytics.trackEvent("Miscellaneous","/LaunchChromeFrameInstaller");document.documentElement.style.overflow="auto";document.body.scroll="auto";Event.stopObserving(window,"resize",this.repositionOldBrowserUpgradeProxy);$("ChromeFrameInstaller_Bg").hide();$("ChromeFrameInstaller").hide();CFInstall.check({mode:"overlay",destination:location.href})}};document.observe("dom:loaded",Global.OnLoad.bind(Global));
Array.prototype.remove=function(a,b){var c=this.slice((b||a)+1||this.length);this.length=a<0?this.length+a:a;return this.push.apply(this,c)};
Map_Search={Settings:{MasterAccountID:0,SearchSetupID:0,LinkID:0,Width:500,Height:350,CenterResults:true,SearchBarHeight:20,StatusBarHeight:20,Sort:"",SortDir:""},BaseUrl:"",Stage:null,requestId:0,requiresMapInit:false,skipSearch:false,BuildLinkUrl:function(a,b){var c=this.BaseUrl;c+=typeof b!="undefined"&&String(b)!="0"?(this.BaseUrl.indexOf("?")>=0||this.BaseUrl.toLowerCase().indexOf(".aspx/")>=0?"&":this.BaseUrl.indexOf("#")>=0?"&":"#")+"PropertyID="+b+"&PerformSearch":(this.BaseUrl.indexOf("?")>=
0||this.BaseUrl.toLowerCase().indexOf(".aspx/")>=0?"&":this.BaseUrl.indexOf("#")>=0?"&":"#")+"PerformSearch";return c},Init:function(){this.InitStage()},CurrentBounds:null,Criteria:{Sort:"Price",SortDirection:"ASC"},InitStage:function(){this.InnerHeight=this.Settings.Height-2;this.InnerWidth=document.all?this.Settings.Width-10:this.Settings.Width-2;var a=document.getElementById("ds_Map_Search_Stage");a.style.width=this.InnerWidth+"px";a.style.height=this.InnerHeight+"px";a=document.getElementById("ds_Map_Search_Map");
a.style.width=window.XMLHttpRequest&&document.all?this.InnerWidth+"px":document.all?this.InnerWidth+8+"px":this.InnerWidth+"px";a.style.height=this.InnerHeight-this.Settings.SearchBarHeight-this.Settings.StatusBarHeight-2+"px";if(this.Settings.Sort!="")this.Criteria.Sort=this.Settings.Sort;if(this.Settings.SortDir!="")this.Criteria.SortDirection=this.Settings.SortDir;var b=document.getElementById("ds_Map_Search_Criteria");b.style.height=this.Settings.SearchBarHeight+"px";b.style.minWidth=window.XMLHttpRequest&&
document.all?this.Settings.Width-10+"px":this.Settings.Width-2+"px";b=$("ds_Map_Search_Status");b.style.height=this.Settings.StatusBarHeight+"px";b.style.width=window.XMLHttpRequest&&document.all?this.Settings.Width-10+"px":this.Settings.Width-2+"px";this.MapObject=new this.Settings.MapType;this.MapObject.Init(a,this.PropertySearch.bind(this));Event.observe(document,"keypress",this.Criteria_KeyPress.bindAsEventListener(this))},PropertyMapMoveSearch:function(){this.CurrentBounds=this.MapObject.getBounds()},
cleanInt:function(a){for(var b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);if(d>=48&&d<=57||d==45)b+=a.substring(c,c+1)}return b},PropertySearch:function(){var a=document.getElementById("ds_Map_Search_Map");if(a.offsetWidth==0&&a.offsetHeight==0)this.requiresMapInit=true;else if(this.requiresMapInit){this.requiresMapInit=false;this.MapObject.Init(a,this.PropertySearch.bind(this))}else if(this.skipSearch)this.skipSearch=false;else{$("ds_Map_Search_Status_Text").innerHTML="Loading...";a=document.getElementById("ds_Map_Search_PriceLow");
var b=document.getElementById("ds_Map_Search_PriceHigh"),c=document.getElementById("ds_Map_Search_Beds"),d=document.getElementById("ds_Map_Search_Baths"),e=document.getElementById("ds_Map_Search_SQFT");this.Criteria.minPrice=0;this.Criteria.maxPrice=-1;this.Criteria.minBeds=0;this.Criteria.minBaths=0;this.Criteria.minSQFT=0;this.Criteria.minLat=-1;this.Criteria.maxLat=-1;this.Criteria.minLon=-1;this.Criteria.maxLon=-1;a.value=this.cleanInt(a.value);b.value=this.cleanInt(b.value)==-1?"":this.cleanInt(b.value);
c.value=this.cleanInt(c.value);d.value=this.cleanInt(d.value);e.value=this.cleanInt(e.value);try{if(a.value!="")this.Criteria.minPrice=parseInt(a.value)}catch(f){this.Criteria.minPrice=0}try{if(b.value!="")this.Criteria.maxPrice=parseInt(b.value)}catch(h){this.Criteria.maxPrice=-1}try{if(c.value!="")this.Criteria.minBeds=parseInt(c.value)}catch(i){this.Criteria.minBeds=0}try{if(d.value!="")this.Criteria.minBaths=parseInt(d.value)}catch(j){this.Criteria.minBaths=0}try{if(e.value!="")this.Criteria.minSQFT=
parseInt(e.value)}catch(k){this.Criteria.minSQFT=0}if(this.CurrentBounds!=null){this.Criteria.minLat=this.CurrentBounds.sw.lat;this.Criteria.maxLat=this.CurrentBounds.ne.lat;this.Criteria.minLon=this.CurrentBounds.sw.lon;this.Criteria.maxLon=this.CurrentBounds.ne.lon}a=$("ds_Map_Search_Price_Title");b=$("ds_Map_Search_Beds_Title");c=$("ds_Map_Search_Baths_Title");d=$("ds_Map_Search_SQFT_Title");a.innerHTML=this.Criteria.maxPrice==-1?"Price: "+this.Criteria.minPrice+"+":"Price: "+this.Criteria.minPrice+
" - "+this.Criteria.maxPrice;b.innerHTML="Beds: "+this.Criteria.minBeds+"+";c.innerHTML="Baths: "+this.Criteria.minBaths+"+";d.innerHTML="SQFT: "+this.Criteria.minSQFT+"+";a=$("ds_Map_Search_Status_Sort_InnerTitle");switch(this.Criteria.Sort){case "Price":case "Beds":case "Baths":a.innerHTML=this.Criteria.Sort+", "+(this.Criteria.SortDirection.toUpperCase()=="ASC"?"lowest first":"highest first");break;case "ImprovedSqFt":a.innerHTML="Improved size, "+(this.Criteria.SortDirection.toUpperCase()=="ASC"?
"smallest first":"largest first");break;case "LotSqFt":a.innerHTML="Lot size, "+(this.Criteria.SortDirection.toUpperCase()=="ASC"?"smallest first":"largest first");break;case "DateAdded":a.innerHTML="Time on market, "+(this.Criteria.SortDirection.toUpperCase()=="DESC"?"newest first":"oldest first");break;default:a.innerHTML="";break}a={};b=this.Criteria;a["requester.AccountID"]=this.Settings.MasterAccountID;a["requester.ApplicationProfile"]="dsSearchAgentV3";a["directive.AdditionalResultColumns[0]"]=
"Latitude";a["directive.AdditionalResultColumns[1]"]="Longitude";a["directive.SortOrders[0].Column"]=b.Sort;a["directive.SortOrders[0].Direction"]=b.SortDirection.toUpperCase();a["directive.ResultPage"]=0;a["directive.ResultsPerPage"]="50";a["responseDirective.IncludeMetadata"]="true";a["query.ForceUsePropertySearchConstraints"]="true";a["query.SearchSetupID"]=this.Settings.SearchSetupID;a["query.LinkID"]=this.Settings.LinkID;a["query.PriceMin"]=b.minPrice>0?b.minPrice:"";a["query.PriceMax"]=b.maxPrice>
0?b.maxPrice:"";a["query.ImprovedSqFtMin"]=b.minSQFT>0?b.minSQFT:"";a["query.BedsMin"]=b.minBeds>0?b.minBeds:"";a["query.BathsMin"]=b.minBaths>0?b.minBaths:"";a["query.LatitudeMin"]=b.minLat!=-1?b.minLat:"";a["query.LongitudeMin"]=b.minLon!=-1?b.minLon:"";a["query.LatitudeMax"]=b.maxLat!=-1?b.maxLat:"";a["query.LongitudeMax"]=b.maxLon!=-1?b.maxLon:"";a["query.IsModule"]=true;for(var g in a)a.hasOwnProperty(g)&&!a[g]&&delete a[g];if(this.properties)for(g=0;g<this.properties.length;g++){b=this.properties[g];
b.marker&&b.marker.setMap(null)}this.LastQueryHash=Object.toJSON(a);new Ajax.Request("/api/results",{parameters:a,onSuccess:this.PropertySuccess.bind(this),onFailure:this.PropertyFailure.bind(this),evalJSON:"force",requestHeaders:["X-Request-ID",++this.requestId]})}},PropertySuccess:function(a){this.properties=a.responseJSON.Results;this.MapProperties()},GoToSearchResults:function(){var a=this.BuildLinkUrl(this.Settings.LinkID);if(this.FramedPage)top.location.href=a;else window.open(a,"_blank","")},
MapProperties:function(){var a=0,b=0,c=$("ds_Map_Search_Status_Text");if(this.properties.length>0){c.innerHTML="Showing top "+this.properties.length+" (<a href='javascript:void(0)' onclick='Map_Search.GoToSearchResults()'>view all</a>) ordered </a>";for(c=0;c<this.properties.length;c++){a=this.properties[c];if(a.Latitude&&a.Longitude&&a.Latitude!=-1&&a.Longitude!=-1){a=parseFloat(this.properties[c].Latitude);b=parseFloat(this.properties[c].Longitude);this.MapObject.extendBounds(a,b);this.properties[c].marker=
this.MapObject.addOverlay(a,b,this.ClickPropertyPreview.bind(this,this.properties[c]),this.ShowPropertyPreview.bind(this,this.properties[c]),this.HidePropertyPreview.bind(this,this.properties[c]),this.properties[c].PropertyID)}}if(this.Settings.CenterResults){this.skipSearch=true;this.MapObject.CenterAndZoomToBounds(this.PropertyMapMoveSearch.bind(this));this.Settings.CenterResults=false}this.MapObject.FixMarkers(this.properties)}else c.innerHTML="No properties found. Refine search."},GenerateSearchURL:function(){var a=
"";if(this.Criteria.minPrice>0)a+="MinPrice="+this.Criteria.minPrice+"&";if(this.Criteria.maxPrice>0)a+="MaxPrice="+this.Criteria.maxPrice+"&";if(this.Criteria.minSQFT>0)a+="MinImprovedSqFt="+this.Criteria.minSQFT+"&";if(this.Criteria.minBeds>0)a+="MinBeds="+this.Criteria.minBeds+"&";if(this.Criteria.minBaths>0)a+="MinBaths="+this.Criteria.minBaths+"&";if(this.Criteria.minLat!=-1)a+="MinLatitude="+this.Criteria.minLat+"&";if(this.Criteria.maxLat!=-1)a+="MaxLatitude="+this.Criteria.maxLat+"&";if(this.Criteria.minLon!=
-1)a+="MinLongitude="+this.Criteria.minLon+"&";if(this.Criteria.maxLon!=-1)a+="MaxLongitude="+this.Criteria.maxLon+"&";a+="PerformSearch";return a},ClickPropertyPreview:function(a){a=this.BuildLinkUrl(this.Settings.LinkID,a.PropertyID);if(this.FramedPage)top.location.href=a;else window.open(a,"_blank","")},ShowPropertyPreview:function(a){this.MapObject.SetMarkerOver(a.marker);this.MapObject.checkResize();var b=this.MapObject.fromLatLngToDivPixel(a.marker);if(a.dom)a.dom.style.display="block";else a.dom=
$E({tag:"div",className:"Property",children:[{tag:"div",className:"Property_Inner",children:[{tag:"div",className:"Property_Photo",children:[{tag:"img",src:parseInt(a.PhotoCount+"")==0?"http://cdn1.diverse-cdn.com/idx-v2/assets-images/beast/nophotoavailable.gif/33c1dc":a.PhotoUriBase+"0-thumb.jpg",className:"MlsImage"},a.IdxIconUri?{tag:"img",src:a.IdxIconUri,className:"MlsIcon"}:{}]},{tag:"div",className:"Property_Price",children:["$"+Formatters.formatNumber(a.Price)]},{tag:"div",className:"Property_BedBath",
children:[(typeof a.Beds=="undefined"?0:a.Beds)+(a.Beds==1?" Bedroom":" Bedrooms")]},{tag:"div",className:"Property_BedBath",children:[a.BathsShortString]},{tag:"div",className:"Property_SQFT",children:typeof a.ImprovedSqFt!="undefined"&&a.ImprovedSqFt!="0"?[a.ImprovedSqFt+" Sqft"]:[]},!this.ShowMLSNumOnModules?{}:{tag:"div",className:"Property_MLSNumber",children:["MLS# "+a.MlsNumber]},typeof a.ListingAgentOffice!="undefined"&&a.ListingAgentOffice!=""?{tag:"div",className:"Property_Office",children:["Listed With: "+
a.ListingAgentOffice]}:{}]}]});this.MapObject.AppendMarker(a,a.marker);a.dom.style.left=b.x>this.Settings.Width/2?b.x+this.MapObject.PreviewOffestX(-1)-Element.getWidth(a.dom)+"px":b.x+this.MapObject.PreviewOffestX(1)+"px";a.dom.style.top=b.y-Element.getHeight(a.dom)/4*3<4?4+this.MapObject.PreviewOffestY(1)+"px":b.y+Element.getHeight(a.dom)/4>this.MapObject.GetHeight()-4?this.MapObject.GetHeight()+this.MapObject.PreviewOffestY(1)-Element.getHeight(a.dom)+"px":b.y+this.MapObject.PreviewOffestY(1)-
Element.getHeight(a.dom)/4*3+"px"},HidePropertyPreview:function(a){if(a.dom){this.MapObject.SetMarkerOut(a.marker);a.timeout=setTimeout(this.HidePropertyPreview_Timeout.bind(this,a),50)}},HidePropertyPreview_Cancel:function(a){clearTimeout(a.timeout)},HidePropertyPreview_Timeout:function(a){if(a.dom){this.MapObject.SetMarkerOut(a.marker);a.dom.style.display="none"}},PropertyFailure:function(){},Clear_Criteria:function(a){if(typeof a=="undefined")a="";var b={},c={};b=$("ds_Map_Search_Criteria_Price");
c=$("ds_Map_Search_Price_Menu");b.timeout&&clearTimeout(b.timeout);if(a!="price"){b.style.display="none";c.removeClassName("Criteria_Over")}b=$("ds_Map_Search_Criteria_Beds");c=$("ds_Map_Search_Beds_Menu");b.timeout&&clearTimeout(b.timeout);if(a!="beds"){b.style.display="none";c.removeClassName("Criteria_Over")}b=$("ds_Map_Search_Criteria_Baths");c=$("ds_Map_Search_Baths_Menu");b.timeout&&clearTimeout(b.timeout);if(a!="baths"){b.style.display="none";c.removeClassName("Criteria_Over")}b=$("ds_Map_Search_Criteria_SQFT");
c=$("ds_Map_Search_SQFT_Menu");b.timeout&&clearTimeout(b.timeout);if(a!="sqft"){b.style.display="none";c.removeClassName("Criteria_Over")}},Criteria_Over:function(a,b){var c={},d={};switch(a){case "price":c=$("ds_Map_Search_Criteria_Price");d=$("ds_Map_Search_PriceLow");break;case "beds":c=$("ds_Map_Search_Criteria_Beds");d=$("ds_Map_Search_Beds");break;case "baths":c=$("ds_Map_Search_Criteria_Baths");d=$("ds_Map_Search_Baths");break;case "sqft":c=$("ds_Map_Search_Criteria_SQFT");d=$("ds_Map_Search_SQFT");
break}this.Clear_Criteria(a);if(c&&c.style.display!="block"){var e=Position.cumulativeOffset(b),f=0,h=e[1]+Element.getHeight(b);f=document.all?e[0]:e[0]-1;if(f+c.getWidth()>this.Settings.Width)f=this.Settings.Width-c.getWidth()-10;b.addClassName("Criteria_Over");c.style.left=f+"px";c.style.top=h+"px";c.style.display="block";d.focus();d.select()}},Criteria_KeyPress:function(a){a.keyCode==Event.KEY_RETURN&&Map_Search.PropertySearch()},Criteria_Out:function(a,b){var c={};switch(a){case "price":c=$("ds_Map_Search_Criteria_Price");
break;case "beds":c=$("ds_Map_Search_Criteria_Beds");break;case "baths":c=$("ds_Map_Search_Criteria_Baths");break;case "sqft":c=$("ds_Map_Search_Criteria_SQFT");break}if(c)c.timeout=setTimeout(this.Criteria_Out_Timeout.bind(this,c,b),250)},Criteria_Out_Timeout:function(){this.Clear_Criteria()},SetPrice:function(a,b){var c=document.getElementById("ds_Map_Search_PriceLow"),d=document.getElementById("ds_Map_Search_PriceHigh");c.value=a;d.value=b>0?b:"";this.Clear_Criteria();this.PropertySearch()},SetBeds:function(a){document.getElementById("ds_Map_Search_Beds").value=
a;this.Clear_Criteria();this.PropertySearch()},SetBaths:function(a){document.getElementById("ds_Map_Search_Baths").value=a;this.Clear_Criteria();this.PropertySearch()},SetSQFT:function(a){document.getElementById("ds_Map_Search_SQFT").value=a;this.Clear_Criteria();this.PropertySearch()},Sort_Over:function(a,b){var c=null;switch(a){case "sort":c=$("ds_Map_Search_Status_Sort_Value");break;case "disc":c=$("ds_Map_Search_Status_Disc_Value")}this.Clear_Status(a);if(c&&c.style.display!="block"){c.style.display=
"block";var d=Position.cumulativeOffset(b),e=0,f=0;if(document.all){e=d[0]+1;f=d[1]-Element.getHeight(c)+2}else{e=d[0];f=d[1]-Element.getHeight(c)}Element.addClassName(b,"Criteria_Over");c.style.left=e+"px";c.style.top=(f<0?0:f)+"px";if(f<0){c.style.height=c.offsetHeight+f-8+"px";c.style.overflow="auto"}}},Sort_Out:function(a,b){var c=null;switch(a){case "sort":c=$("ds_Map_Search_Status_Sort_Value");break;case "disc":c=$("ds_Map_Search_Status_Disc_Value")}if(c)c.timeout=setTimeout(this.Sort_Out_Timeout.bind(this,
a,b),250)},Clear_Status:function(a){if(typeof a=="undefined")a="";var b={},c={};b=$("ds_Map_Search_Status_Sort_Value");c=$("ds_Map_Search_Status_Sort_Title");b.timeout&&clearTimeout(b.timeout);if(a!="sort"){b.style.display="none";c.removeClassName("Criteria_Over")}b=$("ds_Map_Search_Status_Disc_Value");c=$("ds_Map_Search_Status_Disc_Title");b.timeout&&clearTimeout(b.timeout);if(a!="disc"){b.style.display="none";c.removeClassName("Criteria_Over")}},Sort_Out_Timeout:function(){this.Clear_Status()},
SetSort:function(a,b){this.Criteria.Sort=a;this.Criteria.SortDirection=b;this.Sort_Out_Timeout();this.PropertySearch()}};var Formatters={formatNumber:function(a){var b="";a=String(a);for(var c=a.length-3;c>=0;c-=3)b=","+a.substring(c,c+3)+b;if(a.length%3>0)b=a.substring(0,a.length%3)+b;if(b.charAt(0)==",")b=b.substring(1);return b}};
function $E(a){var b;if("string"==typeof a)b=document.createTextNode(a);else{b=document.createElement(a.tag);delete a.tag;if("undefined"!=typeof a.children){if("string"==typeof a.children||"undefined"==typeof a.children.length)b.appendChild($E(a.children));else for(var c=0,d=null;"undefined"!=typeof(d=a.children[c]);c++)b.appendChild($E(d));delete a.children}for(attr in a)b[attr]=a[attr]}return b}
Google_Map=function(){var a=[];this.Init=function(b,c){var d=new google.maps.LatLng(DefaultMapStart.latitude,DefaultMapStart.longitude);this.map=new google.maps.Map(b,{mapTypeId:google.maps.MapTypeId.ROADMAP,disableDoubleClickZoom:false,center:d,zoom:DefaultMapStart.zoom,zoomControl:false,streetViewControl:false,mapTypeControl:false,panControl:false});this.icon={};this.icon.url="http://cdn1.diverse-cdn.com/idx-v2/assets-images/newicons/house_map_marker.png/fa357c";this.icon.shadow="http://cdn3.diverse-cdn.com/idx-v2/assets-images/newicons/house_map_marker_shadow.png/d4aee1";
this.icon.size=new google.maps.Size(28,44);this.icon.shadowSize=new google.maps.Size(51,45);this.icon.anchor=new google.maps.Point(14,44);this.icon.infoWindowAnchor=new google.maps.Point(14,44);this.bounds=new google.maps.LatLngBounds;google.maps.event.addListener(this.map,"idle",function(){c()})};this.getBounds=function(){var b={},c=this.map.getBounds();b.ne={};b.sw={};b.ne.lat=c.getNorthEast().lat();b.ne.lon=c.getNorthEast().lng();b.sw.lat=c.getSouthWest().lat();b.sw.lon=c.getSouthWest().lng();
return b};this.clearOverlays=function(){if(a.length<=0)return false;for(var b=0;b<a.length;b++)a.pop().setMap(null);return true};this.addOverlay=function(b,c,d,e,f){b=new google.maps.LatLng(b,c);b=new google.maps.Marker({position:b,icon:this.icon,map:this.map});google.maps.event.addListener(b,"click",d);google.maps.event.addListener(b,"mouseover",e);google.maps.event.addListener(b,"mouseout",f);b.setMap(this.map);a.push(b);return b};this.FixMarkers=function(){};this.extendBounds=function(b,c){return this.bounds.extend(new google.maps.LatLng(b,
c))};this.getBoundsZoomLevel=function(b){var c=this.map.mapTypes.get(this.map.getMapTypeId()).maxZoom||21,d=this.map.mapTypes.get(this.map.getMapTypeId()).minZoom||0,e=this.map.getProjection().fromLatLngToPoint(b.getNorthEast()),f=this.map.getProjection().fromLatLngToPoint(b.getSouthWest());b=Math.abs(e.x-f.x);e=Math.abs(e.y-f.y);for(c=c;c>=d;--c)if(b*(1<<c)+80<$(this.map.getDiv()).getWidth()&&e*(1<<c)+80<$(this.map.getDiv()).getHeight())return c;return 0};this.CenterAndZoomToBounds=function(b){google.maps.event.trigger(this.map,
"resize");this.map.setZoom(this.getBoundsZoomLevel(this.bounds));this.map.setCenter(this.bounds.getCenter());google.maps.event.addListenerOnce(this.map,"idle",b)};this.checkResize=function(){google.maps.event.trigger(this.map,"resize")};this.getMarkerPoint=function(b){return b.getPosition()};this.PreviewOffestY=function(b){return b==-1?this.GetTopLeftY():this.GetTopLeftY()-4};this.PreviewOffestX=function(b){return b==-1?this.GetTopLeftX()-20:this.GetTopLeftX()+20};this.fromLatLngToDivPixel=function(b){b=
this.GetPixelCoordinates(this.getMarkerPoint(b));var c=this.GetTopLeftX(),d=this.GetTopLeftY();b.x-=c;b.y-=d;return b};this.GetTopLeftX=function(){return this.GetPixelCoordinates(this.map.getBounds().getSouthWest()).x};this.GetTopLeftY=function(){return this.GetPixelCoordinates(this.map.getBounds().getSouthWest()).y-this.map.getDiv().offsetHeight};this.AppendMarker=function(b){this.map.getDiv().appendChild(b.dom);b.dom.style.display="block"};this.GetHeight=function(){return this.map.getDiv().offsetHeight};
this.SetMarkerOver=function(b){b.setIcon("http://cdn2.diverse-cdn.com/idx-v2/assets-images/newicons/house_map_marker_red_medium.png/5d4e9a")};this.SetMarkerOut=function(b){b.setIcon("http://cdn1.diverse-cdn.com/idx-v2/assets-images/newicons/house_map_marker.png/fa357c")};this.GetPixelCoordinates=function(b){var c=Math.pow(2,this.map.getZoom()),d=new google.maps.LatLng(this.map.getBounds().getNorthEast().lat(),this.map.getBounds().getSouthWest().lng());d=this.map.getProjection().fromLatLngToPoint(d);
b=this.map.getProjection().fromLatLngToPoint(b);return new google.maps.Point(Math.floor((b.x-d.x)*c),Math.floor((b.y-d.y)*c))}};
