function openLink(n,t){var i=t===!0?"_blank":"_self",r=window.open(n,i);t&&r.focus()}var Search;(function(n){var t=function(){function n(n){this.searchSuggestionsCount=0;this.contentType="application/json; charset=utf-8";this.options=n;this.bindEvents()}return n.prototype.bindEvents=function(){var n=this;this.searchAutocomplete(this.options);$("#"+n.options.searchFormId).submit(function(){var t=encodeURIComponent($("#"+n.options.textBoxId).val());return $("#"+n.options.textBoxId+"_hidden").val(t),!n.isSearchTextboxEmpty()});this.initAutocomplete()},n.prototype.initAutocomplete=function(){$("#"+this.options.autoCompleteDivId).empty();$("#"+this.options.autoCompleteDivId+" .search-ul-autocomplete").empty();$("#"+this.options.autoCompleteDivId).append(this.options.ulInjected);$("#"+this.options.autoCompleteDivId).hide();this.searchSuggestionsCount=0},n.prototype.searchAutocomplete=function(n){var t=this,i;return t.searchSuggestionsCount=0,i=$.extend({numberOfBestBets:3,numberOfKeyword:3,titleLength:15,summaryLength:40},n),$("#"+t.options.searchFormId+" input").keyup(function(n){var r=n.keyCode;if(!([37,38,39,40].indexOf(r)>=0)){if(typeof t.ajaxRequest!="undefined"&&t.ajaxRequest.abort(),r===13&&!t.isSearchTextboxEmpty()){$("#"+t.options.searchFormId+" button").click();return}t.processWaitingMessage(!0);$(this).val()!==""&&$(this).val().length>2?t.loadBestBetsAsync(encodeURIComponent($(this).val()),i):$("#"+t.options.autoCompleteDivId).hide();t.processWaitingMessage(!1)}}),this},n.prototype.loadBestBetsAsync=function(n,t){var i=this,r={},u;r.SearchedKeyword=n;u={url:"/SearchAPI/SearchTextBox/AX_LoadBestBetsSuggestions/"+i.options.pageId,type:"POST",dataType:"json",async:!0,data:JSON.stringify(r),contentType:this.contentType,success:function(n){for(var u=n,r=0;r<t.numberOfBestBets;r++)u[r]!=undefined?i.renderBestBet(u[r],r):$("#elementBest"+r).remove();i.searchSuggestionsCount+=u.length},error:function(){}};i.ajaxRequest=$.ajax(u);i.ajaxRequest.done(function(){i.loadKeywordsAsync(n,t)})},n.prototype.loadKeywordsAsync=function(n,t){var i=this,r={},u;r.SearchedKeyword=n;u={url:"/SearchAPI/SearchTextBox/AX_LoadKeywordSuggestions/"+i.options.pageId,type:"POST",dataType:"json",contentType:this.contentType,async:!0,data:JSON.stringify(r),success:function(n){for(var u=n,r=0;r<t.numberOfKeyword;r++)u[r]!=undefined?i.renderKeyword(u[r],r):$("#elementKey"+r).remove();i.searchSuggestionsCount+=u.length},error:function(){}};i.ajaxRequest=$.ajax(u);i.ajaxRequest.done(function(){i.searchSuggestionsCount===0?($("#"+i.options.autoCompleteDivId).hide(),$("#"+i.options.autoCompleteDivId+" .search-ul-autocomplete").empty()):$("#"+i.options.autoCompleteDivId).show();i.searchSuggestionsCount=0})},n.prototype.renderBestBet=function(n,t){var r=this,i="";i=n.Thumbnail.trim()!==""?r.options.liImageInjected.replace("elementId","elementBest"+t):r.options.liInjected.replace("elementId","elementBest"+t);i=i.replace("className","elementBest");i=i.replace("ItemName",n.Title);i=i.replace("ItemDescription","<br />"+n.Summary.substr(0,80)+"...");i=i.replace("IsKeyword","");n.Thumbnail.trim()!==""&&(i=i.replace("ItemThumbnail",n.Thumbnail));$("#elementBest"+t).length===0?t>0?$(i).insertAfter("#elementBest"+(t-1)):$("#"+r.options.autoCompleteDivId+" .search-ul-autocomplete").prepend(i):$("#elementBest"+t).html(i);$("#elementBest"+t).attr("onclick","openLink('"+n.Url+"', "+n.IsUrlExternal+");")},n.prototype.renderKeyword=function(n,t){var r=this,i=r.options.liInjected.replace("elementId","elementKey"+t);i=i.replace("className","elementKey");i=i.replace("ItemName",n.Keyword);i=i.replace("ItemDescription","");i=i.replace("IsKeyword","<i class='icon-font icon-search icon--larger'><\/i>");$("#elementKey"+t).length===0?$("#"+r.options.autoCompleteDivId+" .search-ul-autocomplete").append(i):$("#elementKey"+t).html(i);$("#elementKey"+t).click(function(){r.searchKeyword($(this).attr("id"))})},n.prototype.processWaitingMessage=function(n){n?$("#"+this.options.loadingIndicatorId).show():($("#"+this.options.loadingIndicatorId).hide(),this.searchSuggestionsCount=0)},n.prototype.isSearchTextboxEmpty=function(){return $.trim($("#"+this.options.textBoxId).val())===""},n.prototype.searchKeyword=function(n){$("#"+this.options.textBoxId).val($("#"+n).text());$("#"+this.options.searchFormId+" button").click()},n}();n.SearchTextBox=t})(Search||(Search={})),function(n){function t(){$("#aSeeMore").click(function(){$("#divShowMore").slideDown(1600);$("#aSeeMore").hide()});$(".hdnFamilyItems").val()==="0"&&$(".mfp-content").hide()}n.SearchResultInit=t}(Search||(Search={})),function(n){function t(){$(".jq-search-popup").magnificPopup({items:{src:"#search-popup-info-product",type:"inline"},modal:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0})}n.InitSearchStopBox=t}(Search||(Search={}))