function ApplySelectionLimits(n){n&&n.selectize({maxItems:n.data("limit")?parseInt(n.data("limit")):null})}function ClearInput(n,t){t=$(t);t&&t[0].selectize?t[0].selectize.clear():t.is(":checkbox")?t.prop("checked",!1):t.val("")}function isSuggestedFieldInfoMissing(){var n=!1;return $("input.suggested, select.suggested").not("[name*='_number_']").each(function(){n||$(this).val()!=null&&$(this).val()!==""||(n=!0)}),n}function GetCustomFieldValues(n){var t={};return n.find($('[id*="CustomField"]')).each(function(){var n,i,r;(n=$(this).is(":checkbox")?$(this).is(":checked"):$(this).val(),Array.isArray(n)&&(n=n.join(";")),n)&&(i=$(this).attr("id"),r=i.substring(i.indexOf("CustomField_")+12),t[r]={CustomFieldId:r,Value:n})}),t}$(function(){$(".selectized[name*='CustomField_']").not(".required").bind("change",function(){var n=$(this),t=n.attr("id"),i=n[0].options.length;i===0?n.before("<input type='hidden' value='' name='"+t+"'>"):$("input[name="+t+"]").remove()})})