request_callback = undefined;
function commentComplain(antispam_complain, news_id, comment_id, post_id, server_name, server_link, fid, type) {
	if (comment_id) {
		blockTargetId = "complaint_" + comment_id;
		var _link = "http://" + server_link + "/comments.html%3Fnid=" + news_id + "%26thread=" + comment_id;
		//var src = "http://comments-complain.mail.ru/complain/?comment_id=" + comment_id;
		var src = antispam_complain + "?comment_id=" + comment_id;
		src += "&blogpost_id=" + post_id + "&link=" + _link + "&domain=" + server_name;
		if (type == 2)
			src += "&response=Жалоба принята. Спасибо!"
		else
			src += "&response=<span class=\"reported\"><img src=\"/img/html/comment/ico_spam.gif\" width=\"10\" height=\"10\" alt=\"\" />Жалоба принята. Спасибо!</span>"
		request_send(src, callback);
	}
	return false;
}

function commentComplainForum(antispam_complain, news_id, comment_id, post_id, server_name, server_link, fid, type) {
	if (comment_id) {
		blockTargetId = "complaint_" + comment_id;
		//var _link = "http://" + server_link + "/comments.html%3Fnid=" + news_id + "%26thread=" + comment_id;
		var _link = "http://" + server_link + "/comments.html%3Fblog_post_id=" + post_id + "%26thread=" + comment_id + 
		  "%26fid=" + fid;
		
		var src = antispam_complain + "?comment_id=" + comment_id;
		src += "&blogpost_id=" + post_id + "&f_id=" + fid + "&link=" + _link + "&domain=" + server_name;
		if (type == 2)
			src += "&response=Жалоба принята. Спасибо!"
		else
			src += "&response=<span class=\"reported\"><img src=\"/img/html/comment/ico_spam.gif\" width=\"10\" height=\"10\" alt=\"\" />Жалоба принята. Спасибо!</span>"
		request_send(src, callback);
	}

	return false;
}

function commentComplainTravels(antispam_complain, news_id, comment_id, post_id, server_name, server_link, fid, type) {
	if (comment_id) {
		blockTargetId = "complaint_" + comment_id;
		var _link = "http://" + server_link + "/comments.html%3Ftravelid=" + news_id + "%26thread=" + comment_id;
		//var src = "http://comments-complain.mail.ru/complain/?comment_id=" + comment_id;
		var src = antispam_complain + "?comment_id=" + comment_id;
		src += "&blogpost_id=" + post_id + "&f_id=" + fid + "&link=" + _link + "&domain=" + server_name;
		if (type == 2)
			src += "&response=Жалоба принята. Спасибо!"
		else
			src += "&response=<span class=\"reported\"><img src=\"/img/html/comment/ico_spam.gif\" width=\"10\" height=\"10\" alt=\"\" />Жалоба принята. Спасибо!</span>"
		request_send(src, callback);
	}

	return false;
}

function offerComplain( antispam_complain, offer_id, server_name, server_link ) {
	if( offer_id) {
		blockTargetId = "complaint_" + offer_id;
		var _link = "http://" + server_link + "/market/offer.html%3Fid=" + offer_id;
		var src = antispam_complain + "?offer_id=" + offer_id + "&link=" + _link + "&domain=" + server_name;
		src += "&response=Жалоба принята. Спасибо!"
		request_send( src, callback );
	}
	return false;
}

callback = function(data) {
	web.$("targDiv_" + blockTargetId).innerHTML = data;
	document.getElementsByTagName("head")[0].removeChild(request_script);  
}
function request_send(src, callback) {
	request_callback = callback;
	request_script = document.createElement("script");
	request_script.src = src;
	document.getElementsByTagName("head")[0].appendChild(request_script);
}

//----------------------------------------------------------------------------------------

function get_cookie_spam_blog(post_id, comment_id, fid, user_email) {
  return ('comm' + comment_id + user_email);
}

function get_cookie_spam_forum(post_id, comment_id, fid, user_email) {
  return ('comm' + post_id + '/' + comment_id + '/' + fid + '/' + user_email);
}
function get_cookie_spam_offer( offer_id, user_email ) {
  return 'comm' + offer_id + '/' + user_email;
}

