var avadaLiveSearch=function(){var a=[];avadaLiveSearchVars.live_search&&jQuery(".fusion-live-search-input").each(function(){function b(a){var b="";i.html(""),i.removeClass("suggestions-empty"),i.addClass("suggestions-added"),jQuery.isEmptyObject(a)?(i.addClass("suggestions-empty"),b+='<div class="fusion-search-result">'+avadaLiveSearchVars.no_search_results+"</div>",i.append(b)):jQuery.each(a,function(a,c){b="",b+='<a class="fusion-search-result" href="'+c.post_url+'" title="'+c.title+'">',c.image_url&&(b+='<div class="fusion-search-image"><img class="fusion-search-image-tag" src="'+c.image_url+'" alt="Post Thumb'+c.id+'"/></div>'),b+='<div class="fusion-search-content">',b+='<div class="fusion-search-post-title">'+c.title+"</div>",c.type&&(b+='<div class="fusion-search-post-type">'+c.type+"</div>"),b+="</div>",b+="</a>",i.append(b)})}function c(){var c;if(f=e.closest(".fusion-live-search"),c=e.val(),avadaLiveSearchVars.min_char_count<=c.length){if(void 0!==a[c])return void b(a[c]);f.find(".fusion-slider-loading").show(),f.find(".fusion-search-submit").css("color","transparent"),h.css("color","transparent"),jQuery.ajax({url:avadaLiveSearchVars.ajaxurl,type:"post",data:{action:"live_search_retrieve_posts",search:e.val(),perPage:avadaLiveSearchVars.per_page,show_feat_img:avadaLiveSearchVars.show_feat_img,display_post_type:avadaLiveSearchVars.display_post_type},success:function(d){a[c]=d,b(d),f.find(".fusion-slider-loading").hide(),h.css("color",h.attr("data-color"))}})}else f.find(".fusion-slider-loading").hide(),h.css("color",h.attr("data-color")),i.removeClass("suggestions-added")}var d,e=jQuery(this),f=e.closest(".fusion-live-search"),g=f.find(".fusion-search-button"),h=f.find(".fusion-search-submit"),i=f.find(".fusion-search-results");h.attr("data-color",h.css("color")),e.on("focusin",function(){avadaLiveSearchVars.min_char_count<=jQuery(this).val().length&&i.children(".fusion-search-result").length&&i.addClass("suggestions-added")}),e.on("focusout",function(){i.is(":hover")||g.is(":hover")||i.removeClass("suggestions-added")}),jQuery(g,i).on("mouseleave",function(){e.is(":focus")||i.removeClass("suggestions-added")}),e.on("keyup",function(){clearTimeout(d),d=setTimeout(c,500)}),e.on("keydown",function(){clearTimeout(d)})})};jQuery(document).ready(function(){avadaLiveSearch()});