
var rentalPrice=new Array("0","100","150","200","250","300","350","400","450","500","550","600","650","700","800","900","1000","1100","1200","1400","1600","1800","2000","2500","3000","3500","4000","4500","5000","5500","6000","6500","7000","7500","8000","8500","9000","9500","10000");var homePrice=new Array("0","10000","20000","30000","45000","50000","55000","60000","70000","75000","100000","125000","150000","175000","200000","225000","250000","275000","300000","325000","350000","400000","450000","500000","550000","600000","650000","700000","750000","800000","850000","900000","1000000","1250000","1500000","1750000","2000000","2500000","3000000","5000000","7000000","10000000");var gType="";function DisableInputControls()
{if(document.getElementById('minprice'))
{document.getElementById('minprice').style.display="none";document.getElementById('minprice').disabled=true;}
if(document.getElementById('toText'))
{document.getElementById('toText').style.display="none";document.getElementById('minprice').disabled=true;}
if(document.getElementById('maxprice'))
{document.getElementById('maxprice').style.display="none";document.getElementById('maxprice').disabled=true;}
if(document.getElementById('city'))
{document.getElementById('city').style.display="none";document.getElementById('city').disabled=true;}
if(document.getElementById('state'))
{document.getElementById('state').style.display="none";document.getElementById('state').disabled=true;}
if(document.getElementById('orText'))
{document.getElementById('orText').style.display="none";document.getElementById('orText').disabled=true;}
if(document.getElementById('zip'))
{document.getElementById('zip').style.display="none";document.getElementById('zip').disabled=true;}}
function ChangePriceRange(RadioValue,actionURL)
{gType=RadioValue;var morelinksvalue=RadioValue+"More";ChangeMoreLinks(morelinksvalue);document.getElementById('frmSearch').action=actionURL;var minprice=document.getElementById('minprice');var maxprice=document.getElementById('maxprice');DisableInputControls();if(gType=="Rental")
{if(document.getElementById('city'))
{document.getElementById('city').style.display="inline";document.getElementById('city').disabled=false;}
if(document.getElementById('state'))
{document.getElementById('state').style.display="inline";document.getElementById('state').disabled=false;}}
else
{if(gType=="Foreclosure")
{if(document.getElementById("zip"))
{document.getElementById("zip").style.display="inline";document.getElementById("zip").disabled=false;}}
else
{if(gType=="Existing")
{if(document.getElementById('minprice'))
{document.getElementById('minprice').style.display="inline";document.getElementById('minprice').disabled=false;}
if(document.getElementById('toText'))
{document.getElementById('toText').style.display="inline";document.getElementById('minprice').disabled=false;}
if(document.getElementById('maxprice'))
{document.getElementById('maxprice').style.display="inline";document.getElementById('maxprice').disabled=false;}}
if(document.getElementById('city'))
{document.getElementById('city').style.display="inline";document.getElementById('city').disabled=false;}
if(document.getElementById('state'))
{document.getElementById('state').style.display="inline";document.getElementById('state').disabled=false;}
if(gType=="Existing")
{if(document.getElementById('orText'))
{document.getElementById('orText').style.display="inline";document.getElementById('orText').disabled=false;}
if(document.getElementById('zip'))
{document.getElementById('zip').style.display="inline";document.getElementById('zip').disabled=false;}}
if(gType=="Existing")
{if(minprice.length<2||minprice.options[1].value!=homePrice[1])
{minprice.innerHTML="";maxprice.innerHTML="";for(i=0;i<=homePrice.length-1;i++)
{minprice.options.add(new Option((i==0)?'Price Range: $'+homePrice[i]:'$'+formatNumberString(homePrice[i]),homePrice[i]));if(i!=homePrice.length-1)
maxprice.options.add(new Option('$'+formatNumberString(homePrice[i+1]),homePrice[i+1]));}
maxprice.options.add(new Option('No Maximum','99999999'));maxprice.options[homePrice.length-1].selected=true;}}}}
DisableAllHiddenControls();var div=document.getElementById(gType+"HiddenControls");if(div)
{SetDisabledElementAndChildren(div,false);}}
function SetDisabledElementAndChildren(elem,disabled)
{if(elem)
{elem.disabled=disabled;var children=elem.childNodes;if(children!=null)
{for(var i=0;i<children.length;i++)
{children[i].disabled=disabled;}}}}
function DisableAllHiddenControls()
{SetDisabledElementAndChildren(document.getElementById("ExistingHiddenControls"),true);SetDisabledElementAndChildren(document.getElementById("NewHiddenControls"),true);SetDisabledElementAndChildren(document.getElementById("ForeclosureHiddenControls"),true);SetDisabledElementAndChildren(document.getElementById("RentalHiddenControls"),true);}
function ChangeMoreLinks(morelinksvalue)
{if(document.getElementById("NewMore"))
document.getElementById("NewMore").style.display="none";if(document.getElementById("ExistingMore"))
document.getElementById("ExistingMore").style.display="none";if(document.getElementById("ForeclosureMore"))
document.getElementById("ForeclosureMore").style.display="none";if(document.getElementById("RentalMore"))
document.getElementById("RentalMore").style.display="none";if(document.getElementById(morelinksvalue))
document.getElementById(morelinksvalue).style.display="block";}
function formatNumberString(price)
{var formatted=price;var rgx=/(\d+)(\d{3})/;while(rgx.test(formatted)){formatted=formatted.replace(rgx,'$1'+','+'$2');}
return formatted;}
function isValidZip(s)
{var rgx=/(^\d{5}$)/;return rgx.test(s);}
function getName(name)
{name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(window.location.href);if(results==null)
return"";else
return results[1];}
function waitForMilliSec(millis)
{var date=new Date();var curDate=null;do
{curDate=new Date();}
while(curDate-date<millis);}
function AddSiteSuffix(name)
{var siteName=document.getElementById("sitename");if(siteName!=null)
{var siteNameValue=siteName.value;if(siteNameValue!=null&&siteNameValue!="")
{name=name+"_"+siteNameValue;}}
return name;}
function REOmniture(obj,name)
{if(s_re!=null)
{s_re.linkTrackVars="prop9";var nameWithSiteName=AddSiteSuffix(name);s_re.prop9=nameWithSiteName;s_re.tl(obj,"e",nameWithSiteName);}
waitForMilliSec(500);}
function REOmLink(url,name)
{REOmniture(this,name);window.open(url,'_self');}
function searchWidgetOmniture(obj)
{if(gType==null||gType=="")
{return;}
else if(gType=="Existing")
{name="ExistingHomes";}
else if(gType=="New")
{name="NewHomes";}
else if(gType=="Rental")
{name="Rentals";}
else if(gType=="Foreclosure")
{name="Foreclosures";}
REOmniture(obj,name);}
function validateHomeFinder(objForm,cityDefault,zipDefault,blnPrice)
{var retVal=true;var zip=objForm.zip.value;var city=objForm.city.value;if(objForm.zip.style.display=="none")
zip="";if(objForm.city.style.display=="none")
city="";setQueryStringParams();if(gType=="Foreclosure")
{if(isValidZip(zip))
{searchWidgetOmniture(objForm);return true;}
else
{alert("Please enter a valid ZIP code");objForm.zip.focus();return false;}}
if(zip==""||zip==zipDefault)
{if(city==""||city==cityDefault)
{if(objForm.state.options[objForm.state.selectedIndex].value=="na"||objForm.state.selectedIndex<0)
{if(gType=="New"||gType=="Rental")
{alert("Please enter a city and state");}
else
{alert("Please enter a city and state, or enter a valid ZIP code");}}
else
{if(gType=="New"||gType=="Rental")
{alert("Please enter a city");}
else
{alert("Please enter a city or a valid ZIP code");}}
objForm.city.focus();return false;}
if(objForm.state.options[objForm.state.selectedIndex].value=="na"||objForm.state.selectedIndex<0)
{if(gType=="New"||gType=="Rental")
{alert("Please choose a state");}
else
{alert("Please choose a state or enter a valid ZIP code");}
objForm.state.focus();return false;}
if(gType=="Existing")
{objForm.frm.value='bymap';objForm.action="http://g.msn.com/0USRE/02";objForm.target.value="http://g.msn.com/0USRE/03";}}
else
{if(!isValidZip(zip))
{alert("Please enter a valid ZIP code");objForm.zip.focus();return false;}
if(gType=="Existing")
{objForm.frm.value='byzip';objForm.action="http://g.msn.com/0USRE/03";objForm.target.value="";}}
if(blnPrice&&objForm.minprice.style.display=="inline"&&objForm.minprice.disabled==false&&objForm.maxprice.style.display=="inline"&&objForm.maxprice.disabled==false)
{var minPriceValue=objForm.minprice.options[objForm.minprice.selectedIndex].value;var maxPriceValue=objForm.maxprice.options[objForm.maxprice.selectedIndex].value;if(minPriceValue!=""&&maxPriceValue!=""){var minPrice=parseInt(minPriceValue);var maxPrice=parseInt(maxPriceValue);if(minPrice>maxPrice&&maxPrice>0){alert("You have selected a minimum price ($"+minPrice+") greater than your maximum price ($"+maxPrice+").\n\nMaximum price should be greater than minimum price in order to find listings.\nSee \"Price Range\" on this page.\n\nPlease correct this before continuing.");objForm.minprice.focus();retVal=false;}
else{if(minPrice==maxPrice&&maxPrice>0){retVal=confirm("You have selected a minimum price that is equal to your maximum price ($"+maxPrice+").\nThis will cause your search to find ONLY listings with a current list price of EXACTLY $"+maxPrice+".\n\nIs this okay?");}}}}
if(retVal&&navigator.userAgent.indexOf("AOL")==-1&&navigator.userAgent.indexOf("MSIE 3")==-1)
objForm.js.value="on";if(retVal)
{if((zip==""||zip==zipDefault)&&document.getElementById("zip"))
{document.getElementById("zip").disabled=true;}
if((city==""||city==cityDefault)&&document.getElementById("city"))
{document.getElementById("city").disabled=true;}
if((objForm.state.selectedIndex<0||objForm.state.options[objForm.state.selectedIndex].value=="na")&&document.getElementById("state"))
{document.getElementById("state").disabled=true;}
searchWidgetOmniture(objForm);}
return retVal;}
function setQueryStringParams()
{if(gType=="New"||gType=="Rental"||gType=="Existing")
{if(gType=="New"||gType=="Rental")
{if(document.getElementById("zip"))
document.getElementById("zip").name="zp";if(document.getElementById("state"))
document.getElementById("state").name="state";if(document.getElementById("city"))
document.getElementById("city").name="city";}
else if(gType=="Existing")
{if(document.getElementById("zip"))
document.getElementById("zip").name="zp";if(document.getElementById("state"))
document.getElementById("state").name="st";if(document.getElementById("city"))
document.getElementById("city").name="ct";}
if(gType=="Rental")
{document.getElementById("minprice").name='mnpr';document.getElementById("maxprice").name='mxpr';}
else if(gType=="New"||gType=="Existing")
{document.getElementById("minprice").name='mnprice';document.getElementById("maxprice").name='mxprice';}
if(gType=="New")
{document.getElementById("styp").value="buy";}
else if(gType=="Rental")
{document.getElementById("styp").value="rent";}}
else if(gType=="Foreclosure")
{document.getElementById("zip").name="zipcode";if(document.getElementById("password"))
document.getElementById("password").value="msn";}}
var w=window;if(typeof w.addEventListener!="undefined")
w.addEventListener("load",MPSetSelected,false);else if(typeof w.attachEvent!="undefined"){w.attachEvent("onload",MPSetSelected);}
else{if(w.onload!=null){var oldOnload=w.onload;w.onload=function(e){oldOnload(e);MPSetSelected();};}
else
w.onload=MPSetSelected;}
function MPSetSelected()
{var radioArray=document.getElementsByName("radio");if(radioArray&&radioArray.length>0)
{for(var i=0;i<radioArray.length;i++)
{if(radioArray[i].checked)
{radioArray[i].onclick();}}}}