jQuery.noConflict();var defaultstylesheet;var style_cookie;var style_cookie_txt;var style_cookie_site;var kumod_set=false;var ispage;if(!Array.prototype.indexOf){Array.prototype.indexOf=function(b){var a=this.length;var c=Number(arguments[1])||0;c=(c<0)?Math.ceil(c):Math.floor(c);if(c<0){c+=a}
for(;c<a;c++){if(c in this&&this[c]===b){return c}}
return-1}}
var Utf8={encode:function(b){b=b.replace(/\r\n/g,"\n");var a="";for(var e=0;e<b.length;e++){var d=b.charCodeAt(e);if(d<128){a+=String.fromCharCode(d)}else{if((d>127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);a+=String.fromCharCode((d&63)|128)}else{a+=String.fromCharCode((d>>12)|224);a+=String.fromCharCode(((d>>6)&63)|128);a+=String.fromCharCode((d&63)|128)}}}
return a},decode:function(a){var b="";var d=0;var e=c1=c2=0;while(d<a.length){e=a.charCodeAt(d);if(e<128){b+=String.fromCharCode(e);d++}else{if((e>191)&&(e<224)){c2=a.charCodeAt(d+1);b+=String.fromCharCode(((e&31)<<6)|(c2&63));d+=2}else{c2=a.charCodeAt(d+1);c3=a.charCodeAt(d+2);b+=String.fromCharCode(((e&15)<<12)|((c2&63)<<6)|(c3&63));d+=3}}}
return b}};function replaceAll(b,d,c){var a=b.indexOf(d);while(a>-1){b=b.replace(d,c);a=b.indexOf(d)}
return b}
function insert(d){var b=document.forms.postform.message;if(b){if(b.createTextRange&&b.caretPos){var c=b.caretPos;c.text=c.text.charAt(c.text.length-1)==" "?d+" ":d}else{if(b.setSelectionRange){var e=b.selectionStart;var a=b.selectionEnd;b.value=b.value.substr(0,e)+d+b.value.substr(a);b.setSelectionRange(e+d.length,e+d.length)}else{b.value+=d+" "}}
b.focus()}}
function quote(b,a){var v=eval("document."+a+".message");v.value+=">>"+b+"\n";v.focus()}
function checkhighlight(){var a;if(a=/#i([0-9]+)/.exec(document.location.toString())){if(!document.forms.postform.message.value){insert(">>"+a[1])}}
if(a=/#([0-9]+)/.exec(document.location.toString())){highlight(a[1])}}
function highlight(d,f){if(f&&ispage){return}
var b=document.getElementsByTagName("td");for(var c=0;c<b.length;c++){if(b[c].className=="highlight"){b[c].className="reply"}}
var e=document.getElementById("reply"+d);if(e){e.className="highlight";var a=/^([^#]*)/.exec(document.location.toString());document.location=a[1]+"#"+d}}
function get_password(a){var e=getCookie(a);if(e){return e}
var d="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";var e="";for(var c=0;c<8;c++){var b=Math.floor(Math.random()*d.length);e+=d.substring(b,b+1)}
set_cookie(a,e,365);return(e)}
function togglePassword(){var c=(navigator.userAgent.indexOf("Safari")!=-1);var f=(navigator.userAgent.indexOf("Opera")!=-1);var b=(navigator.appName=="Netscape");var a=document.getElementById("passwordbox");var e;if((c)||(f)||(b)){e=a.innerHTML}else{e=a.text}
e=e.toLowerCase();var d="<td></td><td></td>";if(e==d){var d='<td class="postblock">Mod</td><td><input type="text" name="modpassword" size="28" maxlength="75"> <acronym title="Distplay staff status (Mod/Admin)">D</acronym>: <input type="checkbox" name="displaystaffstatus" checked> <acronym title="Lock">L</acronym>: <input type="checkbox" name="lockonpost">  <acronym title="Sticky">S</acronym>: <input type="checkbox" name="stickyonpost">  <acronym title="Raw HTML">RH</acronym>: <input type="checkbox" name="rawhtml">  <acronym title="Name">N</acronym>: <input type="checkbox" name="usestaffname"></td>'}
if((c)||(f)||(b)){a.innerHTML=d}else{a.text=d}
return false}
function toggleOptions(d,c,b){if(document.getElementById("opt"+d)){if(document.getElementById("opt"+d).style.display==""){document.getElementById("opt"+d).style.display="none";document.getElementById("opt"+d).innerHTML=""}else{var a='<td class="label"><label for="formatting">Formatting:</label></td><td colspan="3"><select name="formatting"><option value="" onclick="javascript:document.getElementById(\'formattinginfo'+d+"').innerHTML = 'All formatting is performed by the user.';\">Normal</option><option value=\"aa\" onclick=\"javascript:document.getElementById('formattinginfo"+d+"').innerHTML = '[aa] and [/aa] will surround your message.';\"";if(getCookie("kuformatting")=="aa"){a+=" selected"}
a+='>Text Art</option></select> <input type="checkbox" name="rememberformatting"><label for="rememberformatting">Remember</label> <span id="formattinginfo'+d+'">';if(getCookie("kuformatting")=="aa"){a+="[aa] and [/aa] will surround your message."}else{a+="All formatting is performed by the user."}
a+='</span></td><td><input type="button" value="Preview" class="submit" onclick="javascript:postpreview(\'preview'+d+"', '"+b+"', '"+d+"', document."+c+'.message.value);"></td>';document.getElementById("opt"+d).innerHTML=a;document.getElementById("opt"+d).style.display=""}}}
function getCookie(name){with(document.cookie){var regexp=new RegExp("(^|;\\s+)"+name+"=(.*?)(;|$)");var hit=regexp.exec(document.cookie);if(hit&&hit.length>2){return Utf8.decode(unescape(replaceAll(hit[2],"+","%20")))}else{return""}}}
function set_cookie(c,d,e){if(e){var b=new Date();b.setTime(b.getTime()+(e*24*60*60*1000));var a="; expires="+b.toGMTString()}else{a=""}
document.cookie=c+"="+d+a+"; path=/"}
function set_stylesheet(styletitle){jQuery("#stylesheet").attr("href",ku_boardspath+"/css/"+styletitle+".css")}
function set_cookiestyle(styletitle,txt,site){if(txt){set_cookie("kustyle_txt",styletitle,365)}else{if(site){set_cookie("kustyle_site",styletitle,365)}else{set_cookie("kustyle",styletitle,365)}}}
function get_preferred_stylesheet(){var b=document.getElementsByTagName("link");for(var c=0;c<b.length;c++){var a=b[c].getAttribute("rel");var d=b[c].getAttribute("title");if(a.indexOf("style")!=-1&&a.indexOf("alt")==-1&&d){return d}}
return null}
function delandbanlinks(){if(!kumod_set){return}
var b=document.getElementsByTagName("span");var e;var a;for(var c=0;c<b.length;c++){e=b[c];if(e.getAttribute("class")){if(e.getAttribute("class").substr(0,3)=="dnb"){a=e.getAttribute("class").split("|");var d='[<a href="'+ku_cgipath+"/manage_page.php?action=delposts&boarddir="+a[1]+"&del";if(a[3]=="y"){d+="thread"}else{d+="post"}
d+="id="+a[2]+'" title="Delete" onclick="return confirm(\'Are you sure you want to delete this post/thread?\');">D</a> <a href="'+ku_cgipath+"/manage_page.php?action=delposts&boarddir="+a[1]+"&del";if(a[3]=="y"){d+="thread"}else{d+="post"}
d+="id="+a[2]+"&postid="+a[2]+'" title="Delete & Ban" onclick="return confirm(\'Are you sure you want to delete and ban the poster of this post/thread?\');">&</a> <a href="'+ku_cgipath+"/manage_page.php?action=bans&banboard="+a[1]+"&banpost="+a[2]+'" title="Ban">B</a>]';b[c].innerHTML=d}}}}
function togglethread(a){if(hiddenthreads.toString().indexOf(a)!==-1){document.getElementById("unhidethread"+a).style.display="none";document.getElementById("thread"+a).style.display="block";hiddenthreads.splice(hiddenthreads.indexOf(a),1);set_cookie("hiddenthreads",hiddenthreads.join("!"),30)}else{document.getElementById("unhidethread"+a).style.display="block";document.getElementById("thread"+a).style.display="none";hiddenthreads.push(a);set_cookie("hiddenthreads",hiddenthreads.join("!"),30)}
return false}
function toggleblotter(c){var b=document.getElementsByTagName("li");var a=new Array();var d;for(i=0,iarr=0;i<b.length;i++){att=b[i].getAttribute("class");if(att=="blotterentry"){d=b[i];if(d.style.display=="none"){d.style.display="";if(c){set_cookie("ku_showblotter","1",365)}}else{d.style.display="none";if(c){set_cookie("ku_showblotter","0",365)}}}}}
function expandthread(c,a){if(document.getElementById("replies"+c+a)){var b=document.getElementById("replies"+c+a);b.innerHTML="Expanding thread...<br><br>"+b.innerHTML;new Ajax.Request(ku_boardspath+"/expand.php?board="+a+"&threadid="+c,{method:"get",onSuccess:function(e){var d=e.responseText||"something went wrong (blank response)";b.innerHTML=d;delandbanlinks()},onFailure:function(){alert("Something went wrong...")}})}
return false}
function quickreply(a){if(a==0){document.getElementById("posttypeindicator").innerHTML="new thread"}else{document.getElementById("posttypeindicator").innerHTML="reply to "+a+' [<a href="#postbox" onclick="javascript:quickreply(\'0\');" title="Cancel">x</a>]'}
document.postform.replythread.value=a}
function getwatchedthreads(c,b){if(document.getElementById("watchedthreadlist")){var a=document.getElementById("watchedthreadlist");a.innerHTML="Loading watched threads...";new Ajax.Request(ku_boardspath+"/threadwatch.php?board="+b+"&threadid="+c,{method:"get",onSuccess:function(e){var d=e.responseText||"something went wrong (blank response)";a.innerHTML=d},onFailure:function(){alert("Something went wrong...")}})}}
function addtowatchedthreads(b,a){if(document.getElementById("watchedthreadlist")){new Ajax.Request(ku_boardspath+"/threadwatch.php?do=addthread&board="+a+"&threadid="+b,{method:"get",onSuccess:function(d){var c=d.responseText||"something went wrong (blank response)";alert("Thread successfully added to your watch list.");getwatchedthreads("0",a)},onFailure:function(){alert("Something went wrong...")}})}}
function removefromwatchedthreads(b,a){if(document.getElementById("watchedthreadlist")){new Ajax.Request(ku_boardspath+"/threadwatch.php?do=removethread&board="+a+"&threadid="+b,{method:"get",onSuccess:function(d){var c=d.responseText||"something went wrong (blank response)";getwatchedthreads("0",a)},onFailure:function(){alert("Something went wrong...")}})}}
function hidewatchedthreads(){set_cookie("showwatchedthreads","0",30);if(document.getElementById("watchedthreads")){document.getElementById("watchedthreads").innerHTML='The Watched Threads box will be hidden the next time a page is loaded.  [<a href="#" onclick="javascript:showwatchedthreads();return false">undo</a>]'}}
function showwatchedthreads(){set_cookie("showwatchedthreads","1",30);window.location.reload(true)}
function checkcaptcha(a){if(document.getElementById(a)){if(document.getElementById(a).captcha){if(document.getElementById(a).captcha.value==""){alert("Please enter the captcha image text.");document.getElementById(a).captcha.focus();return false}}}
return true}
function expandimg(j,h,f,c,g,e,a){element=document.getElementById("thumb"+j);var d='<img src="'+f+'" alt="'+j+'" class="thumb" height="'+a+'" width="'+e+'">';var b="<img class=thumb height="+a+" alt="+j+' src="'+f+'" width='+e+">";if(element.innerHTML.toLowerCase()!=d&&element.innerHTML.toLowerCase()!=b){element.innerHTML=d}else{element.innerHTML='<img src="'+h+'" alt="'+j+'" class="thumb" height="'+g+'" width="'+c+'">'}}
function postpreview(d,a,c,b){if(document.getElementById(d)){new Ajax.Request(ku_boardspath+"/expand.php?preview&board="+a+"&parentid="+c+"&message="+escape(b),{method:"get",onSuccess:function(f){var e=f.responseText||"something went wrong (blank response)";document.getElementById(d).innerHTML=e},onFailure:function(){alert("Something went wrong...")}})}}
function set_inputs(id){if(document.getElementById(id)){with(document.getElementById(id)){if(!name.value){name.value=getCookie("name")}
if(!em.value){em.value=getCookie("email")}
if(!postpassword.value){postpassword.value=get_password("postpassword")}}}}
function set_delpass(id){if(document.getElementById(id).postpassword){with(document.getElementById(id)){if(!postpassword.value){postpassword.value=get_password("postpassword")}}}}
function addreflinkpreview(g){ainfo=this.getAttribute("class").split("|");var b=document.createElement("div");b.setAttribute("id","preview"+this.getAttribute("href"));b.setAttribute("class","reflinkpreview");if(g.pageX){b.style.left=""+(g.pageX+12)+"px"}else{b.style.left=(g.clientX+12)}
var f=document.createTextNode("");b.appendChild(f);var c=this.parentNode;var a=c.insertBefore(b,this);var d="</div>";new Ajax.Request("/read.php?b="+ainfo[1]+"&t="+ainfo[2]+"&p="+ainfo[3]+"&single",{method:"get",onSuccess:function(h){var e=h.responseText||"something went wrong (blank response)";a.innerHTML=e+d},})}
function delreflinkpreview(b){var a=document.getElementById("preview"+this.getAttribute("href"));if(a){a.parentNode.removeChild(a)}}
function addpreviewevents(){var c=document.getElementsByTagName("a");var d;var b;for(var a=0;a<c.length;a++){d=c[a];if(d.getAttribute("class")){if(d.getAttribute("class").substr(0,4)=="ref|"){d.addEventListener("mouseover",addreflinkpreview,false);d.addEventListener("mouseout",delreflinkpreview,false)}}}}
function keypress(g){if(g.altKey){var c=document.location.toString();if((c.indexOf("catalog.html")==-1&&c.indexOf("/res/")==-1)||(c.indexOf("catalog.html")==-1&&g.keyCode==80)){if(g.keyCode!=18&&g.keyCode!=16){if(c.indexOf(".html")==-1||c.indexOf("board.html")!=-1){var d=0;var h=c.substr(0,c.lastIndexOf("/")+1)}else{var d=c.substr((c.lastIndexOf("/")+1));d=(+d.substr(0,d.indexOf(".html")));var h=c.substr(0,c.lastIndexOf("/")+1)}
if(d==0){var b=h}else{var b=h+d+".html"}
if(g.keyCode==222||g.keyCode==221){if(match=/#s([0-9])/.exec(c)){var a=(+match[1])}else{var a=-1}
if(g.keyCode==222){if(a==-1||a==9){var f=0}else{var f=a+1}}else{if(g.keyCode==221){if(a==-1||a==0){var f=9}else{var f=a-1}}}
document.location.href=b+"#s"+f}else{if(g.keyCode==59||g.keyCode==219){if(g.keyCode==59){d=d+1}else{if(g.keyCode==219){if(d>=1){d=d-1}}}
if(d==0){document.location.href=h}else{document.location.href=h+d+".html"}}else{if(g.keyCode==80){document.location.href=b+"#postbox"}}}}}}}
window.onload=function(d){delandbanlinks();addpreviewevents();checkhighlight();if(document.getElementById("watchedthreads")){var c=new Draggable("watchedthreads",{handle:"watchedthreadsdraghandle",onEnd:function(){f()}});var a=new Resizeable("watchedthreads",{resize:function(){b()}});function f(){set_cookie("watchedthreadstop",document.getElementById("watchedthreads").style.top,30);set_cookie("watchedthreadsleft",document.getElementById("watchedthreads").style.left,30)}
function b(){var e=document.getElementById("watchedthreads").offsetWidth;var g=document.getElementById("watchedthreads").offsetHeight;set_cookie("watchedthreadswidth",e,30);set_cookie("watchedthreadsheight",g,30)}}
document.onkeydown=keypress};if(style_cookie){var cookie=getCookie(style_cookie);var title=cookie?cookie:defaultstylesheet;set_cookiestyle(title);set_stylesheet(title);}
if(style_cookie_txt){var cookie=getCookie(style_cookie_txt);var title=cookie?cookie:defaultstylesheet;set_cookiestyle(title,true);set_stylesheet(title);}
if(style_cookie_site){var cookie=getCookie(style_cookie_site);var title=cookie?cookie:defaultstylesheet;set_cookiestyle(title,false,true);set_stylesheet(title);}
if(getCookie("kumod")=="yes"){kumod_set=true};