function quote(b){if(document.selection)document.post.com.focus(),document.selection.createRange().text=">>"+b+"\n";else if(document.post.com.selectionStart||"0"==document.post.com.selectionStart){var a=document.post.com.selectionEnd;document.post.com.value=document.post.com.value.substring(0,document.post.com.selectionStart)+">>"+b+"\n"+document.post.com.value.substring(a,document.post.com.value.length)}else document.post.com.value+=">>"+b+"\n"}
function replyhl(b){for(var b=document.getElementById("p"+b),a=document.querySelectorAll(".highlight"),c=0;c<a.length;c++)a[c].className&&(a[c].className=a[c].className.replace(/ highlight$/,""));b.className+=" highlight"}function repquote(b){""==document.post.com.value&&quote(b)}function reppop(b){var a=(new Date).getTime();window.open(b,a,"toolbar=0,scrollbars=0,location=0,status=1,menubar=0,resizable=1,width=660,height=192");return!1}
function recaptcha_load(){document.getElementById("recaptcha_div")&&Recaptcha.create("6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc","recaptcha_div",{theme:"clean"})}
function toggleMobilePostForm(b,a){elem=document.getElementById("mpostform");postForm=document.getElementById("postForm");elem.className.match("hidden")?(elem.className=elem.className.replace("hidden","shown"),postForm.className=postForm.className.replace(" hideMobile",""),elem.innerHTML="Close Post Form"):(elem.className=elem.className.replace("shown","hidden"),postForm.className+=" hideMobile",elem.innerHTML=b?"Start a Thread":"Reply to Thread");a&&window.scroll(0,0)}
function toggleGlobalMessage(){elem=document.getElementById("globalToggle");postForm=document.getElementById("globalMessage");elem.className.match("hidden")?(elem.className=elem.className.replace("hidden","shown"),postForm.className=postForm.className.replace(" hideMobile",""),elem.innerHTML="Close Announcement"):(elem.className=elem.className.replace("shown","hidden"),postForm.className+=" hideMobile",elem.innerHTML="View Important Announcement")}
function init(){if("undefined"!=typeof style_group&&style_group)var b=readCookie(style_group),b=b?b:getPreferredStyleSheet();switch(b){case"Yotsuba B":setActiveStyleSheet("Yotsuba B New");break;case"Yotsuba":setActiveStyleSheet("Yotsuba New");break;case"Burichan":setActiveStyleSheet("Burichan New");break;case"Futaba":setActiveStyleSheet("Futaba New");break;default:setActiveStyleSheet(b)}location.href.match(/boards\.4chan\.org\/(\w+)/);var a=location.href.split(/#/);if(a[1]){if(a[1].match(/^p([0-9]+)$/)){var c=a[1].replace("p","");replyhl(c)}a[1].match(/^q([0-9]+)$/)&&(c=a[1].replace("q",""),repquote(c),replyhl(c))}if("undefined"!=typeof jsMath&&"undefined"!=typeof jsMath.Easy.onload&&!jsMath.Easy.loaded)jsMath.Easy.onload();if(window.location.href.match("/res/")){elem=document.querySelectorAll(".postNum a");len=elem.length;for(a=0;a<len;a++)elem[a].onclick=function(){link=this.getAttribute("href").match("#p");if(!link)return!0;link=this.getAttribute("href").match(/#p([0-9]+)/)[1];replyhl(link)}}if(navigator.userAgent&&navigator.userAgent.match(/iP(hone|ad|od)/i)){links=document.querySelectorAll(".spoiler");len=links.length;for(a=0;a<len;a++)links[a].onclick=function(){this.setAttribute("style",this.getAttribute("style").match("fff")?"color: #000!important;":"color: #fff!important;")}}styleSelect=document.getElementById("styleSelector");len=styleSelect.options.length;for(a=0;a<len;a++)styleSelect.options[a].value==b&&(styleSelect.selectedIndex=a);document.getElementById("delPassword").value=get_pass("4chan_pass");do_code&&"function"==typeof prettyPrint&&prettyPrint();extra.init()}function uninit(){var b=getActiveStyleSheet();b&&createCookie(style_group,b,365,".4chan.org")}function setActiveStyleSheet(b){for(var a,c,d="",e=0;a=document.getElementsByTagName("link")[e];e++)"switch"==a.getAttribute("title")&&(c=a),-1!=a.getAttribute("rel").indexOf("style")&&a.getAttribute("title")&&a.getAttribute("title")==b&&(d=a.href);c.setAttribute("href",d)}
function getActiveStyleSheet(){var b,a,c;for(b=0;a=document.getElementsByTagName("link")[b];b++)if("switch"==a.getAttribute("title"))c=a;else if(-1!=a.getAttribute("rel").indexOf("style")&&a.getAttribute("title")&&a.href==c.href)return a.getAttribute("title");return null}function getPreferredStyleSheet(){return"ws_style"==style_group?"Yotsuba B New":"Yotsuba New"}
function createCookie(b,a,c,d){if(c){var e=new Date;e.setTime(e.getTime()+864E5*c);c="; expires="+e.toGMTString()}else c="";document.cookie=b+"="+a+c+"; path=/"+(d?"; domain="+d:"")}function readCookie(b){for(var b=b+"=",a=document.cookie.split(";"),c=0;c<a.length;c++){for(var d=a[c];" "==d.charAt(0);)d=d.substring(1,d.length);if(0==d.indexOf(b))return d.substring(b.length,d.length)}return null}window.onload=init;window.onunload=uninit;