var xmlHttp;var IE=document.all?true:false;var popupBoxTimer=null;var coordX;var coordY;function displayAttrInfo(a,b){if(popupBoxTimer){clearTimeout(popupBoxTimer);popupBoxTimer=null}if(IE){coordX=event.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;coordY=event.clientY+document.body.scrollTop+document.documentElement.scrollTop}else{coordX=a.pageX;coordY=a.pageY}popupBoxTimer=setTimeout(function(){displayAttrInfoMain(b)},400)}function displayAttrInfoMain(c){popupBoxTimer=null;var b=document.getElementById("helpbox");b.innerHTML="<table class='dhpopup' border='0'><tr><td class='dhpopuptext'>Loading...</td></tr></table>";if(coordX-310<10){b.style.left=coordX+10+"px"}else{b.style.left=coordX-310+"px"}b.style.top=coordY+15+"px";b.style.visibility="visible";xmlHttp=new GetXmlHttpObject();var a=c+"&sid="+Math.random();xmlHttp.onreadystatechange=returnAjaxInfo;xmlHttp.open("GET",a,true);xmlHttp.send(null)}function loadMaintenance(){xmlHttp=new GetXmlHttpObject();var a="/includes/maintenance.php?type=onload";xmlHttp.open("GET",a,true);xmlHttp.send(null)}function returnAjaxInfo(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){document.getElementById("helpbox").innerHTML="<table class='dhpopup' border='0'><tr><td class='dhpopuptext'>"+xmlHttp.responseText+"</td></tr></table>"}}function removeAjaxInfo(){document.getElementById("helpbox").style.visibility="hidden";clearTimeout(popupBoxTimer)}var xmlMessagePrefix='<p class="error">';var xmlMessageSuffix="</p>";function GetXmlHttpObject(){var a=null;if(window.XMLHttpRequest){a=new XMLHttpRequest()}else{if(window.ActiveXObject){a=new ActiveXObject("Microsoft.XMLHTTP")}}if(a===null){alert("Browser does not support HTTP Request");return}return a}function xmlHttpResponse(b,c,a){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){document.getElementById(b).innerHTML=c;document.getElementById(a).innerHTML=xmlHttp.responseText}}function clearMessageDisplayBox(){document.getElementById("messageDisplayBox").innerHTML=""}var historyTablePresent=0;function toggleHistory(b){moveHis=document.getElementById("moveHistory").style;if(historyTablePresent==0){document.getElementById("moveHistory").innerHTML="Loading...";xmlHttp=new GetXmlHttpObject();var a="/includes/functions/ajax/historytable.php?boardID="+b+"&sid="+Math.random();xmlHttp.onreadystatechange=fillHistoryBox;xmlHttp.open("GET",a,true);xmlHttp.send(null)}if(moveHis.display=="none"){moveHis.display="block"}else{moveHis.display="none"}}function fillHistoryBox(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){document.getElementById("moveHistory").innerHTML=xmlHttp.responseText;historyTablePresent=1}}function displaySiteReport(c,d){var b=document.getElementById("reportOutput");b.innerHTML="Loading...";xmlHttp=new GetXmlHttpObject();var a=d+"sid="+Math.random();xmlHttp.onreadystatechange=showSiteReport;xmlHttp.open("GET",a,true);xmlHttp.send(null)}function showSiteReport(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){document.getElementById("reportOutput").innerHTML=xmlHttp.responseText}}var kibitzComment;function postKibitzComment(a){kibitzComment=escape(document.getElementById("titleMatchKibitz").value);document.getElementById("kibitzError").innerHTML="[Please Wait...]<br /><br />";document.getElementById("titleMatchKibitz").value="";xmlHttp=new GetXmlHttpObject();url="/includes/functions/ajax/kibitz_postcomment.php?boardID="+a+"&kibitzComment="+kibitzComment+"&sid="+Math.random();xmlHttp.onreadystatechange=function(){xmlHttpResponse("kibitzError","","matchKibitzContent")};xmlHttp.open("GET",url,true);xmlHttp.send(null)}function updateGames(){xmlHttp=new GetXmlHttpObject();xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(xmlHttp.responseText!=window.oldGames){window.oldGames=xmlHttp.responseText;paintFavicon(xmlHttp.responseText)}}};xmlHttp.open("GET","/includes/functions/ajax/gameCount.php",true);xmlHttp.send(null)}function postNotes(d,c){xmlHttp=new GetXmlHttpObject();var b="/includes/functions/ajax/boardnotes.php";var a="boardID="+d+"&notes="+c;xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(xmlHttp.status==200||window.location.href.indexOf("http")==-1){document.getElementById("notes-alert").innerHTML=xmlHttp.responseText;setTimeout(function(){document.getElementById("notes-alert").innerHTML=""},3000)}else{document.getElementById("notes-alert").innerHTML="Error!";setTimeout(function(){document.getElementById("notes-alert").innerHTML=""},3000)}}};xmlHttp.open("POST",b,true);xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlHttp.send(a)}function paintFavicon(b){if(!isNumber(b)){return false}var d=document.createElement("canvas");d.width=32;d.height=32;var a=d.getContext("2d");var c=new Image();c.src="/images/misc/online-go_icon.ico";c.onload=function(){a.drawImage(c,0,0);if(b>=0){var e=20;var f=12;var i=b;a.font="20px Trebuchet MS";if(b>9){e=8;f=24}else{if(b>99){e=12;f=20;a.font="30px Trebuchet MS";i="∞"}}a.fillStyle="#FFF";a.fillRect(e,12,f,20);a.fillStyle="#000";a.fillText(i,e+2,29)}else{clearInterval(window.intervalID)}var h=document.createElement("link");h.type="image/x-icon";h.rel="shortcut icon";h.href=d.toDataURL("image/x-icon");document.getElementsByTagName("head")[0].appendChild(h);var g=document.getElementById("dynamicgamecount");if(b==-1){g.innerHTML="logged out"}else{g.innerHTML=b}};return true}function isNumber(a){return !isNaN(a-0)};
