function loadTagMenu(n){if($("#tagMenuShowBtn").text("Topics Loading..."),tagMenu==null){setTimeout(()=>loadTagMenu(),300);return}$("#tagMenu").length>0||($("#sideMenu").append(tagMenu),n?($("#tagMenuShowBtn").hide(),$("#tagMenu").show()):($("#tagMenuShowBtn").slideUp("slow"),$("#tagMenu").slideDown("slow")),setContentTypeEvent(),setDateRangeEvents())}function getTagsFromPathname(){if(isIndexPage()){const n=location.pathname.split("/").pop();if(/^\d/.test(n))return n}return null}function isIndexPage(){return location.pathname.includes("database")||location.pathname.includes("analysis")||location.pathname.includes("all")}function isErrorPage(){return!!document.querySelector('meta[name="error-code"]')}function setContentTypeEvent(){const n=document.querySelector("#typeDd"),t=n.parentElement;t.addEventListener("keyup",t=>{(t.key==="Escape"||t.keyCode===27)&&(n.dataset.escPressed="true",setTimeout(()=>{delete document.querySelector("#typeDd").dataset.escPressed},500))});n.addEventListener("change",n=>{setTimeout(()=>{const t=document.querySelector("#typeDd");t.dataset.escPressed!=="true"&&(window.location=`${isHebrewLetter()}/${n.target.value}/${t.dataset.query}`)},300)})}function setDateRangeEvents(){$("#duration").children().click(function(){dateReady=!0});$("#durationDate,#durationDate2").keydown(function(n){dateReady=n.which==13;dateReady&&newDateGo()});$("#duration").children().change(function(){dateReady&&newDateGo()})}function newDateGo(){if($("#durationDate").val()!=""||$("#durationDate2").val()==""||getQueryVariable("date")!=!1){var n=SetPathname();location.href=$("#durationDate").val()==""&&getQueryVariable("date")!=!1||$("#durationDate2").val()==""&&getQueryVariable("date2")!=!1||$("#durationDate").val()!=""&&$("#durationDate2").val()==""&&getQueryVariable("date")!=!1&&getQueryVariable("date2")==!1?n:$("#durationDate").val()!=""?n+"?date="+$("#durationDate").val()+doDate2()+doSignificance():n}}function doSignificance(){return getQueryVariable("significance")?"&significance="+getQueryVariable("significance"):""}function doDate2(){return $("#durationDate2").val()!=""?"&date2="+$("#durationDate2").val():""}function getQueryVariable(n){for(var i,u=window.location.search.substring(1),r=u.split("&"),t=0;t<r.length;t++)if(i=r[t].split("="),i[0]==n)return i[1];return!1}function SetPathname(){return location.pathname.includes("database")||location.pathname.includes("analysis")||location.pathname.includes("all")?location.pathname:"/all"}function pathIndicator(n){n==null?$(".menuItem").removeClass("darkBg"):($('[data-level="'+n.data("level")+'"]').removeClass("darkBg"),n.addClass("darkBg"))}function levelRemover(n){$(".pop").each(function(){$(this).data("level")>n&&$(this).remove()})}var tagMenu,dateReady,closeAll;const isILHost=()=>window.location.hostname.toLowerCase().endsWith(".il")?!0:!1,isHebrew=()=>document.documentElement.lang==="he"?!0:!1,isHebrewLetter=()=>document.documentElement.lang==="he"&&!isILHost()?"/he":"";$(document).ready(function(){function f(){$(".GsearchBox").slideUp();$("#infoMenuItems a").delay(400).fadeIn();$(window).width()<420&&$("#slogo *").show(500)}function u(){l();const n=$("#sBtnControl").attr("aria-expanded")==="true";if(!n){$("#collapsedMenuShow").slideUp();$("#infoMenuItems").show();return}if(loadTagMenu(!0),$("#collapsedMenuShow").slideDown(),$("#infoMenuItems").hide(),!r){r=!0;$('#infoMenuItems a:not([href*="javascript"]').clone().removeAttr("style").prependTo("#collapsedMenuInfo");document.querySelectorAll(".tagTypeGroup").forEach(n=>{const t=n.id,i=n.getAttribute("data-tagname");c(`#${t}`,i)});$("#collapsedMenuShow").on("keyup",function(n){n.key==="Escape"&&$("#sBtnControl").click()})}}function c(n,t){$("#collapsedMenuCat").append("<span>"+t+"<\/span>");$(n+' [data-level="0"] > a').clone().removeAttr("class").each(function(){$(this).attr("href",isHebrewLetter()+$(this).data("altmenu")).removeAttr("data-altmenu");$(this).attr("tabindex",0)}).appendTo("#collapsedMenuCat")}function l(){const t=document.querySelectorAll("#infoMenuItems li");let n=null;for(let i=0;i<t.length;i++){const u=t[i],r=u.querySelector("a");if(r&&r.textContent.trim()==="Menu"&&r.getAttribute("href").startsWith("javascript")){n=u;break}}n&&(n.style.display=window.getComputedStyle(document.querySelector("#sCollapsedMenu")).display!=="none"?"none":"initial")}function h(n){if(isLocal){let t=n.getAttribute("data-src");t&&t.trim()||(t=n.src.replace("http://localhost:60701",""));n.src="https://palwatch.org"+t}else n.src.includes("/home/img?f=")&&(n.src=n.dataset.src);n.onerror=function(){}}function a(){for(let n of document.getElementsByTagName("img"))n.complete?n.naturalWidth===0&&h(n):n.addEventListener("error",h)}var e,n,t,r;$(".Gsearch").click(function(){$("#searchBox").val().length<1?$(".GsearchBox").is(":hidden")?($(".GsearchBox").delay(400).slideDown(),$("#infoMenuItems a").fadeOut(),$(window).width()<420&&$("#slogo *").hide(500),setTimeout(function(){$("#searchBox").focus()},400)):f():$(".Gsearch").submit()});document.querySelectorAll(".Gsearch, #searchBox").forEach(n=>{n.addEventListener("keypress",n=>{n.key==="Enter"&&(n.preventDefault(),document.querySelector(".Gsearch").click())})});$("html").not("#searchBox").click(function(){$(".GsearchBox").is(":hidden")||f()});$("#searchBox , .Gsearch").click(function(n){n.stopPropagation()});e=$(".slogen").height();n=$("header").height();$("#leftMainCon").css("margin-top",n+"px");$(window).scroll(function(){$(".slogen").height()>0&&$(document).scrollTop()>n?($(".slogen").animate({height:"0px"},{queue:!1}),$("#leftMainCon").animate({marginTop:"35px"},{queue:!1})):$(".slogen").height()==0&&$(document).scrollTop()<n&&($(".slogen").animate({height:e+"px"},{queue:!1}),$("#leftMainCon").animate({marginTop:n+"px"},{queue:!1}))});u();$(window).resize(function(){u()});t=null;const o=document.querySelector("#logo2 img").height,s=30,i=document.querySelector("#logo2 img");window.addEventListener("scroll",function(){const r=t;if(t=window.scrollY,r!=null){const n=i.height;if(r<t){if(n<=s)return;i.height=n-1}else if(t<o+65){if(n>=o)return;i.height=n+1}}});$("#menuButton").on("click",function(){const n=$(this).attr("aria-expanded")==="true";if($(this).attr("aria-expanded",!n),n&&!isIndexPage()){$("#sideMenu").slideUp(400,()=>$("header .newSocial").slideDown());return}loadTagMenu(!0);isIndexPage()?($("header .newSocial").hide(),$("#sideMenu").show()):($("header .newSocial").slideUp(400,()=>$("#sideMenu").slideDown()),setTimeout(()=>$("#sideMenu").find('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])').first().focus(),800));i.height=s});$("#sideMenu").on("keyup",function(n){n.key!=="Escape"||n.target.tagName=="SELECT"||isIndexPage()||($("#menuButton").click(),$("#menuButton").focus())});document.addEventListener("click",function(n){if(!isIndexPage()&&n.target.tagName!=="A"&&!document.getElementById("collapsedMenu").contains(n.target)){const t=document.getElementById("sideMenu");t&&!t.contains(n.target)&&$("#menuButton").attr("aria-expanded")==="true"&&$("#menuButton").click()}});r=!1;$("#sBtnControl").on("click",function(){const n=$(this).attr("aria-expanded")==="true";$(this).attr("aria-expanded",!n);u()});window.addEventListener("load",a)});$(document).ready(function(){let n=isIndexPage()&&!isErrorPage()?{dataType:location.pathname.includes("analysis")?"analysis":location.pathname.includes("database")?"database":"",tags:getTagsFromPathname(),date:getQueryVariable("date"),date2:getQueryVariable("date2"),page:getQueryVariable("page"),significance:getQueryVariable("significance"),isIndexPage:"true"}:{isIndexPage:"false"},t={};for(let i in n)n[i]&&(t[i]=n[i]);$.ajax({url:isHebrewLetter()+"/home/IndexMenu",data:t,dataType:"html",success:function(n){(tagMenu=n,isErrorPage())||((location.pathname==isHebrewLetter()+"/"||isIndexPage()||location.pathname.includes(isHebrewLetter()+"/home"))&&loadTagMenu(!0),isIndexPage()&&(document.querySelector("#menuButton").click(),$("#paging").append($("#pagerCon")),$("#pagerCon").show()))},error:function(n,t,i){console.log("An AJAX error occured: "+t+"\nError: "+i+"\nError detail: "+n.responseText)}})});closeAll=!0;$(document).on("mouseleave",".pop, .menuGroup",function(){closeAll=!0;setTimeout(function(){closeAll&&($(".pop").remove(),pathIndicator(null))},500)});$(document).on("mouseover",".menuItem",function(){var t,n;pathIndicator($(this));closeAll=!1;t=$(this).data("level");levelRemover(t);$(this).hasClass("opener")&&(n=$("<div>",{"class":"pop","data-level":t+1}),$(this).children(".togUl").clone().show().prependTo(n),$("body").append(n),n.position({my:(isHebrew()?"right":"left")+" top",at:(isHebrew()?"left":"right")+" top",of:$(this)}))});$(document).on("change",".checkbox",function(){$(this).next()[0].click()});$(document).on("click","a.live",function(){$("#sideMenuInner a , #sideMenuInner input, .pop a, .pop input ").addClass("cursorWait")});$(document).on("click",".cursorWait",function(){return!1});window.addEventListener("pageshow",function(n){n.persisted&&$(".cursorWait").removeClass("cursorWait")})