$(function(){var n=$(".js-main-search-block"),r=n.attr("data-search-url"),t,i;if(n.length>0){t=n.find(".js-search-input");i=n.find(".js-search-results");t.on("keyup",function(){var t=$(this).val();t?$.post(r,{searchKey:t},function(t){i.html(t);n.find(".serch-box").addClass("open");$("body .leave-comment-box").addClass("index-dwn");$("body .sevices").css("opacity","0");$("html, body").animate({scrollTop:$(".serch-box-wr").offset().top-60},100)}):(i.html(""),n.find(".serch-box").removeClass("open"),$("body .sevices").css("opacity","1"))})}if($("body .sevices").length>0)$("body").on("click",function(){t.val("");$("body .sevices").css("opacity","1")});$(window).click(function(){$(".serch-box-wr .serch-box").removeClass("open");$("body .leave-comment-box").removeClass("index-dwn")});$(".serch-box-wr .serch-box").click(function(n){n.stopPropagation()})})