var isDis;
var isTop;
var isLock;

function changeDis(tid,fid) {
	//statusDialog("<IMG SRC=\"http://www.blueya.com/hot-docs/img/loading.gif\" BORDER=\"0\">&nbsp;<B>正在执行操作,请稍侯……</B>",280,30);
	var url = "/changeDis";
	var data = "tid="+tid+"&fid="+fid;
	asynSubmit(url,data,"POST",changeDisResult);
}
function changeDisResult() {
	if (xmlHttp.readyState == 4) {
		var response = xmlHttp.responseText;
		if (xmlHttp.status == 200 && response=='success') {
			//DialogHide();
			//statusDialog("<IMG SRC=\"http://www.blueya.com/hot-docs/img/ok_done.gif\" BORDER=\"0\">&nbsp;<B><FONT COLOR=\"#FF7B00\">操作已完成!</FONT></B>",250,30);
			//setTimeout("DialogHide()",1000);
			//isDis=Math.abs(isDis-1);
			//disHrefName();
			alert("xxxx");
			location.reload();
		} else {
			//processError(xmlHttp.status, response);
			//DialogHide();
			alert("遇到错误：操作失败！\n错误代码：" + xmlHttp.status + "\n错误消息：" + response);
		}
	}
}
function disHrefName() {
	if (isDis == 0)
		setTextById("set_dis","加为精华");
	else setTextById("set_dis","取消精华");
}
function changeTop(tid,fid) {
	var url = "/changeTop";
	var data = "tid="+tid+"&fid="+fid;
	asynSubmit(url,data,"POST",changeTopResult);
}
function changeTopResult() {
	if (xmlHttp.readyState == 4) {
		var response = xmlHttp.responseText;
		if (xmlHttp.status == 200 && response=='success') {
			location.reload();
		} else {
			processError(xmlHttp.status, response);
		}
	}
}
function topHrefName() {
	if (isTop == 0)
		setTextById("set_top","置顶");
	else setTextById("set_top","取消置顶");
}
function changeLock(tid,fid) {
	//statusDialog("<IMG SRC=\"http://www.blueya.com/hot-docs/img/loading.gif\" BORDER=\"0\">&nbsp;<B>正在执行操作,请稍侯……</B>",280,30);
	var url = "/changeLock";
	var data = "tid="+tid+"&fid="+fid;
	asynSubmit(url,data,"POST",changeLockResult);
}
function changeLockResult() {
	if (xmlHttp.readyState == 4) {
		var response = xmlHttp.responseText;
		if (xmlHttp.status == 200 && response=='success') {
			//DialogHide();
			//statusDialog("<IMG SRC=\"http://www.blueya.com/hot-docs/img/ok_done.gif\" BORDER=\"0\">&nbsp;<B><FONT COLOR=\"#FF7B00\">操作已完成!</FONT></B>",250,30);
			//setTimeout("DialogHide();location.href='/backward'",1000);
			//isLock=Math.abs(isLock-1);
			//lockHrefName();
			location.reload();
		} else {
			//processError(xmlHttp.status, response);
			//DialogHide();
			alert("遇到错误：操作失败！\n错误代码：" + xmlHttp.status + "\n错误消息：" + response);
		}
	}
}
function lockHrefName() {
	if (isLock == 0)
		setTextById("set_lock","锁帖");
	else setTextById("set_lock","解锁");
}
function deleteReply(rid,tid,fid) {
	//ScreenConvert();
	//var ShowDiv="<div class='sbpopup'><div class='sbpopupholder'><div class='sbholderclose'><a href='javascript:DialogHide();'>取消</a></div><div class='sbholdertitle'>屏蔽该回帖</div><div class='sbpopupbody'><TABLE width='90%' height='35' style='margin:0 auto;'><TR><TD><input type='radio' name='deleteReply_type' value='0' checked></TD><TD align='left'>删除不扣分</TD><TD><input type='radio' name='deleteReply_type' value='1'></TD><TD align='left'>删除并扣分</TD><TD><input type='radio' name='deleteReply_type' value='2'></TD><TD align='left'>删除并扣除双倍积分</TD></TR></TABLE><p style='padding-top:10px;border-top:1px dashed #dedede;'><input type='button' onclick='javascript:deleteReplySubmit("+rid+","+tid+","+fid+");' value='提　交'>　<input type='button' onclick='javascript:DialogHide();' value='取　消'></p><div class='clear'></div></div></div>";
	//DialogPopUp(ShowDiv);
	deleteReplySubmit(rid,tid,fid);
}
function deleteReplySubmit(rid,tid,fid) {
	//var o=document.getElementsByName("deleteReply_type"),type="1";
	//for(i=0;i<o.length;i++)
	//	if(o[i].checked){type=o[i].value;break;}
	var type="1";
	//DialogHide();
	//statusDialog("<IMG SRC=\"http://www.blueya.com/hot-docs/img/loading.gif\" BORDER=\"0\">&nbsp;<B>正在执行操作,请稍侯……</B>",280,30);
	var url = "/deleteReply";
	var data = "rid="+rid+"&tid="+tid+"&fid="+fid+"&type="+type;
	asynSubmit(url,data,"POST",deleteReplyResult);
}
function deleteReplyResult() {
	if (xmlHttp.readyState == 4) {
		var response = xmlHttp.responseText;
		if (xmlHttp.status == 200 && response=='success') {
			//DialogHide();
			//statusDialog("<IMG SRC=\"http://www.blueya.com/hot-docs/img/ok_done.gif\" BORDER=\"0\">&nbsp;<B><FONT COLOR=\"#FF7B00\">操作已完成!</FONT></B>",250,30);
			//setTimeout("DialogHide();location.href='/backward'",1000);
			alert("屏蔽成功！");
			location.href='/backward';
		} else {
			//processError(xmlHttp.status, response);
			//DialogHide();
			alert("遇到错误：操作失败！\n错误代码：" + xmlHttp.status + "\n错误消息：" + response);
		}
	}
}
function changeHighlights(tid,fid) {
	ScreenConvert();
	var ShowDiv="<div class='sbpopup'><div class='sbpopupholder'><div class='sbholderclose'><a href='javascript:DialogHide();'>取消</a></div><div class='sbholdertitle'>设置帖子标题高亮显示</div><div class='sbpopupbody'><TABLE width='95%' height='70' style='margin:0 auto;'><TR><TD><input type='radio' name='highlights_type' value='normal' checked></TD><TD align='left'><a class='normal'>普通</a></TD><TD><input type='radio' name='highlights_type' value='blue-color'></TD><TD align='left'><a class='blue-color'>蓝色普通</a></TD><TD><input type='radio' name='highlights_type' value='green-color'></TD><TD align='left'><a class='green-color'>绿色普通</a></TD><TD><input type='radio' name='highlights_type' value='red-color'></TD><TD align='left'><a class='red-color'>红色普通</a></TD><TD><input type='radio' name='highlights_type' value='orange-color'></TD><TD align='left'><a class='orange-color'>橙色普通</a></TD></TR><TR><TD><input type='radio' name='highlights_type' value='strong'></TD><TD align='left'><a class='strong'>加粗</a></TD><TD><input type='radio' name='highlights_type' value='blue-color strong'></TD><TD align='left'><a class='blue-color strong'>蓝色加粗</a></TD><TD><input type='radio' name='highlights_type' value='green-color strong'></TD><TD align='left'><a class='green-color strong'>绿色加粗</a></TD><TD><input type='radio' name='highlights_type' value='red-color strong'></TD><TD align='left'><a class='red-color strong'>红色加粗</a></TD><TD><input type='radio' name='highlights_type' value='orange-color strong'></TD><TD align='left'><a class='orange-color strong'>橙色加粗</a></TD></TR></TABLE><p style='padding-top:10px;border-top:1px dashed #dedede;'><input type='button' onclick='javascript:changeHighlightsSubmit("+tid+","+fid+");' value='提　交'>　<input type='button' onclick='javascript:DialogHide();' value='取　消'></p><div class='clear'></div></div></div>";
	DialogPopUp(ShowDiv);
}
function changeHighlightsSubmit(tid,fid) {
	var o=document.getElementsByName("highlights_type"),type="normal";
	for(i=0;i<o.length;i++)
		if(o[i].checked){type=o[i].value;break;}
	DialogHide();
	statusDialog("<IMG SRC=\"http://www.blueya.com/hot-docs/img/loading.gif\" BORDER=\"0\">&nbsp;<B>正在执行操作,请稍侯……</B>",280,30);
	var url = "/changeHighlights";
	var data ="tid="+tid+"&fid="+fid+"&highlights="+type;
	asynSubmit(url,data,"POST",changeHighlightsResult);
}
function changeHighlightsResult() {
	if (xmlHttp.readyState == 4) {
		var response = xmlHttp.responseText;
		if (xmlHttp.status == 200 && response=='success') {
			DialogHide();
			statusDialog("<IMG SRC=\"http://www.blueya.com/hot-docs/img/ok_done.gif\" BORDER=\"0\">&nbsp;<B><FONT COLOR=\"#FF7B00\">操作已完成!</FONT></B>",250,30);
			setTimeout("DialogHide()",1000);
		} else {
			processError(xmlHttp.status, response);
			DialogHide();
		}
	}
}
function deleteTopic(tid,fid,pn) {
	//ScreenConvert();
	//var ShowDiv="<div class='sbpopup'><div class='sbpopupholder'><div class='sbholderclose'><a href='javascript:DialogHide();'>取消</a></div><div class='sbholdertitle'>删除主题</div><div class='sbpopupbody'><TABLE width='90%' height='35' style='margin:0 auto;'><TR><TD><input type='radio' name='deleteTopic_type' value='0' checked></TD><TD align='left'>删除不扣分</TD><TD><input type='radio' name='deleteTopic_type' value='1'></TD><TD align='left'>删除并扣分</TD><TD><input type='radio' name='deleteTopic_type' value='2'></TD><TD align='left'>删除并扣除双倍积分</TD></TR></TABLE><p style='padding-top:10px;border-top:1px dashed #dedede;'><input type='button' onclick='javascript:deleteTopicSubmit("+tid+","+fid+","+pn+");' value='提　交'>　<input type='button' onclick='javascript:DialogHide();' value='取　消'></p><div class='clear'></div></div></div>";
	//DialogPopUp(ShowDiv);
	deleteTopicSubmit(tid,fid,pn);
}
function deleteTopicSubmit(tid,fid,pn) {
	//var o=document.getElementsByName("deleteTopic_type"),type="1";
	//for(i=0;i<o.length;i++)
	//	if(o[i].checked){type=o[i].value;break;}
	var type = "1";
	//DialogHide();
	//statusDialog("<IMG SRC=\"http://www.blueya.com/hot-docs/img/loading.gif\" BORDER=\"0\">&nbsp;<B>正在执行操作,请稍侯……</B>",280,30);
	var url = "/deleteTopic";
	var data = "tid="+tid+"&fid="+fid+"&type="+type;
	asynSubmit(url,data,"POST",deleteTopicResult,[fid,pn]);
}
function deleteTopicResult(data) {
	if (xmlHttp.readyState == 4) {
		var response = xmlHttp.responseText;
		if (xmlHttp.status == 200 && response=='success') {
			//DialogHide();
			//statusDialog("<IMG SRC=\"http://www.blueya.com/hot-docs/img/ok_done.gif\" BORDER=\"0\">&nbsp;<B><FONT COLOR=\"#FF7B00\">操作已完成!</FONT></B>",250,30);
			alert("删除成功");
			//setTimeout("DialogHide();location.href='/board-"+data[0]+"-"+data[1]+".html'",1000);
			location.href="/board-"+data[0]+"-"+data[1]+".html";
		} else {
			//processError(xmlHttp.status, response);
			//DialogHide();
			alert("遇到错误：操作失败！\n错误代码：" + xmlHttp.status + "\n错误消息：" + response);
		}
	}
}
function setTextById(id,text) {
	if (document.all) document.getElementById(id).innerText=text;
	else document.getElementById(id).innerHTML=text;
}