/****************************************
Auto Script Hosting Tool by Mwr247, for BigBoards
http://bigboardsresources.com/
****************************************/

//v1.0.1
//copyright Nor and Thanks 2 choco for that function
if(location.href.match(/showtopic/i))
{
ajax = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
ajax.open("GET","http://"+location.hostname+location.pathname+"?act=idx",true);
ajax.onreadystatechange = function()
{
if(ajax.readyState == 4)
{
div = document.createElement("div");
div.innerHTML = ajax.responseText;
span = document.getElementsByTagName("span");
var arra = new Array();
users = div.getElementsByTagName("a");
   for(i=1;i<users.length;i++){
    if(users[i].parentNode.className=="thin" && users[i].href.match(/showuser\=/i)){
     arra.push(users[i].href);
    }
   }
 for(x=0;x<span.length;x++){
  if(span[x].className=="normalname"){
   var zxline = "";
   if(findInArray(span[x].getElementsByTagName("a")[0].href,arra))
   {
    zxline = '<span style="color:white">online</span>';
   }
   else
   {
    zxline = '<span style="color:red">offline</span>';
   }
   details = span[x].parentNode.parentNode.parentNode.getElementsByTagName("tr")[1].getElementsByTagName("td")[0].getElementsByTagName("span")[0];
   if(details.innerHTML.match(/Joined\:/i)){
    details.innerHTML = details.innerHTML.replace("Joined:","Status: " + zxline + "<br />Joined:");

   }
  }
 }

}
}
ajax.send("");
}
function findInArray(text,array) {
for(i in array) {
if(array[i]==text) return true;
}
return false;
}