function validateInput(){var n=document.getElementById("businessCategories");n&&n.value.toLowerCase()=="xx"&&(n.options[n.selectedIndex].value="XX")}var Geo=function(){function e(n,t,i,r){r?n.append('<option selected="selected" value="'+(i||"")+'">'+t+"</option>"):n.append('<option value="'+(i||"")+'">'+t+"</option>")}function l(n,t){e(n,o||"All Counties"),$(t).each(function(){e(n,this.CountyName,this.CountyCode)}),n.removeAttr("disabled")}function t(n){n.attr("disabled","disabled"),n.empty()}function n(n){t(n),e(n,i||"Select one state to search by county","",!0)}function s(n){n.empty()}function h(n,t){n.append('<option value="XX" selected>Select a City</option>');for(var i=0;i<t.length;i++)n.append('<option value="'+t[i].Zip+'">'+t[i].CityName+"</option>")}function f(n){n.empty()}function ut(n,t){var i,r;for(n.append('<option value="0" selected>Select a Neighborhood</option>'),i=0;i<t.length;i++)r=document.createElement("option"),r.innerText=t[i].SubMarketName,r.value=t[i].SubMarketId,n.append(r)}function rt(n){f(n),n.attr("disabled","disabled").append('<option value="0" selected>Select a Neighborhood</option>')}function it(){var n=0;return $.ajax({url:"/xcommon/Services/Geo.asmx/GetIPLocationRegionID",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",async:!1,success:function(t){n=t.d},error:function(){}}),n}function tt(n){var t="";return $.ajax({url:"/xcommon/Services/Geo.asmx/GetStateCodeByRegionID",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",data:JSON.stringify({regionID:n}),async:!1,success:function(n){t=n.d},error:function(){}}),t}function b(n){var t=0;return $.ajax({url:"/xcommon/Services/Geo.asmx/GetRegionIDByLegacyStateCode",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",data:JSON.stringify({legacyStateCode:n}),async:!1,success:function(n){t=n.d},error:function(){}}),t}function g(n){var t="";return $.ajax({url:"/xcommon/Services/Geo.asmx/GetStateSeoDescriptionByRegionID",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",data:JSON.stringify({regionID:n}),async:!1,success:function(n){t=n.d},error:function(){}}),t}function d(n){var t="";return $.ajax({url:"/xcommon/Services/Geo.asmx/GetStateDescriptionByRegionID",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",data:JSON.stringify({regionID:n}),async:!1,success:function(n){t=n.d},error:function(){}}),t}function k(n){var t="";return $.ajax({url:"/xcommon/Services/Geo.asmx/GetStateAbbreviationByRegionID",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",data:JSON.stringify({regionID:n}),async:!1,success:function(n){t=n.d},error:function(){}}),t}function ft(){var n="";return $.ajax({url:"/xcommon/Services/Geo.asmx/GetIPLocationRegionStateCode",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",async:!1,success:function(t){n=t.d},error:function(){}}),n}function w(){var n="";return $.ajax({url:"/xcommon/Services/Geo.asmx/GetIPLocationRegionDescription",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",async:!1,success:function(t){n=t.d},error:function(){}}),n}function u(n,t,i,r){var u=t.val();u&&u!=="XX"&&$.ajax({url:"/xcommon/Services/Geo.asmx/GetCitiesByCountyCode",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",data:JSON.stringify({countyCode:u}),async:!0,success:function(n){n=n&&n.d?n.d:null,n&&n.length&&(s(i),h(i,n),r!==""&&r!==null&&i.find("option:contains("+r+")").attr("selected","selected"))},error:function(){}})}function p(n,t,i,r){var u=n.val();u&&$.ajax({url:"/xcommon/Services/Geo.asmx/GetCitiesFromPdsByState",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",data:JSON.stringify({regionId:u,countyCode:r}),async:!1,success:function(n){n=n&&n.d?n.d:null,n&&n.length&&(s(t),h(t,n),i!==""&&i!==null&&t.find("option:contains("+i+")").attr("selected","selected"))},error:function(){}})}function y(n,t,i,r){var u=n.val();u&&(t.removeAttr("disabled"),u=parseInt(u),$.ajax({url:"/xcommon/Services/Geo.asmx/GetSubMarketsByState",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",data:JSON.stringify({regionId:u,selectedCity:r}),async:!1,success:function(n){n=n&&n.d?n.d:null,n&&n.length?(f(t),ut(t,n)):(f(t),t.append('<option value="0" selected>No Neighborhoods Available for City</option>'))},error:function(){}}))}function r(i,r,u,f,e,o,s){var h=i.val(),c,a;typeof h!="string"&&(h=h.length==1?h[0]:""),c=h=="ZZ"||h.charAt(0)=="Y",h&&h!="XX"&&(!c||f)?(a=function(i){i&&i.length?(o&&o(),t(r),l(r,i),f&&r.find("[value="+f+"]").attr("selected","selected")):(s&&s(),n(r))},c?(h=typeof f=="number"?f:parseInt(f,10),$.ajax({url:"/xcommon/Services/Geo.asmx/GetCountiesByCountyCode",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",data:JSON.stringify({countyCode:h}),async:!1,success:function(n){n=n&&n.d?n.d:null,a(n)},error:function(){}})):$.ajax({url:"/xcommon/Services/Geo.asmx/GetCountiesByRegion",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",data:JSON.stringify({region:h}),async:!1,success:function(n){n=n&&n.d?n.d:null,a(n)},error:function(){}})):(s&&s(),n(r))}function c(t,i,r,u){var f,s,e,o;r=!!r,window.Utilities&&typeof Utilities.BuildAndExecuteCrossDomainGetRequest=="function"&&(f=t.val(),typeof f!="string"&&(f=f.length==1?f[0]:""),s=f=="ZZ"||f.charAt(0)=="Y",f&&f!="XX"&&(!s||u)?(e="https://www.bizbuysell.com/cobranding/Services/Geo.get.asmx/GetCountiesByRegionLegacyStateCode",o={selectedRegionLegacyStateCode:'"'+f+'"'},r&&(e="https://www.bizbuysell.com/cobranding/Services/Geo.get.asmx/GetCountiesByRegionID",o={selectedRegionID:parseInt(f.replace(/[^0-9]/g,""),10)}),Utilities.BuildAndExecuteCrossDomainGetRequest(e,o,function(n){v(n||[],i,u)},!1)):n(i))}function v(i,r,u){i&&i.length?(t(r),l(r,i),u&&r.find("[value="+u+"]").attr("selected","selected")):n(r)}function a(n,t,i,u){i=i||{};var s=i.SelectedCounty,h=!!i.UseGetRequest,e=!!i.UseRegionID,f=$("#"+n),o=$("#"+t);f.change(function(){h?c(f,o,e):r(f,o,e)}),h?c(f,o,e,s):r(f,o,e,s,u)}function nt(n,t,i,r){r=r||{};var e=r.SelectedCity,f=$("#"+n),o=$("#"+i),s=$("#"+t);f.change(function(){u(f,s,o,e)}),u(f,s,o,e)}function et(n){i=n.SelectStateText||i,o=n.AllCountiesText||o}var i,o;return{ClearCountyDropDown:t,LinkStateAndCountyDropDowns:a,SetDefaultText:et,loadCountyDropDown:r,GetIPLocationRegionID:it,GetIPLocationStateCode:ft,GetStateCodeByRegionID:tt,GetRegionIDByLegacyStateCode:b,GetStateSeoDescriptionByRegionID:g,GetStateAbbreviationByRegionID:k,GetStateDescriptionByRegionID:d,GetIPLocationStateDescription:w,loadCityDropDown:u,LoadCityDropDownFromPdsState:p,LinkCountyAndCityDropDowns:nt,loadSubMarketsDropDownFromPdsState:y,resetSubMarketDropDown:rt}}(),ddlBusinessCategories,SmallBizTrends;(function(n){n.fn.bjqs=function(t){var i={},ft={width:700,height:300,animation:"fade",animationDuration:450,automatic:!0,rotationSpeed:4e3,hoverPause:!0,showControls:!0,centerControls:!0,nextText:"Next",prevText:"Prev",showMarkers:!0,centerMarkers:!0,keyboardNav:!0,useCaptions:!0,backLinkID:"ffs_link",forwardLinkID:"bfs_link"},l=this,o=l.find(".bjqs"),f=o.children("li"),u=f.length,s=!1,h=!1,d=0,a=1,r=0,b=f.eq(d),v="forward",nt="backward",rt,p,g,c,w,ut,k,e;i=n.extend({},ft,t),f.css({height:i.height,width:i.width}),n("#"+i.backLinkID).click(function(n){n.preventDefault(),e("backward",!1)}),n("#"+i.forwardLinkID).click(function(n){n.preventDefault(),e("forward",!1)}),o.css({height:i.height,width:i.width}),l.css({height:i.height,width:i.width}),f.addClass("bjqs-slide");if(i.showControls&&u>1){var it=n('<ul class="bjqs-controls"></ul>'),y=n('<li><a href="#" class="bjqs-next" class="controls">'+i.nextText+"</a></li>"),tt=n('<li><a href="#" class="bjqs-prev" class="controls">'+i.prevText+"</a></li>");y.click(function(n){n.preventDefault(),s||e(v,!1)}),tt.click(function(n){n.preventDefault(),s||e(nt,!1)}),y.appendTo(it),tt.appendTo(it),it.appendTo(l),i.centerControls&&(rt=y.children("a"),w=(l.height()-rt.height())/2,y.children("a").css("top",w).show(),tt.children("a").css("top",w).show())}return i.showMarkers&&u>1&&(p=n('<ol class="bjqs-markers"></ol>'),n.each(f,function(t){i.animType==="slide"?t!==0&&t!==u-1&&(g=n('<li><a href="#">'+t+"</a></li>")):(t++,g=n('<li><a href="#">'+t+"</a></li>")),g.click(function(i){i.preventDefault(),n(this).hasClass("active-marker")||s||e(!1,t)}),g.appendTo(p)}),c=p.children("li"),c.eq(d).addClass("active-marker"),p.appendTo(l),i.centerMarkers&&(w=(i.width-p.width())/2,p.css("left",w))),i.keyboardNav&&u>1&&n(document).keyup(function(n){h||(clearInterval(k),h=!0),s||(n.keyCode===39?(n.preventDefault(),e(v,!1)):n.keyCode===37&&(n.preventDefault(),e(nt,!1))),h&i.automatic&&(k=setInterval(function(){e(v)},i.rotationSpeed),h=!1)}),i.useCaptions&&n.each(f,function(t,i){var r=n(i),e=r.children("img:first-child"),u=e.attr("title"),f;u&&(f=n('<p class="bjqs-caption">'+u+"</p>"),f.appendTo(r))}),i.hoverPause&&i.automatic&&l.hover(function(){h||(clearInterval(k),h=!0)},function(){h&&(k=setInterval(function(){e(v)},i.rotationSpeed),h=!1)}),i.animation==="slide"&&u>1&&($first=f.eq(0),$last=f.eq(u-1),$first.clone().addClass("clone").removeClass("slide").appendTo(o),$last.clone().addClass("clone").removeClass("slide").prependTo(o),f=o.children("li"),u=f.length,$wrapper=n('<div class="bjqs-wrapper"></div>').css({width:i.width,height:i.height,overflow:"hidden",position:"relative"}),o.css({width:i.width*u,left:-i.width}),f.css({float:"left",position:"relative",display:"list-item"}),$wrapper.prependTo(l),o.appendTo($wrapper)),ut=function(n){return i.animation==="fade"&&(n===v?b.next().length?r++:r=0:n===nt&&(b.prev().length?r--:r=u-1)),i.animation==="slide"&&(n===v&&(r=a+1),n===nt&&(r=a-1)),r},i.automatic&&u>1&&(k=setInterval(function(){e(v,!1)},i.rotationSpeed)),f.eq(d).show(),o.show(),e=function(n,t){s||(r=n?ut(n):t&&i.animation==="fade"?t-1:t,s=!0,i.animation==="fade"?(i.showMarkers&&(c.eq(d).removeClass("active-marker"),c.eq(r).addClass("active-marker")),y=f.eq(r),b.fadeOut(i.animationDuration),y.fadeIn(i.animationDuration,function(){b.hide(),d=r,b=y,s=!1})):i.animation==="slide"&&(i.showMarkers&&(c.eq(a-1).removeClass("active-marker"),r===u-1?c.eq(0).addClass("active-marker"):r===0?c.eq(u-3).addClass("active-marker"):c.eq(r-1).addClass("active-marker")),o.animate({left:-r*i.width},i.animationDuration,function(){r===0?(a=u-2,o.css({left:-a*i.width})):r===u-1?(a=1,o.css({left:-i.width})):a=r,s=!1})))},this}})(jQuery),$(function(){Geo.SetDefaultText({SelectStateText:"Select Your County"}),Geo.LinkStateAndCountyDropDowns("ddlStates","ddlCounties")}),ddlBusinessCategories=document.getElementById("businessCategories"),ddlBusinessCategories&&ddlBusinessCategories.value.toLowerCase()=="xx"&&(ddlBusinessCategories.selectedIndex=0);if($("#bfs_slider").length>0){function sliderInit(){$("#bfs_slider").length>0&&$("#bfs_slider").bjqs({animation:"slide",width:270,height:250,showControls:!1});var n=$(".businessInfo");n.length>0&&n.each(function(t,i){for(var u='<span class="indicator">',r,f=0;f<n.length-2;f++)r=0,r=t==0?n.length-2:t==n.length-1?0:t-1,u+=r==f?"<b>&#8226;</b> ":"&#8226; ";u=u.trim()+"</span>",$(i).append(u)})}function deferShowcaseListings(){var n=document.createElement("script");n.type="text/javascript",n.readyState?n.onreadystatechange=function(){(n.readyState==="loaded"||n.readyState==="complete")&&(n.onreadystatechange=null,sliderInit())}:n.onload=function(){sliderInit()},n.src="/cobranding/Handlers/ShowcaseBusinesses.ashx?J=AY&cb_sbsdt=10&cb_sbdt=10&cb_sbwcid=bfs_slider",document.body.appendChild(n)}window.addEventListener?window.addEventListener("load",deferShowcaseListings,!1):window.attachEvent?window.attachEvent("onload",deferShowcaseListings):window.onload=deferShowcaseListings}SmallBizTrends=function(){var n={},t=this;return n}()