function reportAbuseShowForm(identifier, comments, drawformtags, mediaid) {
	var url;
	url = "/ajax.php?method=reportabuseform&identifier="+identifier+"&comments="+escape(comments)+"&drawformtags="+drawformtags+"&mediaid="+mediaid;
	url += "&location=" + escape(window.location);
	ajaxrequest(url);
}

function reportAbuseCancel(identifier) {
	var o;
	o = getObj("divReportAbuseLink"+identifier);
	if (o) o.style.display = "inline";
	o = getObj("divReportAbuseForm"+identifier);
	if (o) o.style.display = "none";
}

function reportAbuseSubmit(identifier) {
	var o, url;
	url = "/ajax.php?method=reportabusesubmit&identifier="+identifier;
	
	o = getObj("reportabuselocation"+identifier);
	if (o) url += "&location=" + escape(o.value);
	o = getObj("reportabusemediaid"+identifier);
	if (o) url += "&mediaid=" + escape(o.value);
	o = getObj("captcha"+identifier);
	if (o) url += "&captcha=" + escape(o.value);
	o = getObj("reportabusecomments"+identifier);
	if (o) url += "&comments=" + escape(o.value);
	
	ajaxrequest(url);
}

function reportAbuseForm_Result(ec, msg) {
	var o, identifier, formhtml;
	
	identifier = getInnerText(xmlDoc.getElementsByTagName("identifier").item(0));
	formhtml = getInnerText(xmlDoc.getElementsByTagName("formhtml").item(0));
	o = getObj("divReportAbuseLink"+identifier);
	if (o) o.style.display = "none";
	o = getObj("divReportAbuseForm"+identifier);
	if (o) {
		o.innerHTML = formhtml;
		o.style.display = "inline";
	}
	
}

function reportAbuseSubmit_Result(ec, msg) {
	var o, identifier;
	
	identifier = getInnerText(xmlDoc.getElementsByTagName("identifier").item(0));
	comments = getInnerText(xmlDoc.getElementsByTagName("comments").item(0));
	
	if (ec>0 && msg!="") {
		alert(msg);
		reportAbuseShowForm(identifier, comments);
	} else {
		reportAbuseReplaceLink(identifier);
	}
	
}

function reportAbuseReplaceLink(identifier) {
	var o;
	o = getObj("divReportAbuseLink"+identifier);
	if (o) {
		o.style.display = "inline";
		o.innerHTML = "<span style=\"color:red;\">Thank you, we will review the content on this page shortly.</span>";
	}
	o = getObj("divReportAbuseForm"+identifier);
	if (o) o.style.display = "none";
}