function ChangeOrderBy(){$("#OrderBy").val().toLowerCase()=="popularity"||$("#OrderBy").val().toLowerCase()=="publishingdate"?$("#OrderDir").val("DESC"):$("#OrderDir").val("ASC");var t=location.href,n=UpdateQueryString("order",$("#OrderBy").val(),t);n=UpdateQueryString("orderdir",$("#OrderDir").val(),n);location.href=n}function ChangeOrderDir(){var t=location.href,n=UpdateQueryString("orderdir",$("#OrderDir").val(),t);n=UpdateQueryString("order",$("#OrderBy").val(),n);location.href=n}function ChangePageSize(){var t=location.href,n=UpdateQueryString("nris",$("#PageSize").val(),t);n=UpdateQueryString("page","1",n);location.href=n}function UpdateQueryString(n,t,i){var u,r,f;return i||(i=window.location.href),u=new RegExp("([?&]|^)"+n+"=.*?(&|#|$)(.*)","gi"),u.test(i)?typeof t!="undefined"&&t!==null?i.replace(u,"$1"+n+"="+t+"$2$3"):(r=i.split("#"),i=r[0].replace(u,"$1$3").replace(/(&|\?)$/,""),typeof r[1]!="undefined"&&r[1]!==null&&(i+="#"+r[1]),i):typeof t!="undefined"&&t!==null?(f=i.indexOf("?")!==-1?"&":"?",r=i.split("#"),i=r[0]+f+n+"="+t,typeof r[1]!="undefined"&&r[1]!==null&&(i+="#"+r[1]),i):i}function LoadArgs(n,t=false){var r=$(n).data("selector"),i=$(r).parents(".carousel-portlet").find(".carousel-more .showallref").attr("data-querystring"),s=$(r).parents(".carousel-portlet").find(".carousel-more .showallref").attr("data-mode"),u=$(n).val(),f,e,o;$(r+"_chkdispo")!==undefined&&(t=$(r+"_chkdispo").is(":checked")||$(r+"_chkdispo").is(":checked"));f=$(r).parents(".carousel-portlet").find(".carousel-more .showallref").attr("href");e=f.split("?")[0]+"?";i.indexOf("idcce")>-1?(i=UpdateQueryString("idcce",u,i),t&&(i=i+"&chkdispo=on")):i=t?i+"&idcce="+u+"&chkdispo=on":i+"&idcce="+u;$(r).parents(".carousel-portlet").find(".showallref").attr("href",e+i);$(r).parents(".carousel-portlet").find(".showallref").attr("data-querystring",i);$(r).load("../partial/SearchPortlet.aspx?mode="+s+"&"+encodeURI(i)+" .carousel.slide");o=$(n).find("option:checked").data("num");$(r).parents(".carousel-portlet").find(".carousel-more .numresult").text(o);SwipeLoad()}function LoadTypes(n){var t=$(n).data("selector"),i=$(t).parents(".carousel-portlet").find(".carousel-more .showallref").attr("data-querystring"),e=$(t).parents(".carousel-portlet").find(".carousel-more .showallref").attr("data-mode"),r=$(n).attr("data-field"),f;r===undefined&&(r="seltip");var u=$(n).val(),o=$(t).parents(".carousel-portlet").find(".carousel-more .showallref").attr("href"),s=o.split("?")[0]+"?";i=i.indexOf(r)>-1?UpdateQueryString(r,u,i):i+"&"+r+"="+u;$(t).parents(".carousel-portlet").find(".showallref").attr("href",s+i);$(t).parents(".carousel-portlet").find(".showallref").attr("data-querystring",i);$(t).load("../partial/SearchPortlet.aspx?mode="+e+"&"+encodeURI(i)+" .carousel.slide");f=$(n).find("option:checked").data("num");$(t).parents(".carousel-portlet").find(".carousel-more .numresult").text(f);SwipeLoad()}function SmartLoadCarousel(n){onVisible(document.querySelector(n),function(){$.ajax({url:$(n).attr("data-url"),method:"GET",cache:!0,success:function(t){var i=$(t+".content");$(n).html(i);SwipeLoad($(n))}})})}function LoadCarousel(n){$.ajax({url:$(n).attr("data-url"),method:"GET",cache:!0,success:function(t){var i=$(t+".content");$(n).html(i);SwipeLoad($(n))}})}function smartFormatNumber(n){let t=Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1,minimumFractionDigits:0,minimumSignificantDigits:1,maximumSignificantDigits:2}),i=parseInt($(n).text().replaceAll(".",""));$(n).text(t.format(i))}function smartMobileFormatNumber(n){/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&smartFormatNumber(n)}$(document).ready(function(){if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&$(".ml-book-search-stats h3.dl > span:last-child").length&&$(".ml-book-search-stats h3.mlol > span:last-child").length&&$(".ml-book-search-stats h3.open > span:last-child").length){let n=Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1,minimumFractionDigits:0,minimumSignificantDigits:1,maximumSignificantDigits:2});smartFormatNumber(".ml-book-search-stats h3.dl > span:last-child");smartFormatNumber(".ml-book-search-stats h3.mlol > span:last-child");smartFormatNumber(".ml-book-search-stats h3.open > span:last-child")}})