const $ServerPath = "http://forums.spybot.info/";

if (typeof XMLHttpRequest == "undefined")
  XMLHttpRequest = function() {
    try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch(e) {};
    try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch(e) {};
    try { return new ActiveXObject("Msxml2.XMLHTTP"); }     catch(e) {};
    try { return new ActiveXObject("Microsoft.XMLHTTP"); }  catch(e) {};
 
    throw new Error("This browser does not support XMLHttpRequest or XMLHTTP.");
  };

function formatLasshO2InfoRow(filename, filesize, md5, status)
{ return "<tr><td class=\"alt1\">" + filename + "</td>"
       + "<td class=\"alt2\">502.832</td>"
       + "<td class=\"alt1\">12345678890123456788901234567889012</td>"
       + "<td class=\"alt2\">L</td></tr>";
}

function getLasshInfo(postid, entryid, url)
{ divname =  "hjtentry_"+postid+"_"+entryid;
  divobj = document.getElementById(divname);
  text = "Loading...";
  var req = new XMLHttpRequest();
  //req.setRequestHeader("Content-Type", "application/x-javascript;");
  data = '';
  req.onreadystatechange = function() 
  { data = data + req.responseText;
    if (req.readyState == 4 && req.status == 200) 
    { //if (req.ResponseText)
      { divobj.innerHTML = req.responseText;
      } 
    }
  };
  req.open("GET", url, true);
  req.send(null);
  aobj = document.getElementById("hjtbutton_"+postid+"_"+entryid);
  aobj.onclick = null;
}

function getLasshLSPInfo(postid, entryid, filename)
{ url = $ServerPath + "lasshpop.php?do=lsp&filename=" + encodeURIComponent(filename);
  getLasshInfo(postid, entryid, url);
}

function getLasshO2Info(postid, entryid, bhoname, clsid)
{ url = $ServerPath + "lasshpop.php?do=bho&name=" + encodeURIComponent(bhoname) + "&guid=" + encodeURIComponent(clsid);
  getLasshInfo(postid, entryid, url);
}

function getLasshDPFInfo(postid, entryid, guid, bhoname, url)
{ url = $ServerPath + "lasshpop.php?do=dpf&name=" + encodeURIComponent(bhoname) + "&guid=" + encodeURIComponent(guid);
  getLasshInfo(postid, entryid, url);
}

function getLasshStartupInfo(postid, entryid, name)
{ url = $ServerPath + "lasshpop.php?do=startupbyname&name=" + encodeURIComponent(name);
  getLasshInfo(postid, entryid, url);
}

function getLasshO23Info(postid, entryid, name, regkey,filename)
{ url = $ServerPath + "lasshpop.php?do=O23&name=" + encodeURIComponent(name) + "&regkey=" + encodeURIComponent(regkey);
  getLasshInfo(postid, entryid, url);
}
