window.onresize=function(){
if(grid){
grid.resize();
}
};
var fields=[{name:"thumbURL"},{name:"price"},{name:"text"},{name:"sqFt"},{name:"beds"},{name:"daysOnRas"},{name:"mlscode"},{name:"mlsnumber"},{name:"office"},{name:"priceSqFt"},{name:"baths"}];
dojo.declare("turbo.data.table.objects",turbo.data.table,{getFieldName:function(_1){
var n=this.fields.get(_1);
return (n)&&(n.name);
},_get:function(_3,_4){
var _5=this.data[_3];
var n=this.getFieldName(_4);
return (_4==undefined||!n?_5:_5[n]);
},_setCell:function(_7,_8,_9){
var n=this.getFieldName(_9);
if(n){
this.data[_8][n]=_7;
}
},createComparator:function(_b,_c,_d){
return function(a,b){
var c=_b.name;
var _11=_b.compare(a[c],b[c]);
return (_11?(_c>0?_11:-_11):(_d&&_d(a,b)));
};
},makeComparator:function(_12){
var _13=null;
for(var i=_12.length-1,col;i>=0;i--){
col=Math.abs(_12[i])-1;
if(col>=0){
_13=this.createComparator(this.fields.get(col),_12[i],_13);
}
}
return _13;
}});
model=new turbo.data.table.objects(fields,homes);
model.canSort=function(_16){
var i=Math.abs(_16)-1;
return i>0;
};
updateInfo=function(){
model.set(homes);
model.count=homes.length;
};
var mark_icons={normal:"pin_green.gif",note:"pin_yellow.gif",important:"pin_red.gif"};
var mail_icons={"new":"mail_new.gif",read:"mail.gif",replied:"mail_forward.gif"};
function formatImage(_18,_19,_1a){
return (_18&&_18!="..."?"<img border=\"0\" src=\"images/"+_1a.def.images[_18]+"\" />":"...");
}
function formatBoolean(_1b){
return "<input type=\"checkbox\" "+(_1b?"checked=\"checked\"":"")+" ></input>";
}
function formatDays(_1c){
if(!_1c||_1c<0){
return "0";
}
return _1c;
}
var leftView={cells:[[{name:"",noresize:true,cansort:false,key:0,formatter:formatThumb,width:"70px"},{name:"Address",noresize:true,width:"160px",key:2},{name:"Price",noresize:true,key:1,formatter:formatCurrency,width:"60px"},{name:"SqFt",noresize:true,width:"60px",key:3},{name:"$/SqFt",noresize:true,width:"60px",key:9,formatter:formatCurrency},{name:"Beds",noresize:true,width:"55px",key:4},{name:"Baths",noresize:true,width:"55px",key:10},{name:"Days",noresize:true,width:"60px",key:5,formatter:formatDays},{name:"MLS",noresize:true,width:"62px",key:6,formatter:renderMLS},{name:"MLS #",noresize:true,width:"72px",key:7}]]};
var structure=[leftView];
var statsStructure=[{noscroll:true,onBeforeRow:function(_50,_51){
_51[0].hidden=(_50==-1);
},cells:[[{noresize:true,cansort:false,width:"70px",cellClasses:"noborder"},{noresize:true,cansort:false,width:"160px"},{noresize:true,formatter:formatCurrency,width:"60px"},{noresize:true,width:"60px"},{noresize:true,formatter:formatCurrency,width:"60px"},{noresize:true,width:"55px"},{noresize:true,width:"55px"},{noresize:true,width:"60px"}]]}];
grid_canSort=function(){
var _1f=this.getSortIndex();
var def=this.getCellDef(_1f);
var _1f=(def&&def.key?def.key:_1f);
var _21=(_1f+1)*(this.sortInfo>0?1:-1);
return (def&&!def.get&&this.model.canSort(_21));
};
function gridClickRow(){
row=grid.selection.getSelected();
id=model.data[row].id;
showHomeInfo(markers[id],id,true);
}
dojo.addOnLoad(init);
function gridInit(){
grid.keepRows=10;
grid.rowsPerPage=10;
grid.selection.multiSelect=false;
grid.canSort=grid_canSort;
grid.autoWidth=false;
dojo.event.connect(grid,"onRowClick","gridClickRow");
statsgrid.keepRows=1;
statsgrid.rowsPerPage=1;
statsgrid.selection.multiSelect=false;
statsgrid.canSort=function(){
return false;
};
statsgrid.autoWidth=false;
data1=[["","Averages","-","-","-","-","-","-"]];
statsmodel=new turbo.data.table(null,data1);
statsmodel.canSort=function(){
return false;
};
statsgrid.setModel(statsmodel);
updateInfo();
}
var rasIcon=new GIcon();
rasIcon.image="/img/ras-pin.png";
rasIcon.shadow="/img/ras-pin-shadowed.png";
rasIcon.iconSize=new GSize(13,34);
rasIcon.shadowSize=new GSize(24,34);
rasIcon.iconAnchor=new GPoint(9,34);
rasIcon.image="/img/ras-pin-sm.png";
rasIcon.shadow="/img/ras-pin-sm-shadowed.png";
rasIcon.iconSize=new GSize(11,28);
rasIcon.shadowSize=new GSize(20,28);
rasIcon.iconAnchor=new GPoint(9,28);
rasIcon.infoWindowAnchor=new GPoint(9,0);
var rasIconUC=new GIcon();
rasIconUC.image="/img/ras-pin-uc-sm.png";
rasIconUC.shadow="/img/ras-pin-sm-uc-shadowed.png";
rasIconUC.iconSize=new GSize(11,28);
rasIconUC.shadowSize=new GSize(20,28);
rasIconUC.iconAnchor=new GPoint(9,28);
rasIconUC.infoWindowAnchor=new GPoint(9,0);
var homes=new Array();
var loadCount=0;
var homesGrid;
var previewMgr;
var curImg=1;
var maxImg=0;
var RasMap;
var RasApp;
var markers=[];
var geocoder=null;
var criteria={maxPrice:-1,minPrice:-1};
var infoCloseLstnr;
var multipleResults=[];
var ewindow;
var showHideMsg=false;
var showHideDoneOnce=false;
var hiddenCount=0;
lastShownId=null;
function loadPieces(){
if(loadCount<homes.length){
var end=loadCount+10;
if(end>homes.length-1){
end=homes.length-1;
}
homesGrid.getDataSource().loadData(homes.slice(loadCount,end),true);
loadCount=loadCount+10;
loadPieces();
}
}
var _moverRef;
function DivFader(_23){
this.aDiv=_23;
_moverRef=this;
this.opacity=100;
}
DivFader.prototype.fadeDiv=function(inc){
this.opacity=this.opacity-inc;
this.aDiv.style.filter="alpha(opacity="+this.opacity+")";
this.aDiv.style.opacity=this.opacity/100;
if(this.opacity>0){
setTimeout("_moverRef.fadeDiv("+inc+")",100);
}else{
this.aDiv.style.display="none";
}
};
var samTab;
var introSetupDone=false;
function introSetup(){
if(!introSetupDone){
introSetupDone=true;
placeSamTab(get("map"));
if(hasPoly()){
openTab();
samTab.used=true;
}
}
}
function placeIntroBox(_25){
introBox=get("introbox");
centerX=_25.offsetLeft+(_25.offsetWidth/2);
centerY=_25.offsetTop+(_25.offsetHeight/2);
dx=introBox.offsetWidth/2;
dy=introBox.offsetHeight/2;
if(!doSamPops()){
introBox.style.display="none";
}else{
introBox.style.left=(centerX-dx)+"px";
introBox.style.top=(centerY-dy)+"px";
introBox.style.zIndex=99999;
introBox.style.display="inline";
}
}
function placeSamTab(_26){
ctrlTab=get("ctrltab");
samTab=new SAMTab(get("ctrltab"),get("map"),80,31,80);
ctrlTab.style.height="31px";
ctrlTab.style.top=(_26.offsetTop+_26.offsetHeight-ctrlTab.offsetHeight)-1+"px";
ctrlTab.style.left=_26.offsetLeft+2+"px";
ctrlTab.style.zIndex=9000;
}
function introClick(_27){
introClose(null,true);
}
function doSamPops(){
return !(getCookie("nosamintro")||samTab.used);
}
function introClose(_28,_29){
if(_28){
var _2a=new Date();
_2a.setTime(_2a.getTime());
days=700;
expires=days*1000*360*24;
setCookie("nosamintro","1",new Date(_2a.getTime()+(expires)),"/","","");
}
introBox=get("introbox");
amap=get("map");
var _2b={points:{to:[parseInt(amap.offsetLeft),parseInt(amap.offsetTop)+parseInt(amap.offsetHeight)-(get("introbox").offsetHeight)]}};
var _2c=new YAHOO.util.Motion("introbox",_2b,1,YAHOO.util.Easing.easeOut);
_2c.onComplete.subscribe(function(){
fade=new DivFader(get("introbox"));
fade.fadeDiv(10);
if(_29){
tabClick(_29);
}else{
samTab.peek();
}
});
_2c.animate();
}
function SAMTab(_2d,_2e,_2f,_30,_31){
this.aDiv=_2d;
this.container=_2e;
this.fullheight=_2f;
this.opening=false;
this.open=false;
this.peeking=false;
this.closedheight=_30;
this.peekheight=_31;
this.used=false;
}
SAMTab.prototype.complete=function(_32){
this.open=!this.open;
this.opening=false;
this.aDiv.style.height=_32+"px";
if(this.peeking){
var me=this;
setTimeout(function(){
me.toggle();
me.peeking=false;
},2000);
}
};
SAMTab.prototype.onResize=function(){
this.aDiv.style.top=(this.container.offsetTop+this.container.offsetHeight-ctrlTab.offsetHeight)-1+"px";
this.aDiv.style.left=this.container.offsetLeft+2+"px";
};
SAMTab.prototype.toggle=function(){
if(!this.opening){
this.opening=true;
this.origPos=parseInt(this.aDiv.style.top);
this.origHeight=parseInt(this.aDiv.style.height);
dy=this.fullheight;
newHeight=this.fullheight;
if(this.peeking){
newHeight=this.peekheight;
}
if(this.open){
newHeight=this.closedheight;
}
dy=this.aDiv.offsetHeight-newHeight;
var _34={top:{to:parseInt(this.aDiv.style.top)+dy},height:{to:newHeight}};
var _35=new YAHOO.util.Motion(this.aDiv.id,_34,0.5,YAHOO.util.Easing.easeOut);
var me=this;
_35.onComplete.subscribe(function(){
me.complete(newHeight);
});
_35.animate();
}
};
SAMTab.prototype.peek=function(){
if(!this.open){
this.peeking=true;
this.toggle();
}
};
function openTab(){
get("previewcont").style.display="none";
get("ctrlbody").style.display="inline";
get("ctrltab").style.width="220px";
samTab.toggle();
}
function tabClick(_37){
if(!samTab.open&&!samTab.opening){
samNew();
openTab();
samTab.used=true;
}else{
if(!_37){
get("previewcont").style.display="inline";
get("ctrlbody").style.display="none";
get("ctrltab").style.width="180px";
samTab.toggle();
}
}
}
function samPeek(){
if(doSamPops()){
samTab.peek();
}
}
function samNew(){
clearMap();
startDraw(true);
}
function samSave(){
if(stopDraw(true)){
startSave();
}
}
function samCancel(){
stopDraw(false,true);
tabClick();
clearMap(true);
}
function init(){
gridInit();
setCheckedValue(null,get("propLoad").value);
setStatusCheckedValue(null,get("statLoad").value);
initSearchBox();
OLpageDefaults(FGCOLOR,"#ffffcc",CAPTIONPADDING,4,TEXTPADDING,4,BASE,2);
RasApp=new RasApplication();
geocoder=new GClientGeocoder();
showSearchOptions();
var _38=document.getElementById("pc");
var h=document.getElementById("h");
if(_38!=null&&_38.value.length>0){
try{
_38=_38.value;
h=h.value;
if(h!=hex_md5(_38)){
msgDlg("The sketch in this link is invalid.  The link may be corrupt.  No sketch will be displayed");
}else{
if(!loadPoly(_38,h)){
}
_38.value="";
}
}
catch(err){
alert(err);
}
}
var _3a=get("searchData");
if(_3a&&_3a.value&&_3a.value.length>0){
showAddress(_3a.value);
}else{
updateCriteria(get("maxP"));
}
polyInit(RasApp,"fetch");
if(navigator.appName=="Microsoft Internet Explorer"){
introSetup();
}
}
function teardown(){
GUnload();
}
function RasApplication(){
this.map=new GMap2(get("map"));
RasMap=this.map;
this.map.addMapType(G_PHYSICAL_MAP);
this.map.addControl(new GLargeMapControl(),new GControlPosition(G_ANCHOR_BOTTOM_RIGHT,new GSize(0,20)));
this.map.addControl(new GMenuMapTypeControl());
this.map.setMapType(G_HYBRID_MAP);
this.map.enableScrollWheelZoom();
this.setStartLocation();
this.installEvents();
infoCloseLstnr=GEvent.addListener(this.map,"infowindowclose",function(p){
RasMap.returnToSavedPosition();
});
previewMgr=new Ext.UpdateManager("preview");
resetImgCount();
this.previousBounds=this.map.getBounds();
var _3c=new Ext.Resizable("map",{handles:"s",minHeight:300,maxHeight:600,pinned:true});
_3c.on("resize",function(){
RasMap.checkResize();
samTab.onResize();
RasApp.onPreFetch();
});
}
RasApplication.prototype.installEvents=function(){
this.eventHandles=new Array();
this.eventHandles.push(GEvent.bind(this.map,"dragend",this,this.onPreFetch));
this.eventHandles.push(GEvent.bind(this.map,"zoomend",this,this.fetch));
this.eventHandles.push(GEvent.bind(this.map,"movestart",this,clearDivs));
};
RasApplication.prototype.clearEvents=function(){
for(i=0;i<this.eventHandles.length;i++){
GEvent.removeListener(this.eventHandles[i]);
}
};
RasApplication.prototype.checkCookie=function(){
var _3d=getCookie("mapdata");
if(_3d&&_3d.length>0){
return _3d.split(",");
}else{
return null;
}
};
RasApplication.prototype.setStartLocation=function(){
var _3e=this.checkCookie();
var _3f=document.getElementById("centerLng");
var _40=document.getElementById("centerLat");
var _41=document.getElementById("zoomLevel");
var _42=get("searchFail");
var _43=get("searchData");
var _44=13;
if(_41!=null&&_41.value.length>0){
_44=_41.value;
if(_44<=0){
_44=13;
}
}else{
if(_3e){
_44=_3e[2];
}
}
if(_3f!=null&&_3f.value.length>0){
this.map.setCenter(new GLatLng(_40.value,_3f.value),Number(_44));
}else{
if(_3e){
this.map.setCenter(new GLatLng(_3e[0],_3e[1]),13);
}else{
this.map.setCenter(new GLatLng(40.02,-105.25),13);
}
}
if(_44!=null){
this.map.setZoom(Number(_44));
}
if(_42!=null&&_42.value.length>0){
msgDlg("Sorry, but we couldn't find any data for the location <b>&quot;"+_43.value+"&quot;</b>");
}
};
RasApplication.prototype.onMoveEnd=function(){
if(ewindow.isHidden()){
this.onPreFetch();
}
};
RasApplication.prototype.onPreFetch=function(){
RasMap.checkResize();
clearDivs();
if(this.previousBounds!==null){
var _45=this.map.getBounds();
if(!_45.equals(this.previousBounds)){
this.fetch();
}
}else{
updateCriteria(get("maxP"),true);
}
};
var fetchCount=0;
RasApplication.prototype.fetch=function(_46){
if(get("noload").checked||drawing){
return;
}
if(navigator.userAgent.indexOf("Safari")>0){
if(fetchCount<1){
fetchCount=fetchCount+1;
showInline("loading");
var me=this;
setTimeout(function(){
me.fetch();
},2000);
return;
}
}
if(hasPoly()){
criteria.encodedPolyCoords=getEncodedPoly();
}else{
criteria.encodedPolyCoords=null;
}
this.map.checkResize();
var _48=this.map.getBounds().getSouthWest();
var _49=this.map.getBounds().getNorthEast();
updateCriteria(get("maxP"),true);
MapHelper.findProps(_48.toUrlValue(4),_49.toUrlValue(4),criteria,_46,this.populate);
grid.selection.clear();
showInline("loading");
fetchCount=fetchCount+1;
};
RasApplication.prototype.populate=function(_4a){
GEvent.removeListener(infoCloseLstnr);
RasMap.clearOverlays();
polyRefresh();
ewindow=new EWindow(RasMap,E_STYLE_7);
RasMap.addOverlay(ewindow);
infoCloseLstnr=GEvent.addListener(RasMap,"infowindowclose",function(p){
RasMap.returnToSavedPosition();
});
homes=[];
markers=[];
if(_4a.length>=150){
get("rescount").innerHTML="More than 150 results, zoom in or <a href=\"#\" onclick=\"initSearchForm()\">refine search</a>";
}else{
get("rescount").innerHTML=_4a.length+" results";
}
hiddenCount=0;
showHideMsg=false;
avgPrice=0;
avgSqft=0;
avgBed=0;
avgBath=0;
avgPSqft=0;
avgDays=0;
for(var i=0;i<_4a.length;i++){
if(_4a[i].mapable=="Y"){
var _4d=new GLatLng(_4a[i].latCoord,_4a[i].lngCoord);
var txt=_4a[i].text;
var id=_4a[i].id;
var _50=createMarker(_4d,"<b>"+formatCurrency(_4a[i].price)+" - "+txt+"</b>",id,_4a[i]);
markers[id]=_50;
RasMap.addOverlay(_50);
}else{
if(_4a[i].mapable=="H"){
showHideMsg=true;
hiddenCount=hiddenCount+1;
}
}
homes.push(_4a[i]);
avgPrice=avgPrice+_4a[i].price;
avgSqft=avgSqft+_4a[i].sqFt;
avgBed=avgBed+_4a[i].beds;
avgBath=avgBath+_4a[i].baths;
avgPSqft=avgPSqft+_4a[i].priceSqFt;
avgDays=avgDays+_4a[i].daysOnRas;
}
avgPrice=avgPrice/(0+_4a.length);
avgSqft=parseInt(avgSqft/_4a.length);
avgBed=Math.round((avgBed/_4a.length)*10)/10;
avgBath=Math.round((avgBath/_4a.length)*10)/10;
avgDays=Math.round((avgDays/_4a.length)*10)/10;
avgPSqft=avgPSqft/(0+_4a.length);
data1=[["","Averages",avgPrice,avgSqft,avgPSqft,avgBed,avgBath,avgDays+""]];
statsgrid.model.set(data1);
hide("loading");
loadCount=0;
var _51=new Date();
_51.setTime(_51.getTime()+(30*24*60*60*1000));
setCookie("mapdata",RasMap.getCenter().toUrlValue(4)+","+RasMap.getZoom(),_51,"/","","");
setTimeout("timedLoadData()",10);
};
function timedLoadData(){
RasMap.checkResize();
startTime=new Date();
updateInfo();
endTime=new Date();
diff=endTime-startTime;
grid.modelChanged();
if(grid.getSortIndex()>0){
grid.sortData();
grid.update();
}
if(grid.selection.getSelectedCount>0){
row=grid.selection.getSelected();
id=model.data[row].id;
showHomeInfo(markers[id],id);
}else{
if(get("showId")!=null&&Number(get("showId").value)>0){
var _52=get("showId").value;
showHomeInfo(markers[_52+""],_52);
get("showId").value="";
}else{
if(lastShownId&&markers[lastShownId+""]){
showHomeInfo(markers[lastShownId+""],lastShownId);
}
}
}
introSetup();
if(showHideMsg){
doShowHideMsg();
}
if(fetchCount==3){
placeIntroBox(get("map"));
}
if(fetchCount==6){
samPeek();
}
}
function doShowHideMsg(_53){
showHideDoneOnce=true;
if(showHideMsg){
var msg="<b>Please <a href=\"/myras\">login</a></b> to view <b>"+hiddenCount+"</b> additional properties. <br/><br/><span style=\"font-size: 10px\">(<a href=\"#\" onclick=\"doShowHideMsg(true)\">why do I have to do this?</a>)</span>";
if(_53){
msg=msg+"<br/><br/>Some MLS companies require user registration before address & location information is displayed.";
}
msgDlg(msg);
}
}
function showHomeInfo(_55,id,_57,d){
hideSearchOptions(true);
clearDivs();
var _59;
var _5a;
var _5b={async:false,callback:function(_5c){
_59=_5c;
}};
resetImgCount();
MapHelper.showHomeInfo(id,_5b);
RasMap.savePosition();
previewMgr.setDefaultUrl("/Property_preview.action?id="+id);
previewMgr.refresh("/Property_preview.action?id="+id);
if(_55!=null||!_57){
if(!_57){
for(i=0;i<homes.length;i++){
if(grid.model.data[i].id==id){
grid.scrollToRow(i);
grid.selection.select(i);
break;
}
}
}
hideMsgDlg();
if(_55){
lastShownId=id;
ewindow.openOnMarker(_55,"<table><tr><td style=\"padding: 5px\" nowrap>"+_59.basicsHTML+"</td><td style=\"vertical-align:top;padding-top: -5px;margin-top:-5px;\"><a style=\"text-decoration: none; border:none\" href=\"#\" onclick=\"lastShownId=null;ewindow.hide()\"><img  align=\"top\" src=\"/img/close.gif\"></a></td></tr></table>");
}else{
showNotMappable(_59);
}
}else{
if(_59.hidden){
}else{
showNotMappable(_59);
}
}
doShowHideMsg();
}
function showNotMappable(_5d){
hideMsgDlg();
var _5e=RasMap.getBounds().getSouthWest();
_5e=new GLatLng(_5e.lat(),RasMap.getCenter().lng());
ewindow.openOnMap(_5e,"<table><tr><td style=\"padding: 5px\" nowrap>"+_5d.basicsHTML+"</td><td style=\"vertical-align:top;padding-top: -5px;margin-top:-5px;\"><a style=\"text-decoration: none; border:none\" href=\"#\" onclick=\"lastShownId=null;ewindow.hide()\"><img  align=\"top\" src=\"/img/close.gif\"></a></td></tr></table>");
}
function createMarker(_5f,_60,id,_62){
var _63;
if(_62.status!="A"){
_63=new GMarker(_5f,rasIconUC);
}else{
_63=new GMarker(_5f,rasIcon);
}
GEvent.addListener(_63,"click",function(){
showHomeInfo(_63,id);
});
GEvent.addListener(_63,"mouseover",function(){
overlib(_60,TEXTPADDING,4,TEXTFONTCLASS,"pinover",WRAP);
});
GEvent.addListener(_63,"mouseout",nd);
return _63;
}
function critStatus(_64,_65,min,max){
var str="";
if((min>=0||max<-1||max>=0)&&(!isNaN(min)&&!isNaN(max))){
str=_64;
if(min>=0){
str=str+String(min);
}else{
str=str+"-";
}
str=str+"/";
if(max>=0){
str=str+String(max);
}else{
if(max<-1){
str=str+String(Math.abs(max))+"+";
}else{
str=str+"-";
}
}
str=str+_65;
}
return str;
}
function buildStatus(){
var str=critStatus("Days:"," ",criteria.minDaysonras,criteria.maxDaysonras);
str=str+critStatus("$","K ",criteria.minPrice/1000,criteria.maxPrice/1000);
str=str+critStatus("Br:"," ",criteria.minBeds,criteria.maxBeds);
str=str+critStatus("Ba:"," ",criteria.minBaths,criteria.maxBaths);
str=str+critStatus("SqFt:"," ",criteria.minSqFt,criteria.maxSqFt);
str=str+critStatus("Parking:"," ",criteria.minParking,criteria.maxParking);
if(str==null||str.length<1){
str="No Criteria";
}
}
function updateCriteria(_6a,_6b){
criteria.maxPrice=_6a.form.maxP.options[_6a.form.maxP.selectedIndex].value;
criteria.minPrice=_6a.form.minP.options[_6a.form.minP.selectedIndex].value;
criteria.maxBeds=_6a.form.maxBr.options[_6a.form.maxBr.selectedIndex].value;
criteria.minBeds=_6a.form.minBr.options[_6a.form.minBr.selectedIndex].value;
criteria.maxSqFt=_6a.form.maxSqFt.options[_6a.form.maxSqFt.selectedIndex].value;
criteria.minSqFt=_6a.form.minSqFt.options[_6a.form.minSqFt.selectedIndex].value;
criteria.maxBaths=_6a.form.maxBath.options[_6a.form.maxBath.selectedIndex].value;
criteria.minBaths=_6a.form.minBath.options[_6a.form.minBath.selectedIndex].value;
criteria.maxParking=_6a.form.maxParking.options[_6a.form.maxParking.selectedIndex].value;
criteria.minParking=_6a.form.minParking.options[_6a.form.minParking.selectedIndex].value;
criteria.minLotsize=_6a.form.minLotSize.options[_6a.form.minLotSize.selectedIndex].value;
criteria.maxLotsize=_6a.form.maxLotSize.options[_6a.form.maxLotSize.selectedIndex].value;
criteria.minYear=_6a.form.minYear.options[_6a.form.minYear.selectedIndex].value;
criteria.maxYear=_6a.form.maxYear.options[_6a.form.maxYear.selectedIndex].value;
criteria.searchTxt=_6a.form.searchTxt.value;
criteria.propType=getCheckedValue(_6a.form.propType);
criteria.status=getStatusCheckedValue(_6a.form.status);
var _6c=_6a.form.daysOnRas.options[_6a.form.daysOnRas.selectedIndex].value;
var _6d=_6c.split(":");
criteria.maxDaysonras=_6d[1];
criteria.minDaysonras=_6d[0];
if(criteria.propType==null||criteria.propType.length<1){
criteria.propType="B";
setCheckedValue(_6a.form.propType,"B");
}
if(criteria.status==null||criteria.status.length<1){
criteria.status="A";
setStatusCheckedValue(_6a.form.status,"A");
}
if(!_6b){
RasMap.checkResize();
RasApp.fetch();
}
}
function clearCriteria(){
var _6e=get("maxP");
_6e.form.maxP.selectedIndex=0;
_6e.form.minP.selectedIndex=0;
_6e.form.maxBr.selectedIndex=0;
_6e.form.minBr.selectedIndex=0;
_6e.form.maxSqFt.selectedIndex=0;
_6e.form.minSqFt.selectedIndex=0;
_6e.form.maxBath.selectedIndex=0;
_6e.form.minBath.selectedIndex=0;
_6e.form.maxDaysOnRas.selectedIndex=0;
_6e.form.minDaysOnRas.selectedIndex=0;
_6e.form.maxParking.selectedIndex=0;
_6e.form.minParking.selectedIndex=0;
_6e.form.minLotSize.selectedIndex=0;
_6e.form.maxLotSize.selectedIndex=0;
_6e.form.minYear.selectedIndex=0;
_6e.form.maxYear.selectedIndex=0;
_6e.form.searchTxt.value="";
setCheckedValue(_6e.form.propType,"B");
setStatusCheckedValue(_6e.form.status,"A");
updateCriteria(_6e);
}
function getCheckedValue(_6f){
var cv="";
if(get("propType-1").checked&&get("propType-2").checked){
cv="B,";
}
if(get("propType-1").checked){
cv=cv+"H,";
}
if(get("propType-2").checked){
cv=cv+"C,";
}
if(get("propType-3").checked){
cv=cv+"I";
}
if(get("propType-4").checked){
cv=cv+"L";
}
return cv;
}
function getStatusCheckedValue(_71){
var cv="";
if(get("status-1").checked){
cv="A,";
}
if(get("status-2").checked){
cv=cv+"U,";
}
return cv;
}
function setCheckedValue(_73,_74){
var _75=_74.split(",");
for(i=0;i<_75.length;i++){
if(_75[i]=="B"){
get("propType-1").checked=true;
get("propType-2").checked=true;
}else{
if(_75[i]=="H"){
get("propType-1").checked=true;
}else{
if(_75[i]=="C"){
get("propType-2").checked=true;
}else{
if(_75[i]=="I"){
get("propType-3").checked=true;
}else{
if(_75[i]=="L"){
get("propType-4").checked=true;
}
}
}
}
}
}
}
function setStatusCheckedValue(_76,_77){
var _78=_77.split(",");
for(i=0;i<_78.length;i++){
if(_78[i]=="A"){
get("status-1").checked=true;
}else{
if(_78[i]=="U"){
get("status-2").checked=true;
}
}
}
}
var searchMLS="";
function showAddress(_79){
var s=_79.substring(0,10);
if(s=="Enter MLS#"){
_79="";
}
var _7b=isSearchOptionsVisible();
if(!_7b){
showSearchOptions();
}
if(_79==null||_79.length<1){
initSearchForm();
if(_7b){
updateCriteria(get("maxP"));
}
}else{
if(!Number(_79)){
var up=String(_79.toUpperCase());
if(up.indexOf("CO")&&!up.endsWith("COLORADO")&&!up.endsWith(" CO")){
_79=_79+", Colorado USA";
}
}
updateCriteria(get("maxP"),true);
geocoder.getLocations(_79,geoResult);
}
return;
}
function geoResult(_7d){
var _7e={};
_7e.text=_7d.name;
_7e.accuracy=0;
if(_7d.Status.code==200){
var _7f=_7d.Placemark[0];
_7e.accuracy=_7f.AddressDetails.Accuracy;
_7e.state="CO";
if(_7f.AddressDetails.Country.AdministrativeArea&&_7f.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName){
_7e.state=_7f.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;
}
if(_7f.AddressDetails.Accuracy>5){
_7e.lat=_7f.Point.coordinates[1];
_7e.lng=_7f.Point.coordinates[0];
if(_7e.state=="CO"&&_7f.AddressDetails.Country.AdministrativeArea){
locality=null;
if(_7f.AddressDetails.Country.AdministrativeArea.Locality){
locality=_7f.AddressDetails.Country.AdministrativeArea.Locality;
}else{
if(_7f.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea&&_7f.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality){
locality=_7f.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality;
}
}
if(locality){
_7e.city=locality.LocalityName;
if(locality.PostalCode){
_7e.zip=locality.PostalCode.PostalCodeNumber;
}
if(locality.Thoroughfare){
_7e.street=locality.Thoroughfare.ThoroughfareName;
}
}
}
}else{
if(_7e.state=="CO"&&_7f.AddressDetails.Country&&_7f.AddressDetails.Country.CountryNameCode=="US"){
RasMap.checkResize();
RasMap.setCenter(new GLatLng(_7f.Point.coordinates[1],_7f.Point.coordinates[0]));
RasApp.fetch();
return;
}
}
}
if(_7d.Status.code==620){
MapHelper.logJSError("Geocoding returning 620!");
}
showInline("loading");
MapHelper.searchBox2(_7e,function(_80){
if(_80==null||_80.length<1||_80[0].searchFailed){
msgDlg("<b>If you are searching for an address, please make sure to enter the city for better results</b><br/>We couldn't find any matches for the location <b>&quot;"+_7d.name+"&quot;</b>");
RasApp.fetch();
return;
}else{
if(_80.length>1){
hide("loading");
multipleResults=_80;
displayMultipleResults();
return;
}
}
showProp(_80[0],_7d);
});
}
function displayMultipleResults(){
var txt="<b>Multiple Results - Please Choose</b><br/>";
for(i=0;i<multipleResults.length;i++){
txt=txt+"<a href=\"#\" onclick=\"chooseProp("+i+")\">"+multipleResults[i].showDesc+"</a><br/>";
}
msgDlg(txt);
}
function chooseProp(idx){
if(multipleResults&&multipleResults.length>0){
if(multipleResults[idx]){
showProp(multipleResults[idx]);
multipleResults=[];
}
}
}
function showProp(_83,_84){
if(_83.showid==null||_83.showid<=0){
msgDlg("<b>If you are searching for an address, please make sure to enter the city for better results</b>.<br/>Sorry, but we couldn't find any listings exactly matching the location <b>&quot;"+_84.name+"&quot;</b>.  We are taking you to a best guess of the general location.");
get("showId").value="";
lastShownId=null;
RasMap.setCenter(new GLatLng(_83.centerLat,_83.centerLng));
RasApp.fetch();
}else{
RasApp.clearEvents();
if(_83.showid!=null&&_83.showid>0){
get("showId").value=_83.showid;
RasMap.setZoom(Number(_83.zoomLevel));
}
RasMap.setCenter(new GLatLng(_83.centerLat,_83.centerLng));
RasApp.installEvents();
RasApp.fetch(_83.showid);
}
}
function initSearchBox(){
var val=get("iptAddress").value;
if(val==null||val.length<1){
get("iptAddress").value="Enter MLS#, City or Address";
}
}
function initSearchForm(_86){
if(_86){
clearSearchField();
}
showSearchOptions();
}
function isSearchOptionsVisible(){
return isVisible("searchOptions");
}
function showSearchOptions(){
show("searchOptions");
var _87=get("frmSearch");
hide("frmSearchButton");
hide("modLink");
hide("previewDetails");
show("moreInfo");
var _88=Number(get("searchOptions").offsetHeight-25);
get("previewContainer").style.marginTop=_88+"px";
}
function clearSearchField(){
get("iptAddress").value="";
get("iptAddress").style.color="#000";
}
function hideSearchOptions(_89){
hide("searchOptions");
initSearchBox();
show("frmSearchButton");
show("previewDetails");
hide("moreInfo");
show("modLink");
var _8a=get("frmSearch");
get("previewContainer").style.marginTop=0;
if(!_89){
updateCriteria(get("maxP"));
}
}
function doHelp(){
hideSearchOptions();
previewMgr.setDefaultUrl("/common/search/noPropPreview.jsp");
previewMgr.refresh("/common/search/noPropPreview.jsp");
}
function startSave(){
show("dlgSave");
get("saveName").value="";
get("saveName").focus();
}
function saveSearch(){
var _8b=get("saveName").value;
if(_8b==null||_8b.length==0){
alert("Please name this search, eg \"Places I like\"");
return false;
}
hide("dlgSave");
MapHelper.saveSearch(RasMap.getBounds().getSouthWest().toUrlValue(4),RasMap.getBounds().getNorthEast().toUrlValue(4),RasMap.getZoom(),criteria,_8b,finishSave);
}
function finishSave(_8c){
if(_8c){
msgDlg("<p><b>Search Saved!</b></p> You can <a href=\"/myras/Search_show.action\">access Saved Searches</a> in <a href=\"/myras\">My Real-a-Save</a>");
}else{
document.location="/myras/Search_save.ahtml";
}
}
function startShare(){
makeSearchLink();
var url=makeSearchLink();
get("linkURL").value=url;
show("linkDiv");
get("linkURL").select();
}
function makeSearchLink(){
var url="http://"+window.location.host+"/Search_execute.action?";
url=addParm(url,"lng",RasMap.getCenter().lng());
url=addParm(url,"lat",RasMap.getCenter().lat());
url=addParm(url,"zoom",RasMap.getZoom());
url=addParm(url,"propType",criteria.propType);
url=addParm(url,"status",criteria.status);
url=addParm(url,"maxPrice",criteria.maxPrice);
url=addParm(url,"minPrice",criteria.minPrice);
url=addParm(url,"minBeds",criteria.minBeds);
url=addParm(url,"maxBeds",criteria.maxBeds);
url=addParm(url,"minSqFt",criteria.minSqFt);
url=addParm(url,"maxSqFt",criteria.maxSqFt);
url=addParm(url,"minBaths",criteria.minBaths);
url=addParm(url,"maxBaths",criteria.maxBaths);
url=addParm(url,"minDays",criteria.minDaysOnRas);
url=addParm(url,"maxDays",criteria.maxDaysOnRas);
url=addParm(url,"minParking",criteria.minParking);
url=addParm(url,"maxParking",criteria.maxParking);
url=addParm(url,"minLotSize",criteria.minLotsize);
url=addParm(url,"maxLotSize",criteria.maxLotsize);
url=addParm(url,"minYear",criteria.minYear);
url=addParm(url,"maxYear",criteria.maxYear);
url=addParm(url,"searchTxt",criteria.searchTxt);
if(hasPoly()){
var _8f=getEncodedPoly();
if(_8f){
url=addParm(url,"pc",_8f);
url=addParm(url,"h",hex_md5(_8f));
}
}
return url;
}
function addParm(url,_91,_92){
_92=String(_92);
num=Number(_92);
if(_92!=null&&_92.length>0&&_92!="undefined"&&num!=-1){
url=url+_91+"="+_92+"&";
}
return url;
}
function startUpdates(){
alert("The Receive Updates UI would appear");
}
function prevImg(mls,_94){
readImgMax();
if(curImg>1){
curImg=curImg-1;
}else{
curImg=maxImg;
}
MapHelper.previewImage(mls,_94,curImg,showImg);
}
function nextImg(mls,_96){
readImgMax();
if(curImg<maxImg){
curImg=curImg+1;
}else{
curImg=1;
}
MapHelper.previewImage(mls,_96,curImg,showImg);
}
function showImg(_97){
get("preview-img").src=_97;
var _98=get("imgStat");
if(_98!=null){
_98.innerHTML=curImg+"/"+maxImg;
}
}
function readImgMax(){
maxImg=get("imgmax").value;
}
function resetImgCount(){
curImg=1;
maxImg=0;
var _99=get("imgStat");
if(_99!=null){
get("imgStat").innerHTML="";
}
}
function highlightChange(val){
if(val>0){
return "<span style=\"color:green;\">"+val+"</span>";
}else{
if(val<0){
return "<span style=\"color:red;\">"+val+"</span>";
}
}
return val;
}
function formatCurrency(num){
if(isNaN(num)){
num="0";
}
sign=(num==(num=Math.abs(num)));
num=Math.floor(num*100+0.50000000001);
num=Math.floor(num/100).toString();
for(var i=0;i<Math.floor((num.length-(1+i))/3);i++){
num=num.substring(0,num.length-(4*i+3))+","+num.substring(num.length-(4*i+3));
}
return (((sign)?"":"-")+"$"+num);
}
function formatThumb(url){
return ("<img src=\""+url+"\" width=70 height=45>");
}
function renderMLS(_9e){
if(_9e=="IR"){
return "IRES";
}else{
if(_9e=="ML"){
return "Metrolist"+"<br/><img src=\"/img/mls/idx.gif\" width=\"30\">";
}else{
if(_9e=="PR"){
return "PPMLS";
}
}
}
return "MLSS";
}
function clearDivs(_9f,_a0){
if(_a0){
ewindow.hide();
}
hide("linkDiv");
hide("dlgSave");
hide("favDone");
hideMsgDlg();
}
function myHandler(e){
var ret=routeEvent(e);
clearDivs();
return ret;
}
function appError(msg){
alert("App Error: "+msg);
}

