function post_comment()
{
	var arr = ['content_id','username_id','checkcode_id'];
	var cop = comment_option;
	var data = '';
	if(!cop.article_id)	return $('#return_msg').html('<font color="red">非法提交！</font>').show();
	if(!cop.open)
	{
		$('#return_msg').html('<font color="red">评论功能已关闭！</font>').show();
		return setTimeout("$('#"+cop.comment_area_id+"').hide('slow')",3000);
	}
	for(var i=0;i<arr.length;i++)
	{
		var a = arr[i];
		if(!cop[a] || !is_element(cop[a]))	return $('#return_msg').html('配置错误，'+arr[i]+'缺失！').show();
		var v = $.trim($('#'+cop[a]).val());
		if(!v && a!='username_id')
		{
			$('#'+cop[a]).focus();
			return $('#return_msg').show().html('<font color="red">信息填写不完整！</font>');
		}
		data += '&'+a.split('_')[0]+'='+encodeURIComponent(v);
	}
	$.post(site_root+'/ajax.php?action=post_comment',data+'&article_id='+cop.article_id,
		function(data)
		{
			eval('json='+data);
			if(json.error)
			{
				$('#return_msg').html(json.error).show();
				$('#'+cop.checkcode_id).focus().val('');
			}
			else
			{
				$('#return_msg').html(json.msg).show();
				$('#'+cop.content_id).empty();
			}
			$('#'+cop.checkcode_img_id).attr('src',$('#'+cop.checkcode_img_id).attr('src')+'?t='+Math.random());
			setTimeout("$('#return_msg').hide('slow')",3000);
		});
}
function load_comment(p)
{
	if(!p || p<1)	p = 1;
	if(!comment_option.comment_area_id || !comment_option.list_id || !is_element(comment_option.comment_area_id) || !is_element(comment_option.list_id) || !comment_option.article_id)	return;
	if(!comment_option.open)	$('#'+comment_option.comment_area_id).hide();
	$('#'+comment_option.list_id).html('Loading...');
	$('#'+comment_option.list_id).load(site_root+'/ajax.php?action=load_comment_list&article_id='+comment_option.article_id+'&page='+p+'&t='+Math.random());
}
function is_element(id)
{
	return document.getElementById(id) ? 1 : 0;
}
