function GetBadPostReportXmlHttpObject() {
  var xmlBadPostReportHttp=null;
  try {
    // Firefox, Opera 8.0+, Safari
    xmlBadPostReportHttp=new XMLHttpRequest();
  }
  catch (e) {
    // Internet Explorer
    try {
      xmlBadPostReportHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
      xmlBadPostReportHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  return xmlBadPostReportHttp;
}

function doReport(id, forumId, reason) {
  xmlBadPostReportHttp=GetBadPostReportXmlHttpObject()
  url="/club/sports/report-bad-post-" + id + "-forum-" + forumId + ".html?reason=" + escape(reason);
  xmlBadPostReportHttp.onreadystatechange=postReport;
  xmlBadPostReportHttp.open("GET",url,true);
  xmlBadPostReportHttp.send(null);
}

function postReport() {
}

function reportPostPrompt(id, forumId) {
	var reason = prompt("Report spam or abusive posts. Enter your reason reporting this post.", "");
	if (reason != null && reason.length > 0) {
		alert("Thanks. We'll look into it.");
		document.getElementById("badReportCell" + id).innerHTML = "&nbsp;";
		doReport(id, forumId, reason);
	}
	else if (reason != null && reason.length == 0) {
		reportPostPrompt(id, forumId);
	}
}
