function doAjax(c,b){
	$('#QC').html("<b><font size=2 color=green> 正在提交...</font></b>");
	$.post(c,function(a){
			if(a){
			if(c.indexOf('Post')==-1){
			fid=$("#"+b).attr("alt");
			$('#QC').html("<b><font size=2 color=blue> 操作成功!</font></b>");
			location.href=APP+"/forum/"+fid
			setTimeout(function(){ $('#QC').remove()},500);
			}else{
			$('#QC').html("<b><font size=2 color=blue> 操作成功!</font></b>");
			$('#floor'+b).fadeOut();
			setTimeout(function(){ $('#QC').remove()},500);
			}
			}
			})
}
function top(ele){
	var url = ele.rel;
	$.post(url,{ajax:1},function(a){
			if(a){
			if (url.indexOf("type/cancel")!=-1)
			$("#tipbox .content").html("<center><font size='4'> 成功取消置顶！</font></center>");
			else
			$("#tipbox .content").html("<center><font size='4'> 置顶成功！</font></center>");
			$("#tipbox").show();
			setTimeout(function(){
				$("#tipbox").fadeOut('slow');
				window.location.reload();
				},1500);
			}
			})
}
function elite(ele){
	var url = ele.rel;
	$.post(url,{ajax:1},function(a){
			if(a){
			if (url.indexOf("type/cancel")!=-1)
			$("#tipbox .content").html("<center><font size='4'> 成功取消加精！</font></center>");
			else
			$("#tipbox .content").html("<center><font size='4'> 加精成功！</font></center>");
			$("#tipbox").show();
			setTimeout(function(){
				$("#tipbox").fadeOut('slow');
				window.location.reload();
				},1500);
			}
			})
}
function send_hf(m){
	if (!checkLogin())
		return
	if(typeof m == 'undefined')
		m = '';
	frames['Editor'+m].SaveContent();
    var h=$("#userId").val();
    var g=$("#userImg").val();
    var e=$("#userName").val();
    var j=$("#userProv").val();
    var f=$('#icontent'+m).val();
    var d=$("#huifu_form_"+m+" input[@name='hf_userId']").val();
    var k=$("#huifu_form_"+m+" input[@name='topicId']").val();
    var c="#hf_ol_"+m;
	if(!checkContent(f)){
        alert('回复不能为空!');
        return
    }
    $.post(APP+"/Forum/doReply",{replyId:m,topicId:k,icontent:f,hf_userId:d},function(b){
            if(b){
			ret = eval('('+b+')');
			if(ret.status==0){
			alert(ret.tip);
			return;
			}
			b = ret.result;
			var ff = frames['Editor'+m].frames['HtmlEditor'];
			ff.document.open();
			ff.document.write('<style>body{margin:0;padding:2px;background:#fff;color:#000;font-size:12px; font-family:"lucida grande",tahoma,arial,"bitstream vera sans",helvetica,sans-serif;white-space:break-word;word-break:break-all;}a:link, a:visited{text-decoration:underline;}div,address,ol,ul,li{margin-top:0;margin-bottom:0;}p{margin:0}</style>');
			ff.document.write('<br />');
			ff.document.close();
			if (ff.document.addEventListener && (typeof frames['Editor'+m].hotkey != 'undefined')) {
			//Gecko: default action of key accelerators (i.e. hotkeys) occurs onkeypress
			ff.document.addEventListener('keypress', frames['Editor'+m].hotkey, false);
			} else if (ff.document.attachEvent && (typeof frames['Editor'+m].hotkey != 'undefined')) {
			//IE: default action of key accelerators occurs onkeydown
			ff.document.attachEvent('onkeydown', frames['Editor'+m].hotkey);
			}
			$('#icontent'+m).val('');
			if(m==''){
			var a='<dl id="floor'+b+'" class="acv_dl09"><dt><a href="'+APP+'/space/'+h+'"><img src="'+g+'" width="50" alt="'+e+'" /></a></dt>';
			a+='<dd><div class="h1"><span class="green6"><a class="Qconfirm" onclick="Qconfirm_show(this.rel,this.id,this.title)" id="'+b+'" alt="'+k+'" rel="'+APP+'/Forum/deletePost/id/'+b+'" href="javascript:void(0)"  title="确定要删除?">删除</a></span><font class="green8"><a href="'+APP+'/space/'+h+'" id="name_'+b+'" rel="'+h+'">'+e+'</a></font>  刚刚</div><div class="h2" id="contentdiv'+b+'">'+f+'</div></dd><div class="clear"></div></dl>';
			$(a).prependTo($("#threadlist"));
			$("#threadlist dl:first-child").hide();
			$("#threadlist dl:first-child").fadeIn('slow');
			}else{
			var a='<div id="floor'+b+'" class="hfbox"><div class="hfhead"><div class="cygl_man"><a href="'+APP+'/space/'+h+'"><img src="'+g+'" width="25" alt="'+e+'" /></a></div></div>';
			a+='<div class="hfcontent"><div class="h4"><span class="green6"><a class="Qconfirm" onclick="Qconfirm_show(this.rel,this.id,this.title)" id="'+b+'" alt="'+k+'" rel="'+APP+'/Forum/deletePost/id/'+b+'" href="javascript:void(0)"  title="确定要删除?">删除</a></span><font class="green8"><a href="'+APP+'/space/'+h+'" id="name_'+b+'" rel="'+h+'">'+e+'</a>';
			if(d)
				a+='对<a href="'+APP+'/space/'+d+'">'+$("#threadlist a[rel="+d+"]:first").text()+'</a>';
			a+='</font>的回复  刚刚</div><div class="h5" id="contentdiv'+b+'">'+f+'</div></div><div class="clear"></div></div>';
			$(c).append(a);
			$("#floor"+b).hide();
			$("#floor"+b).fadeIn('slow');
            $("#huifu_form_"+m).hide();
			}
			if((XNID!=0)&&(ret.xnfeedTitle!='')){
				var template_id = 2;
				var title_data = {"title":ret.xnfeedTitle};
				var body_data = {"content":ret.xnfeedContent};
				XN.Main.apiClient.feed_publishTemplatizedAction(template_id, title_data, body_data, function(result, ex){});
			}
            }
            })
}
$(function(){
		inputDefaultTips("title",'请输入标题');
		})
