function CheckText(ele){if(trim(ele.value)==DefaultSalesSearchText){ele.value="";}}function FoeSearch(string){var theForm=document.searchform;theForm.txtSearch.value=string;}function FoeContentSearch(string){var theForm=document.searchform;theForm.txtContentSearch.value=string;}function ArticleSearch(term){var theForm=document.searchform;if(theForm.txtContentSearch){theForm.txtContentSearch.value=term;DoSearchContentSmall(theForm);}}function DoSearchContentSmall(theForm){var term=theForm.txtContentSearch.value;if(trim(term).length<3){search_alert(String.format("<p>Please enter a term or phrase into the search field.</p>"));}else{var strURL=String.format("{0}Controls/AjaxCalls/ContentSearchBar.aspx?N=0&Ntk=ArticleSearch&Ntt={1}&sid={2}",WebRoot,escape(theForm.txtContentSearch.value),sid);$AJAX.GetForDelegate(function(AjaxResponse){eval(AjaxResponse);},strURL);}}function DoSearchCID(theForm){var SearchType="sale";var NavQuery=new Array();NavQuery.push(ChannelSectionId);var QueryString="N="+NavQuery.join("+");var txtCIDSearch=theForm.txtCIDSearch.value;if(txtCIDSearch==""||txtCIDSearch=="Enter ID"){alert("Please enter CompanyID into the WebID field.");theForm.txtCIDSearch.focus();return false;}else{txtSearch=txtCIDSearch.replace(' ','');QueryString+=String.format("&Ntt={0}&Ntk=IdAccount&Ntx=mode matchall",txtCIDSearch);var strURL=WebRoot+"Controls/AjaxCalls/SearchBar.aspx?SearchType="+SearchType+"&txtCIDSearch="+txtCIDSearch+"&"+QueryString;}var ResponseDelegate=function(AjaxResponse){if(AjaxResponse.indexOf("var doEval = true;")>-1){eval(AjaxResponse);}else{gE("searchformresult").innerHTML=AjaxResponse;}};$AJAX.GetForDelegate(ResponseDelegate,strURL);}function DoSearchWebID(theForm){var SearchType="sale";var NavQuery=new Array();NavQuery.push(ChannelSectionId);var QueryString="N=926822";var txtIDSearch=theForm.txtIDSearch.value;if(txtIDSearch==""||txtIDSearch=="Enter ID"){alert("Please enter MLS ID or Web ID into the WebID field.");theForm.txtIDSearch.focus();return false;}else{txtSearch=txtIDSearch.replace(' ','');QueryString+=String.format("&Ntt={0}&Ntk=IdSearch&Ntx=mode matchall",txtIDSearch);var strURL=WebRoot+"Controls/AjaxCalls/SearchBar.aspx?SearchType="+SearchType+"&txtIDSearch="+txtIDSearch+"&"+QueryString;}var ResponseDelegate=function(AjaxResponse){eval(AjaxResponse);};$AJAX.GetForDelegate(ResponseDelegate,strURL);}function DoSearchNewHomesSmall(theForm){var SearchType="sale";var Category="New-Homes-alt";var beds="0";var pnum1=0;var pnum2=99000000;var txtSearch="";var qrystr="";var qryPrice="";var els=theForm.elements;txtSearch=trim(theForm.txtSearch.value);var sb=theForm.sb.value;var NavQuery=new Array();NavQuery.push(ChannelSectionId);CloseSuggest();if(theForm.EndecaId.value.length>0){NavQuery.push(theForm.EndecaId.value);}var QueryString="N="+NavQuery.join("+");txtSearch=trim(txtSearch);if(txtSearch==""||txtSearch=="City and State, or Zip Code"){search_alert("<p>Please enter a city/state or a zip code into the search field.  We recommend that you follow the following format:</p><p>City, State (e.g. <a href=\"javascript:FoeSearch('San Francisco, CA');\">San Francisco, CA</a>)<br/>Zip Code (e.g.  <a href=\"javascript:FoeSearch('89148');\">89148</a>)</p><p style='text-align:center;'><b>OR</b></p><p><b>To search by country, state or province please <a href=\"#quick_links\">click here</a></b></p>");return false;}var RegExZip=new RegExp(/[0-9]{5}/);if(RegExZip.exec(txtSearch)!=null){txtSearch=txtSearch.replace(' ','');QueryString+=String.format("&Ntt={0}&Ntk=AddrZip&Ntx=mode matchall",txtSearch);}var strURL=WebRoot+"Controls/AjaxCalls/SearchBar.aspx?SearchType="+SearchType+"&sid="+sid+"&txtSearch="+txtSearch+"&sb="+sb+"&"+QueryString+qryPrice+"&SearchFor="+Category;var ResponseDelegate=function(AjaxResponse){if(AjaxResponse.indexOf("var doEval = true;")>-1){eval(AjaxResponse);}else{gE("searchformresult").innerHTML=AjaxResponse;}};$AJAX.GetForDelegate(ResponseDelegate,strURL);}function DoSearchSalesSmall(theForm){var SearchType="sale";var beds="0";var pnum1=0;var pnum2=99000000;var txtSearch="";var qrystr="";var qryPrice="";var els=theForm.elements;txtSearch=trim(theForm.txtSearch.value);var sb=theForm.sb.value;var NavQuery=new Array();NavQuery.push(ChannelSectionId);NavQuery.push(saleID);CloseSuggest();if(theForm.EndecaId.value.length>0){NavQuery.push(theForm.EndecaId.value);}var QueryString="N="+NavQuery.join("+");txtSearch=trim(txtSearch);if(txtSearch==""||txtSearch=="City and State, or Zip Code"){search_alert("<p>Please enter a city/state or a zip code into the search field.  We recommend that you follow the following format:</p><p>City, State (e.g. <a href=\"javascript:FoeSearch('San Francisco, CA');\">San Francisco, CA</a>)<br/>Zip Code (e.g.  <a href=\"javascript:FoeSearch('89148');\">89148</a>)</p><p style='text-align:center;'><b>OR</b></p><p><b>To search by country, state or province please <a href=\"#quick_links\">click here</a></b></p>");return false;}var RegExZip=new RegExp(/[0-9]{5}/);if(RegExZip.exec(txtSearch)!=null){txtSearch=txtSearch.replace(' ','');QueryString+=String.format("&Ntt={0}&Ntk=AddrZip&Ntx=mode matchall",txtSearch);}var strURL=WebRoot+"Controls/AjaxCalls/SearchBar.aspx?SearchType="+SearchType+"&sid="+sid+"&txtSearch="+txtSearch+"&sb="+sb+"&"+QueryString+qryPrice;var ResponseDelegate=function(AjaxResponse){if(AjaxResponse.indexOf("var doEval = true;")>-1){eval(AjaxResponse);}else{gE("searchformresult").innerHTML=AjaxResponse;}};$AJAX.GetForDelegate(ResponseDelegate,strURL);}function DoSearchAgentSmall(theForm){var SearchType="agents";var txtSearch="";var qrystr="";var els=theForm.elements;txtSearch=trim(theForm.txtSearch.value);var Country=theForm.search_country_select.options[theForm.search_country_select.options.selectedIndex].value;var sb=theForm.sb.value;var NavQuery=new Array();CloseSuggest();if(theForm.EndecaId.value.length>0){NavQuery.push(theForm.EndecaId.value);}else{NavQuery.push("0");}var QueryString="N="+NavQuery.join("+");txtSearch=trim(txtSearch);if(txtSearch==""||txtSearch=="City and State, or Zip Code"){search_alert("<p>Please enter a city/state or a zip code into the search field.  We recommend that you follow the following format:</p><p>City, State (e.g. <a href=\"javascript:FoeSearch('San Francisco, CA');\">San Francisco, CA</a>)<br/>Zip Code (e.g.  <a href=\"javascript:FoeSearch('89148');\">89148</a>)</p><p style='text-align:center;'><b>OR</b></p><p><b>To search by country, state or province please <a href=\"#quick_links\">click here</a></b></p>");return false;}var RegExZip=new RegExp(/[0-9]{5}/);if(RegExZip.exec(txtSearch)!=null){txtSearch=txtSearch.replace(' ','');QueryString+=String.format("&Ntt={0}&Ntk=AddrZip&Ntx=mode matchall",txtSearch);}var txtkeyword=trim(theForm.search_keywords.value);var txtBroker=trim(theForm.search_brokerName.value);var txtAgent=trim(theForm.search_agentName.value);if(txtkeyword!=""){if(txtkeyword.length<3){search_alert("<p>Please enter minimum 3 characters.</p>");return false;}var RegExKW=new RegExp(/[^A-Za-z0-9\-\s]+/);if(RegExKW.exec(txtkeyword)){search_alert("<p>Please enter alpha numeric and space only.</p>");return false;}QueryString+=String.format("&Ntt={0}&Ntk=KeywordSearch",theForm.search_keywords.value);}else if((txtBroker!="")&&(txtAgent=="")){if(txtBroker.length<3){search_alert("<p>Please enter minimum 3 characters.</p>");return false;}var RegExKW=new RegExp(/[^A-Za-z0-9\-\s]+/);if(RegExKW.exec(txtBroker)){search_alert("<p>Please enter alpha numeric and space only.</p>");return false;}QueryString+=String.format("&Ntt={0}&Ntk=AgentAdvertiser",theForm.search_brokerName.value);}else if(txtAgent!=""){if(txtBroker.length<3){search_alert("<p>Please enter minimum 3 characters.</p>");return false;}var RegExKW=new RegExp(/[^A-Za-z0-9\-\s]+/);if(RegExKW.exec(txtAgent)){search_alert("<p>Please enter alpha numeric and space only.</p>");return false;}QueryString+=String.format("&Ntt={0}&Ntk=AgentName",theForm.search_agentName.value);}var strURL=WebRoot+"Controls/AjaxCalls/SearchBar.aspx?SearchType="+SearchType+"&txtSearch="+txtSearch+"&sid="+sid+"&sb="+sb+"&C="+Country+"&"+QueryString;var ResponseDelegate=function(AjaxResponse){if(AjaxResponse.indexOf("var doEval = true;")>-1){eval(AjaxResponse);}else{gE("searchformresult").innerHTML=AjaxResponse;}};$AJAX.GetForDelegate(ResponseDelegate,strURL);}function DoSearchAgentExpanded(theForm){var SearchType="agents";var txtSearch="";var qrystr="";var els=theForm.elements;txtSearch=trim(theForm.txtSearch.value);var Country=theForm.search_country_select.options[theForm.search_country_select.options.selectedIndex].value;var sb=theForm.sb.value;var NavQuery=new Array();CloseSuggest();if(theForm.EndecaId.value.length>0){NavQuery.push(theForm.EndecaId.value);}else{NavQuery.push("0");}var QueryString="N="+NavQuery.join("+");txtSearch=trim(txtSearch);if(txtSearch==""||txtSearch=="City and State, or Zip Code"){search_alert("<p>Please enter a city/state or a zip code into the search field.  We recommend that you follow the following format:</p><p>City, State (e.g. <a href=\"javascript:FoeSearch('San Francisco, CA');\">San Francisco, CA</a>)<br/>Zip Code (e.g.  <a href=\"javascript:FoeSearch('89148');\">89148</a>)</p><p style='text-align:center;'><b>OR</b></p><p><b>To search by country, state or province please <a href=\"#quick_links\">click here</a></b></p>");return false;}var RegExZip=new RegExp(/[0-9]{5}/);if(RegExZip.exec(txtSearch)!=null){txtSearch=txtSearch.replace(' ','');QueryString+=String.format("&Ntt={0}&Ntk=AddrZip&Ntx=mode matchall",txtSearch);}var txtkeyword=trim(theForm.search_keywords.value);var txtBroker=trim(theForm.search_brokerName.value);var txtAgent=trim(theForm.search_agentName.value);if((RegExZip.exec(txtSearch)==null)){if(txtkeyword!=""){if(txtkeyword.length<3){search_alert("<p>Please enter minimum 3 characters.</p>");return false;}var RegExKW=new RegExp(/[^A-Za-z0-9\-\s]+/);if(RegExKW.exec(txtkeyword)){search_alert("<p>Please enter alpha numeric and space only.</p>");return false;}QueryString+=String.format("&Ntt={0}&Ntk=KeywordSearch",theForm.search_keywords.value);}else if((txtBroker!="")&&(txtAgent=="")){if(txtBroker.length<3){search_alert("<p>Please enter minimum 3 characters.</p>");return false;}var RegExKW=new RegExp(/[^A-Za-z0-9\-\s]+/);if(RegExKW.exec(txtBroker)){search_alert("<p>Please enter alpha numeric and space only.</p>");return false;}QueryString+=String.format("&Ntt={0}&Ntk=AgentAdvertiser",theForm.search_brokerName.value);}else if(txtAgent!=""){if(txtAgent.length<3){search_alert("<p>Please enter minimum 3 characters.</p>");return false;}var RegExKW=new RegExp(/[^A-Za-z0-9\-\s]+/);if(RegExKW.exec(txtAgent)){search_alert("<p>Please enter alpha numeric and space only.</p>");return false;}QueryString+=String.format("&Ntt={0}&Ntk=AgentName",theForm.search_agentName.value);}}var strURL=WebRoot+"Controls/AjaxCalls/SearchBar.aspx?SearchType="+SearchType+"&txtSearch="+txtSearch+"&sid="+sid+"&sb="+sb+"&C="+Country+"&"+QueryString;var ResponseDelegate=function(AjaxResponse){if(AjaxResponse.indexOf("var doEval = true;")>-1){eval(AjaxResponse);}else{gE("searchformresult").innerHTML=AjaxResponse;}};$AJAX.GetForDelegate(ResponseDelegate,strURL);}function DoSearchNewHomesExpanded(theForm){var SearchType="sale";var Category="New-Homes-alt";var beds="0";var pnum1=0;var pnum2=99000000;var txtSearch="";var qrystr="";var qryPrice="";var els=theForm.elements;txtSearch=trim(theForm.txtSearch.value);var Country=theForm.search_country_select.options[theForm.search_country_select.options.selectedIndex].value;var sb=theForm.sb.value;var NavQuery=new Array();NavQuery.push(ChannelSectionId);CloseSuggest();if(theForm.EndecaId.value.length>0){NavQuery.push(theForm.EndecaId.value);}var bedslist=theForm.search_bedrooms.options;if(bedslist.selectedIndex>0){NavQuery.push(bedslist[bedslist.selectedIndex].value);}var bathslist=theForm.search_bathrooms.options;if(bathslist.selectedIndex>0){NavQuery.push(bathslist[bathslist.selectedIndex].value);}var QueryString="N="+NavQuery.join("+");var minPrice=theForm.search_pricemin.options;var maxPrice=theForm.search_pricemax.options;if((minPrice.selectedIndex>0)||(maxPrice.selectedIndex>0)){if((minPrice.selectedIndex>maxPrice.selectedIndex)&&(maxPrice.selectedIndex!=0)){search_alert("<p>The minimum price must be less than the maximum price</p>");return false;}else{qryPrice=String.format("&Nf=Price_Sales|BTWN+{0}+{1}",minPrice[minPrice.selectedIndex].value,maxPrice[maxPrice.selectedIndex].value);}}else{qryPrice="";}txtSearch=trim(txtSearch);if(txtSearch==""||txtSearch=="City and State, or Zip Code"){search_alert("<p>Please enter a city/state or a zip code into the search field.  We recommend that you follow the following format:</p><p>City, State (e.g. <a href=\"javascript:FoeSearch('San Francisco, CA');\">San Francisco, CA</a>)<br/>Zip Code (e.g.  <a href=\"javascript:FoeSearch('89148');\">89148</a>)</p><p style='text-align:center;'><b>OR</b></p><p><b>To search by country, state or province please <a href=\"#quick_links\">click here</a></b></p>");return false;}var RegExCAZip=new RegExp("[ABCEGHJKLMNPRSTVXY]\\d[A-Z]\\s?\\d[A-Z]\\d","i");var RegExUSZip=new RegExp(/[0-9]{5}/);if(RegExUSZip.exec(txtSearch)!=null){txtSearch=txtSearch.replace(' ','');QueryString+=String.format("&Ntt={0}&Ntk=AddrZip&Ntx=mode matchall",txtSearch);}else if(RegExCAZip.exec(txtSearch)!=null){txtSearch=txtSearch.replace(' ','');QueryString+=String.format("&Ntt={0}&Ntk=AddrZip&Ntx=mode matchall",txtSearch);}var strURL=WebRoot+"Controls/AjaxCalls/SearchBar.aspx?SearchType="+SearchType+"&txtSearch="+txtSearch+"&sid="+sid+"&sb="+sb+"&C="+Country+"&"+QueryString+qryPrice+"&SearchFor="+Category;var ResponseDelegate=function(AjaxResponse){if(AjaxResponse.indexOf("var doEval = true;")>-1){eval(AjaxResponse);}else{gE("searchformresult").innerHTML=AjaxResponse;}};$AJAX.GetForDelegate(ResponseDelegate,strURL);}function DoSearchSalesExpanded(theForm){var SearchType="sale";var Category="";var beds="0";var pnum1=0;var pnum2=99000000;var txtSearch="";var qrystr="";var qryPrice="";var els=theForm.elements;txtSearch=trim(theForm.txtSearch.value);var Country=theForm.search_country_select.options[theForm.search_country_select.options.selectedIndex].value;var sb=theForm.sb.value;var NavQuery=new Array();NavQuery.push(ChannelSectionId);CloseSuggest();if(theForm.EndecaId.value.length>0){NavQuery.push(theForm.EndecaId.value);}if(theForm.search_bedrooms){var bedslist=theForm.search_bedrooms.options;if(bedslist.selectedIndex>0){NavQuery.push(bedslist[bedslist.selectedIndex].value);}}if(theForm.search_bathrooms){var bathslist=theForm.search_bathrooms.options;if(bathslist.selectedIndex>0){NavQuery.push(bathslist[bathslist.selectedIndex].value);}}var QueryString="N="+NavQuery.join("+");qryPrice="";if(theForm.search_pricemin){var minPrice=theForm.search_pricemin.options;var maxPrice=theForm.search_pricemax.options;if((minPrice.selectedIndex>0)||(maxPrice.selectedIndex>0)){if((minPrice.selectedIndex>maxPrice.selectedIndex)&&(maxPrice.selectedIndex!=0)){search_alert("<p>The minimum price must be less than the maximum price</p>");return false;}else{qryPrice=String.format("&Nf=Price_Sales|BTWN+{0}+{1}",minPrice[minPrice.selectedIndex].value,maxPrice[maxPrice.selectedIndex].value);}}}txtSearch=trim(txtSearch);if(txtSearch==""||txtSearch=="City and State, or Zip Code"){search_alert("<p>Please enter a city/state or a zip code into the search field.  We recommend that you follow the following format:</p><p>City, State (e.g. <a href=\"javascript:FoeSearch('San Francisco, CA');\">San Francisco, CA</a>)<br/>Zip Code (e.g.  <a href=\"javascript:FoeSearch('89148');\">89148</a>)</p><p style='text-align:center;'><b>OR</b></p><p><b>To search by country, state or province please <a href=\"#quick_links\">click here</a></b></p>");return false;}var RegExCAZip=new RegExp("[ABCEGHJKLMNPRSTVXY]\\d[A-Z]\\s?\\d[A-Z]\\d","i");var RegExUSZip=new RegExp(/[0-9]{5}/);if(RegExUSZip.exec(txtSearch)!=null){txtSearch=txtSearch.replace(' ','');QueryString+=String.format("&Ntt={0}&Ntk=AddrZip&Ntx=mode matchall",txtSearch);}else if(RegExCAZip.exec(txtSearch)!=null){txtSearch=txtSearch.replace(' ','');QueryString+=String.format("&Ntt={0}&Ntk=AddrZip&Ntx=mode matchall",txtSearch);}else{if(theForm.search_keywords){var txtkeyword=trim(theForm.search_keywords.value);if(txtkeyword!=""){if(txtkeyword.length<3){search_alert("<p>Please enter minimum 3 characters.</p>");return false;}var RegExKW=new RegExp(/[^A-Za-z0-9\-\s]+/);if(RegExKW.exec(txtkeyword)){search_alert("<p>Please enter alpha numeric and space only.</p>");return false;}QueryString+=String.format("&Ntt={0}&Ntk=CommentsLong",theForm.search_keywords.value);}}}var strURL=WebRoot+"Controls/AjaxCalls/SearchBar.aspx?SearchType="+SearchType+"&txtSearch="+txtSearch+"&sid="+sid+"&sb="+sb+"&C="+Country+"&"+QueryString+qryPrice;var ResponseDelegate=function(AjaxResponse){if(AjaxResponse.indexOf("var doEval = true;")>-1){eval(AjaxResponse);}else{gE("searchformresult").innerHTML=AjaxResponse;}};$AJAX.GetForDelegate(ResponseDelegate,strURL);}function DoSearchForeclosureExpanded(theForm){var SearchType="foreclosure";var Category="";var beds="0";var pnum1=0;var pnum2=99000000;var txtSearch="";var qrystr="";var qryPrice="";var els=theForm.elements;txtSearch=trim(theForm.txtSearch.value);var Country=theForm.search_country_select.options[theForm.search_country_select.options.selectedIndex].value;var sb=theForm.sb.value;var NavQuery=new Array();NavQuery.push(foreclosureID);CloseSuggest();if(theForm.EndecaId.value.length>0){NavQuery.push(theForm.EndecaId.value);}if(theForm.search_bedrooms){var bedslist=theForm.search_bedrooms.options;if(bedslist.selectedIndex>0){NavQuery.push(bedslist[bedslist.selectedIndex].value);}}if(theForm.search_bathrooms){var bathslist=theForm.search_bathrooms.options;if(bathslist.selectedIndex>0){NavQuery.push(bathslist[bathslist.selectedIndex].value);}}if(theForm.search_propertytype){var ptypelist=theForm.search_propertytype.options;if(ptypelist.selectedIndex>0){NavQuery.push(ptypelist[ptypelist.selectedIndex].value);}}var QueryString="N="+NavQuery.join("+");qryPrice="";if(theForm.search_pricemin){var minPrice=theForm.search_pricemin.options;var maxPrice=theForm.search_pricemax.options;if((minPrice.selectedIndex>0)||(maxPrice.selectedIndex>0)){if((minPrice.selectedIndex>maxPrice.selectedIndex)&&(maxPrice.selectedIndex!=0)){search_alert("<p>The minimum price must be less than the maximum price</p>");return false;}else{qryPrice=String.format("&Nf=Price_Sales|BTWN+{0}+{1}",minPrice[minPrice.selectedIndex].value,maxPrice[maxPrice.selectedIndex].value);}}}txtSearch=trim(txtSearch);if(txtSearch==""||txtSearch=="City and State, or Zip Code"){search_alert("<p>Please enter a city/state or a zip code into the search field.  We recommend that you follow the following format:</p><p>City, State (e.g. <a href=\"javascript:FoeSearch('San Francisco, CA');\">San Francisco, CA</a>)<br/>Zip Code (e.g.  <a href=\"javascript:FoeSearch('89148');\">89148</a>)</p><p style='text-align:center;'><b>OR</b></p><p><b>To search by country, state or province please <a href=\"#quick_links\">click here</a></b></p>");return false;}var RegExCAZip=new RegExp("[ABCEGHJKLMNPRSTVXY]\\d[A-Z]\\s?\\d[A-Z]\\d","i");var RegExUSZip=new RegExp(/[0-9]{5}/);if(RegExUSZip.exec(txtSearch)!=null){txtSearch=txtSearch.replace(' ','');QueryString+=String.format("&Ntt={0}&Ntk=AddrZip&Ntx=mode matchall",txtSearch);}else if(RegExCAZip.exec(txtSearch)!=null){txtSearch=txtSearch.replace(' ','');QueryString+=String.format("&Ntt={0}&Ntk=AddrZip&Ntx=mode matchall",txtSearch);}else{if(theForm.search_keywords){var txtkeyword=trim(theForm.search_keywords.value);if(txtkeyword!=""){if(txtkeyword.length<3){search_alert("<p>Please enter minimum 3 characters.</p>");return false;}var RegExKW=new RegExp(/[^A-Za-z0-9\-\s]+/);if(RegExKW.exec(txtkeyword)){search_alert("<p>Please enter alpha numeric and space only.</p>");return false;}QueryString+=String.format("&Ntt={0}&Ntk=CommentsLong",theForm.search_keywords.value);}}}var strURL=WebRoot+"Controls/AjaxCalls/SearchBar.aspx?SearchType="+SearchType+"&txtSearch="+txtSearch+"&sid="+sid+"&sb="+sb+"&C="+Country+"&"+QueryString+qryPrice+"&SearchFor="+Category;var ResponseDelegate=function(AjaxResponse){if(AjaxResponse.indexOf("var doEval = true;")>-1){eval(AjaxResponse);}else{gE("searchformresult").innerHTML=AjaxResponse;}};$AJAX.GetForDelegate(ResponseDelegate,strURL);}function SwitchSearch(type,state,Query){if(Query==undefined){Query="";}var UGen=new UrlGen(Query);if(state==undefined){state="small";}var AfterLoad=function(){void(null);};switch(type){case"Foreclosure":switch(state){case"Small":UGen.RemoveParam("sb");UGen.AddParam("sb","2");var strURL=WebRoot+"Controls/AjaxCalls/GetSearchBar.aspx?"+UGen.ToString();break;case"Expanded":UGen.RemoveParam("sb");UGen.AddParam("sb","1");var strURL=WebRoot+"Controls/AjaxCalls/GetSearchBar.aspx?"+UGen.ToString();break;case"Homepage":UGen.RemoveParam("sb");UGen.AddParam("sb","0");var strURL=WebRoot+"Controls/AjaxCalls/GetSearchBar.aspx?"+UGen.ToString();break;}break;default:switch(state){case"Homepage":UGen.RemoveParam("sb");UGen.AddParam("sb","2");var strURL=WebRoot+"Controls/AjaxCalls/GetSearchBar.aspx?"+UGen.ToString();break;case"Expanded":UGen.RemoveParam("sb");UGen.AddParam("sb","1");var strURL=WebRoot+"Controls/AjaxCalls/GetSearchBar.aspx?"+UGen.ToString();break;default:UGen.RemoveParam("sb");UGen.AddParam("sb","0");var strURL=WebRoot+"Controls/AjaxCalls/GetSearchBar.aspx?"+UGen.ToString();break;}break;}$AJAX.GetForDelegate(function(AjaxResponse){gE("search_bar").innerHTML=AjaxResponse;AfterLoad();},strURL);}function GetC(){var CVal=gE("search_country_select")
return CVal.options[CVal.options.selectedIndex].value;}document.body.onclick=function(){CloseSuggest();search_alert_close();};function SuggestDown(e,ele){if(gE("search_alert").style.display=="block"){return false;}var val=ele.value;if(window.event){keynum=e.keyCode;}else if(e.which){keynum=e.which;}switch(keynum){case 13:if(gE("suggest").style.display=="block"){if(CurrentSuggestIndex()>-1){AddSuggest(CurrentSuggestIndex());StopProcessingEvents(e);return false;}}if(SearchBarType=="0"){DoSearchSalesExpanded(ele.form);}else{DoSearchSalesSmall(ele.form);}break;case 27:CloseSuggest();ele.value=val;return false;break;default:return true;break;}}function SuggestUp(e,ele){if(gE("search_alert").style.display=="block"){return false;}var val=ele.value;if(window.event){keynum=e.keyCode;}else if(e.which){keynum=e.which;}switch(keynum){case 13:if(gE("suggest").style.display=="block"){CloseSuggest();StopProcessingEvents(e);return false;}return true;break;case 27:CloseSuggest();ele.value=val;return false;break;case 40:SuggestSelect(CurrentSuggestIndex()+1);break;case 38:SuggestSelect(CurrentSuggestIndex()-1);break;default:if(trim(ele.value).length>1){var Query=String.format("{0}Controls/AjaxCalls/Suggest.aspx?C={1}&term={2}",WebRoot,GetC(),trim(ele.value));$AJAX.GetForDelegate(ShowSuggest,Query);}else{CloseSuggest();}break;}}function ForeclosureSuggestDown(e,ele){if(gE("search_alert").style.display=="block"){return false;}var val=ele.value;if(window.event){keynum=e.keyCode;}else if(e.which){keynum=e.which;}switch(keynum){case 13:if(gE("suggest").style.display=="block"){if(CurrentSuggestIndex()>-1){AddSuggest(CurrentSuggestIndex());StopProcessingEvents(e);return false;}}if(SearchBarType=="0"){DoSearchSalesExpanded(ele.form);}else{DoSearchSalesSmall(ele.form);}break;case 27:CloseSuggest();ele.value=val;return false;break;default:return true;break;}}function ForeclosureSuggestUp(e,ele){if(gE("search_alert").style.display=="block"){return false;}var val=ele.value;if(window.event){keynum=e.keyCode;}else if(e.which){keynum=e.which;}switch(keynum){case 13:if(gE("suggest").style.display=="block"){CloseSuggest();StopProcessingEvents(e);return false;}return true;break;case 27:CloseSuggest();ele.value=val;return false;break;case 40:SuggestSelect(CurrentSuggestIndex()+1);break;case 38:SuggestSelect(CurrentSuggestIndex()-1);break;default:if(trim(ele.value).length>1){var Query=String.format("{0}Controls/AjaxCalls/ForeclosureSuggest.aspx?C={1}&term={2}",WebRoot,GetC(),trim(ele.value));$AJAX.GetForDelegate(ShowSuggest,Query);}else{CloseSuggest();}break;}}function StopProcessingEvents(e){if(e&&e.preventDefault){e.preventDefault();}else if(window.event&&window.event.returnValue){window.eventReturnValue=false;}}function CurrentSuggestIndex(){var LIS=gE("suggest").getElementsByTagName("div");var T=-1;for(var x=0;x<LIS.length;x++){if(LIS[x].className=='hot'){T=x;break;}}return T;}function ScrollToItem(elepos){var eleE=gE('ila'+elepos);var eleS=gE("suggest");var Etop=eleE.offsetTop;var Stop=eleS.scrollTop;if(Etop<gE("suggest").scrollTop){gE("suggest").scrollTop=Etop;}else if((Etop+eleE.offsetHeight)>(Stop+eleS.offsetHeight)){gE("suggest").scrollTop=Etop-eleS.offsetHeight+eleE.offsetHeight;}}function SuggestSelect(num){var LIS=gE("suggest").getElementsByTagName("div");var item=null;for(var x=0;x<LIS.length;x++){if(x==num){LIS[x].className='hot';item=x;}else{LIS[x].className='non';}}if(item==null){if(num>LIS.length-1){item=LIS.length-1;LIS[item].className='hot';}else{item=0;}}if(item>0){ScrollToItem(item);}}function ShowSuggest(AjaxResponse){if(trim(AjaxResponse).length>0){if(gE("suggest").style.display!="block"){gE("suggest").style.display="block";}search_alert_close();ToggleSelects("hidden");gE("suggest").innerHTML=AjaxResponse;}else{CloseSuggest();}}function ToggleSelects(visibility){var Sel=document.getElementsByTagName("select");for(var x=0;x<Sel.length;x++){Sel[x].style.visibility=visibility;}}function CloseSuggest(){gE("suggest").style.display="none";ToggleSelects("visible");}function AddSuggest(index){var CityName=gE("ila"+index).innerHTML.replace(/<[^>]+>/g,"").replace(/\s\/\s/g,"/");var EndecaId=gE("ila"+index).getAttribute('name');gE("txtSearch").value=CityName.toUpperCase();gE("EndecaId").value=EndecaId;}function search_alert(strMessage,strClassName){window.setTimeout(function(){if(strClassName==undefined){strClassName="search_alert";}if(BarStatus.value!=BevtQueue){gE("txtSearch").blur();window.setTimeout(function(){search_alert(strMessage,strClassName);},300);return;}CloseSuggest();ToggleSelects("hidden");gE("search_alert").style.display="block";gE("search_alert").className=strClassName;gE("search_alert_message").innerHTML=strMessage;},300);}function search_alert_close(){if(gE("suggest").style.display=="none"){ToggleSelects("visible");}gE("search_alert").style.display="none";}function SwitchSearchType(strStatus){window.setTimeout(function(){if(strStatus==undefined){if(gE("search_type_list").style.display!='block'){strStatus="open";}else{strStatus="close";}}if(strStatus=="open"){if(BarStatus.value!=BevtQueue){gE("txtSearch").blur();window.setTimeout(function(){SwitchSearchType(strStatus);},300);return;}gE("search_type_list").style.display='block';gE("search_list_backOpen").style.display='block';var G=new GetWindowBunds();gE("search_list_backOpen").style.left="1px";gE("search_list_backOpen").style.top="1px";gE("search_list_backOpen").style.width=(G.VisibleWidth-20)+"px";gE("search_list_backOpen").style.height=(G.PageHeight-20)+"px";}else{gE("search_type_list").style.display='none';gE("search_list_backOpen").style.display='none';}},300);}var BevtQueue="clicked off";function Bevt(e){var theTarget;if(!e){e=window.event;}if(e.target){theTarget=e.target;}else if(e.srcElement){theTarget=e.srcElement;}if(theTarget.nodeType==3){theTarget=theTarget.parentNode;}switch(e.type){case"focus":BarStatus.value="event: "+e.type+"\nTarget ID: "+theTarget.id;break;case"blur":BarStatus.value=BevtQueue;window.clearTimeout(BarStatus.timeout);BarStatus.timeout=window.setTimeout(function(){if(BarStatus.value==BevtQueue){if(PageCache!=null){SwitchSearch('sales','small',PageCache.QueryString);}else{SwitchSearch('sales','small',DefaultQueryString);}}},200);break;}}var BarStatus=new BevtValue(BevtQueue);function BevtValue(Bevt){this.value=Bevt;this.timeout=window.setTimeout(function(){void(null);},1);}function BevtStasis(val){window.setTimeout(function(){BarStatus.value=val;},100);}