function SetHoldValues(n,t){HoldValuesFunction.HoldValuesFor(n,t)}function GetHidCountries(n){var t=$('input[name="hidCountries"]',n).val();return t?t:""}function GetEventTypeAndSubEventTypeID(n){EventTypeID=$("input[class*=hidEventTypeID]",n).val();(typeof EventTypeID==typeof undefined||EventTypeID==!1)&&(EventTypeID=$("[name=EventTypeID]",n).val(),(typeof EventTypeID==typeof undefined||EventTypeID==!1)&&(EventTypeID=$("[name$=EventTypeID]",n).val(),(typeof EventTypeID==typeof undefined||EventTypeID==!1)&&(EventTypeID=0)));SubEventTypeID=$("input[class*=hidSubEventTypeID]",n).val();(typeof SubEventTypeID==typeof undefined||SubEventTypeID==!1)&&(SubEventTypeID=0);AuctionType=$(".hidlistingsearchshowonlineauctiononly",n).val();typeof AuctionType!=typeof undefined&&AuctionType=="true"?AuctionType="online":(AuctionType=$(".hidlistingsearchshowupcomingauctionlistings",n).val(),AuctionType=typeof AuctionType!=typeof undefined&&AuctionType=="true"?"upcoming":"")}function IndustryDropDownChanged(n,t,i,r,u,f,e,o){var h=$("select[class*="+IndustryDropDownClassName+"] option:selected",o),s=h.val();$("#tbManufacturer",o).val("");s==r?s=null:s!=""&&(r=null);IndustrySelected(s,!1,!1,n,t,i,r,u,f,e,o)}function IndustrySelected(n,t,i,r,u,f,e,o,s,h,c){var v=$("select[class*="+CategoryDropDownClassName+"]",c),a=$("select[class*="+ManufacturerDropDownClassName+"]",c),y=$("select[class*="+ModelDropDownClassName+"]"),c,l;$("option:selected",a).each(function(n,t){prevMakeVal[n]=$(t).text()});l=$("input[class*="+ModelTextBoxClassName+"]").val();l!=undefined&&l.length>0&&(prevModelVal=l);ResetAndDefaultOption(v,undefined,undefined,c);ResetAndDefaultOption(a,undefined,undefined,c);ResetAndDefaultOption(y,undefined,undefined,c);i&&ShowHideSubIndustry(!1,c);t?GetSubIndustryAjax(n,r,u,f,e,o,s,h,c):n&&n>0?((e==null||e=="")&&(e=n),disableCatMakeModel(c),GetCategoryAjax(e,r,u,f,o,s,h,c)):r&&(n=$("input[class*=listingsearchbasecategoryid]",c).val(),(e==null||e=="")&&(e=n),n&&n>0&&$("#tbManufacturer",c).length==0&&a.length>0&&GetManufacturerAjax(n,e,r,u,f,o,s,h,c))}function ShowHideSubIndustry(n,t){var i=$("select[class*="+IndustryDropDownClassName+"]",t),r=$("div[class*="+SubIndustryLabelClassName+"]",t);n?(i.show(),r.show()):(i.hide(),r.hide())}function GetSubIndustryAjax(n,t,i,r,u,f,e,o,s){GetEventTypeAndSubEventTypeID(s);typeof t==typeof undefined&&(t=!1);(typeof i==typeof undefined||i==!1)&&(i="");(typeof f==typeof undefined||f==!1)&&(f="");(typeof o==typeof undefined||o==!1)&&(o="");(typeof e==typeof undefined||e==!1)&&(e="");(typeof r==typeof undefined||r==!1)&&(r=0);(u==null||u=="")&&(u=n);$.ajax({url:window.Overrides.baseUrl+"/AjaxContent/GetIndustryList",cache:!1,contentType:"application/json; charset=utf-8",data:window.Overrides.jsonDataFunction({IndustryID:n,EventTypeID:EventTypeID,SubEventTypeID:SubEventTypeID,GetOnlyWithCount:t,DealerGroupName:i,PrimaryContactID:r,AuctionType:AuctionType,ParentCategoryID:u,ExclusiveDealerGroupIDs:f,ShowWholeSaleOnly:e,EventCategoryIDs:o,Countries:GetHidCountries(s)}),type:"POST",dataType:window.Overrides.ajaxDataType,success:function(h){DoGetSubIndustryAjaxResult(h,n,t,i,r,u,f,e,o,s);typeof reloadSubIndustryCallback=="function"&&(reloadSubIndustryCallback(),reloadSubIndustryCallback=null)},error:function(n){var t=n}})}function DoGetSubIndustryAjaxResult(n,t,i,r,u,f,e,o,s,h){var c=$("select[class*="+IndustryDropDownClassName+"]",h),l;ResetAndDefaultOption(c,undefined,undefined,h);$.each(n,function(){c.append($("<option />").val(this.Value).text(this.Text))});HoldValuesFunction.RepopulateHeldValue("#"+c.attr("id"),h);ShowHideSubIndustry(!0,h);enableCatMakeModel(h);c.val()==""&&i&&$("#tbManufacturer",h).length==0&&((f==null||f=="")&&(f=t),l=$("select[class*="+ManufacturerDropDownClassName+"]",h),l.length>0&&GetManufacturerAjax(t,f,i,r,u,e,o,s,h))}function GetLocationParams(n){var i=$('[name$="Radius"]',n).val(),f=$('[name$="Location.Latitude"]',n).val(),e=$('[name$="Location.Longitude"]',n).val();if(f&&e&&$.isNumeric(f)&&$.isNumeric(e))return{Latitude:f,Longitude:e,Distance:i};var r=$('[name$="Location.City"]',n).val(),u=$('[name$="Location.State"]',n).val(),t=$('[name$="Location.Country"]',n).val();return u&&t&&u!=""&&t!=""?r&&i&&r!=""&&parseInt(i)>0?{Countries:t,States:u,City:r,Distance:i}:{Countries:t,States:u,City:r}:t&&t!=""?{Countries:t}:{Countries:GetHidCountries(n)}}function DisableRadius(n){var i=$('[name$="Location.State"]',n).val(),r=$('[name$="Location.Country"]',n).val(),u=$('[name$="Location.City"]',n).val(),t=$('[name$="Radius"]',n);i&&r&&i!=""&&r!=""&&u==""?(t.val(""),t.find("option:not(:first)").prop("disabled",!0)):t.find("option:not(:first)").prop("disabled",!1)}function GetCategoryAjax(n,t,i,r,u,f,e,o){GetEventTypeAndSubEventTypeID(o);typeof t==typeof undefined&&(t=!1);(typeof i==typeof undefined||i==!1)&&(i="");(typeof u==typeof undefined||u==!1)&&(u="");(typeof e==typeof undefined||e==!1)&&(e="");(typeof f==typeof undefined||f==!1)&&(f="");(typeof r==typeof undefined||r==!1)&&(r=0);$.ajax({url:window.Overrides.baseUrl+"/AjaxContent/GetCategoryList",cache:!1,contentType:"application/json; charset=utf-8",data:window.Overrides.jsonDataFunction($.extend(!0,{CategoryID:n,EventTypeID:EventTypeID,SubEventTypeID:SubEventTypeID,GetOnlyWithCount:t,DealerGroupName:i,PrimaryContactID:r,AuctionType:AuctionType,ExclusiveDealerGroupIDs:u,ShowWholeSaleOnly:f,EventCategoryIDs:e,IsParentCategoryDisabled:t||parseInt($("input[name$='EquipmentMessageId']",o).val())==0},GetLocationParams(o))),type:"POST",dataType:window.Overrides.ajaxDataType,success:function(s){DoGetCategoryAjaxResult(s,n,t,i,r,u,f,e,o);typeof reloadCategoryCallback=="function"&&reloadCategoryCallback()},error:function(n){var t=n}})}function DoGetCategoryAjaxResult(n,t,i,r,u,f,e,o,s){var h=$("select[class*="+CategoryDropDownClassName+"]",s),c;ResetAndDefaultOption(h,undefined,undefined,s);$.each(n,function(){h.append($("<option />").val(this.Value).text(this.Text).prop("disabled",this.Enabled==!1))});n.length==0&&h.append($("<option />").val("").text(GetTranslation("NoCategoriesAvailable","No Categories Available")+" | "+GetTranslation("ExpandYourSearch","Expand Your Search")).prop("disabled",!0).prop("selected",!0));HoldValuesFunction.RepopulateHeldValue("#"+h.attr("id"),s);enableCatMakeModel(s);(h.val()<=0||h.val()==t)&&(c=$("select[class*="+ManufacturerDropDownClassName+"]",s),i&&$("#tbManufacturer").length==0&&c.length>0&&GetManufacturerAjax(t,t,i,r,u,f,e,o,s))}function CategoryDropDownChanged(n,t,i,r,u,f,e,o,s){n<=0&&(n=$("select[class*="+IndustryDropDownClassName+"] option:selected",s).val());var h=$("select[class*="+CategoryDropDownClassName+"] option:selected",s).val(),c=$("select[class*="+ManufacturerDropDownClassName+"]",s),l=$("select[class*="+ModelDropDownClassName+"]",s);ResetAndDefaultOption(c,undefined,undefined,s);ResetAndDefaultOption(l,undefined,undefined,s);$("#tbManufacturer",s).val("");t&&h<=0&&(h=u!=undefined&&u!=null&&u>0?u:n);n&&h&&c.length>0&&n>0&&h>0&&$("#tbManufacturer",s).length==0&&(disableCatMakeModel(s),GetManufacturerAjax(n,h,t,i,r,f,e,o,s))}function disableCatMakeModel(n){$("select[class*="+IndustryDropDownClassName+"]",n).prop("disabled",!0);$("select[class*="+CategoryDropDownClassName+"]",n).prop("disabled",!0);$("select[class*="+ManufacturerDropDownClassName+"]",n).prop("disabled",!0);$("input[class*="+ModelTextBoxClassName+"]",n).prop("disabled",!0)}function enableCatMakeModel(n){$("select[class*="+IndustryDropDownClassName+"]",n).prop("disabled",!1);$("select[class*="+CategoryDropDownClassName+"]",n).prop("disabled",!1);$("select[class*="+ManufacturerDropDownClassName+"]",n).prop("disabled",!1);$("input[class*="+ModelTextBoxClassName+"]",n).prop("disabled",!1);$.isFunction($.fn.validateDisabledIf)&&$("[data-val-disabledif-dependentproperty]",n).validateDisabledIf()}function GetManufacturerAjax(n,t,i,r,u,f,e,o,s){GetEventTypeAndSubEventTypeID(s);typeof i==typeof undefined&&(i=!1);(typeof r==typeof undefined||r==!1)&&(r="");(typeof f==typeof undefined||f==!1)&&(f="");(typeof o==typeof undefined||o==!1)&&(o="");(typeof e==typeof undefined||e==!1)&&(e="");(typeof u==typeof undefined||u==!1)&&(u=0);var h;h=i?"/AjaxContent/GetManufacturerMultiSelectList":"/AjaxContent/GetManufacturerList";$.ajax({url:window.Overrides.baseUrl+h,cache:!1,contentType:"application/json; charset=utf-8",data:window.Overrides.jsonDataFunction($.extend(!0,{IndustryID:n,CategoryID:t,EventTypeID:EventTypeID,SubEventTypeID:SubEventTypeID,GetOnlyWithCount:i,DealerGroupName:r,PrimaryContactID:u,AuctionType:AuctionType,ExclusiveDealerGroupIDs:f,ShowWholeSaleOnly:e,EventCategoryIDs:o},GetLocationParams(s))),type:"POST",dataType:window.Overrides.ajaxDataType,success:function(n){DoGetManufacturerAjaxResult(n,s);typeof reloadManufacturerCallback=="function"&&reloadManufacturerCallback()},error:function(n){var t=n}})}function DoGetManufacturerAjaxResult(n,t){var i=$("select[class*="+ManufacturerDropDownClassName+"]",t),u,r;for(ResetAndDefaultOption(i,undefined,undefined,t),$.each(n,function(){i.append($("<option />").val(this.Value).text(this.Text))}),HoldValuesFunction.RepopulateHeldValue("#"+i.attr("id"),t),enableCatMakeModel(t),u=!1,r=0;r<prevMakeVal.length;r++)$("option[value='"+prevMakeVal[r]+"']",i).length>0&&(i.val(prevMakeVal),u=!0);u?$("input[class*="+ModelTextBoxClassName+"]").val(prevModelVal):($("input[class*="+ModelTextBoxClassName+"]").val(""),$('input[name="MaintainCurrentModelGroupSearch"]').prop("checked",!1));prevMakeVal=[]}function ManufacturerDropDownChanged(n){var t=$("select[class*="+IndustryDropDownClassName+"] option:selected",n).val(),i=$("select[class*="+CategoryDropDownClassName+"] option:selected",n).val(),r=$("select[class*="+ManufacturerDropDownClassName+"] option:selected",n).val(),u=$("select[class*="+ModelDropDownClassName+"]",n);ResetAndDefaultOption(u,undefined,undefined,n);t&&i&&r&&t>0&&i>0&&r!=""&&(disableCatMakeModel(n),GetModelAjax(t,i,r,n))}function GetModelAjax(n,t,i,r){$.ajax({url:window.Overrides.baseUrl+"/AjaxContent/GetModelList",cache:!1,contentType:"application/json; charset=utf-8",data:window.Overrides.jsonDataFunction({IndustryID:n,CategoryID:t,Manufacturer:i}),type:"POST",dataType:window.Overrides.ajaxDataType,success:function(n){DoGetModelAjaxResult(n,r);typeof reloadModelCallback=="function"&&reloadModelCallback()},error:function(n){var t=n}})}function DoGetModelAjaxResult(n,t){var i=$("select[class*="+ModelDropDownClassName+"]",t);ResetAndDefaultOption(i,ModelPlaceHolder,"",t);$.each(n,function(){i.append($("<option />").val(this.Value).text(this.Text))});HoldValuesFunction.RepopulateHeldValue("#"+i.attr("id"),t);enableCatMakeModel(t)}function ResetAndDefaultOption(n,t,i,r){var u,e,o,f;n&&(u=n.val(),u&&(e=u!="",e&&!isNaN(parseFloat(u))&&isFinite(u)&&u<=0&&(e=!1),HoldValuesFunction.HoldValue("#"+n.attr("id"),e,r)),o=!1,t||i||(t=$(n).attr("defaultText"),i=$(n).attr("defaultValue"),t||i||(f=$(":first",n),o=f.prop("disabled"),f&&(t=f.text(),i=f.val()))),n.empty(),n.append($("<option />").val(i).text(t).prop("selected",!0).prop("disabled",o)))}function GetSortOrdersAjax(n,t){if(typeof n==typeof undefined){var i=$("select[class*="+IndustryDropDownClassName+"] option:selected",t);n=i.val()}GetEventTypeAndSubEventTypeID(t);$.ajax({url:window.Overrides.baseUrl+"/AjaxContent/GetSortOrders",cache:!1,contentType:"application/json; charset=utf-8",data:window.Overrides.jsonDataFunction({BaseCategoryID:n,EventTypeID:EventTypeID,SubEventTypeID:SubEventTypeID,AuctionType:AuctionType}),type:"POST",dataType:window.Overrides.ajaxDataType,success:function(n){DoGetSortOrderAjaxResult(n,t);typeof reloadSortOrderCallback=="function"&&reloadSortOrderCallback()},error:function(n){var t=n}})}function DoGetSortOrderAjaxResult(n,t){var i=$("select[class*="+SortOrderDropDownClassName+"]",t),r=$(":first",i),u=$(":selected",i);r.val()==0?ResetAndDefaultOption(i,r.text(),r.val(),t):i.empty();$.each(n,function(){i.append($("<option />").val(this.Value).text(this.Text));this.Text==u.text()&&i.val(this.Value)})}var IndustryDropDownClassName="industry-dropdown",CategoryDropDownClassName="category-dropdown",ManufacturerDropDownClassName="manufacturer-dropdown",ModelDropDownClassName="model-dropdown",ManufacturerTextBoxClassName="manufacturer-textbox",ModelTextBoxClassName="model-textbox",SubIndustryLabelClassName="sub-industry-label",SortOrderDropDownClassName="event-type-sort-order-dropdown",ModelPlaceHolder="(Optional)",EventTypeID,SubEventTypeID,AuctionType="",reloadSubIndustryCallback,reloadCategoryCallback,reloadManufacturerCallback,reloadModelCallback,reloadSortOrderCallback,prevMakeVal=[],prevModelVal="",HoldValuesFunction;window.Overrides||(window.Overrides={});$.extend(window.Overrides,{baseUrl:window.Overrides.baseUrl?window.Overrides.baseUrl:"",ajaxDataType:window.Overrides.ajaxDataType?window.Overrides.ajaxDataType:"JSON",jsonDataFunction:window.Overrides.jsonDataFunction?window.Overrides.jsonDataFunction:function(n){return JSON.stringify(n)}});$(".autocomplete-location").siblings("[name$='ClientIsValid']").change(function(){DisableRadius($(this).closest("form"))}).change();HoldValuesFunction={HeldValues:[],HoldValuesFor:function(n,t){HoldValuesFunction.HeldValues.push({Selector:n,SelectedValues:$(this.Selector).val(),ValuesHeld:!1,Container:t})},HoldValue:function(n,t,i){$.each(HoldValuesFunction.HeldValues,function(){if(n&&i&&this.Selector==n&&this.Container[0]==i[0])return(!this.ValuesHeld||t)&&(this.SelectedValues=$(this.Selector,i).val(),this.ValuesHeld=!0),!1})},RepopulateHeldValue:function(n,t){$.each(HoldValuesFunction.HeldValues,function(){var i=this,u,f,r;if(n&&t&&i.Selector==n&&i.Container[0]==t[0])return i.ValuesHeld&&(u=$(i.Selector,i.Container),i.SelectedValues&&i.SelectedValues!=""&&(f=typeof i.SelectedValues=="object"?i.SelectedValues.join(",").split(","):i.SelectedValues.split(","),$(n+" option:selected",t).prop("selected",!1),r=!1,$.each(f,function(){var i=$(n+' option[value="'+this+'"]',t);i.length>0&&(i.prop("selected",!0),r=!0)}),r||($(n,t)[0].selectedIndex=0),u.change(),"#ParentCategoryID"==n&&(dontReloadManufacturers=!0)),this.ValuesHeld=!1),!1})}},function(n){GetEventTypeAndSubEventTypeID();n("select[class*="+CategoryDropDownClassName+"]").each(function(){var t=n(this);SetHoldValues("#"+t.attr("id"),t.closest("form"))})}(jQuery);$(function(){var n=$("#tbManufacturer");n.length>0&&(n.autocomplete({minLength:2,autoFocus:!0,source:function(n,t){var i=$("#ddlIndustry").val();$.ajax({url:"/AjaxContent/GetManufacturerAutoCompleteOptions",type:"POST",dataType:"json",data:{BaseCategoryID:i,Typed:n.term},success:function(n){t($.map(n,function(n){return{label:n.label,value:n.value}}))}})},select:function(n,t){$("#tbManufacturer").val(t.item.label.toUpperCase());$("#tbManufacturer").data("ui-autocomplete")._trigger("change")},response:function(n,t){t.content.length==0&&t.content.push({label:'No Results Found for "'+$("#tbManufacturer").val()+'"',value:""})}}).data("ui-autocomplete")._renderItem=function(n,t){return t.value==""?$('<li class="ui-state-disabled">'+t.label+"<\/li>").appendTo(n):$('<li class="ui-menu-item">'+t.label+"<\/li>").appendTo(n)})})