var isChrome=navigator.userAgent.indexOf("Chrome")>-1;var isExplorer=navigator.userAgent.indexOf("MSIE")>-1;var isFirefox=navigator.userAgent.indexOf("Firefox")>-1;var isSafari=navigator.userAgent.indexOf("Safari")>-1;var isOpera=navigator.userAgent.toLowerCase().indexOf("op")>-1;if((isChrome)&&(isSafari)){isSafari=false}if((isChrome)&&(isOpera)){isChrome=false}function log(a){console.log("ONE_dev: "+a)}function logone(a){console.log("ONE_dev: "+a)}function GetQueryString(d){var c=window.location.search.substring(1);var e=c.split("&");for(var a=0;a<e.length;a++){var b=e[a].split("=");if(b[0]==d){return b[1]}}return""}function GetClientIP(){var a=false;if(GetCookie("IPClientIP")){IP=GetCookie("IPClientIP")}else{a=true}if(GetCookie("IPIsIsrael")){IsIsrael=(GetCookie("IPIsIsrael").toString().toLowerCase()=="true")?true:false}else{a=true}if(a){document.write('<script src="https://svc.one.co.il/SetIPData"></script>')}}function SetIPData(a){logone("Im in SetIPData");logone("IP is "+a.IP);IsIsrael=(a.IsIsrael.toLowerCase()==="true")?true:false;IP=a.IP;SetCookieDays("IPClientIP",IP,30);SetCookieDays("IPIsIsrael",IsIsrael,30)}function OpenWindow(j,g,m,k,c,b,f,e,a,d){var n=GetWindowWidth()/2-m/2;var o=GetWindowHeight()/2-k/2;var h="";h+="menubar="+(b?1:0)+",";h+="status="+(e?1:0)+",";h+="toolbar="+(f?1:0)+",";h+="location="+(a?1:0)+",";h+="resizable="+(c?1:0)+",";h+="scrollbars="+(d?1:0)+",";h+="left="+n+",";h+="top="+o+",";h+="width="+m+",";h+="height="+k;if(g.toLowerCase().indexOf("http://")>-1){var i=g;g=j;j=i}var l=window.open(j,g,h);return l}function GetWindowWidth(){return document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth}function GetWindowHeight(){return document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight}var dateFormat=function(){var d=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,b=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,c=/[^-+\dA-Z]/g,a=function(f,e){f=String(f);e=e||2;while(f.length<e){f="0"+f}return f};return function(h,q,u){var i=dateFormat;if(arguments.length==1&&(typeof h=="string"||h instanceof String)&&!/\d/.test(h)){q=h;h=undefined}h=h?new Date(h):new Date();if(isNaN(h)){throw new SyntaxError("invalid date")}q=String(i.masks[q]||q||i.masks["default"]);if(q.slice(0,4)=="UTC:"){q=q.slice(4);u=true}var e=u?"getUTC":"get",f=h[e+"Date"](),g=h[e+"Day"](),n=h[e+"Month"](),v=h[e+"FullYear"](),k=h[e+"Hours"](),p=h[e+"Minutes"](),t=h[e+"Seconds"](),l=h[e+"Milliseconds"](),r=u?0:h.getTimezoneOffset(),j={d:f,dd:a(f),ddd:i.i18n.dayNames[g],dddd:i.i18n.dayNames[g+7],m:n+1,mm:a(n+1),mmm:i.i18n.monthNames[n],mmmm:i.i18n.monthNames[n+12],yy:String(v).slice(2),yyyy:v,h:k%12||12,hh:a(k%12||12),H:k,HH:a(k),M:p,MM:a(p),s:t,ss:a(t),l:a(l,3),L:a(l>99?Math.round(l/10):l),t:k<12?"a":"p",tt:k<12?"am":"pm",T:k<12?"A":"P",TT:k<12?"AM":"PM",Z:u?"UTC":(String(h).match(b)||[""]).pop().replace(c,""),o:(r>0?"-":"+")+a(Math.floor(Math.abs(r)/60)*100+Math.abs(r)%60,4),S:["th","st","nd","rd"][f%10>3?0:(f%100-f%10!=10)*f%10]};return q.replace(d,function(m){return m in j?j[m]:m.slice(1,m.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.Format=function(a,b){return dateFormat(this,a,b)};
var IsIsrael=true;$j(document).ready(function(){$j("iframe[src*='youtube']").wrap("<div class='embed-container'></div>")});function DoSearch(a){document.location="/Cat/General/SearchResults.aspx?oneSearchtype=1&isSearchInOne=true&q="+escape(a)}function MarkSessionDay(a){if(a==undefined){a=""}SetSessionNumber(a);if(GetSessionNumber(a)<2){SetCookieDays("sessionmark"+a,"1",1)}}function GetSessionNumber(a){if(a==undefined){a=""}var b=GetCookie("sessionnum"+a);if(b<1||b==null){b=SetSessionNumber(a)}return b}function SetSessionNumber(a){if(a==undefined){a=""}var b=GetCookie("sessionnum"+a);if(b<1||b==null){b=1}else{b++}SetCookieDays("sessionnum"+a,b,1);return b}function CountViews(c,b){var a="counter.one.co.il";if(c==="Trivia"||c==="Glitch"||c==="PushArticle"){a="www.one.co.il"}var d="https://"+a+"/NoMobileRedirect/Views/Counter/"+c+"/"+b+"/"+Math.random().toString().split(".")[1];new Image().src=d}function CountArticleView(a){CountViews("Article",a)}function CountGlitchView(a){CountViews("Glitch",a)}function CountVideoView(a){CountViews("Video",a)}function CountVideoViewVpH(a){CountViews("VideoVpH",a)}function CountTriviaView(a){CountViews("Trivia",a)};
function PrepareAdsElementsForResponsiveDesign(){setTimeout(function(){if($j("#adLeftTower").width()>165){$j("#adLeftTower").addClass("adTowerWide")}},3000)}function ImpressionCount(a){return}function ImpressionCountDFP(a,b){var c=new Image();c.src="http://pubads.g.doubleclick.net/gampad/clk?id="+a+"&iu="+b}if(typeof tmo_util!="object"){tmo_util={}}if(typeof tmo_prop!="object"){tmo_prop={}}tmo_prop.IE=(navigator.userAgent.indexOf("MSIE")>=0)?true:false;if(navigator.userAgent.indexOf(".NET4.0E; .NET4.0C;")>=0){tmo_prop.IE=true}tmo_util.stlPopUnder=function(a,e,f,d,c,b,g){tmo_prop.TM_PopUnder="off";tmo_prop.TM_PopUnderData=a;tmo_prop.TM_PopUnderHeight=b;tmo_prop.TM_PopUnderWidth=g;tmo_prop.TM_Targetwindow=f;tmo_prop.TM_PopUnderSpecification=e;top.isPopDone_=false;window.TM_openWin=function(){if(tmo_prop.TM_PopUnder=="off"){tmo_prop.TM_PopUnder="on";myWindow=window.open("",tmo_prop.TM_Targetwindow,tmo_prop.TM_PopUnderSpecification);myWindow.document.write("<html><head><title>&nbsp;Advertisement</title></head><body marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>"+tmo_prop.TM_PopUnderData+"</body></html>");if(!tmo_prop.IE){myWindow.window.open("about:blank").close()}if(d="Pop-under"){myWindow.blur();window.focus()}}};if(!tmo_prop.IE){document.addEventListener("click",window.TM_openWin,false)}if(!tmo_prop.IE){document.addEventListener("mouseup",function(){if(top.isPopDone_){return}var j=Math.random();var h=document.createElement("a");h.href="data:text/html,"+unescape("%3Cscript%3E")+"window.close();"+unescape("%3C/script%3E"),document.getElementsByTagName("body")[0].appendChild(h);var i=document.createEvent("MouseEvents");i.initMouseEvent("click",true,true,window,0,0,0,0,0,true,false,false,true,0,null);h.dispatchEvent(i);h.parentNode.removeChild(h);window.open("about:blank","_tab"+j.toString()).close();top.isPopDone_=true},false)}else{setTimeout(window.TM_openWin,250)}};var tm={tm_pop:function(d,h){var g=h.cap||1;var c=h.wait||4;var b=h.cookie||"__.tm";var i=h.width;var a=h.height;var h="";var f={tm_initializefun:function(){this.ua.tm_initializefun()},ua:{tm_initializefun:function(){this.browser=this.tm_Stringsearchfun(this.list_browser)||"unknown";this.version=this.tm_Versionsearchfun(navigator.userAgent)||this.tm_Versionsearchfun(navigator.appVersion)||"unknown";this.os=this.tm_Stringsearchfun(this.list_os)||"unknown";if(this.browser=="Chrome"||this.browser=="chrome"){i=i||window.innerWidth;a=a||window.innerHeight}else{if(this.browser=="Explorer"||this.browser=="explorer"){i=i||window.innerWidth;a=a||window.innerHeight}else{i=i||screen.width;a=a||screen.height}}h="width="+i+",height="+a+",resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no,scrollbars=yes,top=0,left=0"},list_browser:[{str:navigator.userAgent,subStr:"Chrome",id:"Chrome"},{str:navigator.userAgent,subStr:"OmniWeb",versionSearch:"OmniWeb/",id:"OmniWeb"},{str:navigator.vendor,subStr:"Apple",id:"Safari",versionSearch:"Version"},{prop:window.opera,id:"Opera",versionSearch:"Version"},{str:navigator.vendor,subStr:"iCab",id:"iCab"},{str:navigator.vendor,subStr:"KDE",id:"Konqueror"},{str:navigator.userAgent,subStr:"Firefox",id:"Firefox"},{str:navigator.vendor,subStr:"Camino",id:"Camino"},{str:navigator.userAgent,subStr:"Netscape",id:"Netscape"},{str:navigator.userAgent,subStr:"MSIE",id:"Explorer",versionSearch:"MSIE"},{str:navigator.userAgent,subStr:"Gecko",id:"Mozilla",versionSearch:"rv"},{str:navigator.userAgent,subStr:"Mozilla",id:"Netscape",versionSearch:"Mozilla"}],list_os:[{str:navigator.platform,subStr:"Win",id:"Windows"},{str:navigator.platform,subStr:"Mac",id:"Mac"},{str:navigator.userAgent,subStr:"iPhone",id:"iPhone/iPod"},{str:navigator.platform,subStr:"Linux",id:"Linux"}],tm_Stringsearchfun:function(j){for(var n=0;n<j.length;n++){var m=j[n].str;var e=j[n].prop;this.versionSearchString=j[n].versionSearch||j[n].id;if(m){if(m.indexOf(j[n].subStr)!=-1){return j[n].id}}else{if(e){return j[n].id}}}},tm_Versionsearchfun:function(e){var j=e.indexOf(this.versionSearchString);if(j==-1){return}return parseFloat(e.substr(j+this.versionSearchString.length+1))}},cookie:{tm_get:function(s,v){var u=new Date;u.setTime(u.getTime());var r=(new Date(u.getTime()+1000*60*60*v)).toGMTString();var q=document.cookie.split(";");var w="";var o="";var t=[0,r];for(var n=0;n<q.length;n++){w=q[n].split("=");o=w[0].replace(/^\s+|\s+$/g,"");if(o==s){b_cookie_found=true;if(w.length>1){t=unescape(w[1]).split("|");if(t.length==1){t[1]=r}}return t}w=null;o=""}return t},tm_set:function(e,k,j){document.cookie=e+"="+escape(k+"|"+j)+";expires="+j+";path=/"}},listener:{tm_addfun:function(n,q,o){var m="on"+q;if(typeof n.addEventListener!="undefined"){n.addEventListener(q,o,arguments.callee)}else{if(typeof n.attachEvent!="undefined"){n.attachEvent(m,o)}else{if(typeof n[m]!="function"){n[m]=o}else{var e=n[m];n["old_"+m]=e;n[m]=function(){e();return o()}}}}},tm_removefun:function(j,n,m){var e="on"+n;if(typeof j.removeEventListener!="undefined"){j.removeEventListener(n,m,false)}else{if(typeof j.detachEvent!="undefined"){j.detachEvent(e,m)}else{if(typeof j["old_"+e]!="function"){j[e]=null}else{j[e]=j["old_"+e]}}}}},format:{},random:function(){return Math.floor(Math.random()*1000001)}};f.tm_initializefun();f.format.popunder={settings:{url:d,times:g,hours:c,cookie:b},config:h,isBinded:false,isTriggered:false,tm_initializefun:function(){var e=f.cookie.tm_get(f.format.popunder.settings.cookie,f.format.popunder.settings.hours);this.cookie={};this.cookie.times=!isNaN(Number(e[0]))?Number(e[0]):0;this.cookie.expires=!isNaN(Date.parse(e[1]))?e[1]:(new Date).toGMTString();if(document.readyState=="complete"){setTimeout(f.format.popunder.bind,1)}else{f.listener.tm_addfun(document,"DOMContentLoaded",function(){f.listener.tm_removefun(document,"DOMContentLoaded");f.format.popunder.bind()});f.listener.tm_addfun(document,"onreadystatechange",function(){if(document.readyState=="complete"){f.listener.tm_removefun(document,"onreadystatechange");f.format.popunder.bind()}});f.listener.tm_addfun(window,"load",f.format.popunder.bind)}},bind:function(){if(f.format.popunder.isBinded){return}f.format.popunder.isBinded=true;if(f.format.popunder.cookie.times>=f.format.popunder.settings.times){return}var u={};for(var z in f.format.popunder.binders){var w=f.format.popunder.binders[z];var t=z.split("");var s="",A="";var o=1,m;for(var q=0;q<t.length;q++){var v=t[q];if(v.match(/[a-z0-9]/)==null){continue}m=v.search(/[a-z]/)==0;if(m){if(m!=o){u[s][A]=w;s=v}else{s+=v}}else{if(m!=o||parseInt(q)+1==t.length){if(m!=o){if(typeof u[s]!="object"){u[s]={}}A=v}if(parseInt(q)+1==t.length){u[s][m==o?A+v:A]=w}}else{A+=v}}o=m}}var n=u[f.ua.browser.toLowerCase()]||u.all;var r=Object.keys(n);r.sort();for(var w=0;w<r.length;w++){var A=r[w];if(f.ua.version<=A){break}}n[A]()},binders:{chrome:function(){},chrome37:function(){f.listener.tm_addfun(document,"mousedown",f.format.popunder.triggers.tm_anchor_trigg)},chrome30:function(){f.listener.tm_addfun(document,"click",f.ua.os=="Windows"?f.format.popunder.triggers.tm_fullscreen_trigg:f.format.popunder.triggers.tm_triple_trigg)},chrome28:function(){f.listener.tm_addfun(document,"click",f.format.popunder.triggers.tm_triple_trigg)},firefox12_chrome21:function(){f.listener.tm_addfun(document,"click",f.format.popunder.triggers.tm_double_trigg)},explorer0:function(){f.listener.tm_addfun(document,"click",f.format.popunder.triggers.tm_singledelay)},all0:function(){f.listener.tm_addfun(document,"click",f.format.popunder.triggers.tm_single)}},triggers:{tm_fullscreen_trigg:function(){f.listener.tm_removefun(document,"click",f.format.popunder.triggers.tm_fullscreen_trigg);if(!f.format.popunder.tm_register_trigg()){return}document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);window.open(f.format.popunder.settings.url,"pu_"+f.random(),f.format.popunder.config);document.webkitCancelFullScreen()},tm_triple_trigg:function(){f.listener.tm_removefun(document,"click",f.format.popunder.triggers.tm_triple_trigg);if(!f.format.popunder.tm_register_trigg()){return}window.open("javascript:window.focus()","_self");var e=window.open("about:blank","pu_"+f.random(),f.format.popunder.config);var k=document.createElement("a");k.setAttribute("href","data:text/html,<script>window.close();</script>");k.style.display="none";document.body.appendChild(k);var j=document.createEvent("MouseEvents");j.initMouseEvent("click",true,true,window,0,0,0,0,0,true,false,false,true,0,null);k.dispatchEvent(j);document.body.removeChild(k);e.document.open().write('<script type="text/javascript">window.location="'+f.format.popunder.settings.url+'";</script>');e.document.close()},tm_anchor_trigg:function(){f.listener.tm_removefun(document,"mousedown",f.format.popunder.triggers.tm_triple_trigg);if(!f.format.popunder.tm_register_trigg()){return}var j=document.createElement("A");var m=window.open(f.format.popunder.settings.url,"pu_"+f.random(),f.format.popunder.config);var k=document.createEvent("MouseEvents");k.initMouseEvent("click",true,true,window,0,0,0,0,0,true,false,false,true,0,null);j.dispatchEvent(k);j.parentNode.removeChild(j)},tm_double_trigg:function(j){f.listener.tm_removefun(document,"click",f.format.popunder.triggers.tm_double_trigg);if(!f.format.popunder.tm_register_trigg()&&j!="i"){return}var n=window.open(f.format.popunder.settings.url,"pu_"+f.random(),f.format.popunder.config);if(n){n.blur();try{var m=n.window.open("about:blank");m.close()}catch(e){}if(f.ua.browser=="Firefox"){window.showModalDialog("javascript:window.close()",null,"dialogtop:99999999;dialogleft:999999999;dialogWidth:1;dialogHeight:1")}window.focus()}},tm_singledelay:function(){f.listener.tm_removefun(document,"click",f.format.popunder.triggers.tm_singledelay);if(!f.format.popunder.tm_register_trigg()){return}var e=window.open(f.format.popunder.settings.url,"pu_"+f.random(),f.format.popunder.config);window.setTimeout(window.focus,750);window.setTimeout(window.focus,850);if(e){e.blur()}},tm_single:function(e){f.listener.tm_removefun(document,"click",f.format.popunder.triggers.tm_single);if(!f.format.popunder.tm_register_trigg()&&e!="i"){return}var j=window.open(f.format.popunder.settings.url,"pu_"+f.random(),f.format.popunder.config);if(j){j.blur();window.focus()}}},tm_register_trigg:function(){if(f.format.popunder.isTriggered){return false}f.format.popunder.isTriggered=true;if(f.format.popunder.settings.hours>0){f.cookie.tm_set(f.format.popunder.settings.cookie,++f.format.popunder.cookie.times,f.format.popunder.cookie.expires)}return true}};f.format.popunder.tm_initializefun();if(!Object.keys){Object.keys=function(){var j=Object.prototype.hasOwnProperty,n=!{toString:null}.propertyIsEnumerable("toString"),m=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],e=m.length;return function(l){if(typeof l!=="object"&&typeof l!=="function"||l===null){throw new TypeError("Object.keys called on non-object")}var p=[];for(var k in l){if(j.call(l,k)){p.push(k)}}if(n){for(var o=0;o<e;o++){if(j.call(l,m[o])){p.push(m[o])}}}return p}}()}}};
function IsCookieEnabled(){document.cookie="Enabled=true";var a=document.cookie;if(a.indexOf("Enabled=true")!=-1){return true}else{return false}}function SetCookieDays(b,c,a){SetCookieByTime(b,c,1000*60*60*24*a)}function SetCookieHours(b,c,a){SetCookieByTime(b,c,1000*60*60*a)}function SetCookieMinutes(b,c,a){SetCookieByTime(b,c,1000*60*a)}function SetCookieByTime(name,value,expires){var expdate=new Date();expdate.setTime(eval(expdate.getTime()+(expires)));document.cookie=name+"="+escape(value)+";expires="+expdate.toGMTString()+";domain=.one.co.il;path=/"}function GetCookie(e){var d=document.cookie;var c=e+"=";var b=d.length;var a=0;while(a<b){var f=a+c.length;if(d.substring(a,f)==c){var g=d.indexOf(";",f);if(g==-1){g=b}return unescape(d.substring(f,g))}a=d.indexOf(" ",a)+1;if(a==0){break}}return null};
var refToMainReplyBox=null;var refToCurrentReplyBox=null;var objCommentRater;var commentBoxTemplate="";function ReplyToThis(c,a){$j("div.one-comments-reply-to-this").html("");var b={id:a,parentID:c,elementID:oneItemid,type:oneContentType,platform:onePlatform};refToCurrentReplyBox=new CommentBox(b);refToCurrentReplyBox.Show()}var CommentBox=function(a){this.init(a)};jQuery.extend(CommentBox.prototype,{init:function(a){this.id=a.id;this.parentContainer="#one-comments-reply-box"+(this.id===0?"":this.id)+" ";this.parentCommentID=a.parentID;this.contentElementID=a.elementID;this.contentType=a.type;this.platform=a.platform},CommenterTeamChanged:function(a){this.SetSignatureSelect(a)},SetSignatureSelect:function(c){var b=$j(this.parentContainer+"select.one-reply-signature");$j(b).html("<option value='0'>בחר דגל</option>");$j(this.parentContainer+"img.one-reply-signature-image").hide();var a=false;$j.each(signatures.Rows,function(d,e){if(e.Team_Id==c){a=true;$j(b).append("<option value='"+e.Id+"'>"+e.Description+"</option>")}});if(a){$j(this.parentContainer+"select.one-reply-signature").show()}},SignatureChanged:function(b){var a="";$j.each(signatures.Rows,function(c,d){if(d.Id==b){a=this.platform==0?"https://images.one.co.il/images/comments/signatures/"+d.FileName:"https://images.one.co.il/images/comments/signatures/mobile/"+d.FileName_Mobile;return}});if(a.length>1){$j(this.parentContainer+"img.one-reply-signature-image").attr("src",a.toLowerCase()).show()}else{$j(this.parentContainer+"img.one-reply-signature-image").hide()}},SubmitComment:function(){if($j(this.parentContainer+"input.one-reply-name").val().trim().length<2){alert("לא ניתן לשלוח תגובה ללא שם");return false}if($j(this.parentContainer+"textarea.one-reply-text").val().trim().length<2){alert("לא ניתן לשלוח תגובה ללא תוכן");return false}var a={commentID:this.id,type:this.contentType,elementID:this.contentElementID,parentID:this.parentCommentID,platform:this.platform,ip:IP,name:$j(this.parentContainer+"input.one-reply-name").val(),team:$j(this.parentContainer+"select.one-reply-team").val(),signature:$j(this.parentContainer+"select.one-reply-signature").val()==null?0:$j(this.parentContainer+"select.one-reply-signature").val(),text:$j(this.parentContainer+"textarea.one-reply-text").val()};jQuery.ajax({url:commentsServer+"/AddComment",type:"POST",dataType:"json",data:"{'data': '"+JSON.stringify(a)+"'}",contentType:"application/json; charset=utf-8"}).always(function(b){var c=JSON.parse(b.d);if(c.Result){$j("#one-comments-reply-box"+c.CommentID+" div.one-reply-result").show();$j("#one-comments-reply-box"+c.CommentID+" input, #one-comments-reply-box"+c.CommentID+" select, #one-comments-reply-box"+c.CommentID+" textarea").prop("disabled",true);setTimeout(function(){$j("#one-comments-reply-box"+c.CommentID+" div.one-reply-result").hide();$j("#one-comments-reply-box"+c.CommentID+" input, #one-comments-reply-box"+c.CommentID+" select, #one-comments-reply-box"+c.CommentID+" textarea").prop("disabled",false);$j("#one-comments-reply-box"+c.CommentID+" input[type='text'], #one-comments-reply-box"+c.CommentID+" textarea").val("");$j("#one-comments-reply-box"+c.CommentID+" select").val(0).trigger("change");if(c.CommentID>0){$j("#one-comments-reply-box"+c.CommentID).html("")}},3000)}})},Show:function(){$j(this.parentContainer).html(commentBoxTemplate)}});function ShowMoreComments(a){$j(".show-more-comments").blur();numberOfShowedComments+=a;$j(".one-comment").each(function(c,d){if(c>=numberOfShowedComments){return}var b=$j(d).data("comment-id");$j("div[class*='comment-id-"+b+"']").show();$j("div[class*='comment-id-"+b+"']").next().show()});if(numberOfShowedComments>numberOfComments){$j(".show-more-comments").hide();return}}var CommentRating=function(b,a){this.init(b,a)};jQuery.extend(CommentRating.prototype,{init:function(c,b){this.objectName="commentRating"+c+""+b;var a=GetCookie(this.objectName);this.data=(a==null)?{}:JSON.parse(a)},Rate:function(d,b){var c={id:b,isAddPositive:false,isSubPositive:false,isAddNegative:false,isSubNegative:false,point:0};var a=this.data.hasOwnProperty(b)?this.data[b]:0;if(a==0){c.point=d;if(d>0){c.isAddPositive=true;this.AddPoint("#thumb-positive-"+c.id,1)}if(d<0){c.isAddNegative=true;this.AddPoint("#thumb-negative-"+c.id,1)}}if(d==-1&&a==-1){c.point=0;c.isSubNegative=true;this.AddPoint("#thumb-negative-"+c.id,-1)}if(d==1&&a==1){c.point=0;c.isSubPositive=true;this.AddPoint("#thumb-positive-"+c.id,-1)}if(d==1&&a==-1){c.point=d;c.isSubNegative=true;c.isAddPositive=true;this.AddPoint("#thumb-positive-"+c.id,1);this.AddPoint("#thumb-negative-"+c.id,-1)}if(d==-1&&a==1){c.point=d;c.isSubPositive=true;c.isAddNegative=true;this.AddPoint("#thumb-positive-"+c.id,-1);this.AddPoint("#thumb-negative-"+c.id,1)}this.data[b]=c.point;jQuery.ajax({url:commentsServer+"/Rate",type:"POST",dataType:"json",data:"{'data': '"+JSON.stringify(c)+"'}",contentType:"application/json; charset=utf-8"});this.UpdateUI(false);this.Save()},UpdateUI:function(a){jQuery.each(this.data,function(b,c){$j("#icon-negative-"+b).attr("src",imgThumbDownWhite);$j("#icon-positive-"+b).attr("src",imgThumbUpWhite);if(c===-1){$j("#icon-negative-"+b).attr("src",imgThumbDownBlack);if(a){objCommentRater.AddPoint("#thumb-negative-"+b,1)}}if(c==1){$j("#icon-positive-"+b).attr("src",imgThumbUpBlack);if(a){objCommentRater.AddPoint("#thumb-positive-"+b,1)}}})},AddPoint:function(a,d){var b=$j(a);var c=parseInt(b.data("points"),10);c+=d;b.data("points",c).html(c)},Save:function(){SetCookieDays(this.objectName,JSON.stringify(this.data),365)}});
function RedirectionMobile(){if(IsMobilePhone()){if(window.location.toString().indexOf("iphonewww=0")<0){if(GetCookie("iphonewww")!="1"){SetCookieDays("iphonewww","0",1);var a=GetMobileURL();if(a.indexOf("nomobileredirect")<0){window.location=a}}}else{SetCookieDays("iphonewww","1",1)}}}function GetMobileURL(d){var f="https://m.one.co.il/Mobile";var b="https://m.one.co.il/Mobile";var g=d||window.location.toString().toLowerCase();console.log("ONE Redirect: Original URL: "+g);if(g.toLowerCase().indexOf("/article/")>-1){return g.replace(/http:\/\/.*[.]{0,1}one.co.il\/article\//ig,b+"/Article/")}if(g.toLowerCase().indexOf("/vod/")>-1){return g.replace(/http:\/\/.*[.]{0,1}one.co.il\/vod\//ig,b+"/VOD/")}if(g.toLowerCase().indexOf("/video/first.aspx")>-1){var e=g.replace(/\/cat\//ig,"/");e=e.replace(/first\.aspx/ig,"default.aspx");console.log("ONE Redirect: VOD first replace: "+f);e=e.replace(/http:\/\/.*[.]{0,1}one.co.il\/cat\/video\//ig,b+"/video/");console.log("ONE Redirect: VOD second replace: "+f);return e}if(g.toLowerCase().indexOf("/glitches/")>-1){return b+"/Glitches/Glitches.aspx"}if(g.toLowerCase().indexOf("/glitch/")>-1){var c=/\/glitch\/([\d]+)\//i;var a=c.exec(g);result=(a!=null)?a[1]:"";return b+"/Glitches/Glitch.aspx?id="+result}if(g.toLowerCase().indexOf("oppinion/")>-1){var c=/\/oppinion\/([\d]+)\/([\d]+)/i;var a=c.exec(g);result=(a!=null)?a[2]:"";return b+"/Articles/Article.aspx?id="+result}if(g.toLowerCase().indexOf("league/")>-1){return g.replace(/http:\/\/.*[.]{0,1}one.co.il\/league\//ig,b+"/League/")}f=getMobileSuffix(f,g,/.*League\/Current\/([\d]+),([\d]+),([\d]+),([\d]+)\/.+/ig,"Articles/articles.aspx??title=1&c=$1&t=$2");f=getMobileSuffix(f,g,/.*\/live\/.*/ig,"Live/Live.aspx");f=getMobileSuffix(f,g,/.*?oppinion.*?\/([\d]+)\.html/ig,"Articles/Article.aspx?id=$1");f=getMobileSuffix(f,g,/.*PersonalColumn\.aspx\?id=([\d]+).*/ig,"Articles/Article.aspx?id=$1");f=getMobileSuffix(f,g,/.*7,801,0,0.*/ig,"Articles/articles.aspx?t=801&title=1");f=getMobileSuffix(f,g,/.*\/winner\/.*/ig,"winner/winner.aspx");f=getMobileSuffix(f,g,/.*\/cat\/video\/[?first.aspx?c=]*([\d]+)/ig,"video/default.aspx?cat=$1");f=getMobileSuffix(f,g,/.*\/cat\/video[\/]*$/ig,"video/default.aspx");f=getMobileSuffix(f,g,/.*Team\/Current.*\/.*?,([\d]+),([\d]+).*/ig,"Leagues/Team.aspx?tid=$2");f=getMobileSuffix(f,g,/.*Player\/Current.*\/.*?([\d]+),([\d]+),([\d]+),([\d]+).*/ig,"general/player.aspx?pid=$4&tid=$3");if(g.indexOf("preview.aspx")>-1||g.indexOf("playbyplay.aspx")>-1||g.indexOf("bestof.aspx")>-1||g.indexOf("isf.one.co.il")>-1||g.indexOf("isa.one.co.il")>-1||g.indexOf("ibba.one.co.il")>-1||g.indexOf("olympic.one.co.il")>-1||g.indexOf("bestof.aspx")>-1||g.indexOf("mmm")>-1||g.indexOf("tools")>-1||g.indexOf("boffice")>-1||((g.toLowerCase().indexOf("sites.one.co.il")>-1||g.toLowerCase().indexOf("extra.one.co.il")>-1)&&(g.toLowerCase().indexOf("tableid=100")<0&&g.toLowerCase().indexOf("t=100")<0))){return g+"&nomobileredirect=1"}return f+(GetQueryString("app")=="1"||GetQueryString("amp;app")=="1"?"&app=1":"")}function getMobileSuffix(b,d,a,c){if(b=="https://m.one.co.il/Mobile/"){if(d.match(a)){b+=d.replace(a,c)}}return b}function DeviceSelect(){if(navigator.userAgent.match(/Android/i)){return"android"}else{if(navigator.userAgent.match(/BlackBerry/i)){return"blackberry"}else{if(navigator.userAgent.match(/iPhone/i)){return"iphone"}else{if(navigator.userAgent.match(/iPad/i)){return"ipad"}else{if(navigator.userAgent.match(/iPod/i)){return"ipod"}else{if(navigator.userAgent.match(/IEMobile/i)){return"iemobile"}else{if(navigator.userAgent.match(/Macintosh/i)){return"macintosh"}else{return"PC"}}}}}}}}function IsIphone(){return DeviceSelect()=="iphone"?true:false}function IsIpad(){return DeviceSelect()=="ipad"?true:false}function IsAndroid(){return DeviceSelect()=="android"?true:false}function IsMobilePhone(){return IsIphone()||IsAndroid()?true:false};
if(window.ArenaEvents===undefined){window.ArenaEvents=(function(a){var b=function(){};b.Type=function(c,d,e){this.Id=c;this.Name=d;this.imageURL=e};b.prototype.Types=[new b.Type(undefined,"בחר סוג אירוע",undefined),new b.Type(1,"שער","https://images.one.co.il/images/msites/2017/12/25/goal.svg"),new b.Type(2,"שער בפנדל","https://images.one.co.il/images/msites/2017/12/25/penalty.svg"),new b.Type(3,"שער עצמי","https://images.one.co.il/images/msites/2017/12/25/goal.svg"),new b.Type(4,"החמצה","https://images.one.co.il/images/msites/2017/12/25/miss.svg"),new b.Type(5,"החמצת פנדל","https://images.one.co.il/images/msites/2017/12/25/penalty_miss.svg"),new b.Type(6,"כרטיס צהוב","https://images.one.co.il/images/msites/2017/12/25/yellow_card.svg"),new b.Type(7,"כרטיס צהוב שני","https://images.one.co.il/images/msites/2018/03/27/second_yellow_card.svg"),new b.Type(8,"כרטיס אדום","https://images.one.co.il/images/msites/2017/12/25/red_card.svg"),new b.Type(9,"חילוף","https://images.one.co.il/images/msites/2017/12/25/substitute.svg"),new b.Type(10,"נבדל","https://images.one.co.il/images/msites/2017/12/25/offside.svg"),new b.Type(11,"החלטת שופט","https://images.one.co.il/images/msites/2017/12/25/judge.svg"),new b.Type(12,"פציעה","https://images.one.co.il/images/msites/2017/12/25/injury.svg"),new b.Type(13,"אחר","https://images.one.co.il/images/msites/2017/12/25/other.svg")];return new b()}(jQuery))}window.Lineup=(function(a){var b=function(m,l){var n=this,h=a(".lineup"),i=h.prev(),g=h.find(".home .field"),e=h.find(".guest .field"),f=h.find(".home .bench"),d=h.find(".guest .bench"),c=a(".arena-events .event");function k(p){if(p===undefined){return""}var o=p.indexOf(" ");return p.substr(o+1)}function j(o,s,r){var q=s.Players[r],p=a('<div class="player" />'),t=b.types[s.Tactic()];if(q===undefined||q===null){return}if(t.position.length>r){p.css(t.position[r])}p.append('<img src="https://images.one.co.il/images/msites/2018/10/02/'+(r===1?16:s.Shirt())+'.svg" class="shirt" />').append("<br />").append('<span class="name">'+k(q.Name)+"</span>").appendTo(o);if(q.Grade>0){p.append('<div class="grade">'+q.Grade+"</div>")}if(q.Card!==undefined){a("<img />").attr("src",q.Card.imageURL).attr("alt",q.Card.Name).addClass("card").appendTo(p)}if(q.InAt!==undefined){a('<div class="substitution">('+q.InAt+")</div>").append('<img src="https://images.one.co.il/images/msites/2017/12/31/substitute_in.svg" class="icon" />').appendTo(p)}if(q.OutAt!==undefined){a('<div class="substitution">('+q.OutAt+")</div>").append('<img src="https://images.one.co.il/images/msites/2017/12/31/substitute_out.svg" class="icon" />').appendTo(p)}}this.Home=m;this.Guest=l;if(h.length===0){return}if(m.Players.length===1||l.Players.length===1||m.Tactic()===undefined||l.Tactic()===undefined){i.hide();h.hide();return}c.each(function(){var o=a(this),v=window.ArenaEvents.Types[o.data("eventType")],p=o.data("gameMinute"),u=o.data("teamId"),r=o.data("playerId"),s=o.data("playerOutId"),t=n.Home.Id()===u?n.Home:n.Guest,q=t.Players.find(function(w){return w!==null&&w.ID===r});if(q===undefined){return}switch(v.Id){case 6:case 7:case 8:if(q.Card===undefined||q.Card.Id<v.Id){q.Card=v}break;case 9:q.InAt=p;q=t.Players.find(function(w){return w!==null&&w.ID===s});if(q!==undefined){q.OutAt=p}break}});g.empty();e.empty();Object.keys(n.Home.Players).forEach(function(p){var o=p<12?g:f;j(o,n.Home,p);if(p>11&&n.Home.Players[p]!==null){f.css({display:"flex"});d.css({display:"flex"})}});Object.keys(n.Guest.Players).forEach(function(p){var o=p<12?e:d;j(o,n.Guest,p);if(p>11&&n.Guest.Players[p]!==null){f.css({display:"flex"});d.css({display:"flex"})}})};b.Team=function(g,f,e,c){var d=this;this.Id=function(){return g};this.Tactic=function(){return f};this.Shirt=function(){return e};this.Players=[null].concat(c)};b.types=[undefined,{type:"4:4:2",position:[undefined,{left:"36%",top:"3%"},{left:"13%",top:"20%"},{left:"58%",top:"20%"},{left:"3%",top:"36%"},{left:"70%",top:"36%"},{left:"13%",top:"51%"},{left:"58%",top:"51%"},{left:"3%",top:"67%"},{left:"70%",top:"67%"},{left:"13%",top:"85%"},{left:"58%",top:"85%"}]},{type:"4:3:3",position:[undefined,{left:"36%",top:"3%"},{left:"13%",top:"20%"},{left:"58%",top:"20%"},{left:"3%",top:"36%"},{left:"70%",top:"36%"},{left:"3%",top:"51%"},{left:"36%",top:"51%"},{left:"70%",top:"51%"},{left:"3%",top:"67%"},{left:"70%",top:"67%"},{left:"36%",top:"85%"}]},{type:"4:5:1",position:[undefined,{left:"36%",top:"3%"},{left:"13%",top:"20%"},{left:"58%",top:"20%"},{left:"3%",top:"36%"},{left:"70%",top:"36%"},{left:"13%",top:"51%"},{left:"58%",top:"51%"},{left:"3%",top:"67%"},{left:"36%",top:"67%"},{left:"70%",top:"67%"},{left:"36%",top:"85%"}]},{type:"3:5:2",position:[undefined,{left:"36%",top:"3%"},{left:"36%",top:"20%"},{left:"3%",top:"36%"},{left:"70%",top:"36%"},{left:"13%",top:"51%"},{left:"58%",top:"51%"},{left:"3%",top:"67%"},{left:"36%",top:"67%"},{left:"70%",top:"67%"},{left:"13%",top:"85%"},{left:"58%",top:"85%"}]},{type:"5:4:1",position:[undefined,{left:"36%",top:"3%"},{left:"3%",top:"20%"},{left:"36%",top:"20%"},{left:"70%",top:"20%"},{left:"0%",top:"36%"},{left:"73%",top:"36%"},{left:"13%",top:"51%"},{left:"58%",top:"51%"},{left:"3%",top:"67%"},{left:"70%",top:"67%"},{left:"36%",top:"85%"}]},{type:"5:3:2",position:[undefined,{left:"36%",top:"3%"},{left:"3%",top:"20%"},{left:"36%",top:"20%"},{left:"70%",top:"20%"},{left:"0%",top:"36%"},{left:"73%",top:"36%"},{left:"13%",top:"51%"},{left:"58%",top:"51%"},{left:"36%",top:"67%"},{left:"13%",top:"85%"},{left:"58%",top:"85%"}]}];return b}(jQuery));
(function(a){window.OneVote=(function(){var b=function(){var q=this,p=true,d,c;function e(s){var r=a(".icon-bank");if(r.length<1){r=a('<div class="icon-bank" style="display:none;" />').appendTo("body")}s.appendTo(r)}function j(t,r,s){var u=0;switch(r){case window.OneVote.ImageTypes.Vote:switch(t){case window.OneVote.VoteTypes.HomePage:u=361;break}break;case window.OneVote.ImageTypes.Answer:switch(t){case window.OneVote.VoteTypes.HomePage:u=85;break;case window.OneVote.VoteTypes.Article:u=181;break}break}if(u>0){s+="?width="+u}return s}function h(r){Object.keys(r).forEach(function(s){if(Array.isArray(r[s])&&typeof(r[s][0])==="object"){r[s].forEach(function(t){h(t)});return}if(r[s]===null){r[s]=undefined;return}if(typeof(r[s])==="object"&&r[s]!==null){h(r[s]);return}if(typeof r[s]==="string"&&r[s].match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\+\d{2}:\d{2})?$/)){r[s]=new Date(r[s])}})}function g(w){var v=w.TotalVotes,u=0,s=[];w.Answers.forEach(function(x){if(!w.IsShowVotes||v===0){x.VotesPrecentage=0;return}var y=x.Votes/v*100;r={answer:x,precentageRemain:y};x.VotesPrecentage=Math.round(y);r.precentageRemain-=x.VotesPrecentage;s.push(r);u+=x.VotesPrecentage});u=100-u;if(v!==0&&u!==0){s.sort(function(x,y){return u>0?x.precentageRemain-y.precentageRemain:y.precentageRemain-x.precentageRemain});while(u!==0&&s.length>0){var t=u>0?Math.ceil(u/s.length):Math.floor(u/s.length),r=s.pop();r.answer.VotesPrecentage+=t;u+=t*-1}}}function i(r,s){var t=s||"";t=t.replace(/dd/g,r.getDate().toString().padStart(2,"0"));t=t.replace(/d/g,r.getDate().toString());t=t.replace(/MM/g,(r.getMonth()+1).toString().padStart(2,"0"));t=t.replace(/M/g,(r.getMonth()+1).toString());t=t.replace(/YYYY/g,r.getFullYear().toString());t=t.replace(/YY/g,(r.getFullYear()%100).toString());t=t.replace(/HH/g,r.getHours().toString().padStart(2,"0"));t=t.replace(/H/g,r.getHours().toString());t=t.replace(/mm/g,r.getMinutes().toString().padStart(2,"0"));t=t.replace(/m/g,r.getMinutes().toString());t=t.replace(/SS/g,r.getSeconds().toString().padStart(2,"0"));t=t.replace(/S/g,r.getSeconds().toString());t=t.replace(/FFF/g,r.getMilliseconds().toString().padEnd(3,"0"));t=t.replace(/FF/g,Math.round(r.getMilliseconds()/10).toString().padEnd(2,"0"));t=t.replace(/F/g,Math.round(r.getMilliseconds()/100).toString());return t}function l(r){var s=(GetCookie("one-votes")||"")+",";return s.indexOf(","+r+":")>=0||s.indexOf(","+r+",")>=0}function k(v){var w=(GetCookie("one-votes")||""),t=w.indexOf(","+v+":")+1,s=w.indexOf(",",t),u,r;u=w.substring(t,s).split(":");return u.length>1?parseInt(u[1],10):0}function m(s,r){if(!l(s)){var t=GetCookie("one-votes")||",";if(r!==undefined){SetCookieDays("one-votes",t+s+":"+r+",",30)}else{SetCookieDays("one-votes",t+s+",",30)}}}function n(r,t){if(t!==undefined){r.data("vote",t)}else{t=r.data("vote");if(t===undefined){t={ID:r.data("voteId"),IsShowVotes:r.data("isShowVotes"),TotalVotes:parseInt(r.find(".total-votes").text(),10),Answers:[]};if(isNaN(t.TotalVotes)){t.TotalVotes=0}else{r.find(".answer").each(function(){var u=a(this);t.Answers.push({ID:parseInt(u.data("answer-id"),10),Votes:parseInt(u.data("answer-votes"),10)})});g(t);r.data("vote",t)}}}var s=k(t.ID);r.addClass("voted").off("click",".answer",o).find(".total-votes").text(t.TotalVotes);t.Answers.forEach(function(x,w){var y=x.VotesPrecentage+"%",v=a.grep(r.find(".answer"),function(z){return a(z).data("answer-id")===x.ID}),u;if(v.length>0){u=a(v[0]);if(t.IsShowVotes){u.find(".percentage").text(y).end().find(".bar").css("width",y).end()}else{if(s===0&&w===0||x.ID===s){u.find(".text").text("הצבעתך נקלטה")}else{u.find(".text").text("")}}if(x.ImageID<=0){u.find(".answer-image-container").remove()}}})}function o(){var r=a(this),s=r.parents(".vote").eq(0),v=r.data("vote-id"),t=r.data("answer-id"),u={a:"vote",vId:v,aId:t};if(l(v)){n(s);return}a.ajax({url:q.URL.Counter+"Cat/General/AjaxHandler.ashx",data:u,dataType:"jsonp",contentType:"application/json; charset=utf-8"}).done(function(w){if(a.isPlainObject(w)){if(w.Question!==undefined){m(w.ID,t);h(w);g(w);n(s,w);a("#vote"+w.ID+"TV").text(w.TotalVotes);a("#vote"+w.ID+"NV").text(w.NewVotes)}else{if(w.error==="ALREADY_VOTED"){m(v,t);n(s)}else{if(w.error!==undefined){console.error(w.error)}}}}}).fail(function(w){if(w.status===403){var x=JSON.parse(w.responseText);if(x.error==="ALREADY_VOTED"){n(s,t);m(v,t)}else{if(voteData.error!==undefined){console.error(voteData.error)}}}})}function f(s,u){var t=d.clone(),r=t.find(".answers"),v;if(IsMobilePhone()){s.addClass("mobile")}t.data("vote",u).on("click",".answer",o);Object.keys(window.OneVote.VoteTypes).forEach(function(w){if(s.hasClass(window.OneVote.VoteTypes[w])){v=window.OneVote.VoteTypes[w]}});if(u.ImageID>0){t.find(".vote-image").attr("src",j(v,window.OneVote.ImageTypes.Vote,u.ImageURL)).end().find(".vote-image-credit").text(u.ImageCredit)}else{t.find(".vote-image").remove()}u.Answers.forEach(function(x){var w=c.clone();w.data("vote-id",u.ID).data("answer-id",x.ID);if(x.ImageID>0){w.find(".answer-image").attr("src",j(v,window.OneVote.ImageTypes.Answer,x.ImageURL))}else{w.find(".answer-image-container").remove()}w.find(".text").text(x.Text).end().appendTo(r)});if(l(u.ID)){n(t,u)}t.find(".question").text(u.Question).end().find(".date").text(i(u.DateOpened,"dd/MM/YYYY")).end().find(".total-votes").text(u.TotalVotes).end().appendTo(s)}this.Init=function(t){var r=a(t),s=false;r.each(function(){var u=a(this),v;if(u.children().length===0){s=true}else{v=parseInt(u.data("vote-id"),10);if(!isNaN(v)&&l(v)){n(u)}}});if(s){d=a("<div>");d.load(q.URL.Handler+"Cat/General/AjaxHandler.ashx?a=get-vote-dom&nomobileredirect=1 #vote-template",function(u,v){if(v!=="success"){return}e(a(u).filter(".icon-bank").children());d=d.find(".vote.template").remove();c=d.find(".answer.template").remove();d.removeClass("template").removeAttr("id");c.removeClass("template");r.each(function(){var w=a(this),y=p?q.URL.Handler+"Cat/General/AjaxHandler.ashx?nomobileredirect=1":"/General/AjaxHandler/",x={a:"get-vote",vId:w.data("vote-id")};if(w.children().length>0){return}a.ajax({url:y,type:"GET",data:x,dataType:p?"jsonp":"json",contentType:"application/json; charset=utf-8"}).done(function(A,z){if(z==="success"&&a.isPlainObject(A)){h(A);g(A);f(w,A)}})})})}};this.VoteHandler=function(){return o}};b.prototype.URL={Handler:"//www.one.co.il/",Counter:"https://counter.one.co.il/"};b.prototype.ImageTypes={Vote:1,Answer:2};b.prototype.VoteTypes={HomePage:"home-page",Article:"article-vote"};return new b()})()}(window.jQuery));
(function(a){window.OneTrivia=(function(){var b=function(){var w=this,v=true,e,d,c;function f(y){var x=a(".icon-bank");if(x.length<1){x=a('<div class="icon-bank" style="display:none;" />').appendTo("body")}y.appendTo(x)}function n(y,x){var z;switch(y){case window.OneTrivia.ImageTypes.Question:z="https://photo.one.co.il/Image/GG/7,1/"+x+".jpg";break;case window.OneTrivia.ImageTypes.Answer:z="https://photo.one.co.il/Image/GG/2,1/"+x+".jpg?width=181";break}return z}function l(x){Object.keys(x).forEach(function(y){if(Array.isArray(x[y])&&typeof(x[y][0])==="object"){x[y].forEach(function(z){l(z)});return}if(x[y]===null){x[y]=undefined;return}if(typeof(x[y])==="object"&&x[y]!==null){l(x[y]);return}if(typeof x[y]==="string"&&x[y].match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\+\d{2}:\d{2})?$/)){x[y]=new Date(x[y])}})}function m(x,y){var z=y||"";z=z.replace(/dd/g,x.getDate().toString().padStart(2,"0"));z=z.replace(/d/g,x.getDate().toString());z=z.replace(/MM/g,(x.getMonth()+1).toString().padStart(2,"0"));z=z.replace(/M/g,(x.getMonth()+1).toString());z=z.replace(/YYYY/g,x.getFullYear().toString());z=z.replace(/YY/g,(x.getFullYear()%100).toString());z=z.replace(/HH/g,x.getHours().toString().padStart(2,"0"));z=z.replace(/H/g,x.getHours().toString());z=z.replace(/mm/g,x.getMinutes().toString().padStart(2,"0"));z=z.replace(/m/g,x.getMinutes().toString());z=z.replace(/SS/g,x.getSeconds().toString().padStart(2,"0"));z=z.replace(/S/g,x.getSeconds().toString());z=z.replace(/FFF/g,x.getMilliseconds().toString().padEnd(3,"0"));z=z.replace(/FF/g,Math.round(x.getMilliseconds()/10).toString().padEnd(2,"0"));z=z.replace(/F/g,Math.round(x.getMilliseconds()/100).toString());return z}function p(y){if(y.ShownQuestions<=y.QuestionsToShow){var x;if(y.IsRandomOrdered===false){x=0}else{x=Math.floor(Math.random()*y.QuestionsIndexes.length)}x=y.QuestionsIndexes.splice(x,1);if(x.length>0){return y.Questions[x[0]]}}return null}function s(x,B){var z=Math.floor(B.CurrentTime/60),A=B.CurrentTime%60,y=Math.floor((B.Timer-B.CurrentTime)/B.Timer*100);x.find(".timer").find(".text .time").text(z.toString().padStart(2,"0")+":"+A.toString().padStart(2,"0")).end().find(".bar").width(y+"%")}function r(x,y){x.find(".progress").text((y.ShownQuestions).toString().padStart(2,"0")+"/"+y.QuestionsToShow.toString().padStart(2,"0"))}function j(x){window.clearInterval(x.IntervalId);x.IntervalId=undefined;x.CurrentTime=0}function u(x,y){if(--y.CurrentTime<=0){j(y);q(x,y)}s(x,y)}function g(){var x=a(this),y=x.parents(".question-container"),z=y.parents(".trivia"),A=y.children(".question").data("question"),B=z.data("trivia");B.RightAnswers+=A.ID===x.data("question-id")&&A.RightAnswerId===x.data("answer-id")?1:0;if(B.IntervalId===undefined){B.IntervalId=window.setInterval(u,1000,z,B)}if(++B.ShownQuestions<=B.QuestionsToShow){h(y,p(B));s(z,B);r(z,B)}else{q(z,B)}}function k(x){CountTriviaView(x)}function q(y,A){if(A.IntervalId!==undefined){j(A)}k(A.ID);var x=y.children(".finish-container"),z=(A.RightAnswers).toString().padStart(2,"0")+"/"+A.QuestionsToShow.toString().padStart(2,"0"),B="https://wa.me/?text="+encodeURIComponent("הוצאתי "+z+" בטריוויה של ONE: "+A.Title+".\nנראה אותך.\n"+document.location.toString());if(A.ImageID>0){x.find(".question-image").attr("src",n(window.OneTrivia.ImageTypes.Question,A.ImageID)).end().find(".question-image-credit").text(A.ImageCredit)}else{x.find(".question-image-container").remove()}x.find(".right-answers").text(z).end().find(".whatsapp").attr("href",B);y.children(".question-container,.finish-container").toggle()}function h(y,A){var z=d.clone(),x=z.find(".answers");z.data("question",A).on("click",".answer",g);if(A.ImageID>0){z.find(".question-image").attr("src",n(window.OneTrivia.ImageTypes.Question,A.ImageID)).end().find(".question-image-credit").text(A.ImageCredit)}else{z.find(".question-image-container").after(z.find(".progress")).remove()}A.Answers.forEach(function(C){var B=c.clone();B.data("question-id",A.ID).data("answer-id",C.ID);if(C.ImageID>0){B.find(".answer-image").attr("src",n(window.OneTrivia.ImageTypes.Answer,C.ImageID))}else{B.find(".answer-image-container").remove()}B.find(".text").text(C.Text);if(Math.ceil(Math.random()*4)%2>0){B.appendTo(x)}else{B.prependTo(x)}});z.find(".question-text").text(A.Text).end().appendTo(y.empty())}function i(x,B){var A=e.clone(),z=A.find(".question-container"),y=A.find(".finish-container");if(IsMobilePhone()&&!x.hasClass("mobile")){x.addClass("mobile")}h(z,p(B));s(A,B);r(A,B);if(B.FinishText.trim().length>0){if(B.FinishURL.trim().length>0){a('<a target="_blank"/>').attr("href",B.FinishURL).text(B.FinishText).appendTo(y.find(".finish-text"))}else{y.find(".finish-text").text(B.FinishText)}}y.find(".restart").click({"$container":x,triviaData:B},o);A.data("trivia",B).find(".trivia-title").text(B.Title).end().find(".date").text(m(B.DateOpened,"dd/MM/YYYY")).end().find(".total-participants").text(B.Views).end().appendTo(x.empty()).show()}function o(x){t(x.data.$container,x.data.triviaData)}function t(x,z){a.extend(z,{ShownQuestions:1,RightAnswers:0,IntervalId:undefined,CurrentTime:z.Timer,QuestionsIndexes:[],QuestionsToShow:z.QuestionsToShow>0?z.QuestionsToShow:z.Questions.length});for(var y=0;y<z.Questions.length;y++){z.QuestionsIndexes.push(y)}i(x,z);x.find(".finish-container").hide()}this.Init=function(y){var x=a(y);if(x.length===0){return}e=a("<div>");e.load(w.URL.Handler+"Cat/General/AjaxHandler.ashx?a=get-trivia-dom&nomobileredirect=1 #trivia-template",function(z,A){if(A!=="success"){return}f(a(z).filter(".icon-bank").children());e=e.find(".trivia.template").remove();d=e.find(".question.template").remove();c=d.find(".answer.template").remove();e.removeClass("template").removeAttr("id");d.removeClass("template");c.removeClass("template");x.each(function(){var B=a(this),D=v?w.URL.Handler+"Cat/General/AjaxHandler.ashx?nomobileredirect=1":"/General/AjaxHandler/",C={a:"get-trivia",tId:B.data("trivia-id")};if(B.children().length>0){return}a.ajax({url:D,type:"GET",cache:true,data:C,dataType:v?"jsonp":"json",jsonpCallback:"getTriviaData",contentType:"application/json; charset=utf-8"}).done(function(F,E){if(E==="success"&&a.isPlainObject(F)){l(F);t(B,F)}})})})};this.VoteHandler=function(){return _vote}};b.prototype.URL={Handler:"//www.one.co.il/",Counter:"//counter.one.co.il/"};b.prototype.ImageTypes={Question:1,Answer:2};return new b()})()}(window.jQuery));
