
var CITIES_VISIBLE=0;var COUNTIES_VISIBLE=0;var subdivision_autocomplete_menu;function disableInputs(parentId){$$('#'+parentId+' input').each(function(s){s.disabled=true;});$$('#'+parentId+' select').each(function(s){s.disabled=true;});}
function enableInputs(parentId){$$('#'+parentId+' input').each(function(s){s.disabled=false;});$$('#'+parentId+' select').each(function(s){s.disabled=false;});}
function showCounties(state){$$("#ul_county li[rel="+state+"]").each(function(c_li){$(c_li).show();if(c_li.className!='county_label'){COUNTIES_VISIBLE++;}});$("county_tip").hide();}
function showCities(county){$$("#ul_city li[rel="+county+"]").each(function(c_li){$(c_li).show();if(c_li.className!='county_label'){CITIES_VISIBLE++;}});$("city_tip").hide();}
function hideCounties(state){if(state){$$("#ul_county li[rel='"+state+"']").each(function(c_li){if($(c_li).visible()){$(c_li).hide();if(c_li.className!='county_label'){COUNTIES_VISIBLE--;var checkbox=$(c_li).firstDescendant().firstDescendant();if(checkbox.checked==true){hideCities(checkbox.value);}
checkbox.checked=false;}}});}else{$$('#ul_county li[rel]').each(function(c_li){$(c_li).hide();if(c_li.className!='county_label'){var checkbox=$(c_li).firstDescendant().firstDescendant();if(checkbox.checked==true){hideCities(checkbox.value);}
checkbox.checked=false;}});COUNTIES_VISIBLE=0;}
if(COUNTIES_VISIBLE==0){$("county_tip").show();}}
function hideCities(county){if(county){$$("#ul_city li[rel='"+county+"']").each(function(c_li){if($(c_li).visible()){$(c_li).hide();if(c_li.className!='county_label'){CITIES_VISIBLE--;var checkbox=$(c_li).firstDescendant().firstDescendant();checkbox.checked=false;}}});}else{$$('#ul_city li[rel]').each(function(c_li){$(c_li).hide();if(c_li.className!='county_label'){var checkbox=$(c_li).firstDescendant().firstDescendant();checkbox.checked=false;}});CITIES_VISIBLE=0;}
if(CITIES_VISIBLE==0){$('city_tip').show();}}
function toggleSearchBySection(section){var id='searchBy_'+section;var searchby_url="?";$("searchBySection").update('<div class="oneColumn"><p class="instructions">Loading...</p></div>');var action='get_search_by_inputs_for_'+section;new Ajax.Request(searchby_url,{method:'post',parameters:{controller:'Search',action:action},onSuccess:function(transport){searchby_html=transport.responseText;$("searchBySection").update(searchby_html);},onFailure:function(){alert("The ajax request failed - was trying to retrieve inputs for search by...");}});if(id=='searchBy_mls_no'){disableInputs("searchFormMain");$("searchFormMain").hide();}else{enableInputs("searchFormMain");$("searchFormMain").show();}}
function attachAdvancedSearchEvents()
{$$('ul.scrollBox li label input').each(function(the_input){$(the_input).observe('click',function(){if(the_input.checked==true){$(the_input.parentNode).addClassName('selected');}else{$(the_input.parentNode).removeClassName('selected');}});});$("selectSearchBy").observe('change',function(){var index=$("selectSearchBy").selectedIndex;var div_id='searchBy_'+$('selectSearchBy').options[index].value;var section=$('selectSearchBy').options[index].value;toggleSearchBySection(section);});}
Event.observe(window,'load',function()
{attachAdvancedSearchEvents();});