function commentPreview(){var d=document.getElementById("commentForm");var a=document.getElementById("commentTable");if(!d||!a){return}var c='<dl class="comments"><dt>Live Comment Preview</dt><dd id="pretext"></dd></dl>';var b=0;d.comment.onfocus=function(){if(b==0){a.insertAdjacentHTML("afterEnd",c);b=1}d.comment.onkeyup=function(){preview(d)};d.comment.onkeypress=function(){preview(d)}}}function preview(a){var b=a.comment.value;b=b.replace(/\&/g,"&amp;");b=b.replace(/\</g,"&lt;");b=b.replace(/\>/g,"&gt;");b=b.replace(/\"/g,"&quot;");b=b.replace(/\'/g,"&#39;");b=b.replace(/\n/g,"<br />\n");document.getElementById("pretext").innerHTML=b}function createOBJ(){if(!document.getElementsByTagName("form")){return}x=document.getElementsByTagName("input");for(i=0;i<x.length;i++){if(x[i].getAttribute("className")=="cancel"||x[i].getAttribute("class")=="cancel"){continue}if(x[i].type=="submit"||x[i].type=="image"){x[i].onclick=function(){doublePostingBlocker(this)};x[i].onkeypress=function(){doublePostingBlocker(this)}}}}function doublePostingBlocker(a){window.setTimeout(function(){a.disabled=true},1);window.setTimeout(function(){a.disabled=false},5000)}var tab={init:function(){var b=this.setup.tabs;var a=this.setup.pages;for(i=0;i<a.length;i++){a[i].style.display="none";a[i].style.position="absolute";b[i].onclick=function(){tab.showpage(this);return false}}},showpage:function(e){var d=this.setup.tabs;var a=this.setup.pages;var b;for(b=0;b<d.length;b++){if(d[b]===e){break}}for(var c=0;c<a.length;c++){if(c==b){if(a[b].offsetHeight!=0){a[b].style.display="none";d[b].className=null}else{a[b].style.display="block";d[b].className=null}}else{a[c].style.display="none";d[c].className=null}}}};var showcase={init:function(b,f){var e=document.getElementById("contents");var a="div";var d=util.dom.getElementsByClass(b,e,a);for(var c=0;c<d.length;c++){this.setup(d[c],f)}},setup:function(f,h){var c=f.getElementsByTagName("a");var a=document.createElement("p");var d=new Image();var g=document.createTextNode(c[0].title);if(h=="before"){var b=f.getElementsByTagName("p")[0];f.removeChild(b);f.appendChild(a);f.appendChild(b)}else{f.appendChild(a)}a.className="bigImg";d.src=c[0].href;a.appendChild(d);a.appendChild(g);for(var e=0;e<c.length;e++){var b=new Image();b.src=c[e].href;c[e].onclick=function(){showcase.showImg(this,d,g);return false}}},showImg:function(c,a,b){a.src=c.href;b.nodeValue=c.title}};var scroll={leap:function(c){if(navigator.userAgent.indexOf("iPhone")>-1){return}var h=util.info.getScrollPos();var g=document.getElementById(c);var a=util.info.getElementPos(g);var b=a.y-h.y;var e=a.x-h.x;var f=new Object;f.x=e>0?"plus":"minus";f.y=b>0?"plus":"minus";var d=this.getMaxScroll();a.x=a.x>d.x?d.x:a.x;a.y=a.y>d.y?d.y:a.y;this.land(a,f);this.cancel()},land:function(a,c){var d=util.info.getScrollPos();var b=new Object;b.x=c.x=="plus"?Math.floor(d.x+((a.x-d.x)/5))+1:b.x=Math.max(Math.floor(d.x-(d.x/6)),a.x);b.y=c.y=="plus"?Math.floor(d.y+((a.y-d.y)/5))+1:b.y=Math.max(Math.floor(d.y-(d.y/6)),a.y);scrollTo(b.x,b.y);if(c.y=="plus"&&c.x=="plus"){if(b.y<a.y||b.x<a.x){this.timerID=setTimeout(function(){scroll.land(a,c)},10)}}else{if(c.y=="plus"&&c.x=="minus"){if(b.y<a.y||b.x!=a.x){this.timerID=setTimeout(function(){scroll.land(a,c)},10)}}else{if(c.y=="minus"&&c.x=="plus"){if(b.y!=a.y||b.x<a.x){this.timerID=setTimeout(function(){scroll.land(a,c)},10)}}else{if(c.y=="minus"&&c.x=="minus"){if(b.y!=a.y||b.x!=a.x){this.timerID=setTimeout(function(){scroll.land(a,c)},10)}}else{console.log("error!")}}}}},cancel:function(){util.event.add(document,"mousedown",function(){clearTimeout(scroll.timerID)},false);util.event.add(document,"keydown",function(){clearTimeout(scroll.timerID)},false);util.event.add(document,"mousewheel",function(){clearTimeout(scroll.timerID)},false);util.event.add(document,"DOMMouseScroll",function(){clearTimeout(scroll.timerID)},false)},getMaxScroll:function(){var c=util.info.getScreenSize();var b=util.info.getDocSize();var a=new Object;a.x=b.x-c.x;a.y=b.y-c.y;return a},hop:function(f){var e=f=="up"?"minus":"plus";var g=util.info.getScrollPos();var c=util.info.getScreenSize();var a=new Object;a.x=g.x;a.y=e=="plus"?g.y+c.y:g.y-c.y;var b=this.getMaxScroll();a.x=g.x;a.y=a.y>b.y?b.y:a.y;this.land(a,e);this.cancel()}};util.event.load(createOBJ);util.event.load(commentPreview);util.event.load(prettyPrint);util.event.bindReady(function(){tab.setup={tabs:[document.getElementById("navi").getElementsByTagName("a")[2],document.getElementById("navi").getElementsByTagName("a")[3]],pages:[document.getElementById("navigation"),document.getElementById("search")]};tab.init()});util.event.domLoaded();
