
function AutoCheckPre()
{
var cb=document.getElementById("chbxEmailUpdates");
cb.checked=true;
}
function getPage(curPage,pageCount)
{
if(pageCount == 0)
{
}
else
{
var myPage = document.getElementById('myPage');
var myPage0 = document.getElementById('myPage0');
var i;
var outStr = "";
var prevPage = curPage - 1;
var nextPage = curPage + 1;
var prevPageContent = "<a href='javascript:getPage("+prevPage+","+pageCount+")'><u>Previous</u></a>&nbsp;&nbsp;";
var nextPageContent = "<a href='javascript:getPage("+nextPage+","+pageCount+")'><u>Next</u></a>";
if(curPage == 1)
{
prevPageContent = "Previous&nbsp;&nbsp;";
}
if(curPage == pageCount)
{
nextPageContent = "Next";
}
if(pageCount <= 9)
{
for(i = 1; i <= pageCount; i ++)
{
if( i == curPage)
outStr += "<strong>"+i + "</strong>&nbsp;&nbsp;";
else
outStr += "<a href='javascript:getPage(" + i + ","+pageCount+")'><u>" + i + "</u></a>&nbsp;&nbsp;";
}
myPage0.innerHTML= "Pages:&nbsp;"+prevPageContent + outStr + nextPageContent;
}
else
{
var min;
var max;
if(curPage + 4 > pageCount)
{
max = pageCount;
min = pageCount - 8;
}
if(curPage - 4 < 1)
{
min = 1;
max = 9;
}
if( curPage + 4 <= pageCount && curPage - 4 >= 1)
{
min = curPage - 4;
max = curPage + 4;
}
for(i = min; i <= max; i ++)
{
if( i == curPage)
outStr += "<strong>"+i + "</strong>&nbsp;&nbsp;";
else
outStr += "<a href='javascript:getPage(" + i + ","+pageCount+")'><u>" + i + "</u></a>&nbsp;&nbsp;";
}
myPage0.innerHTML = "Pages:&nbsp;"+prevPageContent + outStr + nextPageContent;
}
var tbCurPageCount = document.getElementById("tbCurPageCount");
tbCurPageCount.value = curPage;
}
GetResults(curPage);
}
function showDetail(str1,str2)
{
var valueSpotter=document.getElementById(str1);
var valueSpotter0=document.getElementById(str2);
valueSpotter.innerHTML="<div align='left' style='background-color:#ffcc66;margin-right:16px'><font size=1>ValueSpotter selects <br>underpriced properties <br>using a patented algorithm.</font></div>";
valueSpotter0.style.display="none";
}
function BuildFullPage()
{
GetListingType();
getRecCount();
GetType();
DisplayPaging();
}
function GetListingType()
{
var listingType = document.getElementById("ListingType");
if(listingType != null && parseInt(listingType.value) >= 0)
gListingTypeForMap = parseInt(listingType.value);
}
function GetType()
{
var typeName = document.getElementById("curType").value;
switch(typeName)
{
case "photo":
document.getElementById('photosView').className='SearchResultsViewTabSelected PhotosViewTab';
document.getElementById('listView').className='SearchResultsViewTab ListViewTab';
document.getElementById('mapView').className='SearchResultsViewTab MapViewTab';
break;
case "list":
document.getElementById('photosView').className='SearchResultsViewTab PhotosViewTab';
document.getElementById('listView').className='SearchResultsViewTabSelected ListViewTab';
document.getElementById('mapView').className='SearchResultsViewTab MapViewTab';
break;
case "map":
document.getElementById('photosView').className='SearchResultsViewTab PhotosViewTab';
document.getElementById('listView').className='SearchResultsViewTab ListViewTab';
document.getElementById('mapView').className='SearchResultsViewTabSelected MapViewTab';
break;
default:
break;
}	
}
function SetType(typeName)
{
document.getElementById("curType").value = typeName;
BuildFullPage();
}	
function SetPageNumber(pageNum)
{
document.getElementById("tbCurPageCount").value = pageNum;
}
function chbxSaveAs_func()
{
var chbxSaveAs = document.getElementById("chbxSaveAs");
var tbSaveAs=document.getElementById("tbxSaveAs");
if(chbxSaveAs.checked == false)
{
tbSaveAs.value = "";
}
}
function AutoCheckSaveSearchAs()
{
var tbSaveAs=document.getElementById("tbxSaveAs");
var chSaveAs=document.getElementById("chbxSaveAs");
if(chSaveAs!=null)//Added by Joe, Jan 19, For avoid javascript error.
if(tbSaveAs.value=="")
{
chSaveAs.checked=false;
}
else
{
chSaveAs.checked=true;
}
}
function callback_GetPageList(res)
{
getPage(1,res.value);
}
function showInd(VSPid)
{
var ID = document.getElementById(VSPid);
ID.className = "notesStyle";
ID.style.width = "270px";
ID.style.margin = "20px 0 0 -220px";
if(VSPid == "VSP")
ID.innerHTML = "<p align=left style='FONT-SIZE:80%'>ValueSpotter<sup><font style='font-size:8px'>TM</font></sup> identifies houses with a low price compared to nearby listings.</p>";
else
ID.innerHTML = "<p align=left>ValueSpotter<sup><font style='font-size:8px'>TM</font></sup> identifies houses with a low price compared to nearby listings.</p>";	
}
function HiddenInd(VSPid)
{
var ID=document.getElementById(VSPid);
ID.className="notesStyleHidden";
}
function CalcAvgValue(str_values)
{
if(str_values == "")
return 0;
var arr = str_values.replace(/\,&nbsp;/g,'').split(",");
if(arr.length == 1)
return str_values;
for(var m=0; m< arr.length; m++)
{
if(arr[m] == "")
{
arr = RemoveArrayItem(arr, m);
m = m - 1;
}
}
var temp;
for(var i=0; i<arr.length; i++) {
var k = i;
for(var j=i+1; j<arr.length; j++) {
if((eval(arr[j])) < (eval(arr[k])))
k = j;
}
if (k != i){
temp = arr[i];
arr[i] = arr[k];
arr[k] = temp;
}
}
var count = arr.length;
var avgValue = 0;
if(count % 2 == 0)
{
avgValue = Math.round((eval(arr[count/2]) + eval(arr[count/2])) / 2);
}
else
{
avgValue = Math.round((eval(arr[(count-1)/2])+eval(arr[(count-1)/2+1]))/2);
}
return avgValue;
}
function RemoveArrayItem(objArray, index)
{
var part1 = objArray.slice(0, index);
var part2 = objArray.slice(index + 1);
return part1.concat(part2);
}
function ISLatiLongMatch(currentLatitude, currentLongitude)
{
var objLatitude = document.getElementById("hdnLatitude");
var objLongitude = document.getElementById("hdnLongitude");
var latitude = 0;
var longitude = 0;
if(objLatitude != undefined && objLatitude != null && objLatitude.value != "")
latitude = parseFloat(objLatitude.value);
if(objLongitude != undefined && objLongitude != null && objLongitude.value != "")
longitude = parseFloat(objLongitude.value);
if((Math.abs(currentLatitude - latitude) > 0.01447388) || (Math.abs(currentLongitude - longitude) > 0.0183676))
return false;
else
return true;
}
function onGetResultsForCompsSucceed(res)
{
if(res == null || res.Tables.length == 0 || res.Tables[0].Rows.length == 0)
return;
for(var i=0; i< res.Tables[0].Rows.length; i++)
{	
if( !ISLatiLongMatch(res.Tables[0].Rows[i].Latitude, res.Tables[0].Rows[i].Longitude) )
{
res.Tables[0].Rows = RemoveArrayItem(res.Tables[0].Rows, i);
i = i - 1;
}
}
if(res.Tables[0].Rows.length > 0)
ShowCompsResults(res);
}
function ShowCompsResults(res)
{
var igen_key = 0;
var type = document.getElementById("curType").value;
var curPageCount=document.getElementById("tbCurPageCount").value;
var str;
var calcMultiple = 1.2;
var lblStat_Price = document.getElementById("lblStat_Price");
var lblStat_PricePerSF = document.getElementById("lblStat_PricePerSF");
var lblStat_DaysMkt = document.getElementById("lblStat_DaysMkt");
var selectedPrice = eval(removeFormatNum(lblStat_Price.innerHTML));
var selectedPricePerSF = 0;
var selectedDaysMkt = 0;
if(lblStat_DaysMkt.innerHTML != "")
{
selectedDaysMkt = eval(lblStat_DaysMkt.innerHTML);
}
var minSalePrice = 0;// = selectedPrice;
var maxSalePrice = 0;// = selectedPrice;
var minPricePerSF = 0;// = selectedPricePerSF;
var maxPricePerSF = 0;// = selectedPricePerSF;
var minDaysMkt = 0;// = selectedDaysMkt;
var maxDaysMkt = 0;// = selectedDaysMkt;
var medianSalePrice = 0;
var medianPricePerSF = 0;
var medianMkt = 0;
var totalCount = res.Tables[0].Rows.length;
if(totalCount >= 1)
{
medianSalePrice = 0;
medianPricePerSF = 0;
medianMkt = 0;	
var strSalePrice = "";
var strPricePerSF = "";
var strMkt = "";
for(var i=0; i<totalCount; i++)
{	
var strCurSaleprice = "";
if(res.Tables[0].Rows[i].statusNum == 1 || res.Tables[0].Rows[i].statusNum == 4)
strCurSaleprice = res.Tables[0].Rows[i].List_Price;
else
strCurSaleprice = res.Tables[0].Rows[i].Sale_Price;
var strCurMkt = res.Tables[0].Rows[i].DaysOnMkt_comps;
if(i == 0)
{
if(strCurSaleprice != "&nbsp;")
{
strSalePrice += removeFormatNum(strCurSaleprice);
if(res.Tables[0].Rows[i].sq_feet != null && res.Tables[0].Rows[i].sq_feet != 0 && res.Tables[0].Rows[i].sq_feet != "N/A")
strPricePerSF += Math.round(eval(removeFormatNum(strCurSaleprice))/eval(res.Tables[0].Rows[i].sq_feet));
}
if(strCurMkt != "&nbsp;")
strMkt += strCurMkt;
}
else
{
if(strCurSaleprice != "&nbsp;")
{
strSalePrice += ","+removeFormatNum(strCurSaleprice);
if(res.Tables[0].Rows[i].sq_feet != null && res.Tables[0].Rows[i].sq_feet != 0 && res.Tables[0].Rows[i].sq_feet != "N/A")
{
if(strPricePerSF == "")
strPricePerSF += Math.round(eval(removeFormatNum(strCurSaleprice))/eval(res.Tables[0].Rows[i].sq_feet));
else
strPricePerSF += ","+Math.round(eval(removeFormatNum(strCurSaleprice))/eval(res.Tables[0].Rows[i].sq_feet));
}
}
if(strCurMkt != "&nbsp;")
strMkt += "," + strCurMkt;
}
}
medianSalePrice = CalcAvgValue(strSalePrice);
if(strPricePerSF == "")
document.getElementById("trPricePerSF").style.display = "none";
else
medianPricePerSF = CalcAvgValue(strPricePerSF);
medianMkt = CalcAvgValue(strMkt);
for(var i=0; i<totalCount; i++)
{	
var strCurSaleprice2 = "";
if(res.Tables[0].Rows[i].statusNum == 1 || res.Tables[0].Rows[i].statusNum == 4)
strCurSaleprice2 = res.Tables[0].Rows[i].List_Price;
else
strCurSaleprice2 = res.Tables[0].Rows[i].Sale_Price;
var strCurMkt2 = res.Tables[0].Rows[i].DaysOnMkt_comps;
if(strCurSaleprice2 != "&nbsp;")
{
var tmpSalePrice = eval(removeFormatNum(strCurSaleprice2));
var tmpPricePerSF = 0;
if(res.Tables[0].Rows[i].sq_feet != null && res.Tables[0].Rows[i].sq_feet != 0 && res.Tables[0].Rows[i].sq_feet != "N/A")
tmpPricePerSF = Math.round(eval(removeFormatNum(strCurSaleprice2))/eval(res.Tables[0].Rows[i].sq_feet));
if(i==0)
{
minSalePrice = tmpSalePrice;
maxSalePrice = tmpSalePrice;
minPricePerSF = tmpPricePerSF;
maxPricePerSF = tmpPricePerSF;
}
else
{
if(tmpSalePrice < minSalePrice)
minSalePrice = tmpSalePrice;
if(tmpSalePrice > maxSalePrice)
maxSalePrice = tmpSalePrice;
if(tmpPricePerSF < minPricePerSF)
minPricePerSF = tmpPricePerSF;
if(tmpPricePerSF > maxPricePerSF)
maxPricePerSF = tmpPricePerSF;
}
}
if(strCurMkt2 != "&nbsp;")
{
var tmpDaysMkt = eval(strCurMkt2);
if(i==0)
{
minDaysMkt = tmpDaysMkt;
maxDaysMkt = tmpDaysMkt;
}
else
{	
if(tmpDaysMkt < minDaysMkt)
minDaysMkt = tmpDaysMkt;
if(tmpDaysMkt > maxDaysMkt)
maxDaysMkt = tmpDaysMkt;
}
}
}
var lblStat_MedianPrice = document.getElementById("lblStat_MedianPrice");
lblStat_MedianPrice.innerHTML = formatNum(medianSalePrice);	
document.getElementById("lblStat_minSalePrice").innerHTML = formatNum(minSalePrice);
document.getElementById("lblStat_maxSalePrice").innerHTML = formatNum(maxSalePrice);
if(eval(selectedPrice)-minSalePrice < 0)
{
document.getElementById("imgBlank1").style.width == 0;
document.getElementById("imgArrow1").style.display = "none";
var tdLPrice = document.getElementById("tdLPrice");
tdLPrice.style.backgroundImage = 'url(images/arrowH.gif)';
tdLPrice.style.backgroundRepeat = 'no-repeat';
tdLPrice.style.backgroundPosition = 'right';
}
else
{
var thisPricePercent = ((eval(selectedPrice)-minSalePrice)/(maxSalePrice-minSalePrice))*100;
if(thisPricePercent > 100)
{
document.getElementById("imgBlank1").style.width == 0;
document.getElementById("imgArrow1").style.display = "none";
var tdHPrice = document.getElementById("tdHPrice");
tdHPrice.style.backgroundImage = 'url(images/arrowH.gif)';
tdHPrice.style.backgroundRepeat = 'no-repeat';
}
else
{
if(maxSalePrice == minSalePrice)
document.getElementById("imgBlank1").style.width = 100*calcMultiple;
else
document.getElementById("imgBlank1").style.width = ((eval(selectedPrice)-minSalePrice)/(maxSalePrice-minSalePrice))*100*calcMultiple;
}
}
if(maxSalePrice == minSalePrice)
document.getElementById("imgSalePrice").style.width = 100*calcMultiple;
else
document.getElementById("imgSalePrice").style.width = ((medianSalePrice-minSalePrice)/(maxSalePrice-minSalePrice))*100*calcMultiple;
if(document.getElementById("trPricePerSF").style.display != "none")
{
document.getElementById("lblStat_MedianPricePerSF").innerHTML = medianPricePerSF;
document.getElementById("lblStat_minPricePerSF").innerHTML = minPricePerSF;
document.getElementById("lblStat_maxPricePerSF").innerHTML = maxPricePerSF;
if(eval(selectedPricePerSF)-minPricePerSF < 0)
{
document.getElementById("imgBlank2").style.width == 0;
document.getElementById("imgArrow2").style.display = "none";
var tdLPricePerSF = document.getElementById("tdLPricePerSF");
tdLPricePerSF.style.backgroundImage = 'url(images/arrowH.gif)';
tdLPricePerSF.style.backgroundRepeat = 'no-repeat';
tdLPricePerSF.style.backgroundPosition = 'right';
}
else
{
var thisPricePerSFPercent = ((eval(selectedPricePerSF)-minPricePerSF)/(maxPricePerSF-minPricePerSF))*100;
if(thisPricePerSFPercent > 100)
{
document.getElementById("imgBlank2").style.width == 0;
document.getElementById("imgArrow2").style.display = "none";
var tdHPricePerSF = document.getElementById("tdHPricePerSF");
tdHPricePerSF.style.backgroundImage = 'url(images/arrowH.gif)';
tdHPricePerSF.style.backgroundRepeat = 'no-repeat';
}
else
{
if(maxPricePerSF == minPricePerSF)
document.getElementById("imgBlank2").style.width = 100*calcMultiple;
else
document.getElementById("imgBlank2").style.width = ((eval(selectedPricePerSF)-minPricePerSF)/(maxPricePerSF-minPricePerSF))*100*calcMultiple;
}
}
if( isNaN(medianPricePerSF) )
medianPricePerSF = 0;		
if(maxPricePerSF == minPricePerSF)
document.getElementById("imgPricePerSF").style.width = 100*calcMultiple;
else
document.getElementById("imgPricePerSF").style.width = ((medianPricePerSF-minPricePerSF)/(maxPricePerSF-minPricePerSF))*100*calcMultiple;
}
document.getElementById("lblStat_MedianDaysMkt").innerHTML = medianMkt;
document.getElementById("lblStat_minDaysMkt").innerHTML = minDaysMkt;
document.getElementById("lblStat_maxDaysMkt").innerHTML = maxDaysMkt;
if(eval(selectedDaysMkt)-minDaysMkt < 0)
{
document.getElementById("imgBlank3").style.width == 0;
document.getElementById("imgArrow3").style.display = "none";	
var tdLMkt = document.getElementById("tdLMkt");
tdLMkt.style.backgroundImage = 'url(images/arrowH.gif)';
tdLMkt.style.backgroundRepeat = 'no-repeat';
tdLMkt.style.backgroundPosition = 'right';
}
else
{
var thisMktPercent = ((eval(selectedDaysMkt)-minDaysMkt)/(maxDaysMkt-minDaysMkt))*100;
if(thisMktPercent > 100)
{
document.getElementById("imgBlank3").style.width == 0;
document.getElementById("imgArrow3").style.display = "none";	
var tdHMkt = document.getElementById("tdHMkt");
tdHMkt.style.backgroundImage = 'url(images/arrowH.gif)';
tdHMkt.style.backgroundRepeat = 'no-repeat';
}
else
{
if(maxDaysMkt == minDaysMkt)
document.getElementById("imgBlank3").style.width = 100*calcMultiple;
else
document.getElementById("imgBlank3").style.width = ((eval(selectedDaysMkt)-minDaysMkt)/(maxDaysMkt-minDaysMkt))*100*calcMultiple;
}
}
if(maxDaysMkt == minDaysMkt)
document.getElementById("imgMkt").style.width = 100*calcMultiple;
else
document.getElementById("imgMkt").style.width = ((medianMkt-minDaysMkt)/(maxDaysMkt-minDaysMkt))*100*calcMultiple;
}
switch(type)
{
case "photo":
{
if(res != null && res.Tables != 0 && res.Tables.length == 1)
{
str = "<table width=\"760\" id=\"dlPhotosView\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;\">";
for(var i=0; i<res.Tables[0].Rows.length; i++)
{
if( i%2 == 0)
str += "<tr><td align=left>";
else
str += "<td align=right>";
var hb = new HouseBox("Comps");
hb.Address		= res.Tables[0].Rows[i].Address;
hb.bathroomText = res.Tables[0].Rows[i].Bath;
hb.bedroomText = res.Tables[0].Rows[i].Bed;
hb.DaysOnMkt = res.Tables[0].Rows[i].DaysOnMkt;
hb.Favorite = res.Tables[0].Rows[i].Favorite ? 1:0;
hb.HouseScore = res.Tables[0].Rows[i].Match;
hb.iGen_Key = res.Tables[0].Rows[i].igen_key;
hb.list_price = res.Tables[0].Rows[i].List_Price;
hb.listingType = res.Tables[0].Rows[i].ListingType;
hb.ln_list_agents_name = res.Tables[0].Rows[i].ln_list_agents_name;
hb.lo_listing_office = res.Tables[0].Rows[i].lo_listing_office;
hb.lot_size = res.Tables[0].Rows[i].Lot;
hb.mls_db = res.Tables[0].Rows[i].mls_db;
hb.mls_num = res.Tables[0].Rows[i].mls_num;
hb.num_photos_dl = res.Tables[0].Rows[i].doesPhotos ? 1:0;
hb.openHouseText = res.Tables[0].Rows[i].Open;
hb.priceChange = res.Tables[0].Rows[i].priceChange;
hb.salePrice = res.Tables[0].Rows[i].Sale_Price;
hb.saleDate = res.Tables[0].Rows[i].Sale_Date;
hb.square_feet = res.Tables[0].Rows[i].sq_feet;
hb.ss_status = res.Tables[0].Rows[i].statusNum;
hb.StaticURL = res.Tables[0].Rows[i].StaticURL;
hb.vs_flag = res.Tables[0].Rows[i].spot ? 1:0;
hb.zipcode = res.Tables[0].Rows[i].city_zip;
hb.cityCode = res.Tables[0].Rows[i].city_code;
var currentBoxHTML = hb.GetHouse();
str += currentBoxHTML;
if( i%2 != 0)
str += "</tr>";
}
str += "</table>";
document.getElementById("displayResults").innerHTML = str;
}
else
{
document.getElementById("displayResults").innerHTML = "No results found.";
}
iGen.WebServices.CompsResults.LogPageHit("COMPS_PHOTO");
break;
}
case "list":
{
if(res != null && res.Tables != 0 && res.Tables.length == 1)
{
str = "<table class=\"resultTable\" cellpadding=4 cellspacing=0><Tr><Td>Address</Td><td>Map</td><td>Status</td><Td>Sq. Ft.</Td><Td>Lot size</Td><Td>Stories</Td><Td>Bed</Td><Td>Bath</Td><Td>Dining<br>Room</Td><Td>Family<br>Room</Td><Td>Pool</Td><Td>Garage</Td><Td>Fire place</Td><Td>Days On Mkt</Td><Td>Rank %</Td><Td>List Price</Td><Td>Sold Price</Td><Td>Sold Date</Td></Tr>";
for(var i=0; i<res.Tables[0].Rows.length; i++)
{	
igen_key = res.Tables[0].Rows[i].igen_key;
var listingType = res.Tables[0].Rows[i].ListingType;
var Dining = "&nbsp;";
var Family = "&nbsp;";
var Pool = "&nbsp;";
var Fireplace = "&nbsp;";
if(res.Tables[0].Rows[i].Dining)
Dining = "<img src='images/Dining.gif'>";
if(res.Tables[0].Rows[i].Family)
Family = "<img src='images/Family.gif'>";
if(res.Tables[0].Rows[i].Pool)
Pool = "<img src='images/Pool.gif'>";	
if(res.Tables[0].Rows[i].Fireplace)
Fireplace = "<img src='images/Fireplace.gif'>";
str += "<tr><td><a href=\"" + res.Tables[0].Rows[i].StaticURL + "\">" + res.Tables[0].Rows[i].Address + "</a></td>";
str += "<td align=center><img align=\"top\" title=\"Click to view map\" class='cursorPointer' src=\"images/newpropertysearch/MapIcon.gif\" border=0 onclick=\"javascript:MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=" + igen_key + "','iGenMap',550,650);\" /></td>";
var strStatus = "&nbsp;";	
if(listingType == 0)
strStatus = res.Tables[0].Rows[i].status;
str += "<td align=center>" + strStatus + "</td>";
var mlsDb = res.Tables[0].Rows[i].mls_db;	
var daysOnMkt = "";
if(listingType == 0 && mlsDb != "300")
{
daysOnMkt = res.Tables[0].Rows[i].DaysOnMkt_comps;
}
str += "<td>" + res.Tables[0].Rows[i].sq_feet + "</td><td>" + res.Tables[0].Rows[i].Lot + "</td><td>" + res.Tables[0].Rows[i].Stories + "</td><td>" + res.Tables[0].Rows[i].Bed + "</td><td>" + res.Tables[0].Rows[i].Bath + "</td>";
str += "<td align=center>" + Dining + "</td><td align=center>" + Family + "</td><td align=center>" + Pool + "</td><td>" + res.Tables[0].Rows[i].Garage + "</td><td align=center>" + Fireplace + "</td><td>" + daysOnMkt + "</td>";
str += "<td>" + res.Tables[0].Rows[i].Match + "%</td><td>$" + res.Tables[0].Rows[i].List_Price + "<br>";
if(listingType == 0)
{
var img = GetMLSLogosByMlsDb( eval(res.Tables[0].Rows[i].mls_db) );	
str += img;
}
str += "</td><td>" + ((res.Tables[0].Rows[i].Sale_Price == "" || res.Tables[0].Rows[i].Sale_Price == "&nbsp;")?"N/A": "$" + res.Tables[0].Rows[i].Sale_Price) + "</td><td>" + ((res.Tables[0].Rows[i].Sale_Date == "" || res.Tables[0].Rows[i].Sale_Date == "&nbsp;") ? "N/A" : res.Tables[0].Rows[i].Sale_Date) + "</td></tr>";	
}
str += "</table>";
document.getElementById("displayResults").innerHTML = str.replace(/<td><\/td>/g,"<td>&nbsp;</td>");
}
else
{
document.getElementById("displayResults").innerHTML = "No results found.";
}
iGen.WebServices.CompsResults.LogPageHit("COMPS_LIST");
break;
}
case "map":
{
if(res != null && res.Tables != 0 && res.Tables.length == 1)
{	
str = "<table cellspacing=\"0\" border=\"0\"><td><table style=\"float:left; margin:0px\" class=\"subbox\"><tr><td valign=top>";
var mls_str = "";	
for(var j=0; j<res.Tables[0].Rows.length; j++)
{
if(mls_str == "")
mls_str += res.Tables[0].Rows[j].mls_num;
else
mls_str += "," + res.Tables[0].Rows[j].mls_num;
}	
str += "<DIV id=\"map\" style=\"WIDTH: 580px; HEIGHT: 475px\"></DIV></td><td valign=top style=\"font-size:9px;\">";
str += "<div id=\"selectedMsg\" style=\"border:1px solid gray;height:145px\" width=\"100%\"></div>";
str += "<table width=\"100%\" cellspacing=\"0\">";
var instantMsgControls = "";
for(var i=0; i<res.Tables[0].Rows.length; i++)
{	
igen_key = res.Tables[0].Rows[i].igen_key;
var listingType = res.Tables[0].Rows[i].ListingType;
var instantMsgContent = "";
instantMsgContent += res.Tables[0].Rows[i].Address;
if(listingType == 0)
instantMsgContent += "<br>Status: <b>" + res.Tables[0].Rows[i].status + "</b>";
instantMsgContent += "<br>List Price: ";
if(listingType == 1)
{
instantMsgContent += "From ";
}
instantMsgContent += "$"+res.Tables[0].Rows[i].List_Price;
if(listingType == 0)
{
if(res.Tables[0].Rows[i].Sale_Price && res.Tables[0].Rows[i].statusNum != 1)
{
if(res.Tables[0].Rows[i].statusNum == 4 && (res.Tables[0].Rows[i].Sale_Price == "" || res.Tables[0].Rows[i].Sale_Price == "&nbsp;"))
instantMsgContent += "<br>Sold Price: N/A";
else
instantMsgContent += "<br>Sold Price: $" + res.Tables[0].Rows[i].Sale_Price;
}
if(res.Tables[0].Rows[i].Sale_Date && res.Tables[0].Rows[i].statusNum != 1)
{
instantMsgContent += "<br>Sold Date: " + res.Tables[0].Rows[i].Sale_Date;
}
}	
instantMsgContent += " <br>bedrooms:"+res.Tables[0].Rows[i].Bed+" - bathrooms:"+res.Tables[0].Rows[i].Bath+"<br>square footage house:"+res.Tables[0].Rows[i].sq_feet+" <br>square footage lot:"+res.Tables[0].Rows[i].Lot+"<br>";
var mlsDb = res.Tables[0].Rows[i].mls_db;
if(listingType == 0 && mlsDb != "300")
{
var isDaysOnMovoto = MLSWithNoListDate(mlsDb);
if(isDaysOnMovoto != null && isDaysOnMovoto == true)
instantMsgContent += "Days on Movoto:";
else
instantMsgContent += "Days on Market:"
instantMsgContent += res.Tables[0].Rows[i].DaysOnMkt_comps+"<br>";
}
if(listingType == 0)
{
instantMsgContent += "MLS number:"+ res.Tables[0].Rows[i].mls_num+"<p>';";
}
instantMsgControls += "<input id='tdInstantMsg_" + igen_key + "' style='display:none;' type=text value='" + instantMsgContent + "'>";
str += "<tr><td id =\""+igen_key+"\" class=\"selectablerow\" onmouseout=\"this.style.backgroundColor=this.getAttribute('BKC');document.getElementById('selectedMsg').innerHTML ='';\" onmouseover=\"this.setAttribute('BKC',this.style.backgroundColor);this.style.backgroundColor='#ffff00';GetMsg("+igen_key+");GetMarkerClick("+igen_key+");\"><a href=\"" + res.Tables[0].Rows[i].StaticURL + "\">" + res.Tables[0].Rows[i].Address + "</a> <br>";
if(listingType == 0)
{
var img = GetMLSLogosByMlsDb( eval(res.Tables[0].Rows[i].mls_db) );	
str += img;
}
str += "&nbsp;" + res.Tables[0].Rows[i].Bed + "/" + res.Tables[0].Rows[i].Bath + " - ";
if(listingType == 1)
{
str += "From ";
}
str += "$" + res.Tables[0].Rows[i].List_Price + "</td></tr>";
}
str += "</table></td></table></td></table>";	
document.getElementById("displayResults").innerHTML = str;
document.getElementById("displayResults").innerHTML += instantMsgControls;
GetMapURL(res);//Added by Joe Aug 23,2005
}
else
{
document.getElementById("displayResults").innerHTML = "No results found.";
}
iGen.WebServices.CompsResults.LogPageHit("COMPS_MAP");
break;
}
default:
{
document.getElementById("displayResults").innerHTML = "";
break;
}
}
GetType();//It's for IE to get type display when user press "back" button, can't be removed.
}
function GetMsg(igen_key)
{
var tdMsgContent = document.getElementById("tdInstantMsg_" + igen_key);
if(tdMsgContent != null)
{
var selectedMsg = document.getElementById('selectedMsg');
if(selectedMsg != null)
selectedMsg.innerHTML = tdMsgContent.value;
}
}
function onSaveSearchSuccessed(result)
{
var SaveResult=document.getElementById("SaveResult");
if(result)
{
SaveResult.innerHTML = "<font color=#9B2D00>Saved Search.</font>";
LoadAllSavedSearch();
}
else
{
SaveResult.innerHTML = "<font color=#9B2D00>Save failed.</font>";
}
}
function GetListingBoxTemplate_Comps(MLSDB)
{
if(MLSDB == undefined || MLSDB == null)
MLSDB = 0;
MLSDB = parseInt(MLSDB);
var template = "";
var templateNHS ="<table cellspacing=\"0\" class=\"resultSTbl\"><tr><td valign=\"top\" width=115><a href='~StaticURL~'>~HouseImg~</a></td><td valign=\"top\" style=\"font-size:9px;width:205px;\"><a href='~StaticURL~'>~Address~</a><br><span style='float:left;display:inline;'>~ZipCode~&nbsp;&nbsp;<a href=\"javascript:TrackGoogleAnalytics('General Map Popup');MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=~IGenKey~','iGenMap',550,650);\"><u>Map</u></a></span><span style='float:right;display:inline;'>From $~Price~</span><br><br>~Bed~ <strong>Bedrooms</strong> - ~Bath~ <strong>Bathrooms</strong><br>~SQFeet~ <strong>SF</strong><br></td></table></td>";
var templateMLS ="<table cellspacing=\"0\" class=\"resultSTbl\"><tr><td valign=\"top\" width=115><a href='~StaticURL~'>~HouseImg~</a></td><td valign=\"top\" style=\"font-size:9px;width:205px;\"><a href='~StaticURL~'>~Address~</a><br><span style='float:left;display:inline;'>~ZipCode~&nbsp;&nbsp;<a href=\"javascript:TrackGoogleAnalytics('General Map Popup');MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=~IGenKey~','iGenMap',550,650);\"><u>Map</u></a></span><span style='float:right;display:inline;'>$~Price~</span><br><br><br>Status: <b>~Status~</b>~SoldInfo~<br>~Bed~ <strong>Bedrooms</strong> - ~Bath~ <strong>Bathrooms</strong><br>~SQFeet~ <strong>SF</strong><br><strong>Lot size</strong>:~LotSize~<br><strong>Days on Market</strong>: ~DaysOnMkt_comps~<br>MLS# ~MLSNum~ &nbsp; ~MLSImg~<br></td></table></td>";
var templateMLS_DaysOnMovoto ="<table cellspacing=\"0\" class=\"resultSTbl\"><tr><td valign=\"top\" width=115><a href='~StaticURL~'>~HouseImg~</a></td><td valign=\"top\" style=\"font-size:9px;width:205px;\"><a href='~StaticURL~'>~Address~</a><br><span style='float:left;display:inline;'>~ZipCode~&nbsp;&nbsp;<a href=\"javascript:TrackGoogleAnalytics('General Map Popup');MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=~IGenKey~','iGenMap',550,650);\"><u>Map</u></a></span><span style='float:right;display:inline;'>$~Price~</span><br><br><br>Status: <b>~Status~</b>~SoldInfo~<br>~Bed~ <strong>Bedrooms</strong> - ~Bath~ <strong>Bathrooms</strong><br>~SQFeet~ <strong>SF</strong><br><strong>Lot size</strong>:~LotSize~<br><strong>Days on Movoto</strong>: ~DaysOnMkt_comps~<br>MLS# ~MLSNum~ &nbsp; ~MLSImg~<br></td></table></td>";
var templateMLS_NoDOM ="<table cellspacing=\"0\" class=\"resultSTbl\"><tr><td valign=\"top\" width=115><a href='~StaticURL~'>~HouseImg~</a></td><td valign=\"top\" style=\"font-size:9px;width:205px;\"><a href='~StaticURL~'>~Address~</a><br><span style='float:left;display:inline;'>~ZipCode~&nbsp;&nbsp;<a href=\"javascript:TrackGoogleAnalytics('General Map Popup');MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=~IGenKey~','iGenMap',550,650);\"><u>Map</u></a></span><span style='float:right;display:inline;'>$~Price~</span><br><br><br>Status: <b>~Status~</b>~SoldInfo~<br>~Bed~ <strong>Bedrooms</strong> - ~Bath~ <strong>Bathrooms</strong><br>~SQFeet~ <strong>SF</strong><br><strong>Lot size</strong>:~LotSize~<br>MLS# ~MLSNum~ &nbsp; ~MLSImg~<br></td></table></td>";
switch(MLSDB)
{
case 701:
template = templateNHS;break;
case 300:
template = templateMLS_NoDOM;break;
case 401:
case 402:
case 411:
case 412:
case 431:
case 432:
case 433:
case 491:
case 471:
template = templateMLS_DaysOnMovoto;break;
default:
template = templateMLS;break;
}
return template;
}
function GetListingBoxTemplate_Result(MLSDB)
{
if(MLSDB == undefined || MLSDB == null)
MLSDB = 0;
MLSDB = parseInt(MLSDB);
var template = "";
var templateNHS ="<table class=\"resultSTbl\"><tr><td valign=\"top\"><a href='~StaticURL~'>~HouseImg~</a></td><td valign=\"top\" style=\"font-size:9px;width:205px;\"><a href='~StaticURL~'>~Address~</a><table style=\"width:100%\" border=0 cellpadding=0 cellspacing=0><tr><td>~ZipCode~&nbsp;&nbsp;<a href=\"javascript:TrackGoogleAnalytics('General Map Popup');MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=~IGenKey~','iGenMap',550,650);\"><u>Map</u></a></td><td align=right>From $~Price~</td></tr></table>~ValueSpotImg~~Bed~ <strong>Bedrooms</strong> - ~Bath~ <strong>Bathrooms</strong><br>~SQFeet~ <strong>SF</strong><div width='100%'><div style='float:right'><br><br><a href='~StaticURL~'><IMG style='margin-bottom:2px' alt='details' src='images/details.gif' border=0></a></div><div style='float:left;width:150px;line-height:200%'>~Open~</div></td></tr><tr><td></td><td>~StrFavorite~</td></tr></table>";
var templateMLS ="<table class=\"resultSTbl\"><tr><td valign=\"top\"><a href='~StaticURL~'>~HouseImg~</a></td><td valign=\"top\" style=\"font-size:9px;width:205px;\"><a href='~StaticURL~'>~Address~</a><table style=\"width:100%\" border=0 cellpadding=0 cellspacing=0><tr><td>~ZipCode~&nbsp;&nbsp;<a href=\"javascript:TrackGoogleAnalytics('General Map Popup');MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=~IGenKey~','iGenMap',550,650);\"><u>Map</u></a></td><td align=right>$~Price~</td></tr></table>~ValueSpotImg~~Bed~ <strong>Bedrooms</strong> - ~Bath~ <strong>Bathrooms</strong><br>~SQFeet~ <strong>SF</strong><div width='100%'><div style='float:right'><a href='~StaticURL~'><IMG style='margin-bottom:2px' alt='details' src='images/details.gif' border=0></a><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(0,~HotleadParameters~);' alt='view it' src='images/viewit_small.gif'><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(3,~HotleadParameters~);' alt='buy it' src='images/buyit_small.gif'></div><div style='float:left;width:150px;line-height:200%'><strong>Lot size</strong>: ~LotSize~<br><strong>Days on Market</strong>: ~DaysOnMkt~ ~StatusOnMkt~<br>MLS# ~MLSNum~&nbsp;~MLSImg~</div>~Open~</div></td></tr><tr><td></td><td>~StrFavorite~</td></tr></table>";
var templateForeclosure ="<table class=\"resultSTbl\"><tr><td valign=\"top\"><a href='~StaticURL~'>~HouseImg~</a></td><td valign=\"top\" style=\"font-size:9px;width:205px;\"><a href='~StaticURL~'>~Address~</a><table style=\"width:100%\" border=0 cellpadding=0 cellspacing=0><tr><td>~ZipCode~&nbsp;&nbsp;<a href=\"javascript:TrackGoogleAnalytics('General Map Popup');MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=~IGenKey~','iGenMap',550,650);\"><u>Map</u></a></td><td align=right>$~Price~</td></tr></table>~ValueSpotImg~~Bed~ <strong>Bedrooms</strong> - ~Bath~ <strong>Bathrooms</strong><br>~SQFeet~ <strong>SF</strong><div width='100%'><div style='float:right'><a href='~StaticURL~'><IMG style='margin-bottom:2px' alt='details' src='images/details.gif' border=0></a><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(0,~HotleadParameters~);' alt='view it' src='images/viewit_small.gif'><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(3,~HotleadParameters~);' alt='buy it' src='images/buyit_small.gif'></div><div style='float:left;width:150px;line-height:200%'><strong>Lot size</strong>: ~LotSize~<br><strong>Days on Market</strong>: ~DaysOnMkt~ ~StatusOnMkt~<br><strong>Status</strong>: ~StatusDESC~<br>MLS# ~MLSNum~&nbsp;~MLSImg~</div>~Open~</div></td></tr><tr><td></td><td>~StrFavorite~</td></tr></table>";
var templateMLS_Office ="<table class=\"resultSTbl\"><tr><td valign=\"top\"><a href='~StaticURL~'>~HouseImg~</a></td><td valign=\"top\" style=\"font-size:9px;width:205px;\"><a href='~StaticURL~'>~Address~</a><table style=\"width:100%\" border=0 cellpadding=0 cellspacing=0><tr><td>~ZipCode~&nbsp;&nbsp;<a href=\"javascript:TrackGoogleAnalytics('General Map Popup');MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=~IGenKey~','iGenMap',550,650);\"><u>Map</u></a></td><td align=right>$~Price~</td></tr></table>~ValueSpotImg~~Bed~ <strong>Bedrooms</strong> - ~Bath~ <strong>Bathrooms</strong><br>~SQFeet~ <strong>SF</strong><div width='100%'><div style='float:right'><a href='~StaticURL~'><IMG style='margin-bottom:2px' alt='details' src='images/details.gif' border=0></a><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(0,~HotleadParameters~);' alt='view it' src='images/viewit_small.gif'><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(3,~HotleadParameters~);' alt='buy it' src='images/buyit_small.gif'></div><div style='float:left;width:150px;'><strong>Lot size</strong>: ~LotSize~<br><strong>Days on Market</strong>: ~DaysOnMkt~ ~StatusOnMkt~ ~newRowOffice~ ~Office~<br>MLS# ~MLSNum~&nbsp;~MLSImg~</div>~Open~</div></td></tr><tr><td></td><td>~StrFavorite~</td></tr></table>";
var templateMLS_OfficeAgent ="<table class=\"resultSTbl\"><tr><td valign=\"top\"><a href='~StaticURL~'>~HouseImg~</a></td><td valign=\"top\" style=\"font-size:9px;width:205px;\"><a href='~StaticURL~'>~Address~</a><table style=\"width:100%\" border=0 cellpadding=0 cellspacing=0><tr><td>~ZipCode~&nbsp;&nbsp;<a href=\"javascript:TrackGoogleAnalytics('General Map Popup');MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=~IGenKey~','iGenMap',550,650);\"><u>Map</u></a></td><td align=right>$~Price~</td></tr></table>~ValueSpotImg~~Bed~ <strong>Bedrooms</strong> - ~Bath~ <strong>Bathrooms</strong><br>~SQFeet~ <strong>SF</strong><div width='100%'><div style='float:right'><a href='~StaticURL~'><IMG style='margin-bottom:2px' alt='details' src='images/details.gif' border=0></a><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(0,~HotleadParameters~);' alt='view it' src='images/viewit_small.gif'><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(3,~HotleadParameters~);' alt='buy it' src='images/buyit_small.gif'></div><div style='float:left;width:150px;'><strong>Lot size</strong>: ~LotSize~<br><strong>Days on Market</strong>: ~DaysOnMkt~ ~StatusOnMkt~ ~newRowOffice~ ~Office~<br>~Agent~<br>MLS# ~MLSNum~&nbsp;~MLSImg~</div>~Open~</div></td></tr><tr><td></td><td>~StrFavorite~</td></tr></table>";
var templateMLS_NoDOM ="<table class=\"resultSTbl\"><tr><td valign=\"top\"><a href='~StaticURL~'>~HouseImg~</a></td><td valign=\"top\" style=\"font-size:9px;width:205px;\"><a href='~StaticURL~'>~Address~</a><table style=\"width:100%\" border=0 cellpadding=0 cellspacing=0><tr><td>~ZipCode~&nbsp;&nbsp;<a href=\"javascript:TrackGoogleAnalytics('General Map Popup');MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=~IGenKey~','iGenMap',550,650);\"><u>Map</u></a></td><td align=right>$~Price~</td></tr></table>~ValueSpotImg~~Bed~ <strong>Bedrooms</strong> - ~Bath~ <strong>Bathrooms</strong><br>~SQFeet~ <strong>SF</strong><div width='100%'><div style='float:right'><a href='~StaticURL~'><IMG style='margin-bottom:2px' alt='details' src='images/details.gif' border=0></a><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(0,~HotleadParameters~);' alt='view it' src='images/viewit_small.gif'><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(3,~HotleadParameters~);' alt='buy it' src='images/buyit_small.gif'></div><div style='float:left;width:150px;line-height:200%'><strong>Lot size</strong>: ~LotSize~<br>~StatusOnMkt~<br>MLS# ~MLSNum~&nbsp;~MLSImg~</div>~Open~</div></td></tr><tr><td></td><td>~StrFavorite~</td></tr></table>";
var templateMLS_DOMStatusOfficeSF ="<table class=\"resultSTbl\"><tr><td valign=\"top\"><a href='~StaticURL~'>~HouseImg~</a></td><td valign=\"top\" style=\"font-size:9px;width:205px;\"><a href='~StaticURL~'>~Address~</a><table style=\"width:100%\" border=0 cellpadding=0 cellspacing=0><tr><td>~ZipCode~&nbsp;&nbsp;<a href=\"javascript:TrackGoogleAnalytics('General Map Popup');MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=~IGenKey~','iGenMap',550,650);\"><u>Map</u></a></td><td align=right>$~Price~</td></tr></table>~ValueSpotImg~~Bed~ <strong>Bedrooms</strong> - ~Bath~ <strong>Bathrooms</strong><br>~Lotsize_desc~ <strong>SF</strong><div width='100%'><div style='float:right'><a href='~StaticURL~'><IMG style='margin-bottom:2px' alt='details' src='images/details.gif' border=0></a><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(0,~HotleadParameters~);' alt='view it' src='images/viewit_small.gif'><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(3,~HotleadParameters~);' alt='buy it' src='images/buyit_small.gif'></div><div style='float:left;width:150px;line-height:200%'><strong>Lot size</strong>: ~LotSize~<br><strong>Days on Movoto</strong>: ~DaysOnMkt~ ~StatusOnMkt~<br><strong>Status</strong>: ~Status~ ~newRowOffice~ ~Office~<br>MLS# ~MLSNum~&nbsp;~MLSImg~</div>~Open~</div></td></tr><tr><td></td><td>~StrFavorite~</td></tr></table>";
var templateMLS_DaysOnMovoto ="<table class=\"resultSTbl\"><tr><td valign=\"top\"><a href='~StaticURL~'>~HouseImg~</a></td><td valign=\"top\" style=\"font-size:9px;width:205px;\"><a href='~StaticURL~'>~Address~</a><table style=\"width:100%\" border=0 cellpadding=0 cellspacing=0><tr><td>~ZipCode~&nbsp;&nbsp;<a href=\"javascript:TrackGoogleAnalytics('General Map Popup');MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=~IGenKey~','iGenMap',550,650);\"><u>Map</u></a></td><td align=right>$~Price~</td></tr></table>~ValueSpotImg~~Bed~ <strong>Bedrooms</strong> - ~Bath~ <strong>Bathrooms</strong><br>~SQFeet~ <strong>SF</strong><div width='100%'><div style='float:right'><a href='~StaticURL~'><IMG style='margin-bottom:2px' alt='details' src='images/details.gif' border=0></a><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(0,~HotleadParameters~);' alt='view it' src='images/viewit_small.gif'><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(3,~HotleadParameters~);' alt='buy it' src='images/buyit_small.gif'></div><div style='float:left;width:150px;line-height:200%'><strong>Lot size</strong>: ~LotSize~<br><strong>Days on Movoto</strong>: ~DaysOnMkt~ ~StatusOnMkt~<br>MLS# ~MLSNum~&nbsp;~MLSImg~</div>~Open~</div></td></tr><tr><td></td><td>~StrFavorite~</td></tr></table>";
var templateMLS_DOMOffice ="<table class=\"resultSTbl\"><tr><td valign=\"top\"><a href='~StaticURL~'>~HouseImg~</a></td><td valign=\"top\" style=\"font-size:9px;width:205px;\"><a href='~StaticURL~'>~Address~</a><table style=\"width:100%\" border=0 cellpadding=0 cellspacing=0><tr><td>~ZipCode~&nbsp;&nbsp;<a href=\"javascript:TrackGoogleAnalytics('General Map Popup');MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=~IGenKey~','iGenMap',550,650);\"><u>Map</u></a></td><td align=right>$~Price~</td></tr></table>~ValueSpotImg~~Bed~ <strong>Bedrooms</strong> - ~Bath~ <strong>Bathrooms</strong><br>~SQFeet~ <strong>SF</strong><div width='100%'><div style='float:right'><a href='~StaticURL~'><IMG style='margin-bottom:2px' alt='details' src='images/details.gif' border=0></a><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(0,~HotleadParameters~);' alt='view it' src='images/viewit_small.gif'><br><IMG style='margin-bottom:2px' class='cursorPointer' onclick='PopUpLeadPage(3,~HotleadParameters~);' alt='buy it' src='images/buyit_small.gif'></div><div style='float:left;width:150px;'><strong>Lot size</strong>: ~LotSize~<br><strong>Days on Movoto</strong>: ~DaysOnMkt~ ~StatusOnMkt~ ~newRowOffice~ ~OfficeFor431~<br>MLS# ~MLSNum~&nbsp;~MLSImg~</div>~Open~</div></td></tr><tr><td></td><td>~StrFavorite~</td></tr></table>";
switch(MLSDB)
{
case 701:
template = templateNHS;break;
case 801:
template = templateForeclosure;break;
case 102:
template = templateMLS_Office;break;
case 204:
template = templateMLS_OfficeAgent;break;
case 300:
template = templateMLS_NoDOM;break;
case 411:
template = templateMLS_DOMStatusOfficeSF;break;
case 401:
case 402:
case 412:
case 432:
case 433:
case 491:
case 471:
case 571:
template = templateMLS_DaysOnMovoto;break;
case 431:
template = templateMLS_DOMOffice;break;
default:
template = templateMLS;break;
}
return template;
}
function onGetResultsSucceed(res)
{
var listingOffice = "";
var myPage = document.getElementById('myPage');
var myPage0 = document.getElementById('myPage0');
if(	myPage != null && myPage0 != null)
{
myPage.style.display = "";
myPage0.style.display = "";
}
var igen_key = 0;
var type = document.getElementById("curType").value;
var curPageCount=document.getElementById("tbCurPageCount").value;
var str;
var v_logSrc = "";
var v_srchIndex = "";
if( searchType == "basic" )
{
var srchIndex = document.getElementById("srchIdx").value;
v_logSrc = "BasicSearch";
}
else if (searchType == "custom")
{
var srchIndex = document.getElementById("srchIdx").value;
v_logSrc = "CustomSearch";
}
else if(searchType == "schools")
{
v_logSrc = "schools";
}
else
{
v_logSrc = "SavedHomes";
}
switch(type)
{
case "photo":
{
if(res != null && res != null && res.Tables != 0 && res.Tables.length == 1)
{
str = "<table width=\"760\" id=\"dlPhotosView\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;\">";
for(var i=0; i<res.Tables[0].Rows.length; i++)
{
if( i%2 == 0)
str += "<tr><td align=left>";
else
str += "<td align=right>";
var hb = new HouseBox("Fav");
hb.Address		= res.Tables[0].Rows[i].Address;
hb.bathroomText = res.Tables[0].Rows[i].Bath;
hb.bedroomText = res.Tables[0].Rows[i].Bed;
hb.DaysOnMkt = res.Tables[0].Rows[i].DaysOnMkt;
hb.Favorite = res.Tables[0].Rows[i].Favorite ? 1:0;
hb.HouseScore = res.Tables[0].Rows[i].Match;
hb.iGen_Key = res.Tables[0].Rows[i].igen_key;
hb.list_price = res.Tables[0].Rows[i].List_Price;
hb.listingType = res.Tables[0].Rows[i].ListingType;
hb.ln_list_agents_name = res.Tables[0].Rows[i].ln_list_agents_name;
hb.lo_listing_office = res.Tables[0].Rows[i].lo_listing_office;
hb.lot_size = res.Tables[0].Rows[i].Lot;
hb.mls_db = res.Tables[0].Rows[i].mls_db;
hb.mls_num = res.Tables[0].Rows[i].mls_num;
hb.num_photos_dl = res.Tables[0].Rows[i].doesPhotos ? 1:0;
hb.openHouseText = res.Tables[0].Rows[i].Open;
hb.priceChange = res.Tables[0].Rows[i].priceChange;
hb.square_feet = res.Tables[0].Rows[i].sq_feet;
hb.ss_status = res.Tables[0].Rows[i].statusNum;
hb.StaticURL = res.Tables[0].Rows[i].StaticURL;
hb.vs_flag = res.Tables[0].Rows[i].spot ? 1:0;
hb.zipcode = res.Tables[0].Rows[i].city_zip;
hb.cityCode = res.Tables[0].Rows[i].city_code;
var currentBoxHTML = hb.GetHouse();
str += currentBoxHTML;
if( i%2 != 0)
str += "</td></tr>";
else
str += "</td>";
}
str += "</table>";
document.getElementById("displayResults").innerHTML = str;
var divbg = document.getElementById("divbg");
divbg.style.height = document.body.scrollHeight;
}
else
{
document.getElementById("displayResults").innerHTML = "No results found.";
document.getElementById("displayResults").style.textAlign="left";
}
if(searchType == "basic" || searchType == "schools")
{
if(document.getElementById("pageLogKey").value != null)
iGen.WebServices.searchResults.LogPageHit(document.getElementById("pageLogKey").value + "_PHOTO",onLogPageHitSuccessed);
}
else if(searchType == "custom")
{
if(document.getElementById("pageLogKey").value != null)
iGen.WebServices.CustomSearchResults.LogPageHit(document.getElementById("pageLogKey").value + "_PHOTO",onLogPageHitSuccessed);
}
else
iGen.WebServices.favorites.LogPageHit("FAVORITES_PHOTO",onLogPageHitSuccessed);
break;
}
case "list":
{
if(res != null && res != null && res.Tables != 0 && res.Tables.length == 1)
{
str = "<table class=\"resultTable\" cellpadding=4 cellspacing=0 ><Tr style=\"background-color:#f0f0f0\"><Td style=\"width:176px\">Address</Td><td>Map</td><Td>Sq. Ft.</Td><Td>Lot</Td><Td>Stories</Td><Td>Bed</Td><Td>Bath</Td><Td>Pool</Td><Td>Garage</Td><Td>Fireplace</Td><Td>Days On Mkt</Td><Td>Favorite</Td><Td>Open</Td><Td>List Price</Td></Tr>";
for(var i=0; i<res.Tables[0].Rows.length; i++)
{
igen_key = res.Tables[0].Rows[i].igen_key;
var listingType = res.Tables[0].Rows[i].ListingType;
var curIsCheck = "";
if(res.Tables[0].Rows[i].Favorite == true)
curIsCheck = "checked";
var Pool = "&nbsp;";
var Fireplace = "&nbsp;";
if(res.Tables[0].Rows[i].Pool)
Pool = "<img src='images/Pool.gif'>";	
if(res.Tables[0].Rows[i].Fireplace)
Fireplace = "<img src='images/Fireplace.gif'>";	
str += "<tr><td><a href=\"" + res.Tables[0].Rows[i].StaticURL + "\">" + res.Tables[0].Rows[i].Address + "</a>";
str += "</td><td align=center><img align=\"top\" title=\"Click to view map\" class='cursorPointer' src=\"images/newpropertysearch/MapIcon.gif\" border=0 onclick=\"javascript:MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=" + igen_key + "','iGenMap',550,650);\" /></td>";
str += "<td>" + res.Tables[0].Rows[i].sq_feet + "</td><td>" + res.Tables[0].Rows[i].Lot + "</td><td>" + res.Tables[0].Rows[i].Stories + "</td><td>" + res.Tables[0].Rows[i].Bed + "</td><td>" + res.Tables[0].Rows[i].Bath + "</td>";
str += "<td align=center>" + Pool + "</td><td>" + res.Tables[0].Rows[i].Garage + "</td><td align=center>" + Fireplace + "</td><td>";
var mlsDb = res.Tables[0].Rows[i].mls_db;
if(listingType == 0)
{
if(mlsDb != "300")
{
if( searchType == "favorite" && res.Tables[0].Rows[i].statusNum != null && parseInt(res.Tables[0].Rows[i].statusNum) > 4 && res.Tables[0].Rows[i].status != null )
str += "<font color=red>" + res.Tables[0].Rows[i].status + "</font>";
else
str += res.Tables[0].Rows[i].DaysOnMkt;
}
else
{
if( searchType == "favorite" && res.Tables[0].Rows[i].statusNum != null && parseInt(res.Tables[0].Rows[i].statusNum) > 4 && res.Tables[0].Rows[i].status != null )
str += "<font color=red>" + res.Tables[0].Rows[i].status + "</font>";
}
}
str += "</td><td><input id=\"check_" + igen_key + "\" type=\"checkbox\" "+curIsCheck+" onclick=\"UpdateSavedHouse('check_"+igen_key+"')\"></td>";
str += "<td>" + res.Tables[0].Rows[i].Open + "</td><td>";
var extraFlag = GetExtraFlag(res.Tables[0].Rows[i].List_Price.flap_display);
if(res.Tables[0].Rows[i].Spot == true)
{
str += "<a class='cursorPointer' onmouseover=\"showInd('VSP_"+ igen_key +"')\" onmouseout=\"HiddenInd('VSP_"+ igen_key +"')\"><img src='images/icon_dollar_sign.gif' border=0></a><span id=\"VSP_"+ igen_key +"\"></span>";
}
str += "$" + res.Tables[0].Rows[i].List_Price;
if(listingType == 0)
{
var img = GetMLSLogosByMlsDb( eval(res.Tables[0].Rows[i].mls_db) );	
str += "<br>" + img;
}
str += "</td></tr>";	
}
str += "</table>";
document.getElementById("displayResults").innerHTML = str.replace(/<td><\/td>/g,"<td>&nbsp;</td>");
}
else
{
document.getElementById("displayResults").innerHTML = "No results found.";
document.getElementById("displayResults").style.textAlign="left";
}
if(searchType == "basic" || searchType == "schools")
{
if(document.getElementById("pageLogKey").value != null)
iGen.WebServices.searchResults.LogPageHit(document.getElementById("pageLogKey").value + "_LIST",onLogPageHitSuccessed);
}
else if(searchType == "custom")
{
if(document.getElementById("pageLogKey").value != null)
iGen.WebServices.CustomSearchResults.LogPageHit(document.getElementById("pageLogKey").value + "_LIST",onLogPageHitSuccessed);
}
else
iGen.WebServices.favorites.LogPageHit("FAVORITES_LIST",onLogPageHitSuccessed);
break;
}
case "map":
{
var eleSearchID = document.getElementById("tbSearchID");
var eleCLatLng = document.getElementById("PS_CLatLng_Zoom");
if(v_logSrc == "BasicSearch" && eleSearchID != null && eleSearchID.value !="" && eleCLatLng != null && eleCLatLng.value != "")	
{	
if(	myPage != null && myPage0 != null)
{
myPage.style.display = "none";
myPage0.style.display = "none";
}
str = "<table width=100%><td><table style=\"float:left; margin:0\" class=\"subbox\"><td valign=top>";
str += "<DIV id=\"map\" style=\"WIDTH: 780px; HEIGHT: 475px\">Loading image data ..</DIV>";
str += "</td></table></td></table>";
document.getElementById("displayResults").innerHTML = str;
gmapContn = null;
gisSelfMap = true;
gISMapSearch = false;	
if(eleSearchID!=null||eleCLatLng!=null)
{	
GetMapForSearchResult(eleSearchID.value,eleCLatLng.value.split(","));
}
break;
}
if(res != null && res != null && res.Tables != 0 && res.Tables.length == 1)
{	
str = "<DIV id=\"map\" style=\"WIDTH: 763px; HEIGHT: 475px\">Loading image data ..</DIV>";
document.getElementById("displayResults").innerHTML = str;
GetMapURL(res);//Added by Joe Aug 23,2005	
}
else
{
document.getElementById("displayResults").innerHTML = "No results found.";
document.getElementById("displayResults").style.textAlign="left";
}
if(searchType == "basic" || searchType == "schools")
{
if(document.getElementById("pageLogKey").value != null)
iGen.WebServices.searchResults.LogPageHit(document.getElementById("pageLogKey").value + "_MAP",onLogPageHitSuccessed);
}
else if(searchType == "custom")
{
if(document.getElementById("pageLogKey").value != null)
iGen.WebServices.CustomSearchResults.LogPageHit(document.getElementById("pageLogKey").value + "_MAP",onLogPageHitSuccessed);
}
else
iGen.WebServices.favorites.LogPageHit("FAVORITES_MAP",onLogPageHitSuccessed);
break;
}
default:
{
document.getElementById("displayResults").innerHTML = "";
break;
}
}
GetType();//It's for IE to get type display when user press "back" button, can't be removed.
if(searchType == "basic")
{
var pageNum = document.getElementById("tbCurPageCount").value;
if(Rresults[pageNum] == null)
{
Rresults[pageNum] = res;
GetMapURL(res,true);
}
}
var myPage = document.getElementById('myPage');
var tbRecNum=document.getElementById("tbRecNum");
var myPage0 = document.getElementById('myPage0');
var tbRecNum0=document.getElementById("tbRecNum0");
myPage.innerHTML =myPage0.innerHTML;
tbRecNum.innerHTML=tbRecNum0.innerHTML;
ShowMLSLogos();
}
function onLogPageHitSuccessed()
{
}
function UpdateSavedHouse(checkboxName)
{
var condition = false;
var condition_true = false;
if( searchType == "favorite" )
{
iGen.WebServices.favorites.CheckAndTryAutoLogin(onCheckLoginSucceed,null,{"ckbName":checkboxName});
}
else
{
iGen.WebServices.Common.CheckUserIsLoggedIn(onUpdateSavedHouseSucceeded,null,{"checkboxName":checkboxName});
}
}
function onCheckLoginSucceed(res,userContext,methodName)
{
var checkboxName = userContext.ckbName;
var condition = (res==null || res == "") ;
var condition_true = ( res == true );
SetSavedHouse(condition,condition_true,checkboxName);
}
function onUpdateSavedHouseSucceeded(result,userContext)
{
condition = !result;
SetSavedHouse(condition,false,userContext.checkboxName);
}
function SetSavedHouse(condition,condition_true,checkboxName)
{	
if( condition == true )
{
if( searchType == "favorite" )
{
window.location.href = GetHomePageLink(true);
}
else
{
checkLoginPop('favorites','favorites');
document.getElementById(checkboxName).checked = false;
}
}
else
{
var curPage = 0;
var tbCurPageCount = document.getElementById("tbCurPageCount");
if(tbCurPageCount!=null)
curPage = tbCurPageCount.value;
if( (searchType == "favorite" && condition_true == true)
|| (searchType != "favorite") )
{
var flag = "";
var igen_key = "";
igen_key = checkboxName.substring(6,checkboxName.length);
var myCheckBox = document.getElementById(checkboxName);
if( searchType != "comps" )
var fv=document.getElementById("fv_"+igen_key);
if(myCheckBox.checked == true)
{	
flag = "A";
if( fv != null)
fv.innerHTML="<img src='images/favorite.gif'>";
}
else
{	
flag = "D";
if( fv != null)
fv.innerHTML="<img src='images/favorite_2.gif'>";
}
switch ( searchType)
{
case "favorite":
iGen.WebServices.favorites.HandleSavedHouse(igen_key,flag,onHandleSavedHouseSuccessed);
break;
case "basic":
iGen.WebServices.searchResults.HandleSavedHouse(igen_key,flag,onHandleSavedHouseSuccessed);
isChange[curPage] = true;
break;
case "schools":
iGen.WebServices.searchResults.HandleSavedHouse(igen_key,flag,onHandleSavedHouseSuccessed);
isChange[curPage] = true;
break;
case "custom":	
iGen.WebServices.CustomSearchResults.HandleSavedHouse(igen_key,flag,onHandleSavedHouseSuccessed);
break;
default:
break;
}
}
else if(searchType == "favorite" && condition_true == false)
{
window.location.href = GetHomePageLink(true);
}
}
}
function onHandleSavedHouseSuccessed(result,userContext,methodName)
{
}
function UpdateSavedHouseSubject(igen_key)
{
iGen.WebServices.Common.CheckUserIsLoggedIn(onUpdateSavedHouseSubjectSucceeded,null,{"igen_key":igen_key});
}	
function onUpdateSavedHouseSubjectSucceeded(result,userContext)
{
if(!result)
{
checkLoginPop('Register','save');
}
else
{
var flag = "";
var myCheckBox = document.getElementById("checkFavMLS");
var fv = document.getElementById("imgFavMLS");
if(myCheckBox.checked == true)
{
flag = "A";
fv.innerHTML="<img src='images/favorite.gif'>";
}
else
{
flag = "D";
fv.innerHTML="<img src='images/favorite_2.gif'>";
}
iGen.WebServices.CompsResults.HandleSavedHouse(userContext.igen_key,flag);
}
}
function SaveSearch()
{
iGen.WebServices.Common.CheckUserIsLoggedIn(onSaveSearchSucceeded);
}
function onSaveSearchSucceeded(result)
{
if(!result)
{
checkLoginPop('Register','save');
}
else
{
var chbxSaveAs=document.getElementById("chbxSaveAs");
var tbSaveAs=document.getElementById("tbxSaveAs");
var tbSearchID=document.getElementById("tbSearchID");
var EmailUpdates=document.getElementById("ddlEmailUpdates");
var emailCheck=document.getElementById("chbxEmailUpdates");
if(emailCheck.checked)
{
var mC=1;
}
else
{
var mC=0;
}
if(tbSaveAs.value && chbxSaveAs.checked)
{
if(searchType == "basic")
{
iGen.WebServices.searchResults.SaveSearch(tbSearchID.value,tbSaveAs.value,EmailUpdates.options[EmailUpdates.selectedIndex].value,mC,onSaveSearchSuccessed);
}
else if(searchType == "custom")
CustomSearchResults.SaveSearch(tbSearchID.value,tbSaveAs.value,EmailUpdates.options[EmailUpdates.selectedIndex].value,mC,callback_SaveSearch);
}
}
}
function DisplayPaging()
{
var res = "";
res = document.getElementById("tbPageCount")
var tbCurPageCount = document.getElementById("tbCurPageCount");
getPage(eval(tbCurPageCount.value), res.value);
if(eval(tbCurPageCount.value) != 1)
LoadLeaderboardAds();
}
function getRecCount()
{
var res = "";
res = document.getElementById("tbCount");
var tbRecNum=document.getElementById("tbRecNum");
var tbRecNum0=document.getElementById("tbRecNum0");
if(eval(res.value)!=0)
{
tbRecNum0.innerHTML=" ["+res.value+" Results]";
}
}
function GetResults(pageNum)
{
if(searchType == "basic" && document.getElementById("curType").value == 'map' && document.getElementById("map") != null)	
{	
var eleCLatLng = document.getElementById("PS_CLatLng_Zoom");
if(eleCLatLng!=null && eleCLatLng.value != "")	
return;
}
var myPage = document.getElementById('myPage');
var tbRecNum = document.getElementById("tbRecNum");
var pageSessionKey = document.getElementById("pageSessionKey").value;
myPage.innerHTML ="";
tbRecNum.innerHTML="";
document.getElementById("displayResults").innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;Loading ...";
if(pageSessionKey == "NewHomeCommunity")
gListingTypeForMap = 1;
switch(searchType)
{
case "basic":	
case "schools":
iGen.WebServices.Common.CheckUserIsLoggedIn(onGetResultsSucceeded,null,{"pageNum":pageNum});
break;
case "favorite":
iGen.WebServices.favorites.ListHouse(pageNum,1,pageSessionKey,onGetResultsSucceed);
break;
case "comps":	
iGen.WebServices.CompsResults.ListHouse(pageNum,1,pageSessionKey,onGetResultsForCompsSucceed);
break;
default:
break;
}
}
function onGetResultsSucceeded(result,userContext)
{
var UserIsLoggedIn = result;
if(UserIsLoggedIn && userLogged[userContext.pageNum] == false)
{	
Rresults[userContext.pageNum] = null;
}
if(Rresults[userContext.pageNum] != null)
{
if(isChange[userContext.pageNum] == true && document.getElementById("curType").value !="map")
Rresults[userContext.pageNum] = null;
}	
if(Rresults[userContext.pageNum] == null)
{	
iGen.WebServices.searchResults.ListHouse(userContext.pageNum,1,pageSessionKey,onGetResultsSucceed);
isChange[userContext.pageNum] = false;
if(UserIsLoggedIn)
{
userLogged[userContext.pageNum] = true;
}
else
{
userLogged[userContext.pageNum] = false;
}
}
else
{	
onGetResultsSucceed(Rresults[userContext.pageNum]);
}
}
function callback_GetMapURL(res)
{
document.getElementById("curMapURL").innerHTML = "<img src=\"" + res.value + "\">";
}	
function moveToCenter( divName )
{
var uAgent = window.navigator.userAgent;
var mydiv = document.getElementById( divName );
mydiv.style.display = 'block';
if(uAgent.indexOf("Firefox") != -1 || uAgent.indexOf("Netscape") != -1 || uAgent.indexOf("Safari") != -1)
{
mydiv.style.left = document.body.scrollLeft+(document.body.clientWidth-mydiv.offsetWidth)/2 +'px';
if(uAgent.indexOf("Safari") != -1)
mydiv.style.top = document.body.scrollTop+(innerHeight-mydiv.offsetHeight)/2 +'px';
else
mydiv.style.top = document.body.scrollTop+(document.body.clientHeight-mydiv.offsetHeight)/2 +'px';
}
else
{
window.document.getElementById( divName ).style.posTop
= document.body.scrollTop+(document.body.clientHeight - document.getElementById( divName ).offsetHeight)/2;
window.document.getElementById( divName ).style.posLeft
= document.body.scrollLeft+(document.body.clientWidth - document.getElementById( divName ).offsetWidth)/2;
}
var top =mydiv.style.top.replace('px','');
if(top < 0)
mydiv.style.top = '0px';
}
function SearchSubAreaProperty(cityCodeAndSubareaCode)
{
var ajaxUrlHeader = GetRelativePath2();
iGen.WebServices.Sitemap.SetPreSelectSession(cityCodeAndSubareaCode);
window.location.href = ajaxUrlHeader+"propertysearch.aspx?PreSelectSubArea=true";
}
function doMapSearchInSitemapCityInfoPage()
{
var rblListingType = document.getElementById("rblListingType");
var ckbSingleFamilyHouse = document.getElementById("ckbSingleFamilyHouse");
var ckbCondoOrTownhouse = document.getElementById("ckbCondoOrTownhouse");
var rblBedrooms = document.getElementById("rblBedrooms");
var rblBathrooms = document.getElementById("rblBathrooms");
var tbxPrice1 = document.getElementById("tbxPrice1").value;
var tbxPrice2 = document.getElementById("tbxPrice2").value;
var saveSearch = document.getElementById("saveSearch");
var iCityCode = document.getElementById("iCityCode").value;
var iCityName = document.getElementById("iCityName").value;
var iMetroAreaCode = document.getElementById("iMetroAreaCode").value;
var rblListingType_0 = document.getElementById("rblListingType_0");
var rblListingType_1 = document.getElementById("rblListingType_1");
var rblBedrooms_0 = document.getElementById("rblBedrooms_0");
var rblBedrooms_1 = document.getElementById("rblBedrooms_1");
var rblBedrooms_2 = document.getElementById("rblBedrooms_2");
var rblBedrooms_3 = document.getElementById("rblBedrooms_3");
var rblBedrooms_4 = document.getElementById("rblBedrooms_4");
var rblBedrooms_5 = document.getElementById("rblBedrooms_5");
var rblBathrooms_0 = document.getElementById("rblBathrooms_0");
var rblBathrooms_1 = document.getElementById("rblBathrooms_1");
var rblBathrooms_2 = document.getElementById("rblBathrooms_2");
var rblBathrooms_3 = document.getElementById("rblBathrooms_3");
var rblBathrooms_4 = document.getElementById("rblBathrooms_4");
var rblBathrooms_5 = document.getElementById("rblBathrooms_5");
var rblBathrooms_6 = document.getElementById("rblBathrooms_6");
var iPropertyType = 12;
if(ckbSingleFamilyHouse.checked && !ckbCondoOrTownhouse.checked)
iPropertyType = 1;
if(ckbCondoOrTownhouse.checked && !ckbSingleFamilyHouse.checked)
iPropertyType = 2;
var listingType = 0;
if(rblListingType_0.checked)
listingType = 0;
else if(rblListingType_1.checked)
listingType = 1;
var bedrooms = 0;
if(rblBedrooms_0.checked)
bedrooms = 0;
else if(rblBedrooms_1.checked)
bedrooms = 1;
else if(rblBedrooms_2.checked)
bedrooms = 2;
else if(rblBedrooms_3.checked)
bedrooms = 3;
else if(rblBedrooms_4.checked)
bedrooms = 4;
else if(rblBedrooms_5.checked)
bedrooms = 5;
var bathrooms = 0;
if(rblBathrooms_0.checked)
bathrooms = 1;
else if(rblBathrooms_1.checked)
bathrooms = 5;
else if(rblBathrooms_2.checked)
bathrooms = 2;
else if(rblBathrooms_3.checked)
bathrooms = 6;
else if(rblBathrooms_4.checked)
bathrooms = 3;
else if(rblBathrooms_5.checked)
bathrooms = 7;
else if(rblBathrooms_6.checked)
bathrooms = 4;
var isDone = false;
var price1 = 0;
var price2 = 0;
if(ForValidatePriceValue(tbxPrice1))
{
price1 = tbxPrice1;
isDone = true;
if(ForValidatePriceValue(tbxPrice2))
{
price2 = tbxPrice2;
}
else
{
isDone = false;
alert("Please put in correct price.");
}
}
else
alert("Please put in correct price.");
if(isDone)
{
var condition = GetCondition(iCityCode, iPropertyType, bedrooms, bathrooms, price1, price2, iMetroAreaCode, listingType);
var searchName = GetSearchName(iCityName, bedrooms, bathrooms, price1, price2);
var mapSearchCondition = getMapSearchConditionExpression(iCityName, iPropertyType, bedrooms, 5, bathrooms, 4, price1, price2, listingType);
var searchName = '';
var emailupdateType = '2';
var searchID = null;
var isAutoSave = false;
if(saveSearch.checked)
{
if(checkUserIsLoggedIn('css'))
iGen.WebServices.Common.SaveMapSearch(iMetroAreaCode, mapSearchCondition, searchName, emailupdateType, searchID, isAutoSave, onSaveMapSearchSucceed);
else
ListingUpdates(iCityCode,true,listingType,iPropertyType,bedrooms,bathrooms,price1,price2);
TrackGoogleAnalytics('Site Map City Info - Daily Listing Updates');
}
else
{
isAutoSave = true;
iGen.WebServices.Common.SaveMapSearch(iMetroAreaCode, mapSearchCondition, searchName, emailupdateType, searchID, isAutoSave, onSearchSucceed);
}
}
}
function onSaveMapSearchSucceed(res)
{
if(res != null && res != "")
{
alert("Your search is saved, and you will receive periodic property updates.");
LoadAllSavedSearch();
OpensrPage(res);
}
else
alert("Save failed.");
}
function onSearchSucceed(res)
{
if(res != null && res != "")
OpensrPage(res);
}
function GetCondition(selectcity, iPropertyType, bedrooms, bathrooms, price1, price2, iMetroAreaCode, listingType)
{
var Condition = "";
var arrCondition = new Array();
arrCondition.push("'" + selectcity + "'");
arrCondition.push("");
arrCondition.push(iPropertyType);
arrCondition.push(bedrooms);
arrCondition.push(bathrooms);
arrCondition.push(price1);
arrCondition.push(price2);
arrCondition.push(false);
arrCondition.push(iMetroAreaCode);
arrCondition.push("basic");
arrCondition.push(listingType);
Condition = arrCondition.join('|');
return Condition;
}
function GetSearchName(selectcity, bedrooms, bathrooms, price1, price2)
{
var BATHROOM = bathrooms;
var BEDROOM = bedrooms;
var SearchName = "";
var txtBATHROOM = BATHROOM;
if(eval(txtBATHROOM) > 4)
txtBATHROOM = eval(txtBATHROOM) - 3.5;
if(txtBATHROOM == "4")
txtBATHROOM = "4+";
SearchName = selectcity + ", "+BEDROOM+"+Bed, "+txtBATHROOM+"+Bath";
if( price1 != "" || price2 != "")
{
SearchName += ", "+price1+"-"+price2;
}
return SearchName;
}
function OpensrPage(searid)
{
if(searid != null && searid != "")
{
var url = GetRelativePath2() + "mapsearch.aspx?searchid=" + searid + "&logSearch=mapsearch&cache=left";
window.location.href = url;
}	
}
function OpensrPageOnListingUpdates(searid)
{
if(searid != null && searid != "")
{
var url = parent.GetRelativePath2() + "mapsearch.aspx?searchid=" + searid + "&logSearch=mapsearch&cache=left";
window.parent.setTimeout("window.parent.location.href = '" + url + "';",1000);
}	
}
var SearchSortItems = {ListPrice: "list_price", DaysOnMarket:"list_date", Bedroom: "bedroom", Bathroom: "bathroom",
GaragesNum: "num_garage", StoriesNum: "num_stories",LotSize:"lot_size", SquareFeet: "square_feet", Pool: "pool", Fireplace: "fireplace"};
var SortOrders = {Ascending: "ASC", Descending: "DESC"};
var SearchSortTypes = {SearchSortItem: SearchSortItems.ListPrice, SortOrder: SortOrders.Ascending};
function SearchResultsUiParameterList()
{
SelectParameterList.call(this);
this.isFirstTimeUpdate = true;
}
if(typeof(SelectParameterList) == 'function')
{
SearchResultsUiParameterList.prototype = new SelectParameterList();
SearchResultsUiParameterList.prototype.Update = function()
{
if(this.isFirstTimeUpdate == true)
{
var searchParameterXMLString = document.getElementById("searchParameterXMLString");
if(searchParameterXMLString && searchParameterXMLString.value != "")
{
var parseSearchParamXmlItems = new ParseSearchParamXmlItems(searchParameterXMLString.value);
this.PropertyParameters = new Array();
this.UserParameters = new Array();

this.UserParameters["userID"] = new StringParameter(parseSearchParamXmlItems.getValue("userID"),"userID");
this.UserID=this.UserParameters["userID"].GetValue();	
var searchId = document.getElementById("tbSearchID");
this.UserParameters["searchId"] = new StringParameter(searchId.value,"searchId");
this.searchId=this.UserParameters["searchId"].GetValue();
this.PropertyParameters["citySubAreaZipcodeString"] = new StringParameter(parseSearchParamXmlItems.getValue("citySubAreaZipcodeString"),"citySubAreaZipcodeString");
this.CitySubAreaZipcodeString=this.PropertyParameters["citySubAreaZipcodeString"].GetValue();
this.PropertyParameters["listingType"] = new StringParameter(parseSearchParamXmlItems.getValue("rdblListingType"),"listingType");
this.ListingType=this.PropertyParameters["listingType"].GetValue();
this.PropertyParameters["propertyType"] = new StringParameter(parseSearchParamXmlItems.getValue("propertyType"),"propertyType");
this.PropertyType=this.PropertyParameters["propertyType"].GetValue();
this.PropertyParameters["minBedrooms"] = new StringParameter(parseSearchParamXmlItems.getValue("minBedrooms"),"minBedrooms");
this.MinBedrooms=this.PropertyParameters["minBedrooms"].GetValue();
this.PropertyParameters["minBathrooms"] = new StringParameter(parseSearchParamXmlItems.getValue("minBathrooms"),"minBathrooms");
this.MinBathrooms=this.PropertyParameters["minBathrooms"].GetValue();
this.PropertyParameters["minPrice"] = new StringParameter(parseSearchParamXmlItems.getValue("minPrice"),"minPrice");
this.MinPrice=this.PropertyParameters["minPrice"].GetValue();
this.PropertyParameters["maxPrice"] = new StringParameter(parseSearchParamXmlItems.getValue("maxPrice"),"maxPrice");
this.MaxPrice=this.PropertyParameters["maxPrice"].GetValue();
this.UserParameters["isAutoSaveSearch"] = new StringParameter(parseSearchParamXmlItems.getValue("isAutoSaveSearch"),"isAutoSaveSearch");
this.IsAutoSaveSearch=this.UserParameters["isAutoSaveSearch"].GetValue();
this.UserParameters["searchName"] = new StringParameter(parseSearchParamXmlItems.getValue("searchName"),"searchName");
this.SearchName=this.UserParameters["searchName"].GetValue();
this.UserParameters["isEmailUpdates"] = new StringParameter(parseSearchParamXmlItems.getValue("isEmailUpdates"),"isEmailUpdates");
this.IsEmailUpdates=this.UserParameters["isEmailUpdates"].GetValue();
this.UserParameters["emailUpdatesFrequency"] = new StringParameter(parseSearchParamXmlItems.getValue("emailUpdatesFrequency"),"emailUpdatesFrequency");
this.EmailUpdatesFrequency=this.UserParameters["emailUpdatesFrequency"].GetValue();


this.PropertyParameters["minSquareFeet"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("minSquareFeet"),"minSquareFeet",parseSearchParamXmlItems.getMustOrNiceHaveValue("minSquareFeet"));
this.MinSquareFeet=this.PropertyParameters["minSquareFeet"].GetValue();
this.PropertyParameters["minLotSize"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("minLotSize"),"minLotSize",parseSearchParamXmlItems.getMustOrNiceHaveValue("minLotSize"));
this.MinLotSize=this.PropertyParameters["minLotSize"].GetValue();
this.PropertyParameters["numberOfStories"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("numberOfStories"),"numberOfStories",parseSearchParamXmlItems.getMustOrNiceHaveValue("numberOfStories"));
this.NumberOfStories=this.PropertyParameters["numberOfStories"].GetValue();
this.PropertyParameters["minDaysOnMarket"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("minDaysOnMarket"),"minDaysOnMarket",parseSearchParamXmlItems.getMustOrNiceHaveValue("minDaysOnMarket"));
this.MinDaysOnMarket=this.PropertyParameters["minDaysOnMarket"].GetValue();
this.PropertyParameters["maxDaysOnMarket"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("maxDaysOnMarket"),"maxDaysOnMarket",parseSearchParamXmlItems.getMustOrNiceHaveValue("maxDaysOnMarket"));
this.MaxDaysOnMarket=this.PropertyParameters["maxDaysOnMarket"].GetValue();
this.PropertyParameters["minYearBuilt"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("minYearBuilt"),"minYearBuilt",parseSearchParamXmlItems.getMustOrNiceHaveValue("minYearBuilt"));
this.MinYearBuilt=this.PropertyParameters["minYearBuilt"].GetValue();
this.PropertyParameters["maxYearBuilt"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("maxYearBuilt"),"maxYearBuilt",parseSearchParamXmlItems.getMustOrNiceHaveValue("maxYearBuilt"));
this.MaxYearBuilt=this.PropertyParameters["maxYearBuilt"].GetValue();
this.PropertyParameters["elementaryDistrict"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("elementaryDistrict"),"elementaryDistrict",parseSearchParamXmlItems.getMustOrNiceHaveValue("elementaryDistrict"));
this.ElementaryDistrict=this.PropertyParameters["elementaryDistrict"].GetValue();
this.PropertyParameters["highSchoolDistrict"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("highSchoolDistrict"),"highSchoolDistrict",parseSearchParamXmlItems.getMustOrNiceHaveValue("highSchoolDistrict"));
this.HighSchoolDistrict=this.PropertyParameters["highSchoolDistrict"].GetValue();
this.PropertyParameters["garage"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("garage"),"garage",parseSearchParamXmlItems.getMustOrNiceHaveValue("garage"));
this.Garage=this.PropertyParameters["garage"].GetValue();
this.PropertyParameters["hasPhotos"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("hasPhotos"),"hasPhotos",parseSearchParamXmlItems.getMustOrNiceHaveValue("hasPhotos"));
this.HasPhotos=this.PropertyParameters["hasPhotos"].GetValue();
this.PropertyParameters["separateFamilyRoom"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("separateFamilyRoom"),"separateFamilyRoom",parseSearchParamXmlItems.getMustOrNiceHaveValue("separateFamilyRoom"));
this.SeparateFamilyRoom=this.PropertyParameters["separateFamilyRoom"].GetValue();
this.PropertyParameters["formalDiningRoom"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("formalDiningRoom"),"formalDiningRoom",parseSearchParamXmlItems.getMustOrNiceHaveValue("formalDiningRoom"));
this.FormalDiningRoom=this.PropertyParameters["formalDiningRoom"].GetValue();
this.PropertyParameters["library"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("library"),"library",parseSearchParamXmlItems.getMustOrNiceHaveValue("library"));
this.Library=this.PropertyParameters["library"].GetValue();
this.PropertyParameters["denOrStudy"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("denOrStudy"),"denOrStudy",parseSearchParamXmlItems.getMustOrNiceHaveValue("denOrStudy"));
this.DenOrStudy=this.PropertyParameters["denOrStudy"].GetValue();
this.PropertyParameters["fullBasement"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("fullBasement"),"fullBasement",parseSearchParamXmlItems.getMustOrNiceHaveValue("fullBasement"));
this.FullBasement=this.PropertyParameters["fullBasement"].GetValue();
this.PropertyParameters["separateLivingUnit"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("separateLivingUnit"),"separateLivingUnit",parseSearchParamXmlItems.getMustOrNiceHaveValue("separateLivingUnit"));
this.SeparateLivingUnit=this.PropertyParameters["separateLivingUnit"].GetValue();
this.PropertyParameters["cabin"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("cabin"),"cabin",parseSearchParamXmlItems.getMustOrNiceHaveValue("cabin"));
this.Cabin=this.PropertyParameters["cabin"].GetValue();
this.PropertyParameters["capeCod"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("capeCod"),"capeCod",parseSearchParamXmlItems.getMustOrNiceHaveValue("capeCod"));
this.CapeCod=this.PropertyParameters["capeCod"].GetValue();
this.PropertyParameters["colonial"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("colonial"),"colonial",parseSearchParamXmlItems.getMustOrNiceHaveValue("colonial"));
this.Colonial=this.PropertyParameters["colonial"].GetValue();
this.PropertyParameters["contemporary"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("contemporary"),"contemporary",parseSearchParamXmlItems.getMustOrNiceHaveValue("contemporary"));
this.Contemporary=this.PropertyParameters["contemporary"].GetValue();
this.PropertyParameters["cottageOrBungalow"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("cottageOrBungalow"),"cottageOrBungalow",parseSearchParamXmlItems.getMustOrNiceHaveValue("cottageOrBungalow"));
this.CottageOrBungalow=this.PropertyParameters["cottageOrBungalow"].GetValue();
this.PropertyParameters["ranch"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("ranch"),"ranch",parseSearchParamXmlItems.getMustOrNiceHaveValue("ranch"));
this.Ranch=this.PropertyParameters["ranch"].GetValue();
this.PropertyParameters["spanish"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("spanish"),"spanish",parseSearchParamXmlItems.getMustOrNiceHaveValue("spanish"));
this.Spanish=this.PropertyParameters["spanish"].GetValue();
this.PropertyParameters["traditional"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("traditional"),"traditional",parseSearchParamXmlItems.getMustOrNiceHaveValue("traditional"));
this.Traditional=this.PropertyParameters["traditional"].GetValue();
this.PropertyParameters["tudor"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("tudor"),"tudor",parseSearchParamXmlItems.getMustOrNiceHaveValue("tudor"));
this.Tudor=this.PropertyParameters["tudor"].GetValue();
this.PropertyParameters["victorian"] = new StringParameterWithMustOrNiceToHave(parseSearchParamXmlItems.getValue("victorian"),"victorian",parseSearchParamXmlItems.getMustOrNiceHaveValue("victorian"));
this.Victorian=this.PropertyParameters["victorian"].GetValue();
}
this.isFirstTimeUpdate = false;
}
else
{
this.PropertyParameters["listingType"] = new DropDownListParameter("listListingTypes","listingType",null,true);
this.ListingType=this.PropertyParameters["listingType"].GetValue();
this.PropertyParameters["minBedrooms"] = new DropDownListParameter("listMinBeds","minBedrooms",null,false);
this.MinBedrooms=this.PropertyParameters["minBedrooms"].GetValue();
this.PropertyParameters["minBathrooms"] = new DropDownListParameter("listMinBaths","minBathrooms",null,true);
this.MinBathrooms=this.PropertyParameters["minBathrooms"].GetValue();
var selectedMaxPrice = document.getElementById("listMaxPrice").options[document.getElementById("listMaxPrice").selectedIndex].value;
if(selectedMaxPrice == "0")
{
selectedMaxPrice = EmptyString.Value;
}
this.PropertyParameters["maxPrice"] = new StringParameter(selectedMaxPrice,"maxPrice");
this.MaxPrice=this.PropertyParameters["maxPrice"].GetValue();
if(this.SortType == null)
{
this.SortType = SearchSortTypes;
}
var sortExpression = this.SortType.SearchSortItem + " " + this.SortType.SortOrder;
this.PropertyParameters["sortString"] = new StringParameter(sortExpression,"sortString");
this.SortString=this.PropertyParameters["sortString"].GetValue();
var statusDESC = GetStatusDESCSelected();
this.PropertyParameters["statusDESC"] = new StringParameter(statusDESC,"statusDESC");
}
}
}
function GetStatusDESCSelected()
{
var lt = document.getElementById("listListingTypes");
if(lt.options[lt.selectedIndex].value != "2")
return "";
var values = new Array();
PushCheckedValue("ckbNoticeOfDefault",values);
PushCheckedValue("ckbLisPerdens",values);
PushCheckedValue("ckbNoticeOfTrustee",values);
PushCheckedValue("ckbNoticeOfForeclosure",values);
PushCheckedValue("ckbRealEstateOwned",values);
return values.join(",");
}
function PushCheckedValue(checkBoxID,objArray)
{
var ckb = document.getElementById(checkBoxID);
if(ckb != null && ckb.checked)
return objArray.push(ckb.value);
}
function ParseSearchParamXmlItems(searchParamXml)
{
this.arrParamList = new Array();
if(searchParamXml != null && searchParamXml != "")
{
var parsedSearchParamXml = parseXmlContent(searchParamXml);
var arrXmlTags = parsedSearchParamXml.getElementsByTagName("p");
for(var i = 0; i < arrXmlTags.length; i ++)
{
var paramItem = {Key: EmptyString.Value, Value: EmptyString.Value, MustOrNiceHaveValue: EmptyString.Value};
if(arrXmlTags[i].attributes.getNamedItem("k") == null)
{
continue;
}
else
{
paramItem.Key = arrXmlTags[i].attributes.getNamedItem("k").value;
if(arrXmlTags[i].attributes.getNamedItem("v"))
{
paramItem.Value = arrXmlTags[i].attributes.getNamedItem("v").value;
if(paramItem.Value == null)
{
paramItem.Value = EmptyString.Value;
}
}
if(arrXmlTags[i].attributes.getNamedItem("mhv"))
{
paramItem.MustOrNiceHaveValue = arrXmlTags[i].attributes.getNamedItem("mhv").value;
if(paramItem.MustOrNiceHaveValue == null)
{
paramItem.MustOrNiceHaveValue = EmptyString.Value;
}
}
this.arrParamList.push(paramItem);
}
}
}
ParseSearchParamXmlItems.prototype.getValue = function(key)
{
for(var i = 0; i < this.arrParamList.length; i ++)
{
if(this.arrParamList[i].Key == key)
{
return this.arrParamList[i].Value;
}
}
return EmptyString.Value;
}
ParseSearchParamXmlItems.prototype.getValueByIndex = function(keyIndex)
{
return this.arrParamList[keyIndex].Value;
}
ParseSearchParamXmlItems.prototype.getMustOrNiceHaveValue = function(key)
{
for(var i = 0; i < this.arrParamList.length; i ++)
{
if(this.arrParamList[i].Key == key)
{
return this.arrParamList[i].MustOrNiceHaveValue;
}
}
return EmptyString.Value;
}
ParseSearchParamXmlItems.prototype.getMustOrNiceHaveValueByIndex = function(keyIndex)
{
return this.arrParamList[keyIndex].MustOrNiceHaveValue;
}
ParseSearchParamXmlItems.prototype.getKeyIndex = function(key)
{
for(var i = 0; i < this.arrParamList.length; i ++)
{
if(this.arrParamList[i].Key == key)
{
return i;
}
}
return -1;
}
}
function BuildFullPage2()
{
GetListingType();
getRecCount2();
GetType();
DisplayPaging2();
}
function ChangeListingType()
{
var obj = document.getElementById("listListingTypes");
var lt = obj.options[obj.selectedIndex].value;
var divSD = document.getElementById("divStatusDESC");
if(parseInt(lt) == 2)//For foreclosure
divSD.className = "HeightBorder clearFloat";//Show status description checkboxs
else
divSD.className = "hideElement";////Hide status description checkboxs
RefreshResults();
}
function RefreshResults()
{
var parameterString = searchResultsUiParameterList.GetXMLString();
var pageSessionKey = document.getElementById("pageSessionKey").value;
iGen.WebServices.CustomSearchResults.GetResultsCount(parameterString, pageSessionKey, onRefreshResultsSucceed);
}
function DoSortSearchResultsForDropDownList(selectedValue)
{
var sortItem = null;
var sortOrder = null;
switch(selectedValue.toString())
{
case "0":
sortItem = SearchSortItems.ListPrice;
sortOrder = SortOrders.Ascending;
break;
case "1":
sortItem = SearchSortItems.ListPrice;
sortOrder = SortOrders.Descending;
break;
case "2":
sortItem = SearchSortItems.DaysOnMarket;
sortOrder = SortOrders.Descending;
break;
case "3":
sortItem = SearchSortItems.DaysOnMarket;
sortOrder = SortOrders.Ascending;
break;
}
DoSortSearchResults(sortItem, sortOrder);
}
function DoSortSearchResults(sortItem, sortOrder)
{
if(sortOrder == null)
{
if(searchResultsUiParameterList.SortType == null)
{
sortOrder = SortOrders.Ascending;
}
else
{
if(searchResultsUiParameterList.SortType.SearchSortItem == sortItem)
{
if(searchResultsUiParameterList.SortType.SortOrder == SortOrders.Ascending)
{
sortOrder = SortOrders.Descending;
}
else
{
sortOrder = SortOrders.Ascending;
}
}
else
{
sortOrder = SortOrders.Ascending;
}
}
}
SearchSortTypes.SearchSortItem = sortItem;
SearchSortTypes.SortOrder = sortOrder;
searchResultsUiParameterList.SortType = SearchSortTypes;
RefreshResults();
}
function onRefreshResultsSucceed(res)
{
var traceRpt = res.TraceReport;
if(traceRpt != null && traceRpt != "")
{
document.getElementById("divTraceViewerReportsMatchediGenKeysAjax").innerHTML = traceRpt;
}
res = res.ResultsCount;
if(res != null)
{
var tbCount = document.getElementById("tbCount");
tbCount.value = res;
var tbCurPageCount = document.getElementById("tbCurPageCount");
tbCurPageCount.value = 1;
BuildFullPage2();
}
}
var resultsTotalCount = null;
function getRecCount2()
{
var tbCount = document.getElementById("tbCount");
if(tbCount)
{
resultsTotalCount = tbCount.value;
}
var tbRecNum=document.getElementById("tbRecNum");
var tbRecNum0=document.getElementById("tbRecNum0");
tbRecNum0.innerHTML=" ["+resultsTotalCount+" Results]";
}
var maxListingsCountPerPage = 49;
function DisplayPaging2()
{
var pageCount=0;
if(resultsTotalCount != null)
{
if(resultsTotalCount%maxListingsCountPerPage==0)
{
pageCount=(resultsTotalCount/maxListingsCountPerPage);
}
else
{
pageCount=Math.floor(resultsTotalCount/maxListingsCountPerPage)+1;
}
}
var tbCurPageCount = document.getElementById("tbCurPageCount");
getPage2(eval(tbCurPageCount.value), pageCount);
if(eval(tbCurPageCount.value) != 1)
{
LoadLeaderboardAds();
}
}	
function getPage2(curPage,pageCount)
{
var myPage0 = document.getElementById('myPage0');
if(pageCount == 0)
{
myPage0.innerHTML = "";
}
else
{
var i;
var outStr = "";
var prevPage = curPage - 1;
var nextPage = curPage + 1;
var prevPageContent = "<a href='javascript:getPage2("+prevPage+","+pageCount+")'><u>Previous</u></a>&nbsp;&nbsp;";
var nextPageContent = "<a href='javascript:getPage2("+nextPage+","+pageCount+")'><u>Next</u></a>";
if(curPage == 1)
{
prevPageContent = "Previous&nbsp;&nbsp;";
}
if(curPage == pageCount)
{
nextPageContent = "Next";
}
if(pageCount <= 9)
{
for(i = 1; i <= pageCount; i ++)
{
if( i == curPage)
outStr += "<strong>"+i + "</strong>&nbsp;&nbsp;";
else
outStr += "<a href='javascript:getPage2(" + i + ","+pageCount+")'><u>" + i + "</u></a>&nbsp;&nbsp;";
}
myPage0.innerHTML= "Pages:&nbsp;"+prevPageContent + outStr + nextPageContent;
}
else
{
var min;
var max;
if(curPage + 4 > pageCount)
{
max = pageCount;
min = pageCount - 8;
}
if(curPage - 4 < 1)
{
min = 1;
max = 9;
}
if( curPage + 4 <= pageCount && curPage - 4 >= 1)
{
min = curPage - 4;
max = curPage + 4;
}
for(i = min; i <= max; i ++)
{
if( i == curPage)
outStr += "<strong>"+i + "</strong>&nbsp;&nbsp;";
else
outStr += "<a href='javascript:getPage2(" + i + ","+pageCount+")'><u>" + i + "</u></a>&nbsp;&nbsp;";
}
myPage0.innerHTML = "Pages:&nbsp;"+prevPageContent + outStr + nextPageContent;
}
var tbCurPageCount = document.getElementById("tbCurPageCount");
tbCurPageCount.value = curPage;
}
GetResults2(curPage);
}	
function GetResults2(pageNum)
{	
var myPage = document.getElementById('myPage');
var tbRecNum = document.getElementById("tbRecNum");
var pageSessionKey = document.getElementById("pageSessionKey").value;
myPage.innerHTML ="";
tbRecNum.innerHTML="";
document.getElementById("displayResults").innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;Loading ...";
switch(searchType)
{
case "custom":
var parameterString = searchResultsUiParameterList.GetXMLString();
iGen.WebServices.CustomSearchResults.ListHouse2(pageNum,pageSessionKey,parameterString,onGetResultsSucceed2);
break;
default:
break;
}
TrackGoogleAnalytics(GetSearchPageName("pc1"));
TrackGoogleAnalyticsNew();
}
function onGetResultsSucceed2(res)
{	
var traceRpt = res.TraceReport;
if(traceRpt != null && traceRpt != "")
{
document.getElementById("divTraceViewerReportsShowCurrentPageAjax").innerHTML = traceRpt;
}
res = res.ListOfCurrentPage;
var listingOffice = "";
var myPage = document.getElementById('myPage');
var myPage0 = document.getElementById('myPage0');
if(	myPage != null && myPage0 != null)
{
myPage.style.display = "";
myPage0.style.display = "";
}
var igen_key = 0;
var type = document.getElementById("curType").value;
var curPageCount=document.getElementById("tbCurPageCount").value;
var str;
var v_logSrc = "";
var v_srchIndex = "";
if (searchType == "custom")
{
var srchIndex = document.getElementById("srchIdx").value;
v_logSrc = "CustomSearch";
}
else if(searchType == "schools")
{
v_logSrc = "schools";
}
else
{
v_logSrc = "SavedHomes";
}
switch(type)
{
case "photo":
{
var j = 0;
if(res != null && res.length > 0)
{
var resultsArray = res;
var resultsLength = resultsArray.length;
str = "<table width=\"760\" id=\"dlPhotosView\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;\">";
for(var i=0; i<resultsLength + 1; i++)
{
if( i%2 == 0)
str += "<tr><td align=left>";
else
str += "<td align=right>";
if(i == 3 || (i < 3 && i == resultsLength))
{
str += "<div id='divCallBackHotlead'></div>";
str += "</td>";
}
else
{
var k = i;
if(i > 3)
{
k = i - 1;
}
var hb = new HouseBox("Result");
hb.Address		= resultsArray[k].Address;		
hb.bathroomText = resultsArray[k].bathroomText;
hb.bedroomText = resultsArray[k].bedroomText;
hb.DaysOnMkt = resultsArray[k].DaysOnMkt;
hb.Favorite = resultsArray[k].Favorite;
hb.HouseScore = resultsArray[k].HouseScore;
hb.iGen_Key = resultsArray[k].iGen_Key;
hb.list_price = resultsArray[k].list_price;
hb.listingType = resultsArray[k].listingType;
hb.ln_list_agents_name = resultsArray[k].ln_list_agents_name;
hb.lo_listing_office = resultsArray[k].lo_listing_office;
hb.lot_size = resultsArray[k].lot_size;
hb.lotsize_desc = resultsArray[k].lotsize_desc;
hb.mls_db = resultsArray[k].mls_db;
hb.mls_num = resultsArray[k].mls_num;
hb.num_photos_dl = resultsArray[k].num_photos_dl;
hb.openHouseText = resultsArray[k].openHouseText;
hb.priceChange = resultsArray[k].priceChange;
hb.square_feet = resultsArray[k].square_feet;
hb.ss_status = resultsArray[k].ss_status;
hb.ss_status_desc = resultsArray[k].ss_status_desc;
hb.StaticURL = resultsArray[k].StaticURL;
hb.vs_flag = resultsArray[k].vs_flag;
hb.zipcode = resultsArray[k].zipcode;
hb.cityCode = resultsArray[k].city_code;
hb.flag_display = resultsArray[k].flag_Display;
var currentBoxHTML = hb.GetHouse();
str += currentBoxHTML;
}
if( i%2 != 0)
str += "</td></tr>";
else
str += "</td>";
}
str += "</table>";
document.getElementById("displayResults").innerHTML = str;
var divbg = document.getElementById("divbg");
divbg.style.height = document.body.scrollHeight;
}
else
{
document.getElementById("displayResults").innerHTML = "No results found.";
document.getElementById("displayResults").style.textAlign="left";
}
if(searchType == "basic" || searchType == "schools")
{
if(document.getElementById("pageLogKey").value != null)
iGen.WebServices.searchResults.LogPageHit(document.getElementById("pageLogKey").value + "_PHOTO",onLogPageHitSuccessed);
}
else if(searchType == "custom")
{
if(document.getElementById("pageLogKey").value != null)
iGen.WebServices.CustomSearchResults.LogPageHit(document.getElementById("pageLogKey").value + "_PHOTO",onLogPageHitSuccessed);
}
else
iGen.WebServices.favorites.LogPageHit("FAVORITES_PHOTO",onLogPageHitSuccessed);
iGen.WebServices.CustomSearchResults.GetPreFillUserNameEmailPhone(onFillInfoSucceed);
break;
}
case "list":
{
if(res != null && res.length > 0)
{
var resultsArray = res;
var resultsLength = resultsArray.length;
str = "<table class=\"resultTable\" cellpadding=4 cellspacing=0 ><Tr style=\"background-color:#f0f0f0\"><Td style=\"width:176px\">Address</Td><td>Map</td>"
+"<Td><a href=\"javascript:DoSortSearchResults(SearchSortItems.SquareFeet, null);\">Sq. Ft.</a></Td>"
+"<Td><a href=\"javascript:DoSortSearchResults(SearchSortItems.LotSize, null);\">Lot</a></Td>"
+"<Td><a href=\"javascript:DoSortSearchResults(SearchSortItems.StoriesNum, null);\">Stories</a></Td>"
+"<Td><a href=\"javascript:DoSortSearchResults(SearchSortItems.Bedroom, null);\">Bed</a></Td>"
+"<Td><a href=\"javascript:DoSortSearchResults(SearchSortItems.Bathroom, null);\">Bath</a></Td>"
+"<Td><a href=\"javascript:DoSortSearchResults(SearchSortItems.Pool, null);\">Pool</a></Td>"
+"<Td><a href=\"javascript:DoSortSearchResults(SearchSortItems.GaragesNum, null);\">Garage</a></Td>"
+"<Td><a href=\"javascript:DoSortSearchResults(SearchSortItems.Fireplace, null);\">Fireplace</a></Td>"
+"<Td><a href=\"javascript:DoSortSearchResults(SearchSortItems.DaysOnMarket, null);\">Days On Mkt</a></Td>"
+"<Td>Favorite</Td><Td>Open</Td><Td><a href=\"javascript:DoSortSearchResults(SearchSortItems.ListPrice, null);\">List Price</a></Td></Tr>";
for(var i=0; i<resultsArray.length; i++)
{
igen_key = resultsArray[i].iGen_Key;
var listingType = resultsArray[i].listingType;
var listingPrice = GetValidatePriceValue(resultsArray[i].list_price.toString());
var curIsCheck = "";
if(resultsArray[i].Favorite == 1)
curIsCheck = "checked";
var Pool = "&nbsp;";
var Fireplace = "&nbsp;";
if(resultsArray[i].pool > 0)
Pool = "<img src='images/Pool.gif'>";	
if(resultsArray[i].fireplace > 0)
Fireplace = "<img src='images/Fireplace.gif'>";	
var nPic = 0;
var myPic = "";
if(resultsArray[i].num_photos_dl > 0)
{
myPic = "<IMG alt=\"House Image Not Available\" width=\"60\" title=\"Click for House Detail\" src=\"" + GetSmallImage(resultsArray[i].mls_num,resultsArray[i].mls_db)+ "\" border=0></a>";
nPic = 1;
}
else
myPic = "<div class='noPhoto' style=\"width:60px;height:45px;font-size:8px;line-height:16px\">Photo Unavailable</div></a>";
str += "<tr><td><div style=\"float:left;width:65px\"><a href=\"" + resultsArray[i].StaticURL + "\">" + myPic + "</div><div style=\"float:left;width:111px\"><a href=\"" + resultsArray[i].StaticURL + "\">" + resultsArray[i].Address + "</a></div><div class=\"clearFloat\"></div>";
str += "</td><td align=center><img align=\"top\" title=\"Click to view map\" class='cursorPointer' src=\"images/newpropertysearch/MapIcon.gif\" border=0 onclick=\"javascript:MM_openBrWindow('mappage/GeneralMap.aspx?HouseId=" + igen_key + "','iGenMap',550,650);\" /></td>";
str += "<td>" + resultsArray[i].square_feet + "</td><td>" + resultsArray[i].lot_size + "</td><td>" + resultsArray[i].num_stories + "</td><td>" + resultsArray[i].bedroomText + "</td><td>" + resultsArray[i].bathroomText + "</td>";
str += "<td align=center>" + Pool + "</td><td>" + resultsArray[i].num_garage + "</td><td align=center>" + Fireplace + "</td><td>";
var mlsDb = resultsArray[i].mls_db;
if(listingType == 0)
{
if(mlsDb != "300")
{
if(searchType == "favorite" && resultsArray[i].ss_status != null && resultsArray[i].ss_status != "")
str += "<font color=red>" + resultsArray[i].ss_status + "</font>";
else
str += resultsArray[i].DaysOnMkt;
}
else
{
if(searchType == "favorite" && resultsArray[i].ss_status != null && resultsArray[i].ss_status != "")
str += "<font color=red>" + resultsArray[i].ss_status + "</font>";
}
}
str += "</td><td><input id=\"check_" + igen_key + "\" type=\"checkbox\" "+curIsCheck+" onclick=\"UpdateSavedHouse('check_"+igen_key+"')\"></td>";
str += "<td>" + resultsArray[i].openHouseText + "</td><td>";
var extraFlag = GetExtraFlag(resultsArray[i].flag_Display, 4);
if(!extraFlag && resultsArray[i].vs_flag == 1)
{
str += "<a class='cursorPointer' onmouseover=\"showInd('VSP_"+ igen_key +"')\" onmouseout=\"HiddenInd('VSP_"+ igen_key +"')\"><img src='images/icon_dollar_sign.gif' border=0></a><span id=\"VSP_"+ igen_key +"\"></span>";
}
str += listingPrice;
if(listingType == 0)
{
var img = GetMLSLogosByMlsDb( eval(resultsArray[i].mls_db) );	
str += "<br>" + img;
}
str += "</td></tr>";	
}
str += "</table>";
document.getElementById("displayResults").innerHTML = str.replace(/<td><\/td>/g,"<td>&nbsp;</td>");
}
else
{
document.getElementById("displayResults").innerHTML = "No results found.";
document.getElementById("displayResults").style.textAlign="left";
}
if(searchType == "basic" || searchType == "schools")
{
if(document.getElementById("pageLogKey").value != null)
iGen.WebServices.searchResults.LogPageHit(document.getElementById("pageLogKey").value + "_LIST",onLogPageHitSuccessed);
}
else if(searchType == "custom")
{
if(document.getElementById("pageLogKey").value != null)
iGen.WebServices.CustomSearchResults.LogPageHit(document.getElementById("pageLogKey").value + "_LIST",onLogPageHitSuccessed);
}
else
iGen.WebServices.favorites.LogPageHit("FAVORITES_LIST",onLogPageHitSuccessed);
break;
}
case "map":
{
var eleSearchID = document.getElementById("tbSearchID");
var eleCLatLng = document.getElementById("PS_CLatLng_Zoom");
if(res != null && res.length > 0)
{	
str = "<DIV id=\"map\" style=\"WIDTH: 763px; HEIGHT: 475px\">Loading image data ..</DIV>";
document.getElementById("displayResults").innerHTML = str;
GetMapURL2(res);//Added by Joe Aug 23,2005	
}
else
{
document.getElementById("displayResults").innerHTML = "No results found.";
document.getElementById("displayResults").style.textAlign="left";
}
if(searchType == "basic" || searchType == "schools")
{
if(document.getElementById("pageLogKey").value != null)
iGen.WebServices.searchResults.LogPageHit(document.getElementById("pageLogKey").value + "_MAP",onLogPageHitSuccessed);
}
else if(searchType == "custom")
{
if(document.getElementById("pageLogKey").value != null)
iGen.WebServices.CustomSearchResults.LogPageHit(document.getElementById("pageLogKey").value + "_MAP",onLogPageHitSuccessed);
}
else
iGen.WebServices.favorites.LogPageHit("FAVORITES_MAP",onLogPageHitSuccessed);
break;
}
default:
{
document.getElementById("displayResults").innerHTML = "";
break;
}
}
GetType();//It's for IE to get type display when user press "back" button, can't be removed.
if(searchType == "basic")
{
var pageNum = document.getElementById("tbCurPageCount").value;
if(Rresults[pageNum] == null)
{
Rresults[pageNum] = res;
GetMapURL(res,true);
}
}
var myPage = document.getElementById('myPage');
var tbRecNum=document.getElementById("tbRecNum");
var myPage0 = document.getElementById('myPage0');
var tbRecNum0=document.getElementById("tbRecNum0");
myPage.innerHTML =myPage0.innerHTML;
tbRecNum.innerHTML=tbRecNum0.innerHTML;
ShowMLSLogos();
}
function SetType2(typeName)
{
document.getElementById("curType").value = typeName;
BuildFullPage2();
}
function SaveSearch2()
{
var chbxSaveAs = document.getElementById("chbxSaveAs");
var tbSaveAs=document.getElementById("tbxSaveAs");
var btnSave=document.getElementById("btnSave");
if(chbxSaveAs.checked == false || tbSaveAs.value == "")
{
alert("Please input the search name to save.");
}
else
{
iGen.WebServices.Common.CheckUserIsLoggedIn(onSaveSearch2Succeeded);
}
}
function onSaveSearch2Succeeded(result)
{
if(!result)
{
checkLoginPop('Register','save');
}
else
{
var chbxSaveAs=document.getElementById("chbxSaveAs");
var tbSaveAs=document.getElementById("tbxSaveAs");
var tbSearchID=document.getElementById("tbSearchID");
var EmailUpdates=document.getElementById("ddlEmailUpdates");
var emailCheck=document.getElementById("chbxEmailUpdates");
if(emailCheck.checked)
{
var mC=1;
}
else
{
var mC=0;
}
if(tbSaveAs.value && chbxSaveAs.checked)
{
if(searchType == "custom")
{
iGen.WebServices.CustomSearchResults.SaveSearch2(tbSearchID.value,tbSaveAs.value,EmailUpdates.options[EmailUpdates.selectedIndex].value,mC,onSaveSearchSucceed2);
}	
}
}
}
function onSaveSearchSucceed2(res)
{
var SaveResult=document.getElementById("SaveResult");
if(res)
{
SaveResult.innerHTML = "<font color=#9B2D00>Saved Search.</font>";
LoadAllSavedSearch();
}
else
{
SaveResult.innerHTML = "<font color=#9B2D00>Save failed.</font>";
}
}
function InputEmail()
{
var popInputEmail = new popUpWindow();
popInputEmail.width = "510";
popInputEmail.height = "315";
popInputEmail.titleBar.innerHTML = "Sign Up for Listing Updates";
popInputEmail.bodyContainerTypeValue = gWebPath + "InputEmail.aspx";
popInputEmail.show();
}
function SaveListingUpdates()
{
iGen.WebServices.Common.CheckUserIsLoggedIn(onSaveListingUpdatesSucceeded);
}
function onSaveListingUpdatesSucceeded(result)
{
if(!result)
InputEmail();
else
ListingUpdatesForSearchResult("");
}
function ListingUpdatesForSearchResult(email)
{
if(searchResultsUiParameterList == undefined || searchResultsUiParameterList == null)
return;
var paras = searchResultsUiParameterList;
if(paras.IsAutoSaveSearch.toLowerCase() == "true" && paras.IsEmailUpdates.toLowerCase() == "true")
alert("You are already receiving updates for this search.");
else
{
var searchId = paras.searchId;
var searchName = paras.SearchName;
iGen.WebServices.CustomSearchResults.ListingUpdates(email, searchId, searchName, onListingUpdatesSucceed);
}
}
function onListingUpdatesSucceed(res)
{
if(res == null || Trim(res) == "")
return;
var emailStatus = res;
switch(emailStatus)
{
case "EmailWrongFormat":
alert('Your E-mail Address is Invalid. Please re-enter.');
return false;
case "InvalidEmail":
alert('This email address you entered is not receiving emails. Please re-enter.');
return false;
case "RegisterFailed":
alert('Regist failed.');
return false;
case "LoggedIn":
alert("Your search is saved, and you will receive periodic property updates.");
LoadAllSavedSearch();	
break;	
case "RegisteredNotLoggedIn":
alert("Your search is saved, and you will receive periodic property updates.");	
break;	
case "NeedActive":
alert("You are now signed up to receive email updates for this search.");	
break;
case "NewlyRegister":
alert("Thanks for signing up. Please click the activation link in the email that we just sent to the email address you provided.");
break;
default://SavedFailed
alert('Failed. Please retry.');
return false;
}
closePopUpWindow();
}
function onFillInfoSucceed(res)
{
var userInfo = res;
var box = document.getElementById("divCallBackHotlead");
if(box != null)
box.innerHTML = "<table class='srHotlead_Main' width='370' border='0' cellpadding='0' cellspacing='0'><tr><td height='60'></td><td colspan='2'><div class='callBackTitle'>Need Help? Get a call back now.</div><div class='callBackTitleForSearchResults'>Or call us toll-free at (888) 766-8686</div></td></tr>"
+ "<tr><td width='15' rowspan='5'></td><td width='250' height='25' class='callBackMention'>Name: <input class='callBackInput' type='text' id='txtName' maxlength='100' tabindex='1' onkeypress=\"btnFocus(event,'','contactMeForCallBack');\" value='" + userInfo[0] + "'></td>"
+ "<td rowspan='4' valign='bottom' align='center'><a onclick=\"SendCallBackHotlead('5');\" class='cursorPointer'><img id='contactMeForCallBack' src='images/contactCallBack.gif'></a></td></tr>"
+ "<tr><td height='25' class='callBackMention'>Email: <input class='callBackInput' type='text' id='txtMail' maxlength='100' tabindex='2' onkeypress=\"btnFocus(event,'','contactMeForCallBack');\" value='" + userInfo[1] + "'></td></tr>"
+ "<tr><td height='25' class='callBackMention'>Phone: <input class='callBackInput' type='text' id='txtPhone' maxlength='100' tabindex='3' onkeypress=\"btnFocus(event,'','contactMeForCallBack');\" value='" + userInfo[2] + "'></td></tr>"
+ "<tr><td height='20' colspan='2' valign='bottom' id='callBackLinkFontSize'><a href='privacypolicy.aspx' target='_blank'>Privacy Policy</a> | <a href='termsofuse.aspx' target='_blank'>Terms of Use</a></td></tr>"
+ "<tr><td height='10' colspan='2'></td></tr></table>";
}
