function setupLocationSearch(){var t=document.getElementById("location-search-submit"),n=document.getElementById("location-types-select"),i=t.getAttribute("data-post-url"),r;t.addEventListener("click",function(){var e="find-care-find-a-location"+n.value.replace(/\s/g,"-").toLowerCase(),f=document.getElementById(e),r=[],u;n.value!=null&&n.value.trim().length>0&&(r.push("locationtype="+n.value),f!=null&&r.push("supplement="+f.value));u=document.getElementById("location-search-query");u.value!=null&&u.value.trim().length>0&&r.push("cityzip="+u.value);methodist.analytics.pushEvent("component_cta_clicked",{component:{interaction_item:"search button: "+t.getAttribute("data-name"),sc_item_id:t.getAttribute("data-id"),sc_rendering_id:t.getAttribute("data-rendering"),sc_component_name:t.getAttribute("data-name"),sc_component_cta_label:t.innerText}});window.location.href=r.length===0?i:i.indexOf("?")>-1?i+"&"+r.join("&"):i+"?"+r.join("&")});r=function(){var r=n.getAttribute("data-link")==="true",t,i;if(r){window.location.href=this.value;return}t="find-care-find-a-location"+n.value.replace(/\s/g,"-").toLowerCase();i=document.querySelectorAll(".supplemental-location-types");Array.prototype.slice.call(i).forEach(function(n){n.parentElement.classList.add("supplemental-location-types-hidden");n.id===t+"-container"&&n.parentElement.classList.remove("supplemental-location-types-hidden")})};n.addEventListener("change",r);setTimeout(function(){n.value="";var t=document.querySelectorAll(".supplemental-location-types");Array.prototype.slice.call(t).forEach(function(n){n.value=""})},10)}document.addEventListener("DOMContentLoaded",setupLocationSearch)