function onReplyClick(_31,id){
	document.location.href="#cmtbody";
	getEl("cmttoid").value=id;
	var tmp="\u56de\u590d"+_31+"\uff1a";
	
	//$('simplerte').contentWindow.document.getElementById('eEditor').contentWindow.document.body.innerHTML=tmp;

	var _tmpV = $("cmtbody").value;


	if(!!window._replyPreFix){
		 _tmpV = _tmpV.replace(window._replyPreFix,'');
	}
		
	window._replyPreFix = tmp ;	


	$('cmtbody').value = window._replyPreFix + _tmpV;

    XN.form.help('cmtbody').focus();
}
function commentRecommend(id) {
	new Ajax.Request("http://movie." + XN.env.domain + "/comment.do", {
		method:"post",
		parameters:"d=voteList&checksum="+token+"&id="+id,
		onSuccess:function(o) {
			if(o.responseText != "error") {
				$('recom').innerHTML = '你已推荐该评论';
                 $('recommender').removeChild($('recommend_user_table'));
				 $('recommender').innerHTML = '<h3>谁推荐了这篇影评<span id="vouch_num_body">(共6人推荐)</span></h3>'+'<table id="recommend_user_table" class="personIconList">' + o.responseText.replace('<tbody>','').replace('</tbody>','') + '</table>';
                ++comment_vouch_num;
                $('vouch_num_body').innerHTML = "(共"+comment_vouch_num+"人推荐)";

            }
		},
		onFailure:function(o) {
			alert("网络连接失败，请稍后再试");	
		}
	});
}
function postCommentReply() {
	if($F('cmtbody').trim()=='') {
		alert('回复内容不能为空');
		return false;
	}
	$('reply_content').value = $F('cmtbody').trim();
	//$('editorFormBtn').disabled = true;
	$('postcommentForm').submit();
}
function postTopic(islevel, isedit) {
    if(window.tinyMCE) tinyMCE.get('editor').save();
	if($F('title').trim()=="") {
		alert('请给评论加个标题');
		return false;
	}
	if($F('title').strlen()>44) {
		alert('标题长度不能超过22汉字');
		return false;
	}
	if(islevel)
		if(getRadio('level')==null) {
			alert('请对影片进行评价');
			return false;
		}
	var _21=$F('editor').trim();
	if(_21=="") {
		alert('你的评论内容为空，这样不好吧');
		return false;
	}
	$('topic_content').value=_21;
	if(isedit) {
		if($F('type')==1) {
			new Ajax.Request("http://movie." + XN.env.domain + "/posttopic.do", {
				method:"post",
				parameters:"d=convertComment&checksum="+token+"&topic_content="+encodeURIComponent(_21),
				onSuccess:function(o) {
					if(o.responseText!="ok") {
						alert(o.responseText);
					} else {
						toSubmitTopic("/posttopic.do?d=edit");
					}
				},
				onFailure:function(o) {
					alert("网络连接失败，请稍后再试");
				}
			});
		} else {
			toSubmitTopic("/posttopic.do?d=edit");
		}
	} else {
		toSubmitTopic("/posttopic.do?d=add");
	}
}

function toSubmitTopic(_action) {
	$('editorForm').action = _action;
	$('editorFormBtn').disabled="true";
	$('editorForm').submit();
}
function addDiscuss() {
    if(window.tinyMCE) tinyMCE.get('editor').save();
	if($F('title').trim()=="") {
		alert('请给评论加个标题');
		return false;
	}
	var _21=$F('editor').trim();
	if(_21=="") {
		alert('你的评论内容为空，这样不好吧');
		return false;
	}
	$('topic_content').value=_21;
	toSubmitTopic("/posttopic.do?d=addDiscuss");
}
//全局变量，保存文本框字符长度，防止中文输入的时候页面闪烁
var doingSize=0;
function checkTextLeft(which) {
	if(which.value == '请用一句话来评论这部电影吧。')which.value='';
	var size = which.value.length;
//	if(doingSize != size){
//		doingSize = size;
		$("chLeft").innerHTML = size.toString(); 
		if(size>150){
			$("statusCount").className="status-count-full";
		}else{
			$("statusCount").className="status-count";
		}
//	}
//	else{
//		return;
//	}
}  
