if(location.href.match(reportBoard) && !location.href.match(/thid=/gi) && !staff.match(pb_username)){
location = '?';
}

if(!location.href.match(/=/gi) && !staff.match(pb_username)){
var allTds = document.getElementsByTagName("td");
for(var i=0;i<allTds.length;i++){
if(allTds[i].className.match(/windowbg2/gi) && allTds[i].width=="66%" && allTds[i].getElementsByTagName("a")[0].href.match(reportBoard)){
allTds[i].parentNode.style.display="none";
}
}
}
if(!location.href.match(/=/gi) && staff.match(pb_username)){
var allTds = document.getElementsByTagName("td");
for(var i=0;i<allTds.length;i++){
if(allTds[i].className.match(/windowbg2/gi) && allTds[i].width=="66%" && allTds[i].getElementsByTagName("a")[0].href.match(reportBoard)){
if(allTds[i].previousSibling.innerHTML.match(/on\.gif/gi)){
document.getElementById("reportslink").style.color = "#FF0000";
document.getElementByid("reportslink").innerHTML = "!*"+document.getElementByid("reportslink").innerHTML+"*!";
}
}
}
}

if(location.href.match(/thread=/gi) && pb_username!="Guest"){
var allLinks = document.getElementsByTagName("a");
for(var i=0;i<allLinks.length;i++){
if(allLinks[i].parentNode && allLinks[i].innerHTML=="Link to Post"){
var thid = escape(allLinks[i].href.split("?")[1]);
var rpl = document.createElement("a");
rpl.href= "http://malagrond.proboards.com/index.cgi?board="+reportBoard+"&action=post&thid="+thid;
rpl.style.color = "#FF0000";
rpl.innerHTML = "Report Post  "
rpl.style.fontWeight = "bold";
allLinks[i].parentNode.insertBefore(rpl, allLinks[i]);
i++;
}
}
}

if(location.href.match(reportBoard) && location.href.match(/action=post/gi) && location.href.match(/thid=/gi)){
function reportize(content){
toploc = top.location.href.split(".com/")[1];
content = "[quote]"+content+"[/quote][hr][url="+toploc+".com/?"+thid+"][b]Reported Post[/b][/url]";
return content;
}
var allT = document.getElementsByTagName("table");
var bcc = 0;
for(var i=0;i<allT.length;i++){
if(allT[i].className.match(/bordercolor/gi) && bcc==1){
break;
}

if(allT[i].className.match(/bordercolor/gi) && bcc<1){
bcc++;
}
}
allT[i].width='650';
allT[i].align = "center";
allT[i].getElementsByTagName("td")[0].innerHTML = "<table border='0' cellspacing='1' cellpadding='4' width='100%'><tr><td class='titlebg'><font size='2'><b>Report Post</b></font></td></tr><tr><td class='windowbg'><form action='/index.cgi' method='post' name='postForm' enctype='multipart/form-data' onSubmit='disable(this)'><input type='hidden' name='action' value='post2'><input type='hidden' name='board' value='"+reportBoard+"'><input type='hidden' name='subject' value='Reported Post by "+pb_username+"' />Report:<br /><textarea name='message' rows='6' cols='70'></textarea><br /><input type='hidden' name='nextaction' value='post'><input type='submit' value='Report' onmousedown='document.getElementsByName(\"message\")[0].value=reportize(document.getElementsByName(\"message\")[0].value)' accesskey='s' tabindex='3'><input type='hidden' name='icon' value='xx' /></form></td></tr></table>";
var a = document.getElementsByTagName('a');
for(i=0; i<a.length; i++) {
 if(a.item(i).className == 'nav') {
  var obj = a.item(i).parentNode;
  while(obj.firstChild.nodeName.match(/^(br|a|#text|font)$/i)) {
   obj.removeChild(obj.firstChild);
  }
break;
 }
}

}