!function(a){var b=function(a,b){this.$element=a,this.options=b},c={init:function(){var b=this.options,d=this.$element;a(d).keypress(function(){var e=a(this).val();e.length>=2&&c.creat_search_frame(b,d,e),d.parent().on("mousedown",function(a){a.stopPropagation()})})},creat_search_frame:function(b,c,e){var g,h,i,j,k,l,m,n,o,p,q,r,s,f='<div class="espcms_search_dropdown"><div class="espcms_search_dropdown_load displaynone">'+b.load_str+'</div><div class="espcms_search_dropdown_list scro_div"></div></div>';if(a(c).parent().css({position:"relative"}),g=a("body").height(),h=c.offset(),i=g-h.top,j=320,k=c.position(),l=c.outerWidth(),m=520>l?520:l,n=c.innerHeight(),a(".espcms_search_dropdown").length<=0&&(a(c).after(f),o=k.top+n,j>i?(a(".espcms_search_dropdown").css({left:k.left-1,width:m}),a(".espcms_search_dropdown").addClass("droptop")):a(".espcms_search_dropdown").css({left:k.left-1,top:o,width:m})),!b.load_url)return!1;if(p="search_key="+encodeURI(e),b.post_key.length>0)for(q=0;q<b.post_key.length;q++)r=b.post_key[q],s=a("#"+r).val(),s&&r&&(p+="&"+r+"="+s);a.ajax({type:"get",url:b.load_url,data:p,global:!1,beforeSend:function(){a(".espcms_search_dropdown_load").show()},success:function(e){a(".espcms_search_dropdown_load").hide(),a(".espcms_search_dropdown_list").empty().append(e),j>i&&a(".espcms_search_dropdown").css({bottom:n+11});var f=new Array;a(".espcms_dropdown_md5_key").each(function(){var b=a(this).val();f.push(b)}),a(".dropdown_talbe_tr").each(function(){var b=a(this).attr("data-key");in_array(b,f)&&a(this).removeClass("dropdown_talbe_tr").addClass("dropdown_talbe_tr_close")}),a(".dropdown_talbe_tr").unbind("click").bind("click",function(){var i,e=a(this).attr("data-id"),f=a(this).attr("data-name"),g=a(this).attr("data-price"),h={id:e,name:f,price:g};b.callback&&(i=a.Callbacks(),i.add(b.callback),i.fire(h,c)),d(),event.stopPropagation()})}})}},d=function(){a(".espcms_search_dropdown")&&a(".espcms_search_dropdown").remove()};a.fn.espcms_search_dropdown=function(d){var e=a.extend({load_url:!1,post_key:[],load_str:'<span class="espcms_icon_fa espcms_icon_fa-spinner espcms_icon_fa-spin espcms_icon_fa-1x" aria-hidden="true"></span>'},d),f=Array.prototype.slice.call(arguments,1);return this.each(function(){var g=a(this),h=g.data("setOption");return h||g.data("setOption",h=new b(g,e)),"string"==typeof d&&a.isFunction(c[d])?c[d].apply(h,f):"object"!=typeof d&&d?!1:c.init.apply(h,f)})},a(document).on("mousedown",function(a){d(),a.stopPropagation()})}(jQuery);