//UBB编辑器，用于用户评论栏目
var icondir = SystemDomain+'fckeditor/UBB/Icons/';
var ubbTools='\
<div class="editorTools"><div class="Toolsbar">\
<ul class="ToolsUL">\
<li><a id="A_bold" href="javascript:void(0);" onclick="UBB_bold();" title="粗体" class="Toolsbutton"><img src="'+icondir+'bold.gif" border="0" alt="粗体" /></a></li>\
<li><a id="A_italic" href="javascript:void(0);" onclick="UBB_italic();" title="斜体" class="Toolsbutton"><img src="'+icondir+'italic.gif" border="0" alt="斜体" /></a></li>\
<li><a id="A_underline" href="javascript:void(0);" onclick="UBB_underline();" title="下划线" class="Toolsbutton"><img src="'+icondir+'underline.gif" border="0" alt="下划线" /></a></li>\
</ul>\
</div>\
<div class="Toolsbar">\
<ul class="ToolsUL">\
<li><a id="A_quote" href="javascript:void(0);" onclick="UBB_quote();" title="插入引用" class="Toolsbutton"><img src="'+icondir+'quote.gif" border="0" alt="插入引用" /></a></li>\
<li><a id="A_smiley" href="javascript:void(0);" onclick="UBB_smiley();" title="表情符号" class="Toolsbutton"><img src="'+icondir+'smiley.gif" border="0" alt="表情符号" /></a></li>\
</ul>\
</div>\
<div style="clear: both;display: block;height:1px;overflow:hidden"></div></div>\
';
var ubbemotstr='<TABLE cellspacing="2" cellpadding="0"><TBODY>'
for(var i=0;i<6;i++){
	ubbemotstr +='<tr>'
	for(var j=((8*(i+1))-7);j<=(8*(i+1));j++){
		ubbemotstr += '<td><a href="javascript:AddSmiley(\'[emot'+j+']\')" class="Smilie" title="[emot'+j+']"><img border="0" src="'+SystemDomain+'style/emot/Face'+j+'.gif"/></a></td>'
	}
	ubbemotstr +='</tr>'
}
ubbemotstr +='</TBODY></TABLE>'
$("#UBBSmiliesPanel").html(ubbemotstr);

function postcomment(){
	var QS = QueryStringFormat();
	tb_show_loader(" ");
	$.ajax({
		type: "POST",
		url: SystemDomain + "home/postxml.asp",
		dataType: "json",
		data: { action: "postcomment",
		logid: QS["logid"], 
		blogid: QS["blogid"], 
		username: $("#msgusername").val() , 
		password:$("#msgpassword").val() , 
		message:$("#message").val() , 
		getcode_comm: $("#getcode_comm").val(),
		r:Math.random()
		},
		timeout:15*1000,
		success: function(x){
			if (x["result"]=="success"){
				$("#msg_failure").hide();$("#msg_success").show();
				$("#msg_span_1").text(x["message"]);
				$("#msgusername").val("");$("#msgpassword").val("");$("#message").val("");$("#msgtopic").val("");$("#getcode_comm").val("");
				loadcomment(1);
				$("#MsgDialog").dialog('open');
			}else{
				$("#msg_failure").show();$("#msg_success").hide();
				$("#msg_span_2").text(x["message"]);
				$("#MsgDialog").dialog('open');
			}
	   },
		complete:function(){
			tb_remove();
	   }
	});
}
function postguestbook(){
	var QS = QueryStringFormat();
	tb_show_loader(" ");
	$.ajax({
		type: "POST",
		url: SystemDomain + "home/postxml.asp",
		dataType: "json",
		data: { action: "postbook",
		blogid: QS["blogid"], 
		username: $("#msgusername").val() , 
		password:$("#msgpassword").val() , 
		message:$("#message").val() , 
		getcode_comm: $("#getcode_comm").val(),
		r:Math.random()
		},
		timeout:15*1000,
		success: function(x){
			if (x["result"]=="success"){
				$("#msg_failure").hide();$("#msg_success").show();
				$("#msg_span_1").text(x["message"]);
				$("#msgusername").val("");$("#msgpassword").val("");$("#message").val("");$("#msgtopic").val("");$("#getcode_comm").val("");
				getGuestBook(1);
				$("#MsgDialog").dialog('open');
			}else{
				$("#msg_failure").show();$("#msg_success").hide();
				$("#msg_span_2").text(x["message"]);
				$("#MsgDialog").dialog('open');
			}
	   },
		complete:function(){
			tb_remove();
	   }
	});

}